mono-tools-4.2/0000775000175000017500000000000012642235744015520 5ustar00directhexdirecthex00000000000000mono-tools-4.2/ChangeLog0000664000175000017500000002001612413742070017260 0ustar00directhexdirecthex000000000000002010-06-07 Sebastien Pouliot * configure.in: Add new gendarme directories 2010-04-18 Sebastien Pouliot * README: Add instructions for building from SVN 2010-03-02 Marek Habersack * configure.in: added check for dmcs, defines DMCS_PRESENT conditional if found. Needed to build docbrowser with dmcs now that mono from trunk tools are built with dmcs. 2010-02-23 Michael Hutchinson * configure.in: Add docbrowser/theme-icons/Makefile.am 2010-02-03 Michael Hutchinson * Makefile.am: * configure.in: Capture ACLOCAL_FLAGS for autoreconf so building is less painful on Mac. 2010-02-03 Michael Hutchinson * configure.in: * asn1view/gtk/Makefile.am * docbrowser/BrowserWidget.cs: * docbrowser/Makefile.am: Make Gnome# optional. * autogen.sh: Pass ACLOCAL_FlAGS to aclocal. 2009-11-29 Sebastien Pouliot * configure.in: Now 2.7 2009-09-24 Gonzalo Paniagua Javier * configure.in: avoid a lot of warnings. 2009-09-20 Sebastien Pouliot * configure.in: Add gendarme.5.in 2008-12-15 Miguel de Icaza * configure.in: Detect the proper LIB_PREFIX and LIB_SUFIX to fix the crasher for gsharp when trying to Plot on other systems. 2009-06-05 Michael Hutchinson * configure.in: Fix build. 2009-06-03 Jonathan Pryor * Makefile.am: Add webdoc to the build. 2008-12-02 Sebastien Pouliot * configure.in: Remove AC_OUTPUT on gnunit files since they break make dist 2008-12-01 Atsushi Enomoto * Makefile.am : remove gnunit. It does not build anymore. 2008-11-17 Sebastien Pouliot * configure.in: Produce gendarme.exe.config from .in file (modified patch from Jesse Jones). 2008-11-10 Sebastien Pouliot * configure.in: Bump to 2.3 2008-11-09 Sebastien Pouliot * configure.in: Add Gendarme framework unit test makefile generation. 2008-10-10 Massimiliano Mantione * Mono.Profiler/Mono.Profiler.mds, Mono.Profiler/mprof-runtime/: Preliminary (but working) code to control the profiler at runtime. 2008-10-09 Daniel Nauck * Makefile.am, configure.in: add gsharp to the build 2008-08-26 Sebastien Pouliot * configure.in: Add Gendarme's Design.Generic rules makefile support. 2008-08-25 Sebastien Pouliot * configure.in: Add Gendarme's Security.Cas rules makefile support. 2008-08-16 Sebastien Pouliot * configure.in: Add Gendarme's Design.Linq rules makefile support. 2008-08-12 Massimiliano Mantione * Mono.Profiler/Makefile.am, Mono.Profiler/adjust-makefiles.sh: More fixes for the Mono.Profiler integration. 2008-08-12 Massimiliano Mantione * Makefile.am, configure.in: Integrated Mono.Profiler in the build. * Mono.Profiler/configure.ac, Mono.Profiler/autogen.sh: Deleted (no longer needed). * Mono.Profiler/adjust-makefiles.sh: Added this script to fix the makefiles again if they are regenerated from Monodevelop. 2008-08-11 Sebastien Pouliot * configure.in: Bump Gendarme version to match the Mono release. 2008-08-11 Massimiliano Mantione * Makefile.am: reverted previous commit (it breaks the build). 2008-08-11 Massimiliano Mantione * Makefile.am: Added Mono.Profiler subdirectory. 2008-07-14 Sebastien Pouliot * configure.in: Bump Gendarme to 0.2.0.0 for the Mono 2.0 branch. 2008-06-14 Andreia Gaita * configure.in: Enable webkit and mono.webbrowser detection. 2008-04-27 Nestor Salceda * configure.in: Add Maintainability setup to the build. 2008-03-22 Sebastien Pouliot * configure.in: Add Gendarme's Wizard and Win32 setup to the build 2008-03-12 Sebastien Pouliot * configure.in: Add Gendarme's Test.Rules makefile support. 2008-03-08 Andreia Gaita * configure.in (docbrowser): Add mono-webbrowser check, and tweak the detected browser engine message to list what is available. 2008-03-07 Alp Toker * configure.in: Add no-op webkit-sharp check (for docbrowser). 2008-02-16 Sebastien Pouliot * configure.in: Gendarme does not need the .xml[.in] files anymore :) 2008-02-01 Andrew Jorgensen * configure.in: get the path to Mono.Cecil.dll during configure 2008-01-28 Wade Berrier * configure.in: version bump -> 1.9 2007-12-12 Mike Kestner * configure.in: update pkgconfig checks for gtkhtml-sharp-3.14 and for gconf without Requires: gnome-sharp. * docbrowser/Makefile.am: update for GACd gtkhtml-sharp-3.14. 2007-11-09 Wade Berrier * configure.in: define MONO_TOOSL in a mcs friendly way (svn revs) version bump -> 1.2.6 2007-11-08 Mike Kestner * configure.in: configure checks for gtkhtml-sharp-3.14 with fallback to 2.0. 2007-04-19 Wade Berrier * configure.in: version bump -> 1.2.4 2007-01-31 Mike Kestner * configure.in: add ilcontrast tool. * Makefile.am: add ilcontrast tool. 2007-01-25 Wade Berrier * configure.in: version bump -> 1.2.3 2006-11-17 Wade Berrier * configure.in: version bump -> 1.2.1 2006-10-30 Wade Berrier * Makefile.am: Add create-native-map to SUBDIRS so building from a tarball works 2006-10-24 Jonathan Pryor * configure.in: Add create-native-map program. * Makefile.am: Build create-native-map. 2006-01-16 Rafael Ferreira * configure.in: updated to use gtk-sharp-2.0/gecko-sharp-2.0 this fixes bugs# 76054 & 76544 related to Pango bugs. 2005-11-27 C.J. Collier * docbrowser/monodoc.desktop.in: Added patch from compnerd@compnerd.org The desktop entry for the monodoc browser is not created properly with the build system. The desktop entry's Exec line contains ${exec_prefix} which is not resolved from the @bindir@ entry. This issue would be masked when the exec-prefix is explicitly passed to the configure script. Otherwise, the configure script internally sets $exec_prefix to $prefix. But this is not evaluated when substituting. 2005-10-27 Ben Maurer * configure.in (GTK_SHARP): simplify this check, since we are not doing the dual 2.0/1.0 thing. (MOZILLA_HOME): get the mozilla home dir from pkgconfig. (MONODOC): Require monodoc in configure.in 2005-10-27 Ben Maurer * configure.in: Make gtkhtml an optional dependency 2005-07-30 Mario Sopena Novales * configure.in: make gecko-sharp dependency conditional 2005-06-09 Gonzalo Paniagua Javier * configure.in: added GNUNIT_VERSION. 2005-06-08 Ben Maurer * configure.in: Use gtk-sharp 1.0. Ensures that people won't use new features. 2005-05-25 Ben Maurer * configure.in: New .in files 2005-05-08 Ben Maurer * configure.in: - Check for mono and put it in RUNTIME - Don't check for monoresgen, as we don't ship that any more the correct name is `resgen' 2005-05-08 Sebastien Pouliot * configure.in: Added lines to generate asn1view Makefiles; * LICENSE: Added license informations for asn1view tool(s); * Makefile.am: Added asn1view subdirectory; 2005-04-23 Mike Kestner * gnunit : moved the nunit-gtk project here. * monodoc-browser : moved the gui browser here from monodoc. 2003-10-11 Jonathan Pryor * Started ChangeLog mono-tools-4.2/INSTALL0000644000175000017500000003661012550553153016550 0ustar00directhexdirecthex00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command `./configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. mono-tools-4.2/minvoke/0000775000175000017500000000000012642235744017170 5ustar00directhexdirecthex00000000000000mono-tools-4.2/minvoke/Makefile.in0000664000175000017500000004304712642235732021242 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = minvoke ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = minvoke 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)$(minvokedir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(minvoke_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/minvoke.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ minvokedir = $(prefix)/lib/minvoke bin_SCRIPTS = minvoke minvoke_DATA = minvoke.exe CLEANFILES = minvoke.exe minvoke.exe.gdb minvoke MapAssembly.dll RetargetAssembly.exe minvoke_sources = \ $(srcdir)/minvoke.cs mapassembly_dll_sources = \ $(srcdir)/MapAssembly.cs \ $(srcdir)/MapDllImportAttribute.cs retargetassembly_exe_sources = \ $(srcdir)/RetargetAssembly.cs EXTRA_DIST = $(minvoke_sources) $(mapassembly_dll_souorces) $(retargetassembly_exe_sources) minvoke.in 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) --gnu minvoke/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu minvoke/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): minvoke: $(top_builddir)/config.status $(srcdir)/minvoke.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-minvokeDATA: $(minvoke_DATA) @$(NORMAL_INSTALL) @list='$(minvoke_DATA)'; test -n "$(minvokedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(minvokedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(minvokedir)" || 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)$(minvokedir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(minvokedir)" || exit $$?; \ done uninstall-minvokeDATA: @$(NORMAL_UNINSTALL) @list='$(minvoke_DATA)'; test -n "$(minvokedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(minvokedir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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)$(minvokedir)"; 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) 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-minvokeDATA 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-minvokeDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-minvokeDATA \ 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 tags-am uninstall \ uninstall-am uninstall-binSCRIPTS uninstall-minvokeDATA .PRECIOUS: Makefile MapAssembly.dll: $(mapassembly_dll_sources) $(MCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -target:library -out:MapAssembly.dll $(mapassembly_dll_sources) RetargetAssembly.exe: $(retargetassembly_exe_sources) $(MCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -target:exe -out:RetargetAssembly.exe $(retargetassembly_exe_sources) minvoke.exe: $(minvoke_sources); $(MCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG -target:exe -out:minvoke.exe $(minvoke_sources) -r:System.Core -r:$(CECIL_ASM) test: minvoke.exe MapAssembly.dll RetargetAssembly.exe mono minvoke.exe MapAssembly.dll RetargetAssembly.exe RetargetedAssembly.exe # 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-tools-4.2/minvoke/minvoke.in0000664000175000017500000000007512413742070021161 0ustar00directhexdirecthex00000000000000#!/bin/sh exec mono "@prefix@/lib/minvoke/minvoke.exe" "$@" mono-tools-4.2/minvoke/RetargetAssembly.cs0000664000175000017500000000055012413742070022763 0ustar00directhexdirecthex00000000000000using System; using System.Runtime.InteropServices; public class User32 { [DllImport ("user32.dll")] public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, string lParam); } public class Foo { public static void Main (string[] args) { IntPtr ip = User32.SendMessage (IntPtr.Zero, 0, IntPtr.Zero, ""); Console.WriteLine (ip); } }mono-tools-4.2/minvoke/minvoke.cs0000664000175000017500000001647412413742070021172 0ustar00directhexdirecthex00000000000000// // minvoke.cs // // (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 System.IO; using System.Linq; using System.Text; using Mono.Cecil; using Mono.Cecil.Cil; namespace MInvoke { class ImportKey { public string module_name; public string entry_point; public ImportKey (string moduleName, string entryPointName) { module_name = moduleName.ToLower(); entry_point = entryPointName; } public override int GetHashCode () { return module_name.GetHashCode() ^ entry_point.GetHashCode(); } public override bool Equals (object o) { ImportKey key = o as ImportKey; if (key == null) return false; return key.module_name == module_name && key.entry_point == entry_point; } } class DllImportMap : Dictionary { } class DllImports : Dictionary { } static class CecilRocks { public static IEnumerable GetAllTypes (this ModuleDefinition self) { return self.Types.SelectMany (t => t.GetAllTypes ()); } static IEnumerable GetAllTypes (this TypeDefinition self) { yield return self; if (!self.HasNestedTypes) yield break; foreach (var type in self.NestedTypes.SelectMany (t => t.GetAllTypes ())) yield return type; } } public class MInvoke { private static CustomAttribute GetMapDllImportAttribute (ICustomAttributeProvider provider) { foreach (CustomAttribute ca in provider.CustomAttributes) { TypeDefinition resolved = ca.AttributeType.Resolve (); if (resolved != null) { if (resolved.Name == "MapDllImport") { // Console.WriteLine ("{0} has a MapDllImportAttribute ({1})", provider, // ca.ConstructorParameters[0]); return ca; } } } return null; } private static bool IsFinalizer (MethodDefinition method) { if (method.Name != "Finalize") return false; if (!method.IsVirtual) return false; if (method.Parameters.Count != 0) return false; return true; } private static DllImportMap BuildMap (string map_assembly) { DllImportMap map = new DllImportMap (); var assembly = AssemblyDefinition.ReadAssembly (map_assembly); foreach (TypeDefinition t in assembly.MainModule.GetAllTypes ()) { if (t.Name == "") continue; if (t.IsSpecialName || t.IsRuntimeSpecialName) continue; foreach (MethodDefinition md in t.Methods) { if (md.IsSpecialName) continue; if (IsFinalizer (md)) continue; CustomAttribute attr = GetMapDllImportAttribute (md); if (attr == null) continue; ImportKey key = new ImportKey (attr.ConstructorArguments [0].Value.ToString(), md.Name); map.Add (key, md); } } return map; } private static DllImports CollectDllImports (AssemblyDefinition assembly) { DllImports imports = new DllImports (); foreach (TypeDefinition t in assembly.MainModule.GetAllTypes ()) { if (t.Name == "") continue; if (t.IsSpecialName || t.IsRuntimeSpecialName) continue; foreach (MethodDefinition md in t.Methods) { if (md.IsSpecialName) continue; if (IsFinalizer (md)) continue; PInvokeInfo pinfo = md.PInvokeInfo; if (pinfo == null) continue; // Console.WriteLine ("{0} is a pinvoke, hashcode = {1}", md, md.GetHashCode()); ImportKey key = new ImportKey (pinfo.Module.Name, pinfo.EntryPoint); if (imports.ContainsKey (key)) Console.WriteLine ("WARNING: pinvoke {0}/{1} shows up more than once in input assembly", key.module_name, key.entry_point); else imports.Add (key, md); } } return imports; } private static void Retarget (AssemblyDefinition assembly, DllImportMap map, DllImports imports) { foreach (TypeDefinition t in assembly.MainModule.Types) { if (t.Name == "") continue; Retarget (t, map, imports); } } private static void Retarget (TypeDefinition type, DllImportMap map, DllImports imports) { foreach (var nested in type.NestedTypes) Retarget (nested, map, imports); foreach (MethodDefinition md in type.Methods) { if (!md.HasBody) continue; for (int i = 0; i < md.Body.Instructions.Count; i ++) { Instruction ins = md.Body.Instructions[i]; if (ins.OpCode == OpCodes.Call) { MethodDefinition method_operand = ins.Operand as MethodDefinition; if (method_operand == null) continue; PInvokeInfo pinfo = method_operand.PInvokeInfo; if (pinfo == null) continue; ImportKey key = new ImportKey (pinfo.Module.Name, pinfo.EntryPoint); if (imports.ContainsKey (key)) { //Console.WriteLine ("{0} is a pinvoke, {1}/{2}", method_operand, pinfo.EntryPoint, pinfo.Module.Name); if (map.ContainsKey (key)) { Console.WriteLine ("retargeting reference to method method {0}/{1}", key.module_name, key.entry_point); var il = md.Body.GetILProcessor (); MethodDefinition mapped_method = map[key]; MethodReference mapped_ref; mapped_ref = type.Module.Import(mapped_method); Instruction callMethod = il.Create(OpCodes.Call, mapped_ref); il.Replace (ins, callMethod); } else { Console.WriteLine ("WARNING: no map entry for method {0}/{1}", key.module_name, key.entry_point); } } } } } } public static void Main (string[] args) { if (args.Length != 3) { Console.Error.WriteLine ("usage: minvoke.exe MapAssemblyName InputAssemblyName OutputAssemblyName"); Environment.Exit (1); } string map_assembly_name = args[0]; string input_assembly_name = args[1]; string output_assembly_name = args[2]; Console.WriteLine ("building list of MapDllImports from map assembly {0}", map_assembly_name); DllImportMap map = BuildMap (map_assembly_name); Console.WriteLine ("building list of DllImports in input assembly {0}", input_assembly_name); var input_assembly = AssemblyDefinition.ReadAssembly (input_assembly_name); DllImports imports = CollectDllImports (input_assembly); Console.WriteLine ("retargeting assembly {0} -> {1}", input_assembly_name, output_assembly_name); Retarget (input_assembly, map, imports); input_assembly.Write (output_assembly_name); } } }mono-tools-4.2/minvoke/Makefile.am0000664000175000017500000000215712642235713021225 0ustar00directhexdirecthex00000000000000minvokedir=$(prefix)/lib/minvoke bin_SCRIPTS = minvoke minvoke_DATA = minvoke.exe CLEANFILES = minvoke.exe minvoke.exe.gdb minvoke MapAssembly.dll RetargetAssembly.exe minvoke_sources = \ $(srcdir)/minvoke.cs mapassembly_dll_sources = \ $(srcdir)/MapAssembly.cs \ $(srcdir)/MapDllImportAttribute.cs retargetassembly_exe_sources = \ $(srcdir)/RetargetAssembly.cs EXTRA_DIST = $(minvoke_sources) $(mapassembly_dll_souorces) $(retargetassembly_exe_sources) minvoke.in MapAssembly.dll: $(mapassembly_dll_sources) $(MCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -target:library -out:MapAssembly.dll $(mapassembly_dll_sources) RetargetAssembly.exe: $(retargetassembly_exe_sources) $(MCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -target:exe -out:RetargetAssembly.exe $(retargetassembly_exe_sources) minvoke.exe: $(minvoke_sources); $(MCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG -target:exe -out:minvoke.exe $(minvoke_sources) -r:System.Core -r:$(CECIL_ASM) test: minvoke.exe MapAssembly.dll RetargetAssembly.exe mono minvoke.exe MapAssembly.dll RetargetAssembly.exe RetargetedAssembly.exe mono-tools-4.2/docbrowser/0000775000175000017500000000000012642235741017666 5ustar00directhexdirecthex00000000000000mono-tools-4.2/docbrowser/monodoc.desktop.in0000664000175000017500000000041612413742070023317 0ustar00directhexdirecthex00000000000000[Desktop Entry] Version=1.0 Name=Mono Documentation GenericName=Documentation Browser Comment=View, search and edit documentation related to Mono Exec=@bindir@/monodoc Icon=monodoc StartupNotify=true Terminal=false Type=Application Categories=Documentation;Development; mono-tools-4.2/docbrowser/XmlNodeWriter.cs0000664000175000017500000002157012413742070022757 0ustar00directhexdirecthex00000000000000// // Mono.Xml.XmlNodeWriter // // Author: // Atsushi Enomoto (ginga@kit.hi-ho.ne.jp) // // (C)2003 Atsushi Enomoto // using System; using System.Xml; namespace Monodoc { public class CopyXmlNodeWriter : XmlWriter { public CopyXmlNodeWriter () : this (true) { } // It should be public after some tests are done :-) public CopyXmlNodeWriter (bool isDocumentEntity) { doc = new XmlDocument (); state = XmlNodeType.None; this.isDocumentEntity = isDocumentEntity; if (!isDocumentEntity) current = fragment = doc.CreateDocumentFragment (); } XmlDocument doc; bool isClosed; // If it is not null, then we are now inside the element. XmlNode current; // If it is not null, then we are now inside the attribute. XmlAttribute attribute; // If it is false, then allow to contain multiple document elements. bool isDocumentEntity; XmlDocumentFragment fragment; // None: started or closed. // XmlDeclaration: after xmldecl. Never allow xmldecl. // DocumentType: after doctype. Never allow xmldecl and doctype. // Element: inside document element. // XmlNodeType state; // Properties public XmlNode Document { get { return isDocumentEntity ? (XmlNode)doc : (XmlNode)fragment; } } public override WriteState WriteState { get { if (isClosed) return WriteState.Closed; if (attribute != null) return WriteState.Attribute; switch (state) { case XmlNodeType.None: return WriteState.Start; case XmlNodeType.XmlDeclaration: return WriteState.Prolog; case XmlNodeType.DocumentType: return WriteState.Element; default: return WriteState.Content; } } } public override string XmlLang { get { for (XmlElement n = current as XmlElement; n != null; n = n.ParentNode as XmlElement) if (n.HasAttribute ("xml:lang")) return n.GetAttribute ("xml:lang"); return String.Empty; } } public override XmlSpace XmlSpace { get { for (XmlElement n = current as XmlElement; n != null; n = n.ParentNode as XmlElement) { string xs = n.GetAttribute ("xml:space"); switch (xs) { case "preserve": return XmlSpace.Preserve; case "default": return XmlSpace.Default; case "": continue; default: throw new InvalidOperationException (String.Format ("Invalid xml:space {0}.", xs)); } } return XmlSpace.None; } } // Private Methods private void CheckState () { if (isClosed) throw new InvalidOperationException (); } private void WritePossiblyTopLevelNode (XmlNode n, bool possiblyAttribute) { CheckState (); if (!possiblyAttribute && attribute != null) throw new InvalidOperationException (String.Format ("Current state is not acceptable for {0}.", n.NodeType)); if (state != XmlNodeType.Element) Document.AppendChild (n); else if (attribute != null) attribute.AppendChild (n); else current.AppendChild (n); if (state == XmlNodeType.None) state = XmlNodeType.XmlDeclaration; } // Public Methods public override void Close () { CheckState (); isClosed = true; } public override void Flush () { } public override string LookupPrefix (string ns) { CheckState (); if (current == null) throw new InvalidOperationException (); return current.GetPrefixOfNamespace (ns); } // StartDocument public override void WriteStartDocument () { WriteStartDocument (null); } public override void WriteStartDocument (bool standalone) { WriteStartDocument (standalone ? "yes" : "no"); } private void WriteStartDocument (string sddecl) { CheckState (); if (state != XmlNodeType.None) throw new InvalidOperationException ("Current state is not acceptable for xmldecl."); doc.AppendChild (doc.CreateXmlDeclaration ("1.0", null, sddecl)); state = XmlNodeType.XmlDeclaration; } // EndDocument public override void WriteEndDocument () { CheckState (); isClosed = true; } // DocumentType public override void WriteDocType (string name, string publicId, string systemId, string internalSubset) { CheckState (); switch (state) { case XmlNodeType.None: case XmlNodeType.XmlDeclaration: doc.AppendChild (doc.CreateDocumentType (name, publicId, systemId, internalSubset)); state = XmlNodeType.DocumentType; break; default: throw new InvalidOperationException ("Current state is not acceptable for doctype."); } } // StartElement public override void WriteStartElement (string prefix, string name, string ns) { CheckState (); if (isDocumentEntity && state == XmlNodeType.EndElement && doc.DocumentElement != null) throw new InvalidOperationException ("Current state is not acceptable for startElement."); XmlElement el = doc.CreateElement (prefix, name, ns); if (current == null) { Document.AppendChild (el); state = XmlNodeType.Element; } else { current.AppendChild (el); state = XmlNodeType.Element; } current = el; } // EndElement public override void WriteEndElement () { WriteEndElementInternal (false); } public override void WriteFullEndElement () { WriteEndElementInternal (true); } private void WriteEndElementInternal (bool forceFull) { CheckState (); if (current == null) throw new InvalidOperationException ("Current state is not acceptable for endElement."); if (!forceFull && current.FirstChild == null) ((XmlElement) current).IsEmpty = true; if (isDocumentEntity && current.ParentNode == doc) state = XmlNodeType.EndElement; else current = current.ParentNode; } // StartAttribute public override void WriteStartAttribute (string prefix, string name, string ns) { CheckState (); if (attribute != null) throw new InvalidOperationException ("There is an open attribute."); if (!(current is XmlElement)) throw new InvalidOperationException ("Current state is not acceptable for startAttribute."); attribute = doc.CreateAttribute (prefix, name, ns); ((XmlElement)current).SetAttributeNode (attribute); } public override void WriteEndAttribute () { CheckState (); if (attribute == null) throw new InvalidOperationException ("Current state is not acceptable for startAttribute."); attribute = null; } public override void WriteCData (string data) { CheckState (); if (current == null) throw new InvalidOperationException ("Current state is not acceptable for CDATAsection."); current.AppendChild (doc.CreateCDataSection (data)); } public override void WriteComment (string comment) { WritePossiblyTopLevelNode (doc.CreateComment (comment), false); } public override void WriteProcessingInstruction (string name, string value) { WritePossiblyTopLevelNode ( doc.CreateProcessingInstruction (name, value), false); } public override void WriteEntityRef (string name) { WritePossiblyTopLevelNode (doc.CreateEntityReference (name), true); } public override void WriteCharEntity (char c) { WritePossiblyTopLevelNode (doc.CreateTextNode (new string (new char [] {c}, 0, 1)), true); } public override void WriteWhitespace (string ws) { WritePossiblyTopLevelNode (doc.CreateWhitespace (ws), true); } public override void WriteString (string data) { CheckState (); if (current == null) throw new InvalidOperationException ("Current state is not acceptable for Text."); if (attribute != null) attribute.AppendChild (doc.CreateTextNode (data)); else { XmlText last = current.LastChild as XmlText; if (last == null) current.AppendChild(doc.CreateTextNode(data)); else last.AppendData(data); } } public override void WriteName (string name) { WriteString (name); } public override void WriteNmToken (string nmtoken) { WriteString (nmtoken); } public override void WriteQualifiedName (string name, string ns) { string prefix = LookupPrefix (ns); if (prefix == null) throw new ArgumentException (String.Format ("Invalid namespace {0}", ns)); if (prefix != String.Empty) WriteString (name); else WriteString (prefix + ":" + name); } public override void WriteChars (char [] chars, int start, int len) { WriteString (new string (chars, start, len)); } public override void WriteRaw (string data) { // It never supports raw string. WriteString (data); } public override void WriteRaw (char [] chars, int start, int len) { // It never supports raw string. WriteChars (chars, start, len); } public override void WriteBase64 (byte [] data, int start, int len) { // It never supports raw string. WriteString (Convert.ToBase64String (data, start, len)); } public override void WriteBinHex (byte [] data, int start, int len) { throw new NotImplementedException (); } public override void WriteSurrogateCharEntity (char c1, char c2) { throw new NotImplementedException (); } } } mono-tools-4.2/docbrowser/ChangeLog0000775000175000017500000013364512413742070021451 0ustar00directhexdirecthex000000000000002010-03-02 Marek Habersack * Makefile.am: if DMCS was found use it to compile everything, or otherwise the browser won't work (monodoc.dll is built with dmcs on trunk) 2010-02-23 Michael Hutchinson * Makefile.am: * theme-icons/*: Add Jakub's great new icons. 2010-02-11 Marek Habersack * Makefile.am (geckorender_assemblies): added $(GNOME_SHARP_LIBS) to fix the build 2009-10-13 Jo Shields * WebKitHtmlRender.cs: WebKit (1.1.15+) now raises NavigationRequested events for initial loads from html, with about:blank uri. We only want to deal with user-generated navigation events, so ignore these. 2009-09-29 Jonathan Pryor * browser.cs: The make-index, make-search-index, and merge-changes options shouldn't display the GUI. 2009-08-13 Jonathan Pryor * browser.cs: Rename --docdir to --docrootdir. Add --docdir option which will read .source files from the specified directory. 2009-08-13 Jonathan Pryor * browser.cs: Provide more accurate help for --engine. 2009-08-13 Jonathan Pryor * Makefile.am: Use Mono.Options for option parsing. * browser.cs: Use Mono.Options for option parsing (yay consistency; --engine=ENGINE will actually work). Add --docdir=DIR parameter to load documentation from the specified directory. 2009-04-25 Jonathan Pryor * browser.cs: Browser.GetHtml() needs to cope with RootTree.RenderUrl() returning a null match node, which can happen because an EcmaUncompiledHelpSource always sets the match node to null, but will return a non-null string. Fixes #505476. 2009-04-30 Marek Habersack * browser.cs: NodePageVisit.Go () - it seems n.tree is almost never a RootTree, so the cast to that type caused monodoc to throw invalid cast exception and bail out. The fix is to use browser.help_tree instead of n.tree. 2009-04-25 Jonathan Pryor * browser.cs: Enable use of the webdoc cache, if present. This requires writing the HTML header (style & script information) instead of letting monodoc.dll generate this, as the cache doesn't contain \n"); } if (help_source != null && help_source.InlineJavaScript != null) { html.Write (" \n"); } html.Write (" \n"); html.Write (" \n"); html.Write (html_content); html.Write (" \n"); html.Write (""); return html.ToString (); } void OnCommentsActivate (object o, EventArgs args) { SettingsHandler.Settings.ShowComments = comments1.Active; // postcomment.Sensitive = comments1.Active; // refresh, so we can see the comments if (CurrentTab != null && CurrentTab.history != null) // catch the case when we are currently loading CurrentTab.history.ActivateCurrent (); } void OnInheritedMembersActivate (object o, EventArgs args) { SettingsHandler.Settings.ShowInheritedMembers = showinheritedmembers.Active; if (CurrentTab != null && CurrentTab.history != null) // catch the case when we are currently loading CurrentTab.history.ActivateCurrent (); } void OnEditingActivate (object o, EventArgs args) { SettingsHandler.Settings.EnableEditing = editing1.Active; // refresh, so we can see the [edit] things if (CurrentTab != null && CurrentTab.history != null) // catch the case when we are currently loading CurrentTab.history.ActivateCurrent (); } void OnCollapseActivate (object o, EventArgs args) { reference_tree.CollapseAll (); reference_tree.ExpandRow (new TreePath ("0"), false); } // // Invoked when the index_entry Entry line content changes // public void OnIndexEntryChanged (object sender, EventArgs a) { if (index_browser != null) index_browser.SearchClosest (index_entry.Text); } // // Invoked when the user presses enter on the index_entry // public void OnIndexEntryActivated (object sender, EventArgs a) { if (index_browser != null) index_browser.LoadSelected (); } // // Invoked when the user presses a key on the index_entry // public void OnIndexEntryKeyPress (object o, KeyPressEventArgs args) { args.RetVal = true; switch (args.Event.Key) { case Gdk.Key.Up: if (matches.Visible == true && index_browser.match_list.Selected != 0) { index_browser.match_list.Selected--; } else { index_browser.index_list.Selected--; if (matches.Visible == true) index_browser.match_list.Selected = index_browser.match_model.Rows - 1; } break; case Gdk.Key.Down: if (matches.Visible == true && index_browser.match_list.Selected + 1 != index_browser.match_model.Rows) { index_browser.match_list.Selected++; } else { index_browser.index_list.Selected++; if (matches.Visible == true) index_browser.match_list.Selected = 0; } break; default: args.RetVal = false; break; } } // // For the accel keystroke // public void OnIndexEntryFocused (object sender, EventArgs a) { nb.Page = 1; } // // Invoked from File/Quit menu entry. // void OnQuitActivate (object sender, EventArgs a) { Application.Quit (); } // // Invoked by Edit/Cut menu entry. // void OnCutActivate (object sender, EventArgs a) { if (CurrentTab.Tab_mode == Mode.Editor) { Clipboard cb = Clipboard.Get (Gdk.Selection.Clipboard); CurrentTab.text_editor.Buffer.CutClipboard (cb, true); } } // // Invoked by Edit/Copy menu entry. // void OnCopyActivate (object sender, EventArgs a) { if (CurrentTab.Tab_mode == Mode.Viewer) CurrentTab.html.Copy (); else { Clipboard cb = Clipboard.Get (Gdk.Selection.Clipboard); CurrentTab.text_editor.Buffer.CopyClipboard (cb); } } // // Invoked by Edit/Paste menu entry. // void OnPasteActivate (object sender, EventArgs a) { Clipboard cb = Clipboard.Get (Gdk.Selection.Clipboard); if (!cb.WaitIsTextAvailable ()) return; //string text = cb.WaitForText (); //CurrentTab.text_editor.Buffer.InsertAtCursor (text); CurrentTab.text_editor.Buffer.PasteClipboard (cb); } class About { [Glade.Widget] Window about; [Glade.Widget] Image logo_image; [Glade.Widget] Label label_version; static About AboutBox; Browser parent; About (Browser parent) { Glade.XML ui = new Glade.XML (null, "browser.glade", "about", null); ui.Autoconnect (this); this.parent = parent; about.TransientFor = parent.window1; Gdk.Pixbuf icon = new Gdk.Pixbuf (null, "monodoc.png"); if (icon != null) { about.Icon = icon; logo_image.Pixbuf = icon; } Assembly assembly = Assembly.GetExecutingAssembly (); label_version.Markup = String.Format ("Version: {0}", assembly.GetName ().Version.ToString ()); } void OnOkClicked (object sender, EventArgs a) { about.Hide (); } // // Called on the Window delete icon clicked // void OnDelete (object sender, DeleteEventArgs a) { AboutBox = null; } static public void Show (Browser parent) { if (AboutBox == null) AboutBox = new About (parent); AboutBox.about.Show (); } } // // Hooked up from Glade // void OnAboutActivate (object sender, EventArgs a) { About.Show (this); } void OnUpload (object sender, EventArgs a) { string key = SettingsHandler.Settings.Key; if (key == null || key == "") ConfigWizard.Run (this); else DoUpload (); } void DoUpload () { Upload.Run (this); } class Upload { enum State { GetSerial, PrepareUpload, SerialError, VersionError, SubmitError, NetworkError, Done } [Glade.Widget] Dialog upload_dialog; [Glade.Widget] Label status; [Glade.Widget] Button cancel; State state; ThreadNotify tn; WebClientAsyncResult war; Contributions d; int serial; public static void Run (Browser browser) { new Upload (browser); } Upload (Browser browser) { tn = new ThreadNotify (new ReadyEvent (Update)); Glade.XML ui = new Glade.XML (null, "browser.glade", "upload_dialog", null); ui.Autoconnect (this); d = new Contributions (); if (Environment.GetEnvironmentVariable ("MONODOCTESTING") == null) d.Url = "http://www.go-mono.com/docs/server.asmx"; status.Text = "Checking Server version"; war = (WebClientAsyncResult) d.BeginCheckVersion (1, new AsyncCallback (VersionChecked), null); } void Update () { Console.WriteLine ("In Update: " + state); switch (state){ case State.NetworkError: status.Text = "A network error ocurred"; cancel.Label = "Close"; return; case State.VersionError: status.Text = "Server has a different version, upgrade your MonoDoc"; cancel.Label = "Close"; return; case State.GetSerial: war = (WebClientAsyncResult) d.BeginGetSerial ( SettingsHandler.Settings.Email, SettingsHandler.Settings.Key, new AsyncCallback (GetSerialDone), null); return; case State.SerialError: status.Text = "Error obtaining serial number from server for this account"; cancel.Label = "Close"; return; case State.SubmitError: status.Text = "There was a problem with the documentation uploaded"; cancel.Label = "Close"; return; case State.PrepareUpload: GlobalChangeset cs = EditingUtils.GetChangesFrom (serial); if (cs == null){ status.Text = "No new contributions"; cancel.Label = "Close"; return; } CopyXmlNodeWriter w = new CopyXmlNodeWriter (); GlobalChangeset.serializer.Serialize (w, cs); Console.WriteLine ("Uploading..."); status.Text = String.Format ("Uploading {0} contributions", cs.Count); XmlDocument dd = (XmlDocument) w.Document; war = (WebClientAsyncResult) d.BeginSubmit ( SettingsHandler.Settings.Email, SettingsHandler.Settings.Key, ((XmlDocument) w.Document).DocumentElement, new AsyncCallback (UploadDone), null); return; case State.Done: status.Text = "All contributions uploaded"; cancel.Label = "Close"; SettingsHandler.Settings.SerialNumber = serial; SettingsHandler.Save (); return; } } void UploadDone (IAsyncResult iar) { try { int result = d.EndSubmit (iar); war = null; if (result < 0) state = State.SubmitError; else { state = State.Done; serial = result; } } catch (Exception e) { state = State.NetworkError; Console.WriteLine ("Upload: " + e); } if (tn != null) tn.WakeupMain (); } void GetSerialDone (IAsyncResult iar) { try { serial = d.EndGetSerial (iar); war = null; if (serial < 0) state = State.SerialError; else state = State.PrepareUpload; } catch (Exception e) { Console.WriteLine ("Serial: " + e); state = State.NetworkError; } if (tn != null) tn.WakeupMain (); } void VersionChecked (IAsyncResult iar) { try { int ver = d.EndCheckVersion (iar); war = null; if (ver != 0) state = State.VersionError; else state = State.GetSerial; } catch (Exception e) { Console.WriteLine ("Version: " + e); state = State.NetworkError; } if (tn != null) tn.WakeupMain (); } void Cancel_Clicked (object sender, EventArgs a) { if (war != null) war.Abort (); war = null; state = State.Done; upload_dialog.Destroy (); upload_dialog = null; tn = null; } } class ConfigWizard { static ConfigWizard config_wizard; [Glade.Widget] Window window_config_wizard; [Glade.Widget] Notebook notebook; [Glade.Widget] Button button_email_ok; [Glade.Widget] Entry entry_email; [Glade.Widget] Entry entry_password; Browser parent; Contributions d; WebClientAsyncResult war; ThreadNotify tn; int new_page; public static void Run (Browser browser) { if (config_wizard == null) config_wizard = new ConfigWizard (browser); return; } ConfigWizard (Browser browser) { tn = new ThreadNotify (new ReadyEvent (UpdateNotebookPage)); Glade.XML ui = new Glade.XML (null, "browser.glade", "window_config_wizard", null); ui.Autoconnect (this); //notebook.ShowTabs = false; parent = browser; window_config_wizard.TransientFor = browser.window1; d = new Contributions (); if (Environment.GetEnvironmentVariable ("MONODOCTESTING") == null) d.Url = "http://www.go-mono.com/docs/server.asmx"; notebook.Page = 8; war = (WebClientAsyncResult) d.BeginCheckVersion (1, new AsyncCallback (VersionChecked), null); } void NetworkError () { new_page = 9; tn.WakeupMain (); } void VersionChecked (IAsyncResult iar) { int ver = -1; try { if (notebook.Page != 8) return; ver = d.EndCheckVersion (iar); if (ver != 0) new_page = 10; else new_page = 0; tn.WakeupMain (); } catch (Exception e){ Console.WriteLine ("Error" + e); NetworkError (); } } // // Called on the Window delete icon clicked // void OnDelete (object sender, DeleteEventArgs a) { config_wizard = null; } // // called when the license is approved // void OnPage1_Clicked (object sender, EventArgs a) { button_email_ok.Sensitive = false; notebook.Page = 1; } // // Request the user registration. // void OnPage2_Clicked (object sender, EventArgs a) { notebook.Page = 2; SettingsHandler.Settings.Email = entry_email.Text; war = (WebClientAsyncResult) d.BeginRegister (entry_email.Text, new AsyncCallback (RegisterDone), null); } void UpdateNotebookPage () { notebook.Page = new_page; } void RegisterDone (IAsyncResult iar) { int code; try { Console.WriteLine ("Registration done"); code = d.EndRegister (iar); if (code != 0 && code != -2){ NetworkError (); return; } new_page = 4; } catch { new_page = 3; } tn.WakeupMain (); } void PasswordContinue_Clicked (object sender, EventArgs a) { notebook.Page = 5; SettingsHandler.Settings.Key = entry_password.Text; war = (WebClientAsyncResult) d.BeginGetSerial (entry_email.Text, entry_password.Text, new AsyncCallback (GetSerialDone), null); } void GetSerialDone (IAsyncResult iar) { try { int last = d.EndGetSerial (iar); if (last == -1){ SettingsHandler.Settings.Key = ""; new_page = 11; tn.WakeupMain (); return; } SettingsHandler.Settings.SerialNumber = last; new_page = 6; tn.WakeupMain (); } catch { NetworkError (); } } void AccountRequestCancel_Clicked (object sender, EventArgs a) { war.Abort (); notebook.Page = 7; } void SerialRequestCancel_Clicked (object sender, EventArgs a) { war.Abort (); notebook.Page = 7; } void LoginRequestCancel_Clicked (object sender, EventArgs a) { war.Abort (); notebook.Page = 7; } // // Called when the user clicks `ok' on a terminate page // void Terminate_Clicked (object sender, EventArgs a) { window_config_wizard.Destroy (); config_wizard = null; } // Called when the registration process has been successful void Completed_Clicked (object sender, EventArgs a) { window_config_wizard.Destroy (); config_wizard = null; try { Console.WriteLine ("Saving"); SettingsHandler.Save (); parent.DoUpload (); } catch (Exception e) { MessageDialog md = new MessageDialog (null, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "Error Saving settings\n" + e.ToString ()); } } void OnEmail_Changed (object sender, EventArgs a) { string text = entry_email.Text; if (text.IndexOf ("@") != -1 && text.Length > 3) button_email_ok.Sensitive = true; } } void OnContributionStatistics (object sender, EventArgs a) { string email = SettingsHandler.Settings.Email; string key = SettingsHandler.Settings.Key; if (key == null || key == "") { MessageDialog md = new MessageDialog (null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "You have not obtained or used a contribution key yet."); md.Title = "No contribution key"; md.Run(); md.Destroy(); } else ContributionStatus.GetStatus (email, key); } class ContributionStatus { enum State { GetStatusError, NetworkError, Done } State state; Status status; string contributoremail; ThreadNotify tn; WebClientAsyncResult war; Contributions d; public static void GetStatus (string email, string key) { new ContributionStatus(email, key); } ContributionStatus (string email, string key) { tn = new ThreadNotify (new ReadyEvent (Update)); d = new Contributions (); if (Environment.GetEnvironmentVariable ("MONODOCTESTING") == null) d.Url = "http://www.go-mono.com/docs/server.asmx"; war = (WebClientAsyncResult) d.BeginGetStatus (email, key, new AsyncCallback (GetStatusDone), null); contributoremail = email; } void Update () { MessageDialog md = null; switch (state) { case State.GetStatusError: md = new MessageDialog (null, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "Server returned error while requesting contributor statistics"); md.Title = "Contribution Statistics Error Occurred"; break; case State.NetworkError: md = new MessageDialog (null, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "Network error occurred while requesting contributor statistics"); md.Title = "Contribution Statistics Error Occurred"; break; case State.Done: md = new MessageDialog (null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Contribution statistics for " + contributoremail + "\n\nTotal contributions: " + status.Contributions + "\nContributions committed: " + status.Commited + "\nContributions pending: " + status.Pending); md.Title = "Contribution Statistics"; break; } md.Run(); md.Destroy(); } void GetStatusDone (IAsyncResult iar) { try { status = d.EndGetStatus (iar); war = null; if (status == null) state = State.GetStatusError; else state = State.Done; } catch (Exception e) { state = State.NetworkError; Console.WriteLine ("Error getting status: " + e); } if (tn != null) tn.WakeupMain (); } } class NewComment { [Glade.Widget] Window newcomment; [Glade.Widget] Entry entry; static NewComment NewCommentBox; Browser parent; NewComment (Browser browser) { Glade.XML ui = new Glade.XML (null, "browser.glade", "newcomment", null); ui.Autoconnect (this); parent = browser; newcomment.TransientFor = browser.window1; } void OnOkClicked (object sender, EventArgs a) { //CommentService service = new CommentService(); // todo newcomment.Hide (); } void OnCancelClicked (object sender, EventArgs a) { newcomment.Hide (); } // // Called on the Window delete icon clicked // void OnDelete (object sender, DeleteEventArgs a) { NewCommentBox = null; } static public void Show (Browser browser) { if (NewCommentBox == null) NewCommentBox = new NewComment (browser); NewCommentBox.newcomment.Show (); } } void OnNewComment (object sender, EventArgs a) { NewComment.Show (this); } class Lookup { [Glade.Widget] Window lookup; [Glade.Widget] Entry entry; static Lookup LookupBox; Browser parent; Lookup (Browser browser) { Glade.XML ui = new Glade.XML (null, "browser.glade", "lookup", null); ui.Autoconnect (this); parent = browser; lookup.TransientFor = browser.window1; } void OnOkClicked (object sender, EventArgs a) { string text = entry.Text; if (text != "") parent.LoadUrl (entry.Text); lookup.Hide (); } // // Called on the Window delete icon clicked // void OnDelete(object sender, DeleteEventArgs a) { LookupBox = null; } static public void Show (Browser browser) { if (LookupBox == null) LookupBox = new Lookup (browser); LookupBox.lookup.Show (); } } // // Invoked by File/LookupURL menu entry. // void OnLookupURL (object sender, EventArgs a) { Lookup.Show (this); } // // Invoked by Edit/Select All menu entry. // void OnSelectAllActivate (object sender, EventArgs a) { CurrentTab.html.SelectAll (); } // // Invoked by New Tab menu entry. // void OnNewTab (object sender, EventArgs a) { AddTab(); } // // Invoked by Close Tab menu entry. // public void OnCloseTab (object sender, EventArgs a) { CloseTab(); } } // // This class implements the tree browser // public class TreeBrowser { Browser browser; TreeView tree_view; TreeStore store; RootTree help_tree; TreeIter root_iter; // // This hashtable maps an iter to its node. // Hashtable iter_to_node; // // This hashtable maps the node to its iter // Hashtable node_to_iter; // // Maps a node to its TreeIter parent // Hashtable node_parent; public TreeBrowser (RootTree help_tree, TreeView reference_tree, Browser browser) { this.browser = browser; tree_view = reference_tree; iter_to_node = new Hashtable (); node_to_iter = new Hashtable (); node_parent = new Hashtable (); // Setup the TreeView tree_view.AppendColumn ("name_col", new CellRendererText (), "text", 0); // Bind events tree_view.RowExpanded += new Gtk.RowExpandedHandler (RowExpanded); tree_view.Selection.Changed += new EventHandler (RowActivated); tree_view.RowActivated += new Gtk.RowActivatedHandler (RowClicked); // Setup the model this.help_tree = help_tree; store = new TreeStore (typeof (string)); root_iter = store.AppendValues ("Mono Documentation"); iter_to_node [root_iter] = help_tree; node_to_iter [help_tree] = root_iter; PopulateNode (help_tree, root_iter); reference_tree.Model = store; } void PopulateNode (Node node, TreeIter parent) { if (node.Nodes == null) return; TreeIter iter; foreach (Node n in node.Nodes){ iter = store.AppendValues (parent, n.Caption); iter_to_node [iter] = n; node_to_iter [n] = iter; } } Hashtable populated = new Hashtable (); void RowExpanded (object o, Gtk.RowExpandedArgs args) { Node result = iter_to_node [args.Iter] as Node; Open (result); } void RowClicked (object o, Gtk.RowActivatedArgs args) { Gtk.TreeModel model; Gtk.TreeIter iter; Gtk.TreePath path = args.Path; tree_view.Selection.GetSelected (out model, out iter); Node result = iter_to_node [iter] as Node; if (!tree_view.GetRowExpanded (path)) { tree_view.ExpandRow (path, false); Open (result); } else { tree_view.CollapseRow (path); } } void Open (Node node) { if (node == null){ Console.Error.WriteLine ("Expanding something that I do not know about"); return; } if (populated.Contains (node)) return; // // We need to populate data on a second level // if (node.Nodes == null) return; foreach (Node n in node.Nodes){ PopulateNode (n, (TreeIter) node_to_iter [n]); } populated [node] = true; } void PopulateTreeFor (Node n) { if (populated [n] == null){ if (n.Parent != null) { OpenTree (n.Parent); } } Open (n); } public void OpenTree (Node n) { PopulateTreeFor (n); TreeIter iter = (TreeIter) node_to_iter [n]; TreePath path = store.GetPath (iter); } public Node SelectedNode { get { Gtk.TreeIter iter; Gtk.TreeModel model; if (tree_view.Selection.GetSelected (out model, out iter)) return (Node) iter_to_node [iter]; else return null; } } public void ShowNode (Node n) { if (node_to_iter [n] == null){ OpenTree (n); if (node_to_iter [n] == null){ Console.Error.WriteLine ("Internal error: no node to iter mapping"); return; } } TreeIter iter = (TreeIter) node_to_iter [n]; TreePath path = store.GetPath (iter); tree_view.ExpandToPath (path); IgnoreRowActivated = true; tree_view.Selection.SelectPath (path); IgnoreRowActivated = false; tree_view.ScrollToCell (path, null, false, 0.5f, 0.0f); } class NodePageVisit : PageVisit { Browser browser; Node n; string url; public NodePageVisit (Browser browser, Node n, string url) { if (n == null) throw new Exception ("N is null"); this.browser = browser; this.n = n; this.url = url; } public override void Go () { string res = Browser.GetHtml (url, n.tree.HelpSource, browser.help_tree); browser.Render (res, n, url); } } bool IgnoreRowActivated = false; // // This has to handle two kinds of urls: those encoded in the tree // file, which are used to quickly lookup information precisely // (things like "ecma:0"), and if that fails, it uses the more expensive // mechanism that walks trees to find matches // void RowActivated (object sender, EventArgs a) { //browser.CurrentTab.SetMode (Mode.Viewer); if (IgnoreRowActivated) return; Gtk.TreeIter iter; Gtk.TreeModel model; if (tree_view.Selection.GetSelected (out model, out iter)){ Node n = (Node) iter_to_node [iter]; string url = n.PublicUrl; Node match; string s; if (n.tree.HelpSource != null) { // // Try the tree-based urls first. // s = Browser.GetHtml (url, n.tree.HelpSource, help_tree); if (s != null){ ((Browser)browser).Render (s, n, url); browser.CurrentTab.history.AppendHistory (new NodePageVisit (browser, n, url)); return; } } // // Try the url resolver next // s = Browser.GetHtml (url, null, help_tree); if (s != null){ ((Browser)browser).Render (s, n, url); browser.CurrentTab.history.AppendHistory (new Browser.LinkPageVisit (browser, url)); return; } ((Browser)browser).Render ("

Unhandled URL

" + "

Functionality to view the resource " + n.PublicUrl + " is not available on your system or has not yet been implemented.

", null, url); } } } // // The index browser // class IndexBrowser { Browser browser; IndexReader index_reader; public BigList index_list; public MatchModel match_model; public BigList match_list; IndexEntry current_entry = null; public static IndexBrowser MakeIndexBrowser (Browser browser) { IndexReader ir = browser.help_tree.GetIndex (); if (ir == null) { return new IndexBrowser (browser); } return new IndexBrowser (browser, ir); } ProgressPanel ppanel; IndexBrowser (Browser parent) { browser = parent; ppanel = new ProgressPanel ("No index found", "Generate", RootTree.MakeIndex, NewIndexCreated); browser.index_vbox.Add (ppanel); browser.index_vbox.Show (); } void NewIndexCreated () { index_reader = browser.help_tree.GetIndex (); //restore widgets browser.index_vbox.Remove (ppanel); CreateWidget (); browser.index_vbox.ShowAll (); } IndexBrowser (Browser parent, IndexReader ir) { browser = parent; index_reader = ir; CreateWidget (); } void CreateWidget () { // // Create the widget // Frame frame1 = new Frame (); VBox vbox1 = new VBox (false, 0); frame1.Add (vbox1); // title HBox hbox1 = new HBox (false, 3); hbox1.BorderWidth = 3; Image icon = new Image (Stock.Index, IconSize.Menu); Label look_for_label = new Label ("Look for:"); look_for_label.Justify = Justification.Left; look_for_label.Xalign = 0; hbox1.PackEnd (look_for_label, true, true, 0); hbox1.PackEnd (icon, false, true, 0); hbox1.ShowAll (); vbox1.PackStart (hbox1, false, true, 0); // entry vbox1.PackStart (new HSeparator (), false, true, 0); browser.index_entry = new Entry (); browser.index_entry.Activated += browser.OnIndexEntryActivated; browser.index_entry.Changed += browser.OnIndexEntryChanged; browser.index_entry.FocusInEvent += browser.OnIndexEntryFocused; browser.index_entry.KeyPressEvent += browser.OnIndexEntryKeyPress; vbox1.PackStart (browser.index_entry, false, true, 0); vbox1.PackStart (new HSeparator (), false, true, 0); //search results browser.search_box = new VBox (); vbox1.PackStart (browser.search_box, true, true, 0); vbox1.ShowAll (); // // Setup the widget // index_list = new BigList (index_reader); //index_list.SetSizeRequest (100, 400); index_list.ItemSelected += new ItemSelected (OnIndexSelected); index_list.ItemActivated += new ItemActivated (OnIndexActivated); HBox box = new HBox (false, 0); box.PackStart (index_list, true, true, 0); Scrollbar scroll = new VScrollbar (index_list.Adjustment); box.PackEnd (scroll, false, false, 0); browser.search_box.PackStart (box, true, true, 0); box.ShowAll (); // // Setup the matches. // browser.matches = new Frame (); match_model = new MatchModel (this); browser.matches.Hide (); match_list = new BigList (match_model); match_list.ItemSelected += new ItemSelected (OnMatchSelected); match_list.ItemActivated += new ItemActivated (OnMatchActivated); HBox box2 = new HBox (false, 0); box2.PackStart (match_list, true, true, 0); Scrollbar scroll2 = new VScrollbar (match_list.Adjustment); box2.PackEnd (scroll2, false, false, 0); box2.ShowAll (); browser.matches.Add (box2); index_list.SetSizeRequest (100, 200); browser.index_vbox.PackStart (frame1); browser.index_vbox.PackEnd (browser.matches); } // // This class is used as an implementation of the IListModel // for the matches for a given entry. // public class MatchModel : IListModel { IndexBrowser index_browser; Browser browser; public MatchModel (IndexBrowser parent) { index_browser = parent; browser = parent.browser; } public int Rows { get { if (index_browser.current_entry != null) return index_browser.current_entry.Count; else return 0; } } public string GetValue (int row) { Topic t = index_browser.current_entry [row]; // Names from the ECMA provider are somewhat // ambigious (you have like a million ToString // methods), so lets give the user the full name // Filter out non-ecma if (t.Url [1] != ':') return t.Caption; switch (t.Url [0]) { case 'C': return t.Url.Substring (2) + " constructor"; case 'M': return t.Url.Substring (2) + " method"; case 'P': return t.Url.Substring (2) + " property"; case 'F': return t.Url.Substring (2) + " field"; case 'E': return t.Url.Substring (2) + " event"; default: return t.Caption; } } public string GetDescription (int row) { return GetValue (row); } } void ConfigureIndex (int index) { current_entry = index_reader.GetIndexEntry (index); if (current_entry.Count > 1){ browser.matches.Show (); match_list.Reload (); match_list.Refresh (); } else { browser.matches.Hide (); } } // // When an item is selected from the main index list // void OnIndexSelected (int index) { ConfigureIndex (index); if (browser.matches.Visible == true) match_list.Selected = 0; } void OnIndexActivated (int index) { if (browser.matches.Visible == false) browser.LoadUrl (current_entry [0].Url); } void OnMatchSelected (int index) { } void OnMatchActivated (int index) { browser.LoadUrl (current_entry [index].Url); } int FindClosest (string text) { int low = 0; int top = index_reader.Rows-1; int high = top; bool found = false; int best_rate_idx = Int32.MaxValue, best_rate = -1; while (low <= high){ int mid = (high + low) / 2; //Console.WriteLine ("[{0}, {1}] -> {2}", low, high, mid); string s; int p = mid; for (s = index_reader.GetValue (mid); s [0] == ' ';){ if (p == high){ if (p == low){ if (best_rate_idx != Int32.MaxValue){ //Console.WriteLine ("Bestrated: "+best_rate_idx); //Console.WriteLine ("Bestrated: "+index_reader.GetValue(best_rate_idx)); return best_rate_idx; } else { //Console.WriteLine ("Returning P="+p); return p; } } high = mid; break; } if (p < 0) return 0; s = index_reader.GetValue (++p); //Console.WriteLine (" Advancing to ->"+p); } if (s [0] == ' ') continue; int c, rate; c = Rate (text, s, out rate); //Console.WriteLine ("[{0}] Text: {1} at {2}", text, s, p); //Console.WriteLine (" Rate: {0} at {1}", rate, p); //Console.WriteLine (" Best: {0} at {1}", best_rate, best_rate_idx); //Console.WriteLine (" {0} - {1}", best_rate, best_rate_idx); if (rate >= best_rate){ best_rate = rate; best_rate_idx = p; } if (c == 0) return mid; if (low == high){ //Console.WriteLine ("THISPATH"); if (best_rate_idx != Int32.MaxValue) return best_rate_idx; else return low; } if (c < 0){ high = mid; } else { if (low == mid) low = high; else low = mid; } } // Console.WriteLine ("Another"); if (best_rate_idx != Int32.MaxValue) return best_rate_idx; else return high; } int Rate (string user_text, string db_text, out int rate) { int c = String.Compare (user_text, db_text, true); if (c == 0){ rate = 0; return 0; } int i; for (i = 0; i < user_text.Length; i++){ if (db_text [i] != user_text [i]){ rate = i; return c; } } rate = i; return c; } public void SearchClosest (string text) { index_list.Selected = FindClosest (text); } public void LoadSelected () { if (browser.matches.Visible == true) { if (match_list.Selected != -1) OnMatchActivated (match_list.Selected); } else { if (index_list.Selected != -1) OnIndexActivated (index_list.Selected); } } } public enum Mode { Viewer, Editor } // // A Tab is a Notebok with two pages, one for editing and one for visualizing // public class Tab : Notebook { // Our HTML preview during editing. public IHtmlRender html_preview; // Where we render the contents public IHtmlRender html; public TextView text_editor; public Mode Tab_mode; public History history; private Browser browser; private Label titleLabel; private Image EditImg; public HBox TabLabel; public string Title { get { return titleLabel.Text; } set { titleLabel.Text = value; } } public Node CurrentNode; public System.Xml.XmlNode edit_node; public string edit_url; void FocusOut (object sender, FocusOutEventArgs args) { if (TabMode == Mode.Editor) text_editor.GrabFocus (); } private static IHtmlRender LoadRenderer (string dll, Browser browser) { if (!System.IO.File.Exists (dll)) return null; try { Assembly ass = Assembly.LoadFile (dll); System.Type type = ass.GetType ("Monodoc." + ass.GetName ().Name, false, false); if (type == null) return null; return (IHtmlRender) Activator.CreateInstance (type, new object[1] { browser.help_tree }); } catch (Exception ex) { Console.Error.WriteLine (ex); } return null; } #if MACOS public static IHtmlRender GetRenderer (string engine, Browser browser) { var renderer = new GtkHtmlHtmlRender (browser.help_tree); renderer.Initialize (); return renderer; } #else public static IHtmlRender GetRenderer (string engine, Browser browser) { IHtmlRender renderer = LoadRenderer (System.IO.Path.Combine (AppDomain.CurrentDomain.BaseDirectory, engine + "HtmlRender.dll"), browser); if (renderer != null) { try { if (renderer.Initialize ()) { Console.WriteLine ("using " + renderer.Name); return renderer; } } catch (Exception ex) { Console.Error.WriteLine (ex); } } foreach (string backend in Driver.engines) { if (backend != engine) { renderer = LoadRenderer (System.IO.Path.Combine (AppDomain.CurrentDomain.BaseDirectory, backend + "HtmlRender.dll"), browser); if (renderer != null) { try { if (renderer.Initialize ()) { Console.WriteLine ("using " + renderer.Name); return renderer; } } catch (Exception ex) { Console.Error.WriteLine (ex); } } } } return null; } #endif public Tab(Browser br) { browser = br; CurrentNode = br.help_tree; ShowTabs = false; ShowBorder = false; TabBorder = 0; TabHborder = 0; history = new History (browser.back_button, browser.forward_button); // // First Page // ScrolledWindow html_container = new ScrolledWindow(); html_container.Show(); // // Setup the HTML rendering and preview area // html = GetRenderer (browser.engine, browser); html_preview = GetRenderer (browser.engine, browser); if (html == null || html_preview == null) throw new Exception ("Couldn't find html renderer!"); browser.capabilities = html.Capabilities; HelpSource.FullHtml = false; HelpSource.UseWebdocCache = true; if ((html.Capabilities & Capabilities.Css) != 0) HelpSource.use_css = true; //Prepare Font for css (TODO: use GConf?) if ((html.Capabilities & Capabilities.Fonts) != 0 && SettingsHandler.Settings.preferred_font_size == 0) { Pango.FontDescription font_desc = Pango.FontDescription.FromString ("Sans 12"); SettingsHandler.Settings.preferred_font_family = font_desc.Family; SettingsHandler.Settings.preferred_font_size = 100; //size: 100% } html_container.Add (html.HtmlPanel); html.UrlClicked += new EventHandler (browser.LinkClicked); html.OnUrl += new EventHandler (browser.OnUrlMouseOver); browser.context_id = browser.statusbar.GetContextId (""); AppendPage(html_container, new Label("Html")); // // Second Page: editing // VBox vbox1 = new VBox(false, 0); VBox MainPart = new VBox(false, 0); // // TextView for XML code // ScrolledWindow sw = new ScrolledWindow(); text_editor = new TextView(); text_editor.Buffer.Changed += new EventHandler (EditedTextChanged); text_editor.WrapMode = WrapMode.Word; sw.Add(text_editor); text_editor.FocusOutEvent += new FocusOutEventHandler (FocusOut); // // XML editing buttons // HBox EdBots = new HBox(false, 2); Button button1 = new Button(""); EdBots.PackStart(button1); Button button2 = new Button(""); EdBots.PackStart(button2); Button button3 = new Button("<_table>"); EdBots.PackStart(button3); Button button4 = new Button("<_see...>"); EdBots.PackStart(button4); Button button5 = new Button("<_para>"); EdBots.PackStart(button5); Button button6 = new Button("Add Note"); EdBots.PackStart(button6); button1.Clicked += new EventHandler (OnInsertExampleClicked); button2.Clicked += new EventHandler (OnInsertListClicked); button3.Clicked += new EventHandler (OnInsertTableClicked); button4.Clicked += new EventHandler (OnInsertType); button5.Clicked += new EventHandler (OnInsertParaClicked); button6.Clicked += new EventHandler (OnInsertNoteClicked); Frame html_preview_frame = new Frame("Preview"); ScrolledWindow html_preview_container = new ScrolledWindow(); // // code preview panel // html_preview_container.Add (html_preview.HtmlPanel); html_preview_frame.Add(html_preview_container); MainPart.PackStart(sw); MainPart.PackStart(EdBots, false, false, 0); MainPart.PackStart(html_preview_frame); // // Close and Save buttons // HBox MainBots = new HBox(false, 3); HBox Filling = new HBox(false, 0); Button close = new Button("C_lose"); Button save = new Button("S_ave"); Button restore = new Button("_Restore"); close.Clicked += new EventHandler (OnCancelEdits); save.Clicked += new EventHandler (OnSaveEdits); restore.Clicked += new EventHandler (OnRestoreEdits); MainBots.PackStart(Filling); MainBots.PackStart(close, false, false, 0); MainBots.PackStart(save, false, false, 0); MainBots.PackStart(restore, false, false, 0); vbox1.PackStart(MainPart); vbox1.PackStart(MainBots, false, false, 0); AppendPage(vbox1, new Label("Edit XML")); // //Create the Label for the Tab // TabLabel = new HBox(false, 2); titleLabel = new Label(""); //Close Tab button Button tabClose = new Button(); Image img = new Image(Stock.Close, IconSize.SmallToolbar); tabClose.Add(img); tabClose.Relief = Gtk.ReliefStyle.None; tabClose.SetSizeRequest (18, 18); tabClose.Clicked += new EventHandler (browser.OnCloseTab); //Icon showed when the Tab is in Edit Mode EditImg = new Image (Stock.Convert, IconSize.SmallToolbar); TabLabel.PackStart (EditImg, false, true, 2); TabLabel.PackStart (titleLabel, true, true, 0); TabLabel.PackStart (tabClose, false, false, 2); // needed, otherwise even calling show_all on the notebook won't // make the hbox contents appear. TabLabel.ShowAll(); EditImg.Visible = false; } public Mode TabMode { get { return Tab_mode; } set { Tab_mode = value; } } public void SetMode (Mode m) { if (Tab_mode == m) return; if (m == Mode.Viewer) { this.Page = 0; browser.cut1.Sensitive = false; browser.paste1.Sensitive = false; browser.print.Sensitive = true; EditImg.Visible = false; } else { this.Page = 1; browser.cut1.Sensitive = true; browser.paste1.Sensitive = true; browser.print.Sensitive = false; EditImg.Visible = true; } Tab_mode = m; } // Events for the Editor void OnInsertParaClicked (object sender, EventArgs a) { text_editor.Buffer.InsertAtCursor ("\n\n"); } void OnInsertNoteClicked (object sender, EventArgs a) { text_editor.Buffer.InsertAtCursor ("\n\n \n \n"); } void OnInsertExampleClicked (object sender, EventArgs a) { text_editor.Buffer.InsertAtCursor ("\n\n \n \n"); } void OnInsertListClicked (object sender, EventArgs a) { text_editor.Buffer.InsertAtCursor ("\n\n \n First Item\n \n"); } void OnInsertTableClicked (object sender, EventArgs a) { text_editor.Buffer.InsertAtCursor ("\n\n \n Column\n" + " Description\n" + " \n" + " \n" + " Term\n" + " Description\n" + " \n" + ""); } void OnInsertType (object sender, EventArgs a) { text_editor.Buffer.InsertAtCursor (""); } void OnSaveEdits (object sender, EventArgs a) { try { edit_node.InnerXml = text_editor.Buffer.Text; } catch (Exception e) { browser.statusbar.Pop (browser.context_id); browser.statusbar.Push (browser.context_id, e.Message); return; } string [] uSplit = EditingUtils.ParseEditUrl (edit_url); if (uSplit[0].StartsWith ("monodoc:")) EditingUtils.SaveChange (edit_url, browser.help_tree, edit_node, GetNiceUrl (browser.CurrentTab.CurrentNode)); else if (uSplit[0].StartsWith ("file:")) EditingUtils.SaveChange (edit_url, browser.help_tree, edit_node, String.Empty); else Console.WriteLine ("Edit url wrong: {0}", edit_url); SetMode (Mode.Viewer); history.ActivateCurrent (); } public static string GetNiceUrl (Node node) { if (node.Element.StartsWith("N:")) return node.Element; string name, full; int bk_pos = node.Caption.IndexOf (' '); // node from an overview if (bk_pos != -1) { name = node.Caption.Substring (0, bk_pos); full = node.Parent.Caption + "." + name.Replace ('.', '+'); return "T:" + full; } // node that lists constructors, methods, fields, ... if ((node.Caption == "Constructors") || (node.Caption == "Fields") || (node.Caption == "Events") || (node.Caption == "Members") || (node.Caption == "Properties") || (node.Caption == "Methods") || (node.Caption == "Operators")) { bk_pos = node.Parent.Caption.IndexOf (' '); name = node.Parent.Caption.Substring (0, bk_pos); full = node.Parent.Parent.Caption + "." + name.Replace ('.', '+'); return "T:" + full + "/" + node.Element; } int pr_pos = node.Caption.IndexOf ('('); // node from a constructor if (node.Parent.Element == "C") { name = node.Parent.Parent.Parent.Caption; int idx = node.PublicUrl.IndexOf ('/'); return node.PublicUrl[idx+1] + ":" + name + "." + node.Caption.Replace ('.', '+'); // node from a method with one signature, field, property, operator } else if (pr_pos == -1) { bk_pos = node.Parent.Parent.Caption.IndexOf (' '); name = node.Parent.Parent.Caption.Substring (0, bk_pos); full = node.Parent.Parent.Parent.Caption + "." + name.Replace ('.', '+'); int idx = node.PublicUrl.IndexOf ('/'); return node.PublicUrl[idx+1] + ":" + full + "." + node.Caption; // node from a method with several signatures } else { bk_pos = node.Parent.Parent.Parent.Caption.IndexOf (' '); name = node.Parent.Parent.Parent.Caption.Substring (0, bk_pos); full = node.Parent.Parent.Parent.Parent.Caption + "." + name.Replace ('.', '+'); int idx = node.PublicUrl.IndexOf ('/'); return node.PublicUrl[idx+1] + ":" + full + "." + node.Caption; } } void OnCancelEdits (object sender, EventArgs a) { SetMode (Mode.Viewer); history.ActivateCurrent (); } void OnRestoreEdits (object sender, EventArgs a) { EditingUtils.RemoveChange (edit_url, browser.help_tree); SetMode (Mode.Viewer); history.ActivateCurrent (); } bool queued = false; void EditedTextChanged (object sender, EventArgs args) { if (queued) return; queued = true; GLib.Timeout.Add (500, delegate { queued = false; StringWriter sw = new StringWriter (); XmlWriter w = new XmlTextWriter (sw); var converter = new Monodoc.Generators.Html.Ecma2Html (); try { edit_node.InnerXml = text_editor.Buffer.Text; EditingUtils.RenderEditPreview (edit_url, browser.help_tree, edit_node, w); w.Flush (); } catch (Exception e) { browser.statusbar.Pop (browser.context_id); browser.statusbar.Push (browser.context_id, e.Message); return false; } browser.statusbar.Pop (browser.context_id); browser.statusbar.Push (browser.context_id, "XML OK"); string s = converter.Export (sw.ToString (), new Dictionary ()); html_preview.Render(s); return false; }); } } } mono-tools-4.2/docbrowser/list.cs0000664000175000017500000002042412413742070021164 0ustar00directhexdirecthex00000000000000// // list.cs: A list widget that scales for lots of data. // // Authors: // Miguel de Icaza (miguel@ximian.com) // Alp Toker (alp@atoker.com) // // (C) 2003 Ximian, Inc. // namespace Monodoc { using Gdk; using Gtk; using System; using System.Collections; delegate void ItemSelected (int index); delegate void ItemActivated (int index); class BigList : Gtk.DrawingArea { Gtk.Adjustment adjustment; int top_displayed; Style my_style; Widget style_widget; Pango.Layout layout; IListModel provider; const string ellipsis = "..."; Hashtable ellipses = new Hashtable (); int old_width; int ellipsis_width, en_width, line_height; int selected_line = -1; int rows = 1; bool is_dragging = false; bool reloaded = true; public bool CanDeselect = false; int old_selected; public BigList (IListModel provider) { this.provider = provider; //Accessibility RefAccessible ().Role = Atk.Role.List; adjustment = new Gtk.Adjustment (0, 0, provider.Rows, 1, 1, 1); adjustment.ValueChanged += new EventHandler (ValueChangedHandler); layout = new Pango.Layout (PangoContext); ExposeEvent += new ExposeEventHandler (ExposeHandler); ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEventHandler); ButtonReleaseEvent += new ButtonReleaseEventHandler (ButtonReleaseEventHandler); KeyPressEvent += new KeyPressEventHandler (KeyHandler); Realized += new EventHandler (RealizeHandler); Unrealized += new EventHandler (UnrealizeHandler); ScrollEvent += new ScrollEventHandler (ScrollHandler); SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler); MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEventHandler); AddEvents ((int) EventMask.ButtonPressMask | (int) EventMask.ButtonReleaseMask | (int) EventMask.KeyPressMask | (int) EventMask.PointerMotionMask); CanFocus = true; style_widget = new EventBox (); style_widget.StyleSet += new StyleSetHandler (StyleHandler); // // Compute the height and ellipsis width of the font, // and the en_width for our ellipsizing algorithm // layout.SetMarkup (ellipsis); layout.GetPixelSize (out ellipsis_width, out line_height); layout.SetMarkup ("n"); layout.GetPixelSize (out en_width, out line_height); layout.SetMarkup ("W"); layout.GetPixelSize (out en_width, out line_height); old_width = Allocation.Width; } void MotionNotifyEventHandler (object o, MotionNotifyEventArgs args) { if (!is_dragging) return; int x, y; GetPointer (out x, out y); Selected = HitTest (y); } void SizeAllocatedHandler (object obj, SizeAllocatedArgs args) { Gdk.Rectangle rect = args.Allocation; if (rect.Equals (Gdk.Rectangle.Zero)) Console.WriteLine ("ERROR: Allocation is null!"); int nrows = Allocation.Height / line_height; if (nrows != rows){ rows = nrows; Reload (); } if (args.Allocation.Width != old_width) ellipses.Clear (); old_width = args.Allocation.Width; } void StyleHandler (object obj, StyleSetArgs args) { if (Style == my_style) return; my_style = style_widget.Style.Copy (); Style = my_style; my_style.SetBackgroundGC (StateType.Normal, Style.BaseGC (StateType.Normal)); Refresh (); } void RealizeHandler (object o, EventArgs sender) { } void UnrealizeHandler (object o, EventArgs sender) { } void ValueChangedHandler (object obj, EventArgs e) { top_displayed = (int) Adjustment.Value; Refresh (); } void RedrawLine (int line) { QueueDrawArea (0, line * line_height, Allocation.Width, (line+1) * line_height); } public void Reload () { adjustment.SetBounds (0, provider.Rows, 1, rows, rows); ellipses.Clear (); reloaded = true; } public void Refresh () { QueueDrawArea (0, 0, Allocation.Width, Allocation.Height); } void ScrollHandler (object o, ScrollEventArgs args) { Gdk.EventScroll es = args.Event; double newloc = 0.0; int steps = Math.Max (rows / 6, 2); switch (es.Direction){ case ScrollDirection.Up: newloc = adjustment.Value - steps; break; case ScrollDirection.Down: newloc = adjustment.Value + steps; break; } newloc = Math.Max (newloc, 0); newloc = Math.Min (newloc, provider.Rows - rows); adjustment.Value = newloc; } void KeyHandler (object o, KeyPressEventArgs args) { args.RetVal = true; switch (args.Event.Key) { case Gdk.Key.Down: Selected++; break; case Gdk.Key.Up: Selected--; break; case Gdk.Key.Page_Down: Selected += rows - 1; break; case Gdk.Key.Page_Up: Selected -= rows - 1; break; case Gdk.Key.End: Selected = provider.Rows; break; case Gdk.Key.Home: Selected = 0; break; case Gdk.Key.Return: if (ItemActivated != null) ItemActivated (Selected); break; default: args.RetVal = false; break; } } uint last_click_time = 0; void ButtonPressEventHandler (object o, ButtonPressEventArgs a) { if (a.Event.Type != Gdk.EventType.ButtonPress) return; if (a.Event.Button == 1) is_dragging = true; HasFocus = true; Gdk.EventButton pos = a.Event; int new_selected = HitTest (pos.Y); int double_click_time = Settings.DoubleClickTime; if ((new_selected == Selected) && (a.Event.Time - last_click_time <= double_click_time)) { Selected = new_selected; Grab.Remove (this); if (ItemActivated != null) ItemActivated (Selected); } else Selected = new_selected; last_click_time = a.Event.Time; a.RetVal = true; } void ButtonReleaseEventHandler (object o, ButtonReleaseEventArgs a) { if (a.Event.Button == 1) is_dragging = false; old_selected = Selected; } int HitTest (double y) { int line = (int) y / line_height; if (line + top_displayed > provider.Rows - 1) return -2; return (line + top_displayed); } public int Selected { get { return selected_line; } set { int selected = value; if (selected != -2) { selected = Math.Max (selected, 0); selected = Math.Min (selected, provider.Rows - 1); } if (selected == Selected && reloaded == false) return; reloaded = false; if (selected_line != -1) RedrawLine (selected_line - top_displayed); if (selected == -2) { if (CanDeselect) { //Translate the selection number selected_line = -1; if (ItemSelected != null) ItemSelected (-1); return; } else return; } if (selected < top_displayed){ top_displayed = selected; adjustment.Value = top_displayed; Refresh (); } else if (selected >= (top_displayed + rows)){ top_displayed = selected - rows + 1; top_displayed = Math.Max (top_displayed, 0); adjustment.Value = top_displayed; Refresh (); } else RedrawLine (selected - top_displayed); selected_line = selected; if (ItemSelected != null) ItemSelected (selected); } } public event ItemSelected ItemSelected; public event ItemActivated ItemActivated; void ExposeHandler (object obj, ExposeEventArgs args) { Gdk.Window win = args.Event.Window; Gdk.Rectangle area = args.Event.Area; win.DrawRectangle (Style.BaseGC (StateType.Normal), true, area); for (int y = 0, row = top_displayed; y < area.Y + area.Height; y += line_height, row++){ Gdk.GC gc; Gdk.Rectangle region_area = new Gdk.Rectangle (0, y, Allocation.Width, line_height); StateType state = StateType.Normal; if (row == selected_line) { if (HasFocus) state = StateType.Selected; else state = StateType.Active; win.DrawRectangle (Style.BaseGC (state), true, region_area); } //FIXME: we have a ghost row at the end of the list! //Console.WriteLine (row + " " + provider.Rows); if (row >= provider.Rows) return; string text = ""; if (ellipses [row] == null){ text = provider.GetValue (row); text = ELabel.Ellipsize (layout, text, Allocation.Width - 2 * 2, ellipsis_width, en_width); ellipses [row] = text; } else text = (string) ellipses [row]; layout.SetText (text); gc = Style.TextGC (state); win.DrawLayout (gc, 2, y, layout); } args.RetVal = true; } public Gtk.Adjustment Adjustment { get { return adjustment; } } } } mono-tools-4.2/docbrowser/admin.cs0000664000175000017500000003062512413742070021305 0ustar00directhexdirecthex00000000000000// // admin.cs: Mono collaborative documentation adminsitration tool. // // Author: // Miguel de Icaza // // (C) 2003 Novell, Inc. // using Gtk; using GtkSharp; using Glade; using System; using System.IO; using System.Xml; using System.Collections; using System.Xml.Serialization; using System.Diagnostics; using System.Runtime.InteropServices; namespace Monodoc { class AdminDriver { static int Main (string [] args) { bool real_server = true; if (Environment.GetEnvironmentVariable ("MONODOCTESTING") != null) real_server = false; Settings.RunningGUI = true; Application.Init (); Admin admin = new Admin (real_server); Application.Run (); return 0; } } class Admin { Glade.XML ui; [Widget] Window main_window; [Widget] ScrolledWindow container, review_container; [Widget] Statusbar statusbar; [Widget] Notebook notebook; [Widget] TextView text_ondisk; [Widget] TextView text_diff; [Widget] TextView text_current; uint contextid; HTML html, html_review; Contributions d; string login = SettingsHandler.Settings.Email; string pass = SettingsHandler.Settings.Key; PendingChange [] changes; public Admin (bool real_server) { LoadProviders (); ui = new Glade.XML (null, "admin.glade", "main_window", null); ui.Autoconnect (this); contextid = statusbar.GetContextId (""); main_window.DeleteEvent += new DeleteEventHandler (OnDeleteEvent); d = new Contributions (); if (real_server) d.Url = "http://www.go-mono.com/docs/server.asmx"; html = new HTML (); html.LinkClicked += new LinkClickedHandler (LinkClicked); html.Show (); html.SetSizeRequest (700, 500); container.Add (html); html_review = new HTML (); html_review.LinkClicked += new LinkClickedHandler (ReviewLinkClicked); html_review.Show (); review_container.Add (html_review); } bool Decouple (string prefix, string url, out int id, out int serial) { if (!url.StartsWith (prefix)){ id = 0; serial = 0; return false; } string rest = url.Substring (prefix.Length); int p = rest.IndexOf ('$'); string sid = rest.Substring (0, p); string sserial = rest.Substring (p+1); id = int.Parse (sid); serial = int.Parse (sserial); return true; } void LinkClicked (object o, LinkClickedArgs args) { string url = args.Url; int id, serial; Console.WriteLine ("Got: " + url); if (Decouple ("review:", url, out id, out serial)){ RenderReview (id, serial); return; } Console.WriteLine ("Unhandled url: " + url); } class FileAction { public GlobalChangeset globalset; public DocSetChangeset docset; public FileChangeset fileset; public FileAction (GlobalChangeset gs, DocSetChangeset ds, FileChangeset fs) { globalset = gs; docset = ds; fileset = fs; } } class ItemAction { public GlobalChangeset globalset; public DocSetChangeset docset; public FileChangeset fileset; public Change change; public ItemAction (GlobalChangeset gs, DocSetChangeset ds, FileChangeset fs, Change c) { globalset = gs; docset = ds; fileset = fs; change = c; } } void ApplyFile (FileAction fa) { XmlDocument d = LoadDocument (fa.docset, fa.fileset.RealFile); foreach (Change c in fa.fileset.Changes){ XmlNode old = d.SelectSingleNode (c.XPath); if (old != null) old.ParentNode.ReplaceChild (d.ImportNode (c.NewNode, true), old); } SaveDocument (d, fa.docset, fa.fileset); } void ApplyItem (ItemAction fa) { XmlDocument d = LoadDocument (fa.docset, fa.fileset.RealFile); XmlNode old = d.SelectSingleNode (fa.change.XPath); if (old != null) old.ParentNode.ReplaceChild (d.ImportNode (fa.change.NewNode, true), old); SaveDocument (d, fa.docset, fa.fileset); } static void WriteNode (string file, string str) { using (FileStream s = File.Create (file)){ using (StreamWriter sw = new StreamWriter (s)){ sw.Write (str); } } } void DiffChangeItem (ItemAction fa) { XmlDocument d = LoadDocument (fa.docset, fa.fileset.RealFile); XmlNode orig = d.SelectSingleNode (fa.change.XPath); XmlNode newn = fa.change.NewNode; text_ondisk.Buffer.Text = orig.InnerXml; text_current.Buffer.Text = newn.InnerXml; WriteNode ("/tmp/file-1", orig.InnerXml); WriteNode ("/tmp/file-2", newn.InnerXml); Process diffp = new Process (); diffp.StartInfo.FileName = "diff"; diffp.StartInfo.Arguments = "-uw /tmp/file-1 /tmp/file-2"; diffp.StartInfo.UseShellExecute = false; diffp.StartInfo.RedirectStandardOutput = true; diffp.Start (); text_diff.Buffer.Text = "=" + diffp.StandardOutput.ReadToEnd (); diffp.WaitForExit (); } void SaveDocument (XmlDocument d, DocSetChangeset docset, FileChangeset fileset) { string basedir = (string) providers [docset.DocSet]; string file = basedir + "/" + fileset.RealFile; d.Save (file); RenderReview (current_id, current_serial); } void ReviewLinkClicked (object o, LinkClickedArgs args) { string url = args.Url; int id, serial; if (Decouple ("flag-done:", url, out id, out serial)){ d.UpdateStatus (login, pass, id, serial, 1); notebook.Page = 0; return; } if (url.StartsWith ("apply-file:")){ string rest = url.Substring (11); ApplyFile ((FileAction) action_map [Int32.Parse (rest)]); return; } if (url.StartsWith ("apply-change:")){ string rest = url.Substring (13); ApplyItem ((ItemAction) action_map [Int32.Parse (rest)]); return; } if (url.StartsWith ("diff-change:")){ string rest = url.Substring (12); DiffChangeItem ((ItemAction) action_map [Int32.Parse (rest)]); notebook.Page = 2; } Console.WriteLine ("Unhandled url: " + url); } Hashtable cache = new Hashtable (); GlobalChangeset LoadReview (int id, int serial) { string key = String.Format ("{0}:{1}", id, serial); if (cache [key] != null) return (GlobalChangeset) cache [key]; // // Download contribution // XmlNode n = d.FetchContribution (login, pass, id, serial); // // Parse into GlobalChangeset // XmlDocument doc = new XmlDocument (); doc.AppendChild (doc.ImportNode (n, true)); XmlNodeReader r = new XmlNodeReader (doc); GlobalChangeset s; try { s = (GlobalChangeset) GlobalChangeset.serializer.Deserialize (r); } catch (Exception e) { Console.WriteLine ("Error: " + e); Status = "Invalid contribution obtained from server: " + key; return null; } cache [key] = s; return s; } Hashtable action_map; int current_id, current_serial; // // Renders the id/serial representation for review by the administrator. // void RenderReview (int id, int serial) { current_id = id; current_serial = serial; notebook.Page = 1; GlobalChangeset globalset; globalset = LoadReview (id, serial); HTMLStream s = html_review.Begin ("text/html"); s.Write (""); if (globalset == null){ s.Write ("No data found"); html_review.End (s, HTMLStreamStatus.Ok); return; } int key = 0; action_map = new Hashtable (); // // First make sure we dont have sources that we dont know about, // so a contribution can not be flagged as done by accident // bool allow_flag_as_done = true; foreach (DocSetChangeset docset in globalset.DocSetChangesets){ if (!providers.Contains (docset.DocSet)){ s.Write (String.Format ("Warning: Skipping {0}", docset.DocSet)); allow_flag_as_done = false; continue; } } if (allow_flag_as_done) s.Write (String.Format ("

Changes: [Flag as Done]

", id, serial)); foreach (DocSetChangeset docset in globalset.DocSetChangesets){ if (!providers.Contains (docset.DocSet)) continue; if (docset == null){ s.Write ("Null?"); continue; } string ds; ds = String.Format ("
Docset: {0}
", docset.DocSet); foreach (FileChangeset fileset in docset.FileChangesets){ string fs, es = null; fs = String.Format ("

[Apply] File: {1}
", key, fileset.RealFile); action_map [key++] = new FileAction (globalset, docset, fileset); if (fileset.RealFile == null){ s.Write (String.Format ("Warning: invalid contribution, its missing filename")); continue; } XmlDocument d = LoadDocument (docset, fileset.RealFile); foreach (Change c in fileset.Changes){ XmlNode orig = d.SelectSingleNode (c.XPath); XmlNode newn = c.NewNode; if (orig == null){ s.Write (String.Format ("Warning, node {0} does not exist", c.XPath)); continue; } if (ds != null) { s.Write (ds); ds = null; } if (fs != null) { s.Write (fs); fs = null; es = "
"; } string original_text = orig.InnerXml; string new_text = c.NewNode.InnerXml; if (original_text == new_text){ //s.Write ("Applied
"); continue; } int p = c.XPath.LastIndexOf ("/"); s.Write (String.Format ("[Diff]", key)); s.Write (String.Format ("[Apply]: {1} ", key, c.XPath)); if (c.FromVersion != RootTree.MonodocVersion) s.Write ("FROM OLD VERSION"); action_map [key++] = new ItemAction (globalset, docset, fileset, c); s.Write (""); s.Write (""); s.Write (String.Format ("", Htmlize (original_text))); s.Write (""); s.Write ("
CurrentNew
{0}"); s.Write (Htmlize (new_text)); s.Write ("
"); } if (es != null) s.Write (es); } } s.Write (""); html_review.End (s, HTMLStreamStatus.Ok); } // // Colorizes the ECMA XML documentation into some pretty HTML // string Htmlize (string s) { string r = s.Replace ("<", "<").Replace (">", ">").Replace ("<", "<").Replace ("/para>", "para>

"); return r; } // // Loads the `file' from a DocSetChangeset // XmlDocument LoadDocument (DocSetChangeset ds, string file) { XmlDocument d = new XmlDocument (); string basedir = (string) providers [ds.DocSet]; d.Load (basedir + "/" + file); return d; } void OnDeleteEvent (object o, DeleteEventArgs args) { Application.Quit (); } void RenderChanges () { notebook.Page = 0; HTMLStream s = html.Begin ("text/html"); if (changes != null){ s.Write ("

Pending Changes

"); int i = 0; foreach (PendingChange ch in changes){ s.Write (String.Format ("{3}: {2}
", ch.ID, ch.Serial, ch.Login, i++)); } } else { s.Write ("

No pending changes on the server

"); } html.End (s, HTMLStreamStatus.Ok); } void OnCheckUpdatesClicked (object o, EventArgs args) { Status = "Loading"; try { changes = d.GetPendingChanges (login, pass); if (changes == null) Status = "No changes available"; else Status = "Changes loaded: " + changes.Length + " contributions"; RenderChanges (); } catch (Exception e){ Status = "There was a failure trying to fetch the status from the server"; Console.WriteLine (e); } } string Status { set { statusbar.Pop (contextid); statusbar.Push (contextid, value); } } Hashtable providers = new Hashtable (); public void LoadProviders () { string config_dir = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); string monodoc_dir = System.IO.Path.Combine (config_dir, "monodoc"); string settings_file = System.IO.Path.Combine (monodoc_dir, "providers.xml"); XmlSerializer ser = new XmlSerializer (typeof (Providers)); Providers p; if (File.Exists (settings_file)) p = (Providers) ser.Deserialize (new XmlTextReader (settings_file)); else { Console.WriteLine ("File {0} does not exist", settings_file); Console.WriteLine ("Format is:"); Console.WriteLine (@" "); Environment.Exit (1); return; } for (int i = 0; i < p.Locations.Length; i++){ providers [p.Locations [i].Name] = p.Locations [i].Path; } } } /// /// Configuration Loading /// public class ProviderLocation { [XmlAttribute] public string Name; [XmlAttribute] public string Path; } public class Providers { [XmlElement ("Location", typeof (ProviderLocation))] public ProviderLocation [] Locations; } } mono-tools-4.2/docbrowser/GtkHtmlHtmlRender.cs0000664000175000017500000000523512413742070023553 0ustar00directhexdirecthex00000000000000// // // GtkHtmlHtmlRender.cs: Implementation of IHtmlRender that uses Gtk.HTML // // Author: Mario Sopena // Author: Rafael Ferreira // using System; using Gtk; using System.IO; using System.Reflection; namespace Monodoc { class GtkHtmlHtmlRender : IHtmlRender { HTML html_panel; public Widget HtmlPanel { get { return (Widget) html_panel; } } string url; public string Url { get { return url; } } RootTree help_tree; public event EventHandler OnUrl; public event EventHandler UrlClicked; public GtkHtmlHtmlRender (RootTree help_tree) { this.help_tree = help_tree; } protected void LinkClicked (object o, LinkClickedArgs args) { url = FixUrl (args.Url); if (UrlClicked != null) UrlClicked (this, new EventArgs()); } static string FixUrl (string url) { if (url == null) return url; return url.Replace ("<", "<").Replace (">", ">"); } protected void OnUrlMouseOver (object o, OnUrlArgs args) { url = FixUrl (args.Url); if (OnUrl != null) OnUrl (this, args); } public void JumpToAnchor (string anchor) { html_panel.JumpToAnchor(anchor); } public void Copy () { html_panel.Copy(); } public void SelectAll () { html_panel.SelectAll(); } public void Render (string html_code) { Gtk.HTMLStream stream = html_panel.Begin ("text/html"); stream.Write(html_code); html_panel.End (stream, HTMLStreamStatus.Ok); } static Stream GetBrowserResourceImage (string name) { Assembly assembly = typeof (RootTree).Assembly; System.IO.Stream s = assembly.GetManifestResourceStream (name); return s; } protected void UrlRequested (object sender, UrlRequestedArgs args) { Stream s = help_tree.GetImage (args.Url); if (s == null) s = GetBrowserResourceImage ("monodoc.png"); byte [] buffer = new byte [8192]; int n, m; m=0; while ((n = s.Read (buffer, 0, 8192)) != 0) { args.Handle.Write (buffer, n); m += n; } args.Handle.Close (HTMLStreamStatus.Ok); } public void Print (string Html) { #if !MACOS if (Html == null) { Console.WriteLine ("empty print"); return; } PrintManager.Print (Html); #endif } public bool Initialize () { try { html_panel = new HTML (); } catch (Exception ex) { Console.WriteLine (ex.Message); Console.WriteLine (ex.StackTrace); return false; } html_panel.Show (); html_panel.LinkClicked += new LinkClickedHandler (LinkClicked); html_panel.OnUrl += new OnUrlHandler (OnUrlMouseOver); html_panel.UrlRequested += new UrlRequestedHandler (UrlRequested); return true; } public Capabilities Capabilities { get { return Capabilities.None; } } public string Name { get { return "GtkHtml"; } } } } mono-tools-4.2/docbrowser/README.ADMIN0000664000175000017500000001152712413742070021375 0ustar00directhexdirecthex00000000000000Using the Admin Tool ==================== The administration tool is not the most polished piece of software, but these are the instructions on how to use it: For you to start using the Administration tool, you must be granted permissions to become an administrator on the Monodoc system site, you must contact Miguel (miguel@novell.com) to gain Monodoc permissions. Configuring the Tool ==================== The Admin tool works by pulling contributions that have been submitted to the web site and allowing you to review the change and apply the change if the change is correct. The tool works by patching local copies of the documentation, and those changes must then be committed to the repository before they can be distributed to people. This means that you need a Mono Subversion account to be able to check in the documentation and to get fresh copies of the documentation. The tool needs to be configure so it knows how to map contributions in the documentation to your local check out, this is done by creating the file ~/.config/monodoc/providers.xml The file contents is for example: Here as you can see the configuration file is made to point to the various directories that I have checkout from CVS. Policies ======== People contribute many kinds of changes, and we do not necessarily want all of those changes, changes that are typically OK: * Completing missing documentation. * Providing illustrative examples. * Copy/pasting documentation from the ECMA specification. The ECMA specification has been updated and the license allows us to incorporate those changes. We have sadly not automated this process and hence the documentation that we have reflects the first ECMA release, not the latest one. * Pointing out alternative APIs that might be better suited for a particular task, limitations in an API. Changes that are not OK: * Long explanations in the summary line that should be instead in the Remarks section. * Sample code in languages other than C#. People have been picking samples in Boo, Visual Basic, Jscript and IronPython, but considering that we do even have complete C# coverage, it is better to keep all samples in C#. * Documentation that has been copy/pasted from Microsoft documentation. This means that for every change that affects the Microsoft stack documentation an editor must verify that the text for the equivalent class is not the same. This can be a very time consuming operation, and it is best to not approve a change if you have not explicitly verified that this is not a copy. * Opinions, these should be kept out of the documentation, this is a technical document and we should not be passing value judgments on it. Using the Tool ============== Once you have configured the tool, run the `make c' command in this directory. This will bring up the administration tool. Click on "Check Server Updates to get updates from the server". Many of the early applications are pending review or have some problems but we have not cleared them out yet, so its best to start at the higher numbered contributions which are the freshest. Click on a contribution, it will show you the actual change. The rendering is not perfect, if you want to get further information click [Diff], that will provide a rendering before and after that you can more easily examine. When you like a change, click on [Apply], and commit the code properly giving credit on the commit message to the person that made the contribution (you must do this from a separate window where you run svn commit). [Yes, this could be improved] If the contribution is large, also add the contribution to the AUTHORS for that particular bit of documentation. Once a contribution has been applied and there is nothing left to use (either because it has been applied, or the contribution has been deemed as invalid) click the [Flag as Done] button that will remove the contribution from the list Samples in Other Languages ========================== The reality is that we probably need a better system to handle examples, keep those examples off-line so that people can contribute alternative implementations, but at this point we do not have a mechanism to do this. mono-tools-4.2/docbrowser/admin.glade0000664000175000017500000004045112413742070021752 0ustar00directhexdirecthex00000000000000 True Monodoc Admin Tool. GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True False 0 True False 0 True True Check Server Updates. True GTK_RELIEF_NORMAL True 0 False False 0 False False True True True False GTK_POS_TOP False False True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_NONE GTK_CORNER_TOP_LEFT False True True Pending False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_NONE GTK_CORNER_TOP_LEFT False True True Contribution False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True False 0 True 0 0.5 GTK_SHADOW_NONE True 0.5 0.5 1 1 0 0 12 0 True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_NONE GTK_CORNER_TOP_LEFT True True True False True GTK_JUSTIFY_LEFT GTK_WRAP_WORD True 0 0 0 0 0 0 True <b>On Disk</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 0 True True True 0 0.5 GTK_SHADOW_NONE True 0.5 0.5 1 1 0 0 12 0 True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_NONE GTK_CORNER_TOP_LEFT True True True False True GTK_JUSTIFY_LEFT GTK_WRAP_WORD True 0 0 0 0 0 0 True <b>Diff</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 0 True True 0 True True True 0 0.5 GTK_SHADOW_NONE True 0.5 0.5 1 1 0 0 12 0 True True GTK_POLICY_AUTOMATIC GTK_POLICY_AUTOMATIC GTK_SHADOW_NONE GTK_CORNER_TOP_LEFT True True True False True GTK_JUSTIFY_LEFT GTK_WRAP_WORD True 0 0 0 0 0 0 True <b>Current</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 label_item 0 True True False True True Viewer False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab 0 True True True True 0 False False mono-tools-4.2/docbrowser/BookmarkManager.cs0000664000175000017500000003326412413742070023257 0ustar00directhexdirecthex00000000000000// // Filename BookmarkManager.cs: Manages bookmark saving/restoring and the secondary dialog // windows // Author: // Rafael Ferreira // // (C) 2005 Rafael Ferreira // using System; using Gtk; using Glade; using System.Collections; using System.Xml.Serialization; using System.Xml; using System.IO; namespace Monodoc { public class BookmarkManager { [Serializable] public class BookmarkBase { [XmlAttribute] public string ID = Guid.NewGuid ().ToString (); [XmlAttribute] public string Name = String.Empty; public BookmarkBase () {} } [Serializable] [XmlInclude (typeof (Bookmark))] public class BookmarkGroup : BookmarkBase { [XmlElement ("Member")] public ArrayList Members = new ArrayList (); public BookmarkGroup () {} public BookmarkGroup (string name) { Name = name; } } [Serializable] public class Bookmark : BookmarkBase { public string Url; public Bookmark (string name, string url){ Name = name; Url = url; } public Bookmark () {} } internal class ManageBookmarkDialog { [Glade.Widget] Gtk.TreeView bookmarks_treeview; [Glade.Widget] Gtk.Window manage_bookmarks_dialog; BookmarkGroup root_group; Hashtable iter_to_id; string selected_id = string.Empty; CellRendererText cell_render; const string UNTITLED = "Untitled"; public ManageBookmarkDialog (BookmarkGroup bookmarks) { Glade.XML xml = new Glade.XML ("browser.glade","manage_bookmarks_dialog"); xml.Autoconnect (this); iter_to_id = new Hashtable (); root_group = bookmarks; bookmarks_treeview.RulesHint = true; bookmarks_treeview.EnableSearch = true; // treeview handlers bookmarks_treeview.RowExpanded += new Gtk.RowExpandedHandler (on_row_expanded); bookmarks_treeview.Selection.Changed += new EventHandler (on_row_selected); bookmarks_treeview.RowActivated += new Gtk.RowActivatedHandler (on_row_activated); cell_render = new CellRendererText (); cell_render.Edited += new EditedHandler (on_cellrender_edited); cell_render.Editable = true; bookmarks_treeview.AppendColumn ("Column 1", cell_render,"text",0); } void on_row_expanded (object sender, Gtk.RowExpandedArgs args) { } void on_row_selected (object sender, EventArgs args) { Gtk.TreeIter iter; Gtk.TreeModel model; if (bookmarks_treeview.Selection.GetSelected (out model, out iter)) { selected_id = iter_to_id[iter] as string; } } void on_cellrender_edited (object sender, EditedArgs args) { // root group can't be edited if ( selected_id == root_group.ID) return; BookmarkBase bk = null; BookmarkManager.GetBookmarkBase (root_group,selected_id,ref bk); if (bk == null ) { Console.WriteLine ("error, could not retrieve bookmark:{0}",selected_id); return; } // it is not a bookmark bk.Name = args.NewText; //refreshing tree_view BookmarkManager.Refresh (); BuildTreeView (); } void on_row_activated (object sender, Gtk.RowActivatedArgs args) { } void OnDelete (object o, DeleteEventArgs args) { manage_bookmarks_dialog.Destroy (); } void on_NewFolderButton_clicked (object sender, EventArgs args) { BookmarkManager.AddBookmarkGroup (root_group,selected_id,UNTITLED); BookmarkManager.Refresh (); BuildTreeView (); } void on_EditButton_clicked (object sender, EventArgs args) { } void OnDeleteClicked (object o, EventArgs args) { if (selected_id != string.Empty) { BookmarkManager.DeleteBookmarkBase (root_group,selected_id); BookmarkManager.Refresh (); BuildTreeView (); } } void OnCancelClicked (object o, EventArgs args) { //TODO add undo logic manage_bookmarks_dialog.Hide (); } public void Show () { BuildTreeView (); manage_bookmarks_dialog.ShowAll (); } void BuildTreeView () { TreeStore store = new TreeStore (typeof (string)); bookmarks_treeview.Model = store; TreeIter iter = store.AppendValues (root_group.Name); // appending root iter_to_id[iter] = root_group.ID; // calling the recursevily builder BuildTreeViewHelper (root_group,iter,store); /* foreach (object i in root_group.Members) { if (i is Bookmark) iter_to_id[store.AppendValues (iter, ((Bookmark)i).Name )] = ((Bookmark)i).ID; } */ bookmarks_treeview.ExpandAll (); } void BuildTreeViewHelper (BookmarkGroup bookmarks, TreeIter iter, TreeStore store) { TreeIter tmp_iter; foreach (object i in bookmarks.Members) { if (i is BookmarkGroup) { tmp_iter = store.AppendValues (iter, ((BookmarkGroup)i).Name ); iter_to_id[tmp_iter] = ((BookmarkGroup)i).ID; BuildTreeViewHelper ((BookmarkGroup)i, tmp_iter, store); } if (i is Bookmark) { tmp_iter = store.AppendValues (iter, ((Bookmark)i).Name); iter_to_id[tmp_iter] = ((Bookmark)i).ID; } } } } internal class AddBookmarkDialog { [Glade.Widget] Gtk.Entry name_entry; [Glade.Widget] HBox hbox37; [Glade.Widget] Gtk.Window add_bookmark_dialog; string text, url; BookmarkGroup root; Combo combo; Hashtable combo_to_id = new Hashtable (); public AddBookmarkDialog (BookmarkGroup root_group) { Glade.XML xml = new Glade.XML ("browser.glade","add_bookmark_dialog"); xml.Autoconnect (this); combo = new Combo (); ArrayList list = new ArrayList (); BuildComboList (root_group,list); combo.PopdownStrings = list.ToArray (typeof (string)) as string[]; combo.AllowEmpty = false; combo.Entry.Editable = false; combo.DisableActivate (); // pusihing widget into hbox hbox37.PackEnd (combo); //combo.Entry.Activated += new EventHandler (on_combo_entry_activated); root = root_group; text = url = String.Empty; } // recursively builds combo box private void BuildComboList (BookmarkGroup bookmarks, ArrayList list) { foreach (object i in bookmarks.Members) { if (i is BookmarkGroup) { BuildComboList (i as BookmarkGroup, list); } } list.Add (bookmarks.Name); combo_to_id[bookmarks.Name] = bookmarks.ID; } public void on_AddBookmark_delete_event (object o, DeleteEventArgs args) { add_bookmark_dialog.Destroy (); } public void on_AddButton_clicked (object o, EventArgs args) { BookmarkManager.AddBookmark (root,combo_to_id [combo.Entry.Text] as string,name_entry.Text,url); add_bookmark_dialog.Hide (); BookmarkManager.Refresh (); } public void on_CancelButton_clicked (object o, EventArgs args) { add_bookmark_dialog.Hide (); } public void on_combo_entry_activated (object sender, EventArgs args) { } public void Show (string T, string U) { name_entry.Text = T; text = T.Trim (); url = U.Trim (); add_bookmark_dialog.ShowAll (); } } // attributes: static BookmarkGroup root_group; static string bookmark_file; static XmlSerializer serializer; static Browser _Browser; static string current_bookmark_group = String.Empty; static AddBookmarkDialog add_window = null; static ManageBookmarkDialog edit_window = null; static Hashtable menu_to_id; const string ADD_BANNER = " Bookmark this page"; const string EDIT_BANNER = " Manage bookmarks"; const string ROOT_NAME = "Bookmarks"; private static void Refresh () { BookmarkManager.Save (); BookmarkManager.BuildMenu (_Browser.bookmarksMenu); } private static void Save () { using (FileStream file = new FileStream (bookmark_file,FileMode.Create)) { serializer.Serialize (file,root_group); } #if DEBUG Console.WriteLine ("bookmarks saved ({0})",root_group.Members.Count); #endif } private static void Load () { using (FileStream file = new FileStream (bookmark_file,FileMode.Open)) { root_group = (BookmarkGroup)serializer.Deserialize (file); } #if DEBUG Console.WriteLine ("bookmarks loaded ({0})",root_group.Members.Count); #endif } public BookmarkManager (Browser browser){ _Browser = browser; #if DEBUG Console.WriteLine ("Bookmark Manager init"); #endif // discovering bookmark file bookmark_file = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); bookmark_file = System.IO.Path.Combine (bookmark_file, "monodoc"); bookmark_file = System.IO.Path.Combine (bookmark_file, "bookmarks.xml"); // creating serializer serializer = new XmlSerializer (typeof (BookmarkGroup)); // trying to load saved bookmarks try { Load (); }catch (Exception e) { // no bookmarks found, creating new root root_group = new BookmarkGroup (ROOT_NAME); } current_bookmark_group = ROOT_NAME; menu_to_id = new Hashtable (); BuildMenu (_Browser.bookmarksMenu); } public static void BuildMenu (MenuItem bookmark_menu) { Menu aux = (Menu) bookmark_menu.Submenu; foreach (Widget w in aux.Children) { aux.Remove (w); } menu_to_id.Clear (); //adding Default Items: AccelGroup bk_grp = new AccelGroup (); _Browser.window1.AddAccelGroup (bk_grp); ImageMenuItem item; item = new ImageMenuItem (ADD_BANNER); //item.Image = new Gtk.Image (Stock.Add,IconSize.Menu); item.AddAccelerator ("activate",bk_grp,new AccelKey (Gdk.Key.D,Gdk.ModifierType.ControlMask,AccelFlags.Visible)); item.Activated += on_add_bookmark_activated; aux.Append (item); //edit item = new ImageMenuItem (EDIT_BANNER); item.AddAccelerator ("activate",bk_grp,new AccelKey (Gdk.Key.M,Gdk.ModifierType.ControlMask,AccelFlags.Visible)); item.Activated += on_edit_bookmark_activated; //item.Image = new Gtk.Image (Stock.Edit,Iconsize,Menu); aux.Append (item); // and finally the separtor aux.Append (new SeparatorMenuItem ()); BuildMenuHelper (aux,root_group); aux.ShowAll (); } private static void BuildMenuHelper (Menu menu, BookmarkGroup group) { foreach (object i in group.Members) { if (!(i is BookmarkGroup)) continue; MenuItem item = new MenuItem (((BookmarkGroup)i).Name); item.Activated += on_bookmarkgroup_activated; menu_to_id[item] = ((BookmarkGroup)i).ID; menu.Append (item); Menu m = new Menu (); item.Submenu = m; BuildMenuHelper (m, ((BookmarkGroup)i)); } foreach (object i in group.Members) { if (i is Bookmark) { #if DEBUG Console.WriteLine ("appending bookmark: [" + ((Bookmark)i).Name + "]"); #endif MenuItem item = new MenuItem (((Bookmark)i).Name); menu_to_id[item] = ((Bookmark)i).ID; item.Activated += on_bookmark_activated; menu.Append (item); menu_to_id[item] = ((Bookmark)i).ID; } } } // Event Handlers static void on_add_bookmark_activated (object sender, EventArgs e){ add_window = new AddBookmarkDialog (root_group); add_window.Show (_Browser.CurrentTab.Title,_Browser.CurrentUrl); } static void on_edit_bookmark_activated (object sender,EventArgs e) { edit_window = new ManageBookmarkDialog (root_group); edit_window.Show (); } static void on_bookmark_activated (object sender, EventArgs e) { // finding the inner label BookmarkBase bk = null; GetBookmarkBase (root_group, menu_to_id[ (MenuItem)sender] as string,ref bk); if (bk != null) { if (bk is Bookmark) _Browser.LoadUrl (((Bookmark)bk).Url); } else { Console.WriteLine ("Bookmark error -> could not load bookmark"); } } static void on_bookmarkgroup_activated (object sender, EventArgs e) { if (((MenuItem)sender).Child is Gtk.Label) { Gtk.Label label = (Gtk.Label) ((MenuItem)sender).Child; current_bookmark_group = label.Name; } } public void EditBookMark () {} // static helper methods /// Recursively deletes a bookmark public static void DeleteBookmarkBase (BookmarkGroup bookmarks, string ID) { foreach (object i in bookmarks.Members) { if (i is Bookmark) { if (((Bookmark)i).ID == ID) { bookmarks.Members.Remove (i); return; } } else if (i is BookmarkGroup) { if (((BookmarkGroup)i).ID == ID) { bookmarks.Members.Remove (i); return; } DeleteBookmarkBase (((BookmarkGroup)i), ID); } } } /// Recursively finds a bookmarkbase public static void GetBookmarkBase (BookmarkGroup bookmarks, string ID, ref BookmarkBase retval) { foreach (object i in bookmarks.Members) { if (((BookmarkBase)i).ID == ID) { retval = i as BookmarkBase; return; } if (i is BookmarkGroup) GetBookmarkBase ((BookmarkGroup)i,ID,ref retval); } } /// Recursively adds a bookmark public static void AddBookmark (BookmarkGroup bookmarks, string parent_ID, string bookmark_text, string bookmark_url) { if ( bookmarks.ID == parent_ID) { bookmarks.Members.Add (new Bookmark (bookmark_text,bookmark_url) ); return; } foreach (object i in bookmarks.Members) { if (i is BookmarkGroup) { AddBookmark (((BookmarkGroup)i), parent_ID,bookmark_text, bookmark_url); } } } /// Recursively adds a bookmark public static void AddBookmarkGroup (BookmarkGroup bookmarks, string parent_ID, string name) { if (bookmarks.ID == parent_ID) { bookmarks.Members.Add (new BookmarkGroup (name)); return; } foreach (object i in bookmarks.Members) { if (i is BookmarkGroup) AddBookmarkGroup (((BookmarkGroup)i), parent_ID,name); if (i is Bookmark){ if (((Bookmark)i).ID == parent_ID) { bookmarks.Members.Add (new BookmarkGroup (name)); return; } } } } } } mono-tools-4.2/docbrowser/monodoc.png0000664000175000017500000000706212413742070022031 0ustar00directhexdirecthex00000000000000PNG  IHDR00WsBIT|dtEXtTitleMade with Sodipodi/'tEXtAuthorUnknown! zTXtDescriptionxKT(L.)-J_~ , IDATxŚ{\Tǿk 3Ud@DDEPR.)sW{vKv GKw歲Tl׶d+rR1D0knSfY>sy(xxI@ pe3 &k@y0yZѨ%d"?VP(D)~gIm a !WÃ%<|4 }A)#" `F>>DE͑\~ Ozzzݮ<,O#€FݴRd1ܸQBaa x |HA ? ttX666Dzz`2׀o? (22'l} xx1"x99TVV9Q9\G7!ōgqMN:Cm=:wvF`Vprt$<";5\/b= R* ֠ I `3ubD$˖/B!(һ//":V^:׆VkKXh!g^@v ]Q1M1嗘3g}zy{sq4 Ĵ@~ 4,z ^aQ+V.$O`B8̙$aXk̜P(pwwGTZtѹ6v %%%)i?r:J@ N}Q@b!<<ߢQA &z#"'ķ#zC 4 lT6VWb8Z-o;[;Yf5n˭^`4ْ?|N^tB`g_H 07ԅ܀`ܹ b1mf.  JPV\#]v#;@y;%hmm/Q($&`BVdVZ\Eƪi]%S``zhcGoJŬٯ3|DÇ8z"##3_EP4 f`k9w,+W.ӳS%mvLԆ 6lgFΔz} 7Kڲmk{խUpmm*yyZ}M OO}n]=8rMAvqffg+ 8B^^.B{;Z-=zQ^^FNθa2vġ\VZAAAO==/on"x HMm4wէ<<&ǎRoN:!އB%LU|r  婧0L`9,_==IK ^TFd7g0<}rr$#3#>[濻{{WΝj6|̇=/Ʋwϗ? "+3VF"wfR2뵵w._;`0$YԊ$7ز%ɓ&PaD$Ihnn.IIōw濍Z{|ѡ6U' /_ yy~ڋ ?"eCS'ٱ}+Qsӫl,555|j Fb憗w/4 Orqȡ03=c[2dH..:r1~9sa7N[ 3>&ģ7:QQo2nݺakgǵkdeek^Υ^rxl@PPYY1MTܻv%hp.\"+3ލwo|ϼ(U*I'ggmGD[Q٣T8y$f:ReeV 4WSvҳ7c%#=.#8dBa9ZRɉ?ӧO+ сh-iiiYc5WFu3ׁ y!#h @I n_J|})n;>օNCGv^-'`KlǢoSQq8**nw^\FQ"'j0o9[mϹm@vX/RcǎʕdW;qq߸gZTr$8u l  ȑ87odk+_୾5h`zjj3Qjh ƣ!-,?Dnn6FGR$ɲj ?}I9sCGPPPP@UUsyK+K}KKܙ5:APhvTWWү?CHOO%3#1p` ݺ>FædӦ@$$cR`pp9Z @N}IP888R]Usg"OLnF!( Χ{ܽa~rɠZJ$Ir3=?A$P)U8:uNu5(2r :W7ΟdNpIL 9 y|K{Pw7oL`!"ΝP{«v2U_ov"7(&<Ҟ0T@Ӑ#GR\-yK_s{mk7Ɨא1/ vG? L.KO\f͞+9::5NE cu @: q'`k=ɧ#dߐ3/7a0uCx83#W \GZD@ٕ/L:IENDB`mono-tools-4.2/docbrowser/BrowserWidget.cs0000664000175000017500000000633112413742070023001 0ustar00directhexdirecthex00000000000000//Permission is hereby granted, free of charge, to any person obtaining //a copy of this software and associated documentation files (the //"Software"), to deal in the Software without restriction, including //without limitation the rights to use, copy, modify, merge, publish, //distribute, sublicense, and/or sell copies of the Software, and to //permit persons to whom the Software is furnished to do so, subject to //the following conditions: // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. // //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, //EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF //MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND //NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE //LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION //OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION //WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // //Copyright (c) 2008 Novell, Inc. // //Authors: // Andreia Gaita (avidigal@novell.com) // using System; using Mono.WebBrowser; using Gtk; using Gdk; #if GNOME using Gnome; #endif namespace Monodoc { public class BrowserWidget : Gtk.Bin { public IWebBrowser browser; int width, height; public BrowserWidget() : base() { width = height = 200; browser = Manager.GetNewInstance (Platform.Gtk); } protected override void OnRealized () { base.OnRealized (); WindowAttr attributes = new WindowAttr (); attributes.WindowType = Gdk.WindowType.Child; attributes.X = Allocation.X; attributes.Y = Allocation.Y; attributes.Width = Allocation.Width; attributes.Height = Allocation.Height; attributes.Wclass = WindowClass.InputOutput; attributes.Visual = Visual; attributes.Colormap = Colormap; attributes.EventMask = (int) Events; attributes.EventMask = attributes.EventMask | ((int) Gdk.EventMask.ExposureMask | (int) Gdk.EventMask.KeyPressMask | (int) Gdk.EventMask.KeyReleaseMask | (int) Gdk.EventMask.EnterNotifyMask | (int) Gdk.EventMask.LeaveNotifyMask | (int) Gdk.EventMask.StructureMask | (int) Gdk.EventMask.FocusChangeMask); GdkWindow = new Gdk.Window (ParentWindow, attributes, Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Colormap | Gdk.WindowAttributesType.Visual); GdkWindow.UserData = this.Handle; Style = Style.Attach (GdkWindow); Style.Background (StateType.Normal); browser.Load (this.Handle, width, height); } protected override void OnMapped () { base.OnMapped (); GdkWindow.Show (); } protected override void OnUnmapped () { base.OnUnmapped (); GdkWindow.Hide (); } protected override void OnSizeAllocated (Rectangle allocation) { base.OnSizeAllocated (allocation); if ((WidgetFlags & WidgetFlags.Realized) != 0) { GdkWindow.MoveResize (allocation); if (browser != null) browser.Resize (allocation.Width, allocation.Height); } } protected override void OnSizeRequested (ref Requisition requisition) { SetSizeRequest (width, height); } } } mono-tools-4.2/docbrowser/Makefile.in0000664000175000017500000007204712642235731021744 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = docbrowser ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = monodoc AssemblyInfo.cs 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)$(desktopdir)" \ "$(DESTDIR)$(monodocdir)" "$(DESTDIR)$(pixmapdir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(desktop_DATA) $(monodoc_DATA) $(noinst_DATA) $(pixmap_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/AssemblyInfo.cs.in $(srcdir)/Makefile.in \ $(srcdir)/monodoc.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ monodocdir = $(prefix)/lib/monodoc @DMCS_PRESENT_FALSE@COMPILER = $(MCS) @DMCS_PRESENT_TRUE@COMPILER = $(MCS) SUBDIRS = theme-icons @ENABLE_GTKHTML_TRUE@noinst_DATA = admin.exe @ENABLE_GECKO_TRUE@GECKO_TARGET = GeckoHtmlRender.dll @ENABLE_GTKHTML_TRUE@GECKO_PRINTING_DEF = "-d:USE_GTKHTML_PRINT" @ENABLE_GTKHTML_TRUE@GTKHTML_TARGET = GtkHtmlHtmlRender.dll @ENABLE_WEBKIT_TRUE@WEBKIT_TARGET = WebKitHtmlRender.dll @ENABLE_MONOWEBBROWSER_TRUE@MONOWEBBROWSER_TARGET = MonoWebBrowserHtmlRender.dll CLEANFILES = browser.exe browser.exe.mdb admin.exe admin.exe.mdb $(GECKO_TARGET) $(GECKO_TARGET).mdb $(GTKHTML_TARGET) $(GTKHTML_TARGET).mdb $(WEBKIT_TARGET) $(WEBKIT_TARGET).mdb $(MONOWEBBROWSER_TARGET) $(MONOWEBBROWSER_TARGET).mdb monodoc.desktop Options.cs monodoc_DATA = browser.exe $(GECKO_TARGET) $(GTKHTML_TARGET) $(WEBKIT_TARGET) $(MONOWEBBROWSER_TARGET) DISTCLEANFILES = AssemblyInfo.cs monodoc.desktop monodoc bin_SCRIPTS = monodoc browser_sources = \ $(srcdir)/browser.cs \ $(srcdir)/list.cs \ $(srcdir)/elabel.cs \ $(srcdir)/history.cs \ $(srcdir)/editing.cs \ $(srcdir)/Contributions.cs \ $(srcdir)/XmlNodeWriter.cs \ $(srcdir)/IHtmlRender.cs \ $(srcdir)/BookmarkManager.cs \ $(srcdir)/ProgressPanel.cs browser_built_sources = AssemblyInfo.cs Options.cs geckorender_sources = \ $(srcdir)/PrintManager.cs \ $(srcdir)/GeckoHtmlRender.cs gtkhtmlrender_sources = \ $(srcdir)/PrintManager.cs \ $(srcdir)/GtkHtmlHtmlRender.cs webkitrender_sources = \ $(srcdir)/WebKitHtmlRender.cs monowebbrowserrender_sources = \ $(srcdir)/BrowserWidget.cs \ $(srcdir)/MonoWebBrowserHtmlRender.cs admin_sources = \ $(srcdir)/admin.cs \ $(srcdir)/Contributions.cs browser_assemblies = $(GTK_SHARP_LIBS) $(MONODOC_LIBS) $(GNOME_SHARP_LIBS) -r:System.Web.Services -r:System.Web # we insert gtkhtml libs if we have them for printing geckorender_assemblies = $(GTK_SHARP_LIBS) $(GTKHTML_SHARP_LIBS) $(GECKO_SHARP_LIBS) $(GNOME_SHARP_LIBS) $(MONODOC_LIBS) -r:browser.exe gtkhtmlrender_assemblies = $(GTK_SHARP_LIBS) $(GTKHTML_SHARP_LIBS) $(GNOME_SHARP_LIBS) $(MONODOC_LIBS) -r:browser.exe webkitrender_assemblies = $(GTK_SHARP_LIBS) $(WEBKIT_SHARP_LIBS) $(MONODOC_LIBS) -r:browser.exe monowebbrowserrender_assemblies = $(GTK_SHARP_LIBS) $(GNOME_SHARP_LIBS) $(MONOWEBBROWSER_LIBS) $(MONODOC_LIBS) -r:browser.exe -r:Mono.WebBrowser.dll EXTRA_DIST = \ $(browser_sources) \ $(geckorender_sources) \ $(gtkhtmlrender_sources) \ $(monowebbrowserrender_sources) \ $(webkitrender_sources) \ monodoc.desktop.in \ admin.cs \ admin.glade \ browser.glade \ monodoc.png \ AssemblyInfo.cs.in \ README.ADMIN desktopdir = $(datadir)/applications desktop_DATA = monodoc.desktop pixmapdir = $(datadir)/pixmaps pixmap_DATA = monodoc.png 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) --gnu docbrowser/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docbrowser/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): monodoc: $(top_builddir)/config.status $(srcdir)/monodoc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ AssemblyInfo.cs: $(top_builddir)/config.status $(srcdir)/AssemblyInfo.cs.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-desktopDATA: $(desktop_DATA) @$(NORMAL_INSTALL) @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(desktopdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(desktopdir)" || 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)$(desktopdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \ done uninstall-desktopDATA: @$(NORMAL_UNINSTALL) @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(desktopdir)'; $(am__uninstall_files_from_dir) install-monodocDATA: $(monodoc_DATA) @$(NORMAL_INSTALL) @list='$(monodoc_DATA)'; test -n "$(monodocdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(monodocdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(monodocdir)" || 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)$(monodocdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(monodocdir)" || exit $$?; \ done uninstall-monodocDATA: @$(NORMAL_UNINSTALL) @list='$(monodoc_DATA)'; test -n "$(monodocdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(monodocdir)'; $(am__uninstall_files_from_dir) install-pixmapDATA: $(pixmap_DATA) @$(NORMAL_INSTALL) @list='$(pixmap_DATA)'; test -n "$(pixmapdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pixmapdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pixmapdir)" || 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)$(pixmapdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pixmapdir)" || exit $$?; \ done uninstall-pixmapDATA: @$(NORMAL_UNINSTALL) @list='$(pixmap_DATA)'; test -n "$(pixmapdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pixmapdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(monodocdir)" "$(DESTDIR)$(pixmapdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-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-desktopDATA install-monodocDATA \ install-pixmapDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binSCRIPTS 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: uninstall-binSCRIPTS uninstall-desktopDATA \ uninstall-monodocDATA uninstall-pixmapDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ distclean distclean-generic distclean-tags distdir dvi dvi-am \ html html-am info info-am install install-am \ install-binSCRIPTS install-data install-data-am \ install-desktopDATA install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-monodocDATA install-pdf \ install-pdf-am install-pixmapDATA 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-am uninstall uninstall-am uninstall-binSCRIPTS \ uninstall-desktopDATA uninstall-monodocDATA \ uninstall-pixmapDATA .PRECIOUS: Makefile # admin hardcodes GTKHTML for now. @ENABLE_GTKHTML_TRUE@admin.exe: $(admin_sources) $(srcdir)/admin.glade @ENABLE_GTKHTML_TRUE@ $(COMPILER) -debug -out:admin.exe $(admin_sources) -resource:$(srcdir)/admin.glade,admin.glade $(browser_assemblies) $(GTKHTML_SHARP_LIBS) -r:System.Drawing browser.exe: $(browser_sources) $(browser_built_sources) $(srcdir)/browser.glade $(srcdir)/monodoc.png $(COMPILER) -debug -out:browser.exe $(browser_sources) $(browser_built_sources) -resource:$(srcdir)/monodoc.png,monodoc.png -resource:$(srcdir)/browser.glade,browser.glade $(browser_assemblies) $(CSHARP_FLAGS) GeckoHtmlRender.dll : $(geckorender_sources) browser.exe $(COMPILER) -debug -target:library -out:$@ $(geckorender_sources) $(geckorender_assemblies) $(GECKO_PRINTING_DEF) $(CSHARP_FLAGS) GtkHtmlHtmlRender.dll : $(gtkhtmlrender_sources) browser.exe $(COMPILER) -debug -target:library -out:$@ $(gtkhtmlrender_sources) $(gtkhtmlrender_assemblies) $(CSHARP_FLAGS) WebKitHtmlRender.dll : $(webkitrender_sources) browser.exe $(COMPILER) -debug -target:library -out:$@ $(webkitrender_sources) $(webkitrender_assemblies) $(CSHARP_FLAGS) MonoWebBrowserHtmlRender.dll : $(monowebbrowserrender_sources) browser.exe $(COMPILER) -debug -target:library -out:$@ $(monowebbrowserrender_sources) $(monowebbrowserrender_assemblies) $(CSHARP_FLAGS) Options.cs: cp `pkg-config --variable=Sources mono-options` . b: browser.exe MONO_PATH=. $(RUNTIME) --debug browser.exe c: admin.exe MONO_PATH=. $(RUNTIME) --debug admin.exe monodoc.desktop: monodoc.desktop.in sed -e "s|\@bindir\@|$(bindir)|" $< > $@ # 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-tools-4.2/docbrowser/Contributions.cs0000664000175000017500000002402112413742070023050 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // Mono Runtime Version: 1.1.4322.2032 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ // // This source code was auto-generated by Mono Web Services Description Language Utility // /// /// ///Web service for the MonoDoc contribution system /// [System.Web.Services.WebServiceBinding(Name="ContributionsSoap", Namespace="http://tempuri.org/")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public class Contributions : System.Web.Services.Protocols.SoapHttpClientProtocol { public Contributions() { this.Url = "http://www.go-mono.com/docs/server.asmx"; } /// ///Check the client/server version; 0 means that the server can consume your data /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckVersion", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] public int CheckVersion(int version) { object[] results = this.Invoke("CheckVersion", new object[] { version}); return ((int)(results[0])); } public System.IAsyncResult BeginCheckVersion(int version, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CheckVersion", new object[] { version}, callback, asyncState); } public int EndCheckVersion(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((int)(results[0])); } /// ///Requests a registration for a login /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Register", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] public int Register(string login) { object[] results = this.Invoke("Register", new object[] { login}); return ((int)(results[0])); } public System.IAsyncResult BeginRegister(string login, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Register", new object[] { login}, callback, asyncState); } public int EndRegister(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((int)(results[0])); } /// ///Returns the latest serial number used for a change on the server /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetSerial", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] public int GetSerial(string login, string password) { object[] results = this.Invoke("GetSerial", new object[] { login, password}); return ((int)(results[0])); } public System.IAsyncResult BeginGetSerial(string login, string password, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetSerial", new object[] { login, password}, callback, asyncState); } public int EndGetSerial(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((int)(results[0])); } /// ///Submits a GlobalChangeSet as a contribution /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/Submit", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] public int Submit(string login, string password, System.Xml.XmlNode node) { object[] results = this.Invoke("Submit", new object[] { login, password, node}); return ((int)(results[0])); } public System.IAsyncResult BeginSubmit(string login, string password, System.Xml.XmlNode node, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Submit", new object[] { login, password, node}, callback, asyncState); } public int EndSubmit(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((int)(results[0])); } /// ///Obtains the list of pending contributions /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetPendingChanges", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] public PendingChange[] GetPendingChanges(string login, string password) { object[] results = this.Invoke("GetPendingChanges", new object[] { login, password}); return ((PendingChange[])(results[0])); } public System.IAsyncResult BeginGetPendingChanges(string login, string password, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetPendingChanges", new object[] { login, password}, callback, asyncState); } public PendingChange[] EndGetPendingChanges(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((PendingChange[])(results[0])); } /// ///Obtains a change set for a user /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/FetchContribution", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] public System.Xml.XmlNode FetchContribution(string login, string password, int person_id, int serial) { object[] results = this.Invoke("FetchContribution", new object[] { login, password, person_id, serial}); return ((System.Xml.XmlNode)(results[0])); } public System.IAsyncResult BeginFetchContribution(string login, string password, int person_id, int serial, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("FetchContribution", new object[] { login, password, person_id, serial}, callback, asyncState); } public System.Xml.XmlNode EndFetchContribution(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((System.Xml.XmlNode)(results[0])); } /// ///ADMIN: Obtains the number of pending commits /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetStatus", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] public Status GetStatus(string login, string password) { object[] results = this.Invoke("GetStatus", new object[] { login, password}); return ((Status)(results[0])); } public System.IAsyncResult BeginGetStatus(string login, string password, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetStatus", new object[] { login, password}, callback, asyncState); } public Status EndGetStatus(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((Status)(results[0])); } /// ///ADMIN: Updates the status of a contribution /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/UpdateStatus", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, Use=System.Web.Services.Description.SoapBindingUse.Literal)] public void UpdateStatus(string login, string password, int person_id, int contrib_id, int status) { this.Invoke("UpdateStatus", new object[] { login, password, person_id, contrib_id, status}); } public System.IAsyncResult BeginUpdateStatus(string login, string password, int person_id, int contrib_id, int status, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("UpdateStatus", new object[] { login, password, person_id, contrib_id, status}, callback, asyncState); } public void EndUpdateStatus(System.IAsyncResult asyncResult) { this.EndInvoke(asyncResult); } } /// [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] public class PendingChange { /// public string Login; /// public int ID; /// public int Serial; } /// [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] public class Status { /// public int Contributions; /// public int Commited; /// public int Pending; } mono-tools-4.2/docbrowser/MonoWebBrowserHtmlRender.cs0000775000175000017500000001430212413742070025111 0ustar00directhexdirecthex00000000000000//Permission is hereby granted, free of charge, to any person obtaining //a copy of this software and associated documentation files (the //"Software"), to deal in the Software without restriction, including //without limitation the rights to use, copy, modify, merge, publish, //distribute, sublicense, and/or sell copies of the Software, and to //permit persons to whom the Software is furnished to do so, subject to //the following conditions: // //The above copyright notice and this permission notice shall be //included in all copies or substantial portions of the Software. // //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, //EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF //MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND //NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE //LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION //OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION //WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // //Copyright (c) 2008 Novell, Inc. // //Authors: // Andreia Gaita (avidigal@novell.com) // using System; using Mono.WebBrowser; using Gtk; using System.IO; using System.Text; using System.Collections; namespace Monodoc { public class MonoWebBrowserHtmlRender : IHtmlRender { BrowserWidget html_panel; RootTree help_tree; public MonoWebBrowserHtmlRender (RootTree help_tree) { this.help_tree = help_tree; } public event EventHandler OnUrl; public event EventHandler UrlClicked; // Jump to an anchor of the form public void JumpToAnchor (string anchor_name) { } //Copy to the clipboard the selcted text public void Copy () { } //Select all the text public void SelectAll () { } // Variable that handles the info encessary for the events // As every implementation of HtmlRender will have differents events // we try to homogenize them with the variabel string url; public string Url { get {return url; } } public Widget HtmlPanel { get { return (Widget)html_panel; } } public void Print (string Html) { html_panel.browser.ExecuteScript ("print();"); return; } LoadFinishedEventHandler loadEvent; public bool Initialize () { html_panel = new BrowserWidget (); html_panel.Realized += delegate (object sender, EventArgs e) { html_panel.browser.NavigationRequested += delegate (object sender1, NavigationRequestedEventArgs e1) { url = CheckUrl (e1.Uri); // if the file is cached on disk, return if (url.StartsWith ("file:///") || url.StartsWith("javascript:", StringComparison.InvariantCultureIgnoreCase)) return; if (UrlClicked != null) UrlClicked (this, new EventArgs()); e1.Cancel = true; }; html_panel.browser.StatusChanged += delegate (object sender1, StatusChangedEventArgs e1) { url = e1.Message; if (OnUrl != null) OnUrl (this, new EventArgs ()); }; }; cache_imgs = new Hashtable(); tmpPath = Path.Combine (Path.GetTempPath (), "monodoc"); return html_panel.browser.Initialized; } // URL like T:System.Activator are lower cased by gecko to t.;System.Activator // so we revert that string CheckUrl (string u) { if (u.IndexOf (':') == 1) return Char.ToUpper (u[0]) + u.Substring (1); return u; } static int tmp_file = 0; string tmpPath; Hashtable cache_imgs; public void Render (string html_code) { string r = ProcessImages (html_code); // if the html code is too big, write it down to a tmp file if (((uint) r.Length) > 50000) { string filename = (tmp_file++) + ".html"; string filepath = Path.Combine (tmpPath, filename); using (FileStream file = new FileStream (filepath, FileMode.Create)) { StreamWriter sw = new StreamWriter (file); sw.Write (r); sw.Close (); } html_panel.browser.Navigation.Go (filepath); } else { html_panel.browser.Render (r); } } // Substitute the src of the images with the appropriate path string ProcessImages (string html_code) { //If there are no Images return fast int pos = html_code.IndexOf (" 0) back.Sensitive = true; else back.Sensitive = false; if (pos+1 == history.Count) forward.Sensitive = false; else forward.Sensitive = true; } active = value; } } private bool active; public History (Gtk.Button back, Gtk.Button forward) { this.back = back; this.forward = forward; back.Sensitive = false; forward.Sensitive = false; back.Clicked += new EventHandler (BackClicked); forward.Clicked += new EventHandler (ForwardClicked); history = new ArrayList (); } public void AppendHistory (PageVisit page) { pos++; if (history.Count <= pos) history.Add (page); else history [pos] = page; if (pos > 0) back.Sensitive = true; forward.Sensitive = false; } public void ActivateCurrent () { if (pos < 0) return; PageVisit p = (PageVisit) history [pos]; p.Go (); } internal void BackClicked (object o, EventArgs args) { if (!active) return; if (pos < 1) return; pos--; PageVisit p = (PageVisit) history [pos]; p.Go (); if (pos > 0) back.Sensitive = true; else back.Sensitive = false; forward.Sensitive = true; } internal void ForwardClicked (object o, EventArgs args) { if (!active) return; if (pos+1 == history.Count) return; pos++; PageVisit p = (PageVisit) history [pos]; p.Go (); if (pos+1 == history.Count) forward.Sensitive = false; back.Sensitive = true; } } } mono-tools-4.2/docbrowser/elabel.cs0000664000175000017500000000440112413742070021432 0ustar00directhexdirecthex00000000000000// // elabel.cs: An ellipsizing label widget // // Author: // Alp Toker (alp@atoker.com) // // (C) 2003 Alp Toker // using System; using Gtk; public class ELabel : Label { string text = ""; const string ellipsis = "..."; const string en_char = "n"; int ellipsis_width, en_width, tmp; int old_width; Pango.Layout layout; bool refreshed = false; public ELabel (string text) : base ("") { int width, height; GetSizeRequest (out width, out height); SetSizeRequest (0, height); SizeAllocated += new SizeAllocatedHandler (OnSizeAllocated); Text = text; } new public string Text { get { return text; } set { text = value; Reload (); Refresh (); } } void OnSizeAllocated (object o, SizeAllocatedArgs args) { if (refreshed) { refreshed = false; return; } if (Allocation.Width != old_width) Refresh (); old_width = Allocation.Width; refreshed = true; } void Reload () { layout = Layout.Copy (); layout.SetText (ellipsis); layout.GetPixelSize (out ellipsis_width, out tmp); layout.SetText (en_char); layout.GetPixelSize (out en_width, out tmp); } void Refresh () { string ellipsized = Ellipsize (layout, text, Allocation.Width, ellipsis_width, en_width); if (base.Text != ellipsized) base.Text = ellipsized; } public static string Ellipsize (Pango.Layout layout, string newtext, int bound, int ellipsis_width, int en_width) { int width, tmp; layout.SetText (newtext); layout.GetPixelSize (out width, out tmp); if (width < bound) return newtext; if (bound <= ellipsis_width) return ellipsis; string ellipsized = ""; int i = 0; //make a guess of where to start i = (bound - ellipsis_width) / (en_width); if (i >= newtext.Length) i = 0; ellipsized = newtext.Substring (0, i); //add chars one by one to determine how many are allowed while (true) { ellipsized = ellipsized + newtext[i]; layout.SetText (ellipsized); layout.GetPixelSize (out width, out tmp); if (i == newtext.Length - 1) { //bad guess, start from the beginning ellipsized = ""; i = 0; continue; } if (width > bound - ellipsis_width) break; i++; } ellipsized = ellipsized.Remove (ellipsized.Length - 1, 1); ellipsized += ellipsis; return ellipsized; } } mono-tools-4.2/docbrowser/GeckoHtmlRender.cs0000664000175000017500000001360512413742070023231 0ustar00directhexdirecthex00000000000000// // GeckoHtmlRender.cs: Implementation of IHtmlRender that uses Gecko // // Author: Mario Sopena // Author: Rafael Ferreira // using System; using System.Text; using System.IO; using System.Collections; using Gecko; using Gtk; #if USE_GTKHTML_PRINT using Gnome; #endif namespace Monodoc { public class GeckoHtmlRender : IHtmlRender { //Images are cached in a temporal directory Hashtable cache_imgs; string tmpPath; WebControl html_panel; Viewport panel; public Widget HtmlPanel { get { return (Widget) panel; } } string url; public string Url { get { return url; } } RootTree help_tree; public event EventHandler OnUrl; public event EventHandler UrlClicked; public GeckoHtmlRender (RootTree help_tree) { this.help_tree = help_tree; } public bool Initialize () { tmpPath = Path.Combine (Path.GetTempPath (), "monodoc"); try { string mozHome = System.Environment.GetEnvironmentVariable ("MOZILLA_HOME"); if (mozHome != null) WebControl.CompPath = mozHome; html_panel = new WebControl (tmpPath, "MonodocGecko"); } catch (Exception ex) { Console.WriteLine (ex.Message); Console.WriteLine (ex.StackTrace); return false; } html_panel.Show(); //due to Gecko bug html_panel.OpenUri += OnOpenUri; html_panel.LinkMsg += OnLinkMsg; panel = new Viewport(); panel.Add (html_panel); cache_imgs = new Hashtable(); return true; } public Capabilities Capabilities { get { return Capabilities.Css | Capabilities.Fonts; } } public string Name { get { return "Gecko"; } } protected void OnOpenUri (object o, OpenUriArgs args) { url = CheckUrl (args.AURI); // if the file is cached on disk, return if (url.StartsWith ("file:///") || url.StartsWith("javascript:", StringComparison.InvariantCultureIgnoreCase)) return; if (UrlClicked != null) UrlClicked (this, new EventArgs()); args.RetVal = true; //this prevents Gecko to continue processing } protected void OnLinkMsg (object o, EventArgs args) { url = CheckUrl (html_panel.LinkMessage); if (OnUrl != null) OnUrl (this, args); } // URL like T:System.Activator are lower cased by gecko to t.;System.Activator // so we revert that string CheckUrl (string u) { if (u.IndexOf (':') == 1) return Char.ToUpper (u[0]) + u.Substring (1); return u; } /* NOT ALREADY IMPLEMENTED */ public void JumpToAnchor (string anchor_name) { } /* NOT ALREADY IMPLEMENTED */ public void Copy() {} /* NOT ALREADY IMPLEMENTED */ public void SelectAll() {} static int tmp_file = 0; public void Render (string html_code) { string r = ProcessImages (html_code); // if the html code is too big, write it down to a tmp file if (((uint) r.Length) > 50000) { string filename = (tmp_file++) + ".html"; string filepath = Path.Combine (tmpPath, filename); using (FileStream file = new FileStream (filepath, FileMode.Create)) { StreamWriter sw = new StreamWriter (file); sw.Write (r); sw.Close (); } html_panel.LoadUrl (filepath); } else { html_panel.OpenStream ("file:///", "text/html"); html_panel.AppendData (r); html_panel.CloseStream (); } } // Substitute the src of the images with the appropriate path string ProcessImages (string html_code) { //If there are no Images return fast int pos = html_code.IndexOf (" True Mono Documentation Library GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False 640 480 True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True False 0 True True _File True True New _Tab True True gtk-add 1 0.5 0.5 0 0 True _Lookup URL... True True gtk-jump-to 1 0.5 0.5 0 0 True _Print... True True gtk-print 1 0.5 0.5 0 0 True True _Close Tab True True gtk-close 1 0.5 0.5 0 0 True Quit True True gtk-quit 1 0.5 0.5 0 0 True _Edit True True _Cut True True gtk-cut 1 0.5 0.5 0 0 True _Copy True True gtk-copy 1 0.5 0.5 0 0 True _Paste True True gtk-paste 1 0.5 0.5 0 0 True True Select All True True _View True True Collapse All True True Show Inherited Members True False True Show Comments True False True _Bookmarks True True _Contributing True True _Upload Contributions... True True gtk-network 1 0.5 0.5 0 0 True _View Contribution Statistics... True True gtk-find-and-replace 1 0.5 0.5 0 0 True True Edit Mode True False True _Help True True About... True True gtk-about 1 0.5 0.5 0 0 0 False True 3 True True False 3 True False 6 True True 0 True True GTK_RELIEF_NONE True True GTK_ARROW_LEFT GTK_SHADOW_NONE 0.5 0.5 0 0 0 False False True True GTK_RELIEF_NONE True True GTK_ARROW_RIGHT GTK_SHADOW_NONE 0.5 0.5 0 0 0 False False 0 False True True False 3 22 22 True gtk-dialog-info 4 0.5 0.5 0 0 0 False True True False 0 0 True True True n/a False True GTK_JUSTIFY_RIGHT False False 1 0.5 6 0 0 False False 0 True True 0 False True True False 3 True True 260 True True True True GTK_POS_BOTTOM False False 3 True True GTK_POLICY_ALWAYS GTK_POLICY_ALWAYS GTK_SHADOW_IN GTK_CORNER_TOP_LEFT True True False False False True False True True False 3 True gtk-help 1 0.5 0.5 0 0 0 True True True _Contents True False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 False False tab 3 True False 3 False True True False 3 True gtk-index 1 0.5 0.5 0 0 0 True True True _Index True False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 index_entry 0 False False tab 3 True False 0 False True True False 3 True gtk-find 1 0.5 0.5 0 0 0 True True True _Search True False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 False False tab True False True False 0 True True 0 True True True False 0 False True 0 True True True About monodoc GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE True False False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST 6 True False 6 True False 6 True 0.5 0.5 0 0 0 True True True False 0 True True <span size="larger"><b>monodoc:</b> The Mono Documentation Library viewer</span> False True GTK_JUSTIFY_LEFT False True 0.5 0.5 0 0 0 False False True <b>Version</b> False True GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 False False 0 True False 0 False True True False 6 True True <b>Authors:</b> Miguel de Icaza (miguel@ximian.com) Duncan Mak (duncan@ximian.com) Joshua Tauberer (tauberer@for.net) Lee Malabone Philip Van Hoof Johannes Roith (johannes@jroith.de) Alp Toker (alp@atoker.com) Piers Haken John Luke (jluke@cfl.rr.com) Ben Maurer Mario Sopena Novales (mario.sopena@gmail.com) Rafael Ferreira (raf@ophion.org) False True GTK_JUSTIFY_LEFT False True 0.5 0 0 0 0 True True True True <b>Plugins:</b> ECMA Documentation. Mono XML Documentation. Mono Handbook. Manual Pages. Compiler Errors. ECMA C# Specification. False True GTK_JUSTIFY_LEFT False True 0.5 0 0 0 0 True True 0 True True True 0 False True True GTK_BUTTONBOX_END 0 True True True True True gtk-ok True GTK_RELIEF_NORMAL True 0 False True True Lookup URL GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST 3 True False 0 True _URL to lookup: True True GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 False False True True True True True True 0 True * True lookup_entry 2 False False True False 0 True True True True gtk-ok True GTK_RELIEF_NORMAL True 0 True False 2 False False True Login configuration GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST 7 True False True GTK_POS_TOP False False True False 0 True You can edit the contents of the API documentation in MonoDoc and contribute those back. To do this you must agree to relicense your updates under the terms of the MIT X11 Open Source License and register your email address with the documentation service. If you agree, click Continue False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True True True True Continue True GTK_RELIEF_NORMAL True 0 False False 0 False False False True True 0 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True False 0 True _Email: True True GTK_JUSTIFY_LEFT False False 0.5 0.5 9 0 entry_email 0 False False True True True True True 0 True * False 0 True True True xx False False GTK_JUSTIFY_LEFT False False 0.5 0.5 7 0 0 False False 0 True False True False 0 True False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True True True True Continue True GTK_RELIEF_NORMAL True 0 False False 0 False False False True True 1 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True Monodoc is requesting an account for you. False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True True True True True Cancel True GTK_RELIEF_NORMAL True 0 False False 0 False False False True True 2 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True <b>Error:</b> Monodoc encountered a failure when requesting a password for your e-mail address. Try again later. False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True True True True True Ok True GTK_RELIEF_NORMAL True 0 False False GTK_PACK_END 0 False False False True True 3 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True False 0 True Once you receive your password on the mail, please enter it here: False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 False False True False 0 True Password: True True GTK_JUSTIFY_LEFT False False 0.5 0.5 9 0 entry_password 0 False False True True True False 0 True * False 0 True True True False False GTK_JUSTIFY_LEFT False False 0.5 0.5 7 0 0 False False 0 True True 0 True False True False 0 True True True True Continue True GTK_RELIEF_NORMAL True 0 False False GTK_PACK_END 0 False False False True True 4 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True MonoDoc is logging into the server. False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True False 0 True False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True True Cancel True GTK_RELIEF_NORMAL True 0 False False 0 True True 0 False False False True True 5 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True <b>Congratulations!</b> You can now contribute your changes to MonoDoc by using the File/Upload menu option. False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True True Ok True GTK_RELIEF_NORMAL True 0 False False GTK_PACK_END 0 False False False True True 6 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True <b>Terminated</b> The request to the Monodoc server has been cancelled. False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True True Ok True GTK_RELIEF_NORMAL True 0 False False GTK_PACK_END 0 False False False True True 7 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True <b>Please wait</b> MonoDoc is checking the server version. False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True True Cancel True GTK_RELIEF_NORMAL True 0 False False 0 False False False True True 8 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True <b>Communications Problem</b> There was a communications problem when communicating with the Mono Documentation Server. False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True True Ok True GTK_RELIEF_NORMAL True 0 False False GTK_PACK_END 0 False False False True True 9 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True <b>Version missmatch</b> This version of MonoDoc is not compatible with the current Monodoc server, please upgrade your MonoDoc installation. False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 False False True False 0 True True Ok True GTK_RELIEF_NORMAL True 0 False False GTK_PACK_END 0 False False False True True 10 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True False 0 True <b>Password Problem</b> The passkey entered is incorrect. Please try again. False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 True False True False 0 True True Ok True GTK_RELIEF_NORMAL True 0 False False GTK_PACK_END 0 False False False True True 11 False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 tab True Uploading Documentation Updates - MonoDoc GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE True True False True False False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST True True False 0 True GTK_BUTTONBOX_END True True True Cancel True GTK_RELIEF_NORMAL True 0 0 False True GTK_PACK_END True False 0 True Monodoc Documentation Updates Uploader. False False GTK_JUSTIFY_LEFT False False 0.5 0.5 10 11 0 False False True False 0 True <b>Status:</b> False True GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 False False True False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 0 False False 0 True True 0 False False True New Comment GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False True False True False False GDK_WINDOW_TYPE_HINT_NORMAL GDK_GRAVITY_NORTH_WEST True False 0 True TODO: Some advise on posting here. False False GTK_JUSTIFY_LEFT True False 0.5 0.5 5 5 0 False False True 5 2 False 0 0 True True True True 0 True * False 1 2 0 1 5 5 True True True True 0 True * False 1 2 1 2 5 5 True Title: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 2 3 5 5 fill True True True True 0 True * False 1 2 2 3 5 5 True Comment False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 3 4 5 5 fill True E-Mail: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 1 2 5 5 fill True Name: False False GTK_JUSTIFY_LEFT False False 0 0.5 0 0 0 1 0 1 5 5 fill True True GTK_POLICY_NEVER GTK_POLICY_ALWAYS GTK_SHADOW_NONE GTK_CORNER_TOP_LEFT True True True False True GTK_JUSTIFY_LEFT GTK_WRAP_NONE True 0 0 0 0 0 0 1 2 3 4 5 5 fill fill True True gtk-ok True GTK_RELIEF_NORMAL True 1 2 4 5 5 5 fill True True gtk-cancel True GTK_RELIEF_NORMAL True 0 1 4 5 5 5 fill 0 True True True Manage Bookmarks GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER True 375 275 True False True False False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST True True False 0 True False 0 8 True True GTK_POLICY_NEVER GTK_POLICY_AUTOMATIC GTK_SHADOW_IN GTK_CORNER_TOP_LEFT True True False False False True False False False 0 True True 9 True GTK_BUTTONBOX_START 4 True True True gtk-delete True GTK_RELIEF_NORMAL True True True True New Folder True GTK_RELIEF_NORMAL True 0 False True GTK_PACK_END 0 True True True 0 False True 7 True GTK_BUTTONBOX_END 0 True True True gtk-close True GTK_RELIEF_NORMAL True 0 False True True Add Bookmark GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER True 60 115 False False True False False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST True 23 True False 0 2 True False 22 True Name: False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 PANGO_ELLIPSIZE_NONE -1 False 0 0 False False True True True True 0 True * False 0 True True 0 False True 2 True False 5 True Create in: False False GTK_JUSTIFY_LEFT False False 0.5 0.5 0 0 PANGO_ELLIPSIZE_NONE -1 False 0 0 False False 0 True False 5 True False 199 True True gtk-cancel True GTK_RELIEF_NORMAL True 0 False False True True gtk-add True GTK_RELIEF_NORMAL True 0 False False 4 False True mono-tools-4.2/docbrowser/theme-icons/0000775000175000017500000000000012642235741022101 5ustar00directhexdirecthex00000000000000mono-tools-4.2/docbrowser/theme-icons/GNOME/0000775000175000017500000000000012642235741022746 5ustar00directhexdirecthex00000000000000mono-tools-4.2/docbrowser/theme-icons/GNOME/monodoc-256.png0000664000175000017500000020036112413742070025420 0ustar00directhexdirecthex00000000000000PNG  IHDR\rfsBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<tEXtTitleCalculatorJH^tEXtAuthorJakub Steiner/ IDATxiey{sνULsGME٢[,;A 9d:"q;Ld6ӂ" " A 9DBl%eŌhRu^ry|xsvuu> TߺV{sγ<ZJ)jgy,ƹxceY/ZWo(7K^/Ҟ-oUExc=* e~Yۘ=> }iόW~s?7עxC6eKoxC/}=# Cښhw shRfw~}׼"xC|׈_>c?t~mEa|H[}V> wyfMh#DQ1hRΡY 5(aDJ~?/M+7pք~:{ǭ?R~ p^cRic4(mʠ&L,2|)Eq 1C!+1|?zA 6\x\7Ю}h(%=\z(ܛb۹攮hg41i1k4jv3~DMɠZƐ!b amk)%K:W=劔"1y/s %WX'׊~{7ǜy6r~(澔ҽm5CC@7 43 YXìmh;ӆ9PPc(%Q">RfY Ei|Hֱ\/(J8P9!xP?&zcDpFѵR7׀{/[a#J)zWox_Zp?_sgηǬkJ=R|(}{rJgsZkCmӠI9Gc kha>kQ(Qȹ&">R.\;\3D)PPr&640ư^h0cq&@XҚ2FPBkR?+e쯽>IO ^_M!Bއmk!>{QVqoc*J89K6[g˼kZWNA)1ڀĔY1$ pQ=:RʤڎňsnsζiGKZaEk֚b@1PHES(@)rk @. mO-l=zxWKmv!Gam)Ky6@iV=ˬy4$1ovf %q6uK>D?F@E?`\JV=9Ęk1l6 Q(Rhc1A.ZRJ>sÃ)e2g-9J)cENb=q"%G\_ߺ }=뽁p^7<籾ZrwלzB=Rr|i]s_13:|X͙25vf;yR k ca{}fVc`=y}mBP Z4_8Ku血k )rN %')ɒS!D6V"M J+ƑrF)b )Fq@&Hbȥ1HxGx>6 ޺K W[ȿ |fє£9燭ik+9Qwޡ3{;]9;]CXlPZˡ(g5D. cd9Vg0 ckx F3$~ZPr:GNY׉05OI)\R!3PdV a %ET0Z&BIc JɉwM+nc0Zя4S5k o5Gu]0^^הx\gcHvޣ)2s֜1kUְ;3k,gO;k8;cXNv[5G4Z+1<#X,{Wg>c|(ƒ"nB@+Ek-{b ($.!4 (S 180bO,%&˧X$ާ(!xf݌u&¼k>`!(N@)`"H"ƄR,{ R&I)y"H)y)םx_}qͣ7cԃ%R JJ(3{qjwF,{yLbl3Fcj\^FVkj>g1zRLXcPZb"9Bfmےrk;|hk1J1kdRJ,ks,ƐS"D٬Ui#Hso %g#L ME)T.kŤ$!B}ǘBP1I>HrI È{4",":8xQ-AWZV{[6Ţ1ua>k]luFbptzXX '+OGڧ,* 5a @o@uysi%CΌls;PqU+_sPs!ֆB)9Qmȹ`v Z\2Z{lXG1"rA<))3 1aCQ5NH 1eRh#8d"9nك)%|?@yy__'>,"[Jr>p;WRX~g~|#/n|#~2o<~8f KNw|gѵbZg$8Zg阵ĥܳRG|XX<e H,gvX,hUR3I#DJEb$11䔡sZ+B"nꌳ笤֔n)Z@1oX@soWTKPJf1S$]ג (MJԬ5{{S(E="`ɐr)`BHB!F +r,rS;B`_g;h7Ξ=xDL a~x| /}KZaA?ϔP 3ԆܲVJq6+:g 9fju6 J[R*\|\ fN,8zi?zI;-j)McT0Z~īTWc$"trF򠍸ښ/\6]HMp]k- ޣ+.:+j) iG=T/^nt lHAT1* P@k-}8c)u !u1nIR h9CU1(臁=49G82kp3?쳿uܹ 0"Ÿx`/K`'~^pݿws=N>͙3ghۖZynsj!łjEYϕyl7FQ\@+B !%R.h#1DU +#,X4MC^*-X gO9CӶBEԩ+Ŭk4hmХ6BtABY#&%'r" +WB+Cvbs,5E8hb)4NPJ(s&P"MPx1S՞Ҋk5hmYq5I$S^)Rm'<,Ia蚖!mR{BP!ac4m"&mC{0FSf]ú:aX'Iå!Һaoo3xxt=O>kƘp]wqw|>:@R 0lX\.Y.HNڭe6P"LΊN!ĀVhE%(rpƀ8'`c}M1K ]Yr)i܌ R8ˉR,)DF?4 D)4mCo!#2mے1Z8uC,m+`+UU73 DtPdJUb#Mp*zYIy?n h~{H1Kʰsm[ͫbfP :FL- \roq )Fڶad 5xitG{( Aҍ1lYo{i?S?u?s?)0 "%I>V)RuNm.\. EsM,Q 9g/?{UHsoʴH΅XiWc)(\C F@/ecjPhc*Y#gmFHQrٸ9MzL`XgHhQ)))bS-nI1m4ZB RZ[R,4`I1lY;EBS VRFMl-1U2e9U?mҾkT2RU 1F3!#8*EPCLGAkcX @s?sEZj= x 9rޡ` u9fg7}3#{RBZghMnyX67uNR5C/V7כ'a"yȥufL1V<^k R嚐t~`uWE&Y gmm!DIIz*X(I}OfF UduwHK,]YmkrhMHde$!'T6{5jiD}%ZYyfT'%ʙa" %mj-ݨ"%I9jH*i(`!'k:%!K'o~pUV&0ZaJ*?Ǻ+@+$9g5ݤi~_Bý9 մDS(UZ6i F/9pH:Zk+nK[]zc3֑Bڰa9PZXS6mEkK Ƶl8p6ՎXg1VKZ5 !R keֈ;6 FkAsٜPJ\J$z\( 8B)M]kZ'LOAԮsdt;X{JI fj!x-qm{uJkxaJLFsށ8)}[T7 xs nwz[Q"o+Eч*-_yڠ-M^8z=`#rJV;A}XRĊՔZJkm 3z-{,`iNJT q'f?S@Ja !Ba7֐SdZ Zk5)߿M۲{bL4'l^x\CJF,mJ6B)CRr G~"NplZɹaݯi]됓rNmK$s~ mR5Ĝuӽ$aj,pÍ~7]:ˑP~nuKp nɤߧ~\~]5ˆSrNtr,i.+7tsu]խFr@|Z@| O:1")&Xq(%CȾƫUIR*zjҴm躖9K5 c4]+Vp)kGBfRpcmm1AJ6=hc0։ UR{M5(˟됋hF)-mQP[hTbb̈́TCZSr!Tol$ǯRj hc)E.pm>#뿭^ں8acoKۂ> ^lۡ2GZA۵2țZ)a>}􍳤%MƊR.0TdY @kI.CVuT>*)/HzM)nF)q7AQ$&{p`1W7DZ8T\ckJRt}Wq 8m$كBѶҼcg!8'J#¾,J7WJg뀒uN =(^f[ȳ#w"TMm&³'x;m uNMBP@bԛ{\JKaQJѶ 63L|GFj%$mdV\U?RJ Bcf][I.9G&j]QRUŽ=8I1PuX,@0 R#_JUv\X G{MVl֡\B(!U(]>:40rBr?8&! .qR09)$`'B`6͔f PYfU 1H 0F9ab|tt]+rㄈS-R ] YI |$kaBi$ܨ`VfDXgAj+F@jźe^k&Cu>^,ea*Gʢ2,Šv_+pFRs 1JguXQHr3-՚F c!km 1е]l*#ʨ,{Vzju,E)ls>l)ȒZ)yuhg-R _vM7mι&(z>i@uF䜟:.)siyE/0ZIѕO+?4-Z+ȅm7 %Rf0c #f8zR/_V8 g9GLIL Xq 'JmIQ\"Mۈr)TA0m'5cBEg$?[IkV cTi%TN\0Qj!NWѲHI)et4m#VUjC+2WÚk%zWS^J!xJeǟ'MsJtmzLqtt.#⚖Ūg=x]s>9pۦSpO~r;8 0Z1Wm]u%%ԼWi ){)^AU0]B M1W*iT!sQ{L6EZ떒$sPi:Lqں=L@n9aJa Q k@,!eXfrAw&)Υk 1Jc؜(2 au5ۢxSxb`A{ՊB zIc4)ѓs" =9yr *\gywYsb!1>rI7c}NngBЭ<~@}ӟ~O?_J93Jt IDAT`;-' Wg{gJ>k[BLG8dKx#6Z)>^Ww#L>9JAbUIm5(B7N6`rJ)cX+kԹHʥ%[AV|PyIm3uBYbC!JVRRKi7VIWC8~jkK)SJڕ+`Y8+~d%ŪJ"i%HI}V+UX\f[}3.Iдw=To(B5PP ZC=t-ÖxI@:Z8<;LrOGѵC)3Z))? 'K 8JI$E0ѴXѳ#RIʆWm7HyyڿǁIEdnVoVEQ=wCVz5 ҠcaLh[I7Mt;;;'B$3ڊH})\$AڅykmaGZ0 >jy@#!!bqa=鵓慮>).?u,Q_b|SiyZ^݌Gtc&™3go;?O<}n|A~&mhbbN> p\'J`;m1"1sh'?vɅX%gbdH 8*SAD8c(AFZr5M#X l`bh#KSo/mRe )Dlcf!r)? %C_W 8 p|y—rߓ)w<pT RX)dfnsQS2m=54JgAQ5dJܹShqR SNib`www.4 W4KZ@dkZiR Zڦ[I5`۰Z@F2109ܿF #zA<׬W 傔dQ9z=xBN~ae۷IWj=?;g A_zkdxnC,\A ܶmyG x8Nxv\>wC8)hz埪ӁC *HK'8kѳrEڞnX kaQ:նaQ ֹڦJæÏQRM{YT0Rn0u]muY/}t,Y.gX,P%ΎR(ntn 鼸Zǟ_r~LA9(]j կ)(7(i8wsrQm >r?$X=s=SfA<5ﭳ#HL-VBPPk̻VZ]I,%fj"FK;)f*{qC 1۵ ڦmHIr bzVCbux@ZƁ_V|9b@H#)zT<. ~+!Vk_'d> 5\FQc$1xx#!H)Źsfm`mMx3\jrΗj͇&\*px?{c3xSu6ZRgSIQ %'R[2.z$6 (E׶(I󝳌C.:"Rhz~yHZP %C/B"y PC5?.Wo&/#ş{-XֵOq~scI h\iJ~f]l}mG?0ܦ^I|smbOYk7-U&?^djcEٸtM{ie]{!&T{T|-۴qbճ;ƚaH̗~ 5r%0J)<z |k꟤ .wS"@KRĚ9{ 錱,8Xڹ};\/ iHҺV {J\@C~ŰZT˽di%ﮖ;G_\K_yv_ +uZˢC`ݣ\b$/tVN3Ku|y_M71V|@7^8wvv# `0m>'oN8h֚vFTԒZ辭t5 SJm;W9r/^^=%GrIkly-wӓ pZ/w(r/z ٫W {QXVm-č֎t0`dYvLol8횀ۜMjR tH<.CFfXA -Vr4"y[X["o๎nϞ ԃePŀ(emҙ(K7RKՉ{|-11oYOㄟsaۿOrr9K~dj _Js%6rW/ מ9QkrWx/d]| aiVJkMtLMM(HxʵګՊq=^$,`]v\O:Nmc}_ųO= c%5,Wȵz, 7vsI\SJ9xf q $/80݌٤tUH϶k1FQʯ{ $= ?czI='v< wR,a_I/gpƠJE'uUK۶EYCȉY7( !pE^>Oگ0 m?y/4MsV^qsL@\#Fkǹj-eu BUGZQI@„|:Qz5}/GRKu `I2DF`J:=ۖ)%|s_,~>O? <]So>l'u# k'k:vv5"iL)9 NkiZqˍ>~/if-)WF)dk-i+wÿ r4%8pp/e8v(2[^sy2m?hۢS6(0/%ՂVzlBx­pmKtmm[hiq Asx?41Fi'Q9gn;%`K)EsZ6l7')ŵ?ҕi_,WtfH`?rK)Gg~En[;{|{7x;Iu 1eVcS!0:&]WdvJb A#ԹÈ2_JckIkjC~@j-SrA_wٿofm_Rǔ`,@! 3wVb}:6mNg !\2<7kzoz)1ZwY7cR!%gL-RZps="NѫN[RY3!C L?HSӐjؓ҆z@[#Ta=> .i:Zv`޶V3zN\9JULd4?ZkZG{'_잾_˗*EڠT$$]bD*?wܻ>'%Z+~Jf"HA CYt]JZGcU2S`ch\1QZq7VP S;3}?ĵ'WC Oބy3$dGT7qd~hWս?c?L)-~OݿwWWԗ*b1r'S"qG8!)sUf;u(Hq O)q#Mnz4Z|4Ó'|o:~LØ +K,c[mQFϩmulwo9$ pe|V^jI4ƈmAQߓU0~Iƨ_ RJuJoҖhú?s)_OsxKO}n6Z,DʑX+e)N C6tu]w`}衇//ȩSϳ9P~8YPua0 {s ߞx<p0MVJ5a) `LI9iYS>.* ػWD݌G=%{} 59UtJ">&փGPd~f2_S )Ijϫsf>1B|)aHֱ۶7JFXL.Te #UT}iJ ' aO?q~%^x{>RTL [$F5]G/\(iYkɟ͑o\KTl㠼Z6dmx0)7c{9uΥ>qF\X#)<(%#̛—[oX\C,Xig.yC 5m[H.~1\d*ra cՏơ)wb=Xoyb͕Á1:L)5J.򘒴*E*nМ:9 mJl˛椱j&%*KK!#yb,)D?R~q#F8 QE)lR6?ɍwJ+:r $#5ÈudFbʄ57SF?_Fz27 p|81Iㄠ#·ӀY٬5,\n jK\zj(VsﱗmRU|sm5Mμ"N::VR&#.xkd_(? B)Ae1ʔڳ!x6ibJQ&R*8u aõ1b ;5>+Nw~;"+o^!BELeHhdžs= BP[Հ' ǕA>^:N9cSNW:x)spp c㭲 0F6R~IAN݁e]ǝ=sn:G3hc)ȼ3}?c}b È2V1$AF'>%|#5)kJ`$ӌ<" h"A3.l\ 9K1H v)5к٩B !DWzv+cjiJzGh?<4Q6~rp={X y/ /$<`RyNjsoܬ4$@ks8c@)F?l])d$&6F@@i"s =O7]? Q\mdfU> ^ K']Ӷҁ ̳FFZicE1daJ}VIc@igOK# CZֹ:UYMV$%s[2u6ZEU>1F9~m*B՞z :/Ea_~tD=(9 JI݄(s&55s_twR8uԛ܉v95^dR(qx"N hzUԴߤDd\wkM% w_/wkk)KRȱ̥'DL*8 u2Ίi FiYg&(g]1xQ R/Tx0E)s39I9*u~˺:_bJaGbo?ssrm\  Yp#I͵P Bu-Ji+ ]e?#?Nl %l_|I姆}oRǽ/=1x `]uU-ZbP(^PZ:^X/Gb!>Aʫw28G5%kg~5JQJƔ73 32b\8-Ʋ[m}fɦHJ%Q4iZH==!@xc I<$x A~S`/PƎm fi$9,S,f_va}{שSƖ@NWso}k2nb`j02-BTߎ1gȉzD ]aE4P"ƄF!¬* Z 6 vқg0 Y̚JX1%nxrƔ@ iUUx駟~?'xV]+KwJ NUm\)GPUXL4J@V`RN7حL >&Dv5,Cw"pj GB#y(5R r4rG=rN> g(^#" i )LstPR@UB0F b IDAT.޶mQ%e01$L-,'Q[7+TF"'`vԢ27G-s);'>c=a~`pE7BW @* |Ņ~%Fͷ3 ;54emU`1@znZtgy z:Rȥυa 10t5.-4uY،Fު U<XgPi0 t5PUpϡy"Xi=aRCS} Fic ,l;fɕ40%cgs<۽o^4L< `Aʌr!I+' 0x>h0ou;0. H)$``5#pP)9c@]$ᇞ{q'r<I7ްl2m8D K+_G)=O)kY/n ,v]wZj(`9ARRDr KjPJvtl Y(cX*9xl m5C{30+r2QL#=Zi ?&BVrՎY"c-0~@u(%s{hcQ.ijb@d ИJpV|uUMw[a{/e5!%I3r̩K!Jرnxm_bTWs}`*]1e0 =I[WwO zp/u;2mW6,7m ڹ(L`10#KLJ C̾7v2d`hQf#b)rD硥G KqLq O)! iMכ''1 m4ZgqCA?x+L]$U;5u}^Le!2QOENWg zicJ+\rFUPPkcrk<8O:~pOowRXUPH`oobY%`N/z4 4bd#>vW~7 ?EhwB|>}9.rJO1ƈ O K|JUf')6>~ xy-L"3=1K}@֚%eX;9 >A [:0 -Bn(:Ml2"ρcPJ~cCco=0F+Fckap# दň Umע눒X.*F(WQkm.q$<~`oNBQBB9Elt-i919E876uq 2U4;YC1Xx@}箪 {*:pIlW `yV%'W@%ېț7@C=<_8@Ԉ1bZ~z_;_O6*(ɕӮxԓo}X4`C,a<#(<TE>c Ia޶Զ P ϵ("!DF(B UԵCb*mVe2FP+t}pPϗx Hƃ>qKf߿~MxPةqśeٳg? ,u#&_> ,7t?> =J7CJHcx,n/]Vk+go-o}- #1){IBͪri]ib,2jQpߩiEiu|J!Q1@FM c0IDK9$MY)q z}PdUM=Ͼg{7yW.vEZJ(h'"ɪM3CQbtwNBگگ}?@;).^"!x3y0߹Saת9 f5,f ue!<|// _hV!{(ec_*fJqV]lF ?3: R?@۵P XSYOG`pPA 7"g6[Yg匐ȁp M(qji{׷C E]'!$93βd6jjɮ9PU>= h.c)Vݐ`~xRcPؿǿӊ,6mYN)bmNIB k,P5UNJyv{.!<\mF]W 5Y@h*d }1D2 wdIa=kUUx>է"[םȂJs) ٙUՀ-o#R Mfڮ>꺡 PSOF>Fag7yvo"^s#{߳g5^XV?t8Գ>xF! B+.T<5#`#%Gc)CB!Z:I ̈T&c6UӠCfm){{! a3w\WO'M)W.߃zVc1oF@QRlya0g ޸xp/5cNl0֓b1(`qO&H茒R@H%;3꺒|5u @p'IBNw/^…~?,>AuX3 094Fy PCg3 sVFԇ@Ҕ`;HπRB`0v}# s H%`A;c:vk f QԸ&Ơr Dd{ gx+<^W/|A3rARi8$(bc@̰?qR"z677yO8MV#XU8\>W.O R%Ua 1gC)lCnAeBǛ?,NNymZ{/qC'ޏRd7ڠYBIXDkt8gنkF @;E| 4pɕ0/[ NJȝHg]B mڥw."^EAc`'VKM>Gݕ nFW.]@1''dʁrIP-Vr+o\?{us#ȃ/=veO:OB[NOQpRc1F{׊m*@_m -'{]UК>z}T-_)ѿ8c _k/wQ^ۯcq]?(춣OstB̴骬C.g(pUWH) 4Ȋ"Qμx ߾7s \9~ڑlz+wn󵫗`tZ~h0+JK##r!V.bxG7{Vl!,o<8'`^W7+qc j`-s}c)T ԕu+6z/~w|kG?_0b; q^ ʷppu;Wހ?.uZ|PL{R|cc} #2w$1D4*У X@J VH\?&<3 ũ'ߋaD\.?+ow_ʑogzn7hs̯_0ZT5;9cuHk!(pun/xs ] dz&;\VEt#pU?#4Ud k9'jɁ88l@j刖&yMw~3؏$f!݃.dy)|G>?ݛcv.k rQ8u 3 1x pԽ( ӭt$(MRRNCO$i}DRdAw"'mBg $'? X!|Jk-$7 "u 'ދ-Dž }{yU~HlNIRhއul_! ]|ſ+x,0rrY/0znSUnAit ) 5tqUE{_+hBƙGqwS'?'~g06d[̇~躞=)W%65h6QwOC{ @PU!ijPԺ!N {؀u֒= )G O݆@|dRԴ)#Xkhv F1K7\i*l4O'g>c7KA>Cs!`5-V9BAÈ8*x[Lj}"n:ҥK/oġM(c n R䜇uk홓Re2xbdcV{0l>Ęq} *W!F"rs(9C9S$\zu<8ƣ9~cuIM@zB)Sĩ60ֱy~u>mA6"9rgp1%$U]6@бA0rP`{XgУc)3ZXǾ͍ x*y__t󃷴o'޺ Fkhֲ±1DiniY/%<3׿/@0>n xRHOόJdQr 98kLu.JM!j;JN2c֬޽©wp0K@3['>џG8;2wY~G !#$u.䐂d">(P&Z̯a6ȻGA)i*UUvI:20ZOP0$ :bb"65.LສЊ j+;e4ChGCF܎J2مu=f Xwq\)X$@[(P(Pؾ3ͥR^[+qz7),u`VaS40 Go*uʁJJ)tWw"k͠GzB(P0kqz'AOď#g-;==ZBB$3uy; 9sb0"N(,?;ERlU(£U5wA."O';} Hf!IL45xPJ٧RDAH%B^ ư99̏ rO>v c}֝:`! di&/Ø o\ކ,)xU잸Vn SU;ۑ Uu XtR#J6i[ Q@_vjr5F.⾇$~g? pCG(C]!7v\X~'YLcϿHQ=r2 hӏ < &ZU;! ۀ5%ZkY+0kCazj2P( %PHJ|1|tl5.r U^#hYx?7_827=vq«xļКdk 2"dPb SWF[hka}p3Oq^R(J)U}F8'}@h%$`yc{m*\97ɁUvW>̲`R>s1~#FLWww݀ΣԷrFUF^U>Fr QU"#CfeQq hm; P(PWJ:eQ^o45(% :c6CmB},9XU1cӆV c碾ESYcJ!DŽ'/<.MC4pxC~o7 chҔ7B?y"az,~ہCywwDj/k0W9$/8a D$9@~w^.bkC;,Q[0 87q 776||cW?AnJ@ɨ*+@e F)? IDATcGk1UeZd咦A]5S0:@$JD*#V-ՏA؃SmE"-ȲYP4#|߯h󨭥ҲA*e=%Yi 7yiE;G1h!u4@9_ejr4cG@<.88=6Z[XkSa¼)143 Iuz7t) !IpXuҩAg@Nvv:ŀMss`H/тvsMM^I2~HMSJ7p Ɛ/>`MI1@DOеylxsν/~ /&C@PKnq`1xKlPҀR` C lBAk|4(< !$blj9'䢀"#h t. ^Fi7](3$ tM95o }?UNr}+n ͘2e}SJ" V QP%{uBև]) BѨj } RRBYZ.5**[ԳcAi{W_~lwù jHSt)fUaĊ] dl[?Zׯ?G?KkbZGlz7MV-r:X 0LMԫ*QxCPȨRSU Us1s cn*҅;s|ZHx*[릅0uSSS:Jan E9m}Dfb3jH9HnQW+a1^u)aQظLJO4Z̚CR29 1Ȱ_?phiWHE=iu#bHkj$}> -a~?!\xZq* LrTrnLE!6Zmm CSkϜ9sKg j RJ pxOHO*0p[r(bz.Il)^z㍱pU3BL!ig/@BGd31mۡeZS kUn0~RRz}?i ~][cA}A8W$cȠ.4Bo$f#m71[gU")^qu9و1 `sTMyQ2]z l_| b|Hh+α{Tdጅu5z )gc 53E(XciJ]AcŜnff5E9~3cD<0J:t]V!h%*VTu'c1@imסm)%ʄ3CZ 9A\"{0q;6 uss!a Rg-<!PlccF]'yjnޕǶ.1T!E C/j[/r3 tbrd~ŕeꪪ;;FPjq޵nȦ0ި8JYU2 eIŶ\ #@AJ5:y~]9TUPWNNCއ 8h[_f_6P~;SaWqZ(.V?"Ai:״2c)JtWU躁iE:J9C0@T( XFjX;$*0lM9I5D!r ڶg=d=vlǮm]X_z(|Rb /@*RiM[.TˁMU|yLNY$28W SR耤qa}Ow"!ApeJ)fDJ">k$#{ ±`Ic(w4d#%[TJya@6.oW.(Q{wYmH6sc8677Ӏ{" <ǖS n?<_uxy `$axhx1W%NF u\M.Ï E,v}7ȅ4C)(453P739|HS>0!ƌ"u.k+XKMA'f^> 3"4aQ,YC5%d Zl@k!ι4$R< =!3!y8Kdy'' >6t--F'Yݚ0e*9Z) wx5i?bpb+˿7~=4ZWE8B׊F3Ez%qJzN UtC? %a/E6><{"Pzu3C׳Ok<ص ?HhrsQ` -":c+3llO{F|)E2 EJ.1luz(PL]%im&ƅF'2p1dY8>ypurnJF ,Lb)BZj)QoRH1 'Xɣsv ~)t[`VL#b+pO#&$8Œ!!E Pa1BWY)k}H%s0a>D<䇏O l_z jsbDaC)LXu 1'Z wP یU ई`9ʲ>Uu@n #?Ykh,_r$ڌ)4;ImI"/"yqIń\EG34|Lhf34ޔRK:q!z:\kci( L9D0H"QCD~҇&`#ۙCH5[Cۊdy06IU3OKaZ!NӚ`CEf}UFW8jZ>8 .m׭U'qY4`C\e\L~(H)CP`#bBLfRWr^IhK,btpơSRJRF?y#*L N?p"4gX, 1DD-)#1CB?xS* y%AZ_Y`NNCRC`7!G{

s(:4x'#TU?0z8 A*X }e8)VӁ7gB$xq ^:n@-*J΂v8 E"f0v=oll Qfb f*l13/Z"7 !Js!'3TA5R)hĜ)Yk4PaqǩO}60\˯ Ck+.|4FN0᠅ |j簷I\!m'zIc Ѐ*|)8CWUpF_IuUQ@0xuv2v}vb1P(P {{> 'iO1;FdB]Pc0!)3|;o| e2_b;mSWq tik,|0!f*>ag=x'@7/T X%>^ J z9a.54j2tZ;,XP|l5Ú8]tuX ic.I8z# eFid#yG *U~ّ,]zr`| #yFRi@M`(@5W+N)p8iN(eYx% ༞0uQL=,5i>zulN͇8]ϴZT5.S[pUc-ν~>e+.ok*V@?ߘp.o'2'`9 NBf*uθPA::ɧq#"H`}sA|-i G駧:8髊}BEB0-cy :Q&R w66=9(:[SO ul[3P5Փ.W/BfIWO?9R6&;JA]75pek//!ZoV1G/R :0p|@E2hea /_z㓙((0LD Ty1J@#kgC {RV-iL]( }jCV\p HMcecd[Ó;a2J!S2 %?pL= <v]w ZX\cR #PƉ!#% +]iŐYs1W%cZ+k ̬ꪆ|~xbPf"Ү4rbE<\$) =`jjq$1tM=0jma?C7^"+%{גz)MT=UJAC)sk'=.r g ;55;AD[)&in"ǘJ\O Ж}scO|@~;n7(.;< Q%D PJQbIvѠoEr@^g-h5 QA2Q(M `F3 Rc.eJ-F J`eAm1xm$/c"AJ |Ld=~WOr"1% >£?|{o~Woq5|"7bAcͥ0=S'shۉ/|J1 >`l:6hK{M@)-KݐAVVnnKۥM`.*Y}K}= m )H Q(:[WQ7_*(b TYѥq(K+~!_=}ף+BU@}";))hSM|Vqš-BU9t"Umd'ZrcdiRZ43_Wq0> >8+sǕ׿"C|^F!:Tc-\Uc3XuM`p0khY~7I쥔HW0x9s IbO@ !l,85*ذw-Di)(&33峻<Dfk]O@ hJuIN&/xU<'gr)T*E@.U$DT#0!ɸ44t 7AGqu]j,jnDy8RDTW 1Sh+yzLF"^.Y_ }Iװqko}_V GC0[٩O \ߺʒ6nǁ(RH{ЌF >&vұg?pƠMZ*sa,eUxv'RKRVE(ZIy,I>] c ?|< v~?W S 1^tUPLL2\abu᷾J}aӜL5*y䰬&?;rrߐ'3c+hEEXe1a{-v' )1r;/ /}_͗H WRXD%~0>G'%\&!/KTP(ΓqLHcyz݃Ċ=C:NnU@(`ſ.Gr0>6~-~?w0̮* y#6)`D6~#3zv@KcU@1EqakVd2P.'(`j$Ge:0:*< 8ge (Պc60> [p+l*hk4DJ9I"7꺮'q-^O4`bo o?%ڷC1Ĝrsy#xIo_J@SVU ,9 t?1C6o|‘Yk~l 'AwCF/.Q qт+֯-4M~ߝ5 ڶ6XsHe\ʉ9S3?Ln=TufK+ -}Aڃ5D?u]٤S4uy hX6?!Bk:+<tMHPN+FLrcMU3m(2E4x JvW>?T"+a{_K_=l78߃2JF-c`n~zE`k,SS/|nj¹w=3p5 A9wakiq̙6M oU||l9/Kڶj_U XSل<c{N;p ڶ0}'7 N!FԮbbQw/(R3< gtޣ;Ҁjm 4ڶeʑ >H}M.H@cH YG uE?(5XQPL8耵-4(!$\ݝ}^/!xo 0ovTP (Lulv9%QG@L/'f˿A#l[b)0\EN~$MP9+D<9`I{]Qe;1@l몆Pk E)4MED[!8w*)yL3~@Y&- 8Kq-, x&wd+PPiE!@XLI IDATG1 M]!g+O?lPbS?o^=?t__1#.ӪڮC\kۗ߀tfܡ|*Ҳm +𛗮|{Y_p׸uL)DJoIZh޹4A<ΎB]jz3 ns !hP7̅5_՝aSR F֝nJ9 6SCQJ (v!pT79A`6b܂<{)R+vZl3>+5_NrO [õWxKK!Qqn*/g[p 059X;F1=w+KUUxG>t{>8Z?" pjŞ)@ 5,yRB)7 1xTڌ1VĐ\#\R }C_ưMV*ʄ['v棝!'c eR5#c5Z[:955{F L2(8Lcș5DʹD/vq 97 ]]#O=?5;tW^+_^["Փ.W/pPd,%I=$/K28\o+n؃s~޼0 [q8K)+*.~?}WϠ R]JFݘ瞤VU!dXŷJ&K,T̽; eXqբhBMfcwr Gvڴ6 Iař:nޝ=@uy&ݻoo[T!X)#8ZOZ0Wr()$['@6q92q8)dq(Qp70~\r$MQq̳VJ@G;;{{!f28>R\t=HChCs|BVd Kމ@.0m&":@k+\(@{kH]E#MV!%>A~8,g wv|6&)n !Û@`3l68NlJr@b ^zz?y?@z^%8Rj`vvv><\"p[o#W@\"H)@+ |۰WQFC!=f)iWs†4(E{B9mhK_QRT%h !h7k[93ػ^.^{{_۠b4S9ݷ^.~1GA !ߺq׿gXn{ߗ\{ꍮ,8 D6HzP3#" &ƀB}; _-rx1v-"5PtD)%PTss)0jOyUfZ!%0=QJ)RǺx m}{,j1ٿp) (I;_3#neRo}﫷ſO+z'mz~:p8Ϗo7\$ € =TډNfwLG8y` 9+T8˘\$X,e91BDRI(\|R5*{,nx)`8>n0}pڇp3|_m=8Kл]'[oi҃؀px8GBQdn[7}{PJ cO:I'c76y$s>R :yj4/}=PkHl${x=uRJhۉ0 _ Uu*$~詿W$XrJ=u]ar­oR?~'gq7F{g.=KOEL&;ŎƒGo)(9>kyQA|X{{@&XX3~Kw.V9W' <PJ)X~D`)V9jzj׭zyM@MA~Z0tHEݓ͡l; U4KFh 4Tn ة0 c\e^c4R|h td(iskeJ)w@hv1~wvv]Ùι Lʲp>wжCېr!Pw}X.|lݛ0 XksJ@j`ws䜰ӒQ).K2WJN5Fa"Po"U2e[0dd2-Fr Jkև8j4Mú P9E0o衛[P`sw_݇nО Oa38wjC4RL{8(>]n !Lom< ) 0>)OIlٌ€Vsͦi? yaBRDy"fcƼ( 4S9NԊGI1 4leICAh ݵLɈk ѻyB߻JNۈS* ~֋ga'{ ]&g/co{!%r#("96hm{70s~Pn"v?4bbl LS9ܒ!J׾ꅽwBxo//ׯ_hT~ܛiT \J`%&vWs'5m[J)k0lhduvk8!: t) gÊ@'aFqz! o~~gxM ڦ玔כmT%XVV#URґ~<: =otm>dU>,$_+v4:=Z1ƅ>Fܹs)%_6چxԯ",n_yO_x_:h1 %ݜol=8g9ĜOΑaГ9(|jAOOOi$ ux,A Z}\k_i>i o2V9=s!v]?P 4 CXvH_gw(ELt6cBq0܍lA$֓0i1sw^w(9I_iX PZc}p38si@Xp9>|ŽO"}M4PPh 3AaqB#Ibc,6h /on /G8r'ycmՅh=)?0eU~ƿ1 {w=Ryk)h q0\ Zrjdԗ7+M(h% ӣrJΈo ss=sw)!$unC6$%y8_:( ߻`wxc3"+JU!mBdgogΜ__ b4Ճr=.J@<;u+@o`?58w)IYH=4RIB@C'3]?V\1e;;!wz2wO00$ټ4dA;D.Wp7Yx$ O_ oC)~r;pLVu=xd ڶ̻J)8x 3%RSS$kO֦pzEW޺?}i|Si_qw8W)pZy?@N,PA۶膂!цP@iͶVf6NAUʈ-qvҡ@i *L`OCi! Waz-zo"yoe==q-o fsŧ{i\At%w^&^}On^n_ /MG@TNm #@' WO],ACO~ BB_E8tmz`u"G!`>:#a" )A KQ .l R:6n ؿ]| > zCui]/~%p]ՀoVi:k lj ޤh8]zΔA =(aa7^{1:iޒB56L"4Y ՘Ё5UJ<I!ᵿ# ?'m|Q8|~PA]{C.0`I(xנ"B,IL:w,sH)9?\xȩ^CaJGl < BrLð ,P8sfoT,7-@9%IpÙ }C`9'l: :t]rckk[~?^Q]kO?HE7A)Jq.yA:MR!Da׿s^|ncN ׷yc ƸH)lyIOFFq3~(x7m~ υI|, BZ6dJՂ,^C-%#0o9RՂ~gn7O#X3RZdy.(Akoedzvd(|͈z]|W^\j8!)[_uM`[BTb\\!I C8Kf1?0?n^M?l!ft}'Ibj8\@5a _;4_OX8hc)pY?7фoR Q8 CQB+Nc.|uL8M8e^ &X"%.0 0Jl2:L&֡m' >s]?.]y տo翈{zzZX#=JcBI#s*davM =|oOreŏ؏}CqS.<.&O`[80nZ u#؆\8kLf@N#W.̮q7B2ג*#";m+]DSNc&v%. 7r8K?lw% IDATv/]Å+W~'C8uy.!@I}R`BR+9x ^ zS[CDZ\x@憠zSPMADZ~v(de rtڲGA\SA@E{*0,KYPOpRH2 E~WƟ[k~mQXܥt.\ /e~eXJspot=Ci(V!XdX9@MA=)y ʕ+?n#&`' fMɿ}=)>i6zh 1E+'YZ| iU0j„G؋1o97o}${I߼P$UHFpnpgܛ"^SI1Sj0@y/ܤ0l rJMC>]@vvw1sS6߽?IlN.7Rƶc/h[c~)n5Msi}2n1x&zKNcSΤES` !w  1Au]Ћ5ZyJ?1(Eάֶs?.pa_/k8w .]WFӒH%g" ZdWmY !wNp8?ՎQk-B eTJYAi p"P)mg?OMlor']'mg) p$X6AW_SJ!.Si fT nbFW(L@ޙ= 寡%VJ!$ r/xJ~kM霗Rkq)]$(ⶦɥ/ s̓@hk1(膀$!]#et*G g5)EƇamTޙ]LH1"q(T'22%%d,^;.;H@2?lш!z\SBRg:i'?i̍Sazm+2a\v< $11Fj ;q.BBH 6,屘eUci-%bӧ9B$-YƎ}Jl)Z.QP%0 '{2k`V YFIY93H xR &Xt -1!ת 9(:Iœ1s@"c2ĬQ`Д50H!, P%!)4ΥT ?Wlж-~g~ӟ翁$ʀW=Z q̙c} xR2pcKbm?א#roZDwǜڛ=JƐއs9S-1PFX4&GȵseN.f>2?Wptm뺛'W۴Ak#`)p>_nb  V< @+I|4 ͹J+e'JQ$9ƽ9.J1.)#G.R7P2cyk 9rdLX,pDEH<) J=FZZ=NbkiC'JFK: 4w)^d!AʄT`9س$O軞2'1J5yCDm q$Y_ආ ì }%0!4ptWk9'(P8YH'ъSҀ)99;]g]ǼBQ0B hNN~bF\#/K)0!\2O$} U:˜SLINjCC4#9I1Ș[OZFkI(Alz&@d%Vm0ҡY ! C R5I#p⎗L:Yi ǩ{5(ᝃմP2C0+$188 JFO@i\qw^?sm>_{F7m@d*;M`=+f)0uYk}L@F`.bQb"Pp8 d 'ɔBDQFx((rOPPi[,Om~dfsBfyd*9rEl pIl>E=e26EA6=X+: 5ڶ|Iۢ[tFo-%`>[0٪Wm(bCQa>qs^20"s)ZQdn EAj5~I\*%c>iд-vžz7n7/h7'ܦR`Ts{<6&0Ut)9̧S{F[=Odd2A#o$4ĥ[k0 =hȇ `ŢЏ \j)(sЙ1:ki{! 3|hj3)f%I>H dh^&*cYA )Q/P޴)E h(ƌ]6ɵj8ؐ6@i KIq`4]׋ @TzņqHq9!I"^buZ#KƵZm "X(^s9gܻwk{BP \N-7R=l)Xpk2|xPrΩOJĕF1ia93֡/2]Sc bNElIyx?(B VH yY-C76U_-ݻW_kk{(Pt;R Y_' \r2! 9CYv̜C&ac| p:)' =}p%q:G9c@P𤯈DdJ5R2Re3_;0 Ҿ!JZ68QG2ӴAxuЦ𜞇7\2)fx/z -rNANbuE*6#6rRzAe9huO\,hCblNQJ`j뵵-68!(1_!C(R2[Q vhRqgäaصXLQ0(-ǥІ$|L)hAlZ{oG =$9ZC`ι1.%i=v)Zk1V-Vز0mSPFM1"EYKd1()b>_YJh} (V-9i=MrF4.bHhF 'rƭx_l+.RrbD ]߱"E*Rb\lJ=.\ƣ:fVl1VQܕ@΅N4|cpHȢG?c( ݢc;c9;wdXAzAL@NK @%_MF98JmJ6:;J\ ǀ Μ= 8aQ2z DՇqIRTw|6~h c(FqPi0?ж<*C䦇{3g~#3BFMdc 8_RF+춫6XPyPɣ' (%GrWjm ~(R` 8Cύ3ڐetJ[q+\jq5׆^{52%sjF KfChOoH*@{{ BB 0 ]v6hmG>s!@5Ws*שl+ȶ^_l+an= [c 3-mFt6cW-P.[snd]Db JQUX dr*r*HPk4:vڎpb/; %DZ#cz e }ߍW])O1I1ؤ1)1t鹁yg%!eܙ ((4,mЊLp3lX=G9u C1I~# IDAT' Xh0edVJ492D*RW `YAk&V:3 ImJ~@vwنÔ<%A!|Vi ]>f '`H _*5O"k&{z:=A9'L&RQR^'#WkWMʮڠZRR|M8Zi*R{HaQơM(`1_ІgIc¹l4\bMPFi2iZ.?5$>W k_i>o = 8%E~@}ʢ3PE"V[.J@HjZƍG\jmLq)8-˄IHmuiQ$nպhS 6P !*fe7]T\.OHbچM/Ei 7_$>Ez=f#t:SJ dߑ7%0tPh1Y]gX?/Y0$Oa$VdBK\:DnB_-V=E,[a=uD,Keס RPRyPV嚢d)J7[k b` XQ;m8Ds*$ZI϶AP5J6 "@_ F }Ji9ы[ӆ 6xFȍ0iqɅ n=+\s/@\dB6v RGCS-)X־= `kS˥5Za#yr<.F\ fz[)xޣYtJNmmG/MG) {;hϓ_RdBRRGh0'~ X 8lvBUd,j,)qq#l7nRY;mHT_#S/]2ƊN_(\I9KB2 /V|MC16q+d M;Au=nqm%R-TJa"B€v'-#|.S7(RB@aHªȆ֒R#`YoҘg# m1xuZGE^QAlb]0 GF<VjsfQSlCH) J!!UɄ,Y $S|`,֍cAVX×С!IؐRh'-fM9"L8F%BIOZG%p%/zY=b$oex=}yYzenHI[d+XkI%KR pOG zI_C47z/>㢔Y}!mt6V2r#I6c R\/.T`jB_;*J,gjTLf U>8yIi^|NKZsw;? .ESJsYJ5gƤme'B& Y\`K,іJ S!))m y2MUǍF,^/C:(Y>Ԙ ZAamo.91)V zoDrUmI~ʬEqKolx|,P%GI%P Bj ABNGfɄ/KeKZ)*ׄ^ ]r뼔R N(E8c"r vwv$:!$F (T+ c,Y294˜Uʱ).?k, P Ī;;VG*ZAn$BLXO_Ȅi`YV"9CKD%&MJNb2+e.AKIl;9\ (%|߿-h^M3` h_h4,l}Y$]zsΉ5ں[g~[Y?/q ~= ^8sXxfި9S%` ߺ/\ӆM \Sk Mh#@%8$m%g(Pp2-wV! u9C9=3\ϼs3 .}V;xTwש BGd—E<ȩyC^G"]@"|LϕO"Oً2Tc`gZSY3k`Ty6"",Y'=s2 /^bw}L ?}E"z 4ΐM].&(Ώen{hXh{_;%xºF㹋`Xh-3U5ڀGh~zz!J`( 8˚sX%j{B.a#D:ED(A!=h EY]S5@pb.nQc$ =|ɛp~hky >DӃ֌X싕hSy0$8W8!$c-Ju]cUyaj1FAD1Xh11i ]\mnwE ~4k A@k2Ɯ !{w݀ QYo(-5epJ8,,$'P:2Ӕ؇޵sMf489-:V h%$mUY01Vx}Lc8>"u/g?lקݛy,(xPJ%IK^6""r5,FT'vE]T 4:J^QDU TioK"ְ1 PeӒ֧ D\P!aօ@iUrHTEih//HiϧBxz$ꂜ7@|^u޾:xsC.@ss XTz:u.<?t],UFI# ~~=heU"l_N)B u ݸF)$jf]J*8Af9|$6V_~~9G9Dz1>E P¨+5h#q(5Rjp-ڒ+Ri8TKiP5Uy3=UvkuMf5(p&hp α2VF9i OV3 LVrO?#*7p1׍udLYR&]hY]A p4jD"qUiϤPa9Uphud TBA%x gi`yGs"Ԡ ?Os`yhbUj(uUU;h,hl7A0 ""Z~T:P2VT*IȌi*wjOXCd*Z}h izk!V#xZq..;>᰹>g8[ x'}kQ 7=*kήг$tRR0,,A%g>h}G@-T5NbȺ7p|mzȋS==EOUZk!OICM@gku8M@ǧٌv~ Ƴ /h\-{("!߬ٴRjhpT6ZIDX$HȺQd2[-!ʗ ,(.kp0 :̱C-P g gAhʡʓyԹ4dd($a(kkeVо -hXkΒ9,A]Aʊ@c4,<ţq'GqN@Iئc8o4 :- گ@{"Z !\85}+B*9YvU(k(B]KE&2g yPph,Ģ@Fkq⩪I{I0bmfER"!䫪&VW] Ѐ c4 FԨA]KRR@*X&''Q ZV` !fuYɊH6<$`0`'tsk+6Wsl&\ x&] VC=H _kߞXT]iֵTaOi?,,5k-=𨙆yJOyb s?͎Ioj "#Ȳ vQ!P AhMVCKPJiœ&yAf:6B;ٴf%MA*kITZ,*u)oBrFQx`<͚5 Z5gYAbcm2<^x5y7ZbLa$E3/% ~U){]:Y'Pp8>K,1șUEm?" eR?uA$SRd ƫL&w DjatƚwA1P D>w0KM23ԏG46#(cP EU:@@j Y+h5TIO@cfR>*fM-KYM35S1x1̼IDATR8C6hOnŦ̈́m:D: V [_X{Sa꺾3ۀQ.#K#EIWV%"CD0l2hZF&3`~.}(0&4sل p8Eӓڇi%1хzt B[)V[3bXeXp΢.gA7 )oS0Nisib<`ccuk+)x"Kkj~@|+qӳD' 1as0{kV*o vkάE1"V"(2(IlYxh,W&Rs4t֐^\GOE>P]Ω,b!=xZjHEմZcQ{UU"\1ҵ迳;wӪ(;WT 8F!Xb}%j'kF NNEȲpCACZiϾB@/!,@;&ɥTpbz&\8i<)`ӊ`ZFMcO&d>BN9~\9a р3>NIJ0h<VGXx-œ + ]Cpk{g??@SDQccxO XkKg.}tl@#cJX(\[(\(B=;5`\q_gIqV18sBZǘE@E)FJR]hCeQRN(~~jDN|j[ ܬ5t4bu5kOxamZ%7~? IzɚNgx[;x/vGHVx8"2|xaDuKrs˷%tS}S[QE]8Y 7,'jT]c0$f#,uٔʂL͌:gt^Ru@YJdY6 @Uc$@5T]AiEZ II>Ȱ2`:W\d#ǣ%[v7 c.mm<xsI gq }tdHaGUu#s7^(mf fVQ}B઎A`޵^UYkF8C9X0Q< qk'V2qz3'0VS:NȲàsۧ=3db=_@  @/u'>*o PPx<^ZT"}w~^DZL4ERAkMGR%+%?ߟAɉk))/f1~n z'~s6K*l5=x}o0) <bOg"yg*"<>'#)vvqxt/1x o?Pbnt2g ຩv^ .PWU1UPJl'fePuP.k2ͩU#*d $,paeTn x-ӵIܽ ^l%ܭ'fϞo{}=›) =D4[YF.b05M([o!h_ d(B#Cc5R`Z{{{(\Gc0P{X* FZ |]{w{pc}s O3|#Kŝ@<~UommNtIa<$>F He0%TMeZ,V0"Eq$s$G2N|m.%.j6+T`7`Gq?֢,Kb6!^ >s,ː71Sl>^>z ~EKkWwt=96?yڀ^ āH8$H3}PbZ*JIp{iP+CLϾZ#+h9 $ 5$Tyv*t>?8,O_o' _4_ p|1uU*pY-@ (˲,,qppp-Aн2?'~'~BD~rw.?mr)olNjGxs01ib>\*Gؐ4Лc| Z:G /?ô(}/~5Z ȭFU|g c$-eq~tD'Ogی*(0#/m% lF9gY]YVi,ˢ!\4|}(ԵR u'ֻ&v}ZJ6s &I<((HX|'|,;]M{!.oOfM:p)x4[[8J b2٩,*."DB`8(6Ѓ<ipx^ޤ/z #Kz lf:9NǺ3iҌfqT}#,>r㋖1;{xr϶v9y9yͣu$O\yJ0adcdi)-r B/Z֍_ndEYۀ"u`F'89wӽlGZ}5}{7Hwk=B V]߭zVx/]J83F?4@¹?+Hk讉Hk+5Cȍ/[g>ٷb;g.׳װ"IIpF@&'ߜ@g1v>&1)\/*˵0/7hg&VDz<=tc= 4 8,[BmE^Utx?aum*HQG=f&cki1 eiSȏr5osIOW{3sBsM}O!<ȹ6'bº/s[ƧR6`Xk] 'v3sVYxMAob;hrNk׳?:D7ۄoZ*!S=WDEURbZ)Mjl0)$؉dBUUEKL>yHs#]OqsT8,X\7LE+do낿y}+p6UU^cG dqJXιg[;G88)o>F1V:MD& AaF1,FGPVgd|sPkIB%(5LD"JOwG [efr7_U@wty|",.ޗc{6[T`ndz(r6G)q7Y0.Zɔ߶d^C[0DŽ( kSjM I50'Ť6'eZhYAy?\u**: dgEdža7/gN{]?|3&2d~]@{mgJoAPUՉv92Ɛ9˿c\S]~ɣGKz7xCvNZP^xç DBDx#1#?g~b%)T:4hR_7-W5&*aU}!ƣDyM~`oG/ps`_-m/3z,:p;Y˞v{tц~aq>K[a%u]?B` C|`u֗_~i~UF$D؏ԏw==!vaYtJD9 y3AtZ $ZcVjLJ ӂf<^^(q|NH1u <|qPEu>zil{[}Ms?""Y,Z@ X}O=z϶z-H1/gEMq ~_DU[SdpQ;gN'FNU9-O^~cpyӨB#$%UyiJ\}j|skc}]go{?ؗӃfz}E^].w7ww7vsh?<:ˋum?>xiEoSi ϗ[dE eCa=>vuuP͛oI4|lh۾D;.Ϸٶ~w0e@ hYVm ߦ n?JZk=7Et iφ_o*Տaԭ``qV8kNձSVד{˳r-k>g/v6ѯ߅wv>-ܶ>+ YC8onnpg}`Д;琦cFQ8??)i Q!+^6,Ca9Z:ەg'IE%o]An:Zm7vW{ J7O3]!0\<`0@`)%& NOO1LB!4iOW~ϽN^|:z[UzW]w5u[.vL짃!(-@H 6ӧ4M?[㜳.O`w9f}ԫ(oQ/s!xӀ[[_mTuů&d۲z <$ Ax$hSBh1cjs~~}vvUUa^l7,"mˡ/}>9zuF |ju__m뾻{0 V@-"̅@yl ۂ`vo 62+9c`" _ek-~&ۖm_!/Z! p-8n GêZx%Ճ1B-4xoS{?-~W˱';E-./k8Ճ0wVe+ ev@-p= (s[h[pþaۭRnL[/]i-{}ooz6^+`яd1/ Ka{1E]|v6龻l[oz|CګokAK\w7Z -_< pᢺ{Ex^m;h !YmW`K`q9u]! Bڟoߥɶeۯ->?^eB 0pa;o}VMu]?C9ۯ`s VA;󖽾i7ٶlu'{4e+ັ\{Zw.!;YBBX EBou}~Ѷeۯ->C?~peۯwcO~%k >6 ` ]nѯ}׃R!\7IW z  k?z aw[}@a}UW};IENDB`mono-tools-4.2/docbrowser/theme-icons/GNOME/monodoc-24.png0000664000175000017500000000212212413742070025324 0ustar00directhexdirecthex00000000000000PNG  IHDRw=sBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<tEXtTitleCalculatorJH^tEXtAuthorJakub Steiner/IDATHMhUw&4_͋*MX0.ݨ ](RЅŝw!-( V۔$4i^%/3f{\ϼɢw3g{U"½ %cphdi%jڒթ~6DD||8𩖛IeEmN{Ώ*pW__.gDXR6==cCD^{ PC9zk)C&4<n9bU(TkO?_&ö-lKaY RJEF0&6,j7S+333^J6֚|> OYRռ<p{сhQzRD-Lki#\ [|gDV;yV q@h< 4%[Jϲ<Ϳߔ-ʁO%}+Vw[:1]Tgeۢx=4/5F({.P =\Zoc6FkJIg$pb[Bb|$~qS=PDKKKw1`ˊtTMh67`11u]X" pX[`mwzOuFnQxAp+Dmv]7#,_[ݘA4ʊm<d r4(6Z)~f#ڒZBQl\]Vttt b9ǷBGYFsV@3gV'&&._fʏw(Σ׷ Ð/^`dtl`g_'[],{GO>r e; n}׽oW?659t ݵh*O6!DmDEH~ahvIENDB`mono-tools-4.2/docbrowser/theme-icons/GNOME/monodoc-512.png0000664000175000017500000072136712413742070025431 0ustar00directhexdirecthex00000000000000PNG  IHDRxsBIT|d pHYs^tEXtSoftwarewww.inkscape.org<tEXtTitleCalculatorJH^tEXtAuthorJakub Steiner/ IDATxkliz{k9ݧu23D`gX$6DL䀹& |i " LF(B¹)|qX" @083]U^y鞞q{f̜G:{ﳫjzVs?GZ9v)7~3og2v_7b`l983ȿ{;g;g;S?c߰ρv&~>xvv}C z_W| elg;oAu^Wu? ;g;پj{L 9;˅eי'(VJiuQ@ҿK/N_+7ssp+cU#X_QFR/%vv$;{'>w|qÇi|8*\]g\RK\ZsfIJljjanT (ZfYaԒnZጣ; hwN@&LLZ+z4NTU5R+Zrn}@)QLS4XB@T#Ne \^^2TzoV+B3ovĔQ ,F1?~w@|l_AyG/~#:W\^1X*iųkwuzG!n6Γj!,u1;{;❥sBJ! u(J8)H1RV0`afwmq&BZۏTKJĘ軎Z+@dZYR,cJ+bJV+R 0av(YzaEYbZ'ĀRü;Ldb`0Z{!K? {>ۼ(B>~&y Vkl7w;BlBZ0ZSJZ˪Qb5]qZyUa5cZ)Rmb%ńur*gR8c"ZrDža'oy1Vjc:y;w׾y@ib^,3$0Ff%$Z0PjFk8 m⠔1a58cQR8o8NZ!Pj&؟>`v)-yzܧ~+KTB}i>t8Lϭy >RY PdW`* YBh `]rYъzv9KZiw(YJ\h|n#BqRX!e1yOk2}wzmeRZi!9TyZKBsΓsaY֤HY"0r:KN%7(*\vkyJJg(d#yΔ"B(o󷚛s2>퟇OAk.~R_Q*}rtiX(rs;aX6k}ߓsX2*c,Zi FW[fwGf2 9eutM4 EZ p13sdJbf^!Wnah'>v躎Z2(ML{"`5 Ҽ1ZF9sRI1et}w̋cȥ`} C2)^@΅޳,X'Ąs3)c-8aaß#B} ;o o}SwO+XJ^pN?33]ʥRZΊ،LZzPQ}GNI9ut޲s޲Zut֠dhP2̿Z g^f9w)osBLBՖ%4PqL1cRYWL dJܾnǼ$Z)aaꅬ:ׂ %W-ӌ{@`h8]t:rhХa -Ke6XNA{R (e1Prd!(J@*.eeDqc{\2_S%\xٹpA?7VİlM9*ܥbqP bQ=1E}U 1X !콧<`X fy:gخ{Pe02>•Z[E1: 1E,13.3㴐 R3 EJaDkӘV..6FI}R*Պe^)Д03=ZK'֚RTC VnEG)L;#pr&JNԍh蜣 32C-M'<?OΙ{OWW1cA+ò,hm8lR`{UvğO//>\JyR̼wqrV_ Y%k8NCY+EwnSr&Ȫ_q%9.\nV}G5c(y=_k#'Tck1(0 PR ] \j^o8G3hYAv$@Ci[Ն~zoAɬ77kqI@DV9疭RJP+uL ysl[JN,a&gy?oݺE)eQT4n'$J1'%/-ܿ%iil& 4x9'?rϭ+gM)̏_ ~vRۡ{mYORY0@5Th3펔 Hi%t^)gpq9/ٶ֬Vkn2(syڳ,;tV=UǪsXQZ@m$4s"7+k2fj=cOJypJyumȩPjfg./.ҠK@w,ݎ"Klm4!% a8LT$_ 9J,lYS$9a%1jM*{R r>;W| _`^1 :֙S&^sPZZE=d>$ol> e"}'k9+EWÊa^R$іܞкruyś>Fœj]څ}孟G3{;{پ}A_֗RK!).(3J'R.~utNnI\M`caT{ͦ\n6б=CgجzzoyMy[x2(+ׇ9fc`?BL0-- K̝;I!byfekelB806R*Zj`'Rղx ,41Fb[yc,;V8+r!0NC͙X ֶxΟ*)ˁ6R#)%B65n/֒RndD)w*d˲YQ5lm <^ڥJ ụk ˿C07:g&r)L$‹V(  .P멵p;YLi޿'a?ggV}Q /{UEBJ'rĜ/og?˗;+ɀ;W'<&Sc%NC@=t%r̤+CSIK17n_nV]u\{6CF]7n -.VNuvfZkBLnsd?Ews@Mx{O?8Ĕ0CRXcdm1hp RJ /:}uiPJ15\fu[O{ 88k#saEc aŲ,\H0 ȿ!bd%-˫ VY1^8q]G5J.Lkجה0ZIɹ^pqs'y:GI(BqZ?α,g w"*<LH D?L(j{a!%gNY0 ZM_׿Ht3M#(El_H6\s]']xc/s6jp!R TRܽw(k? ߝ=`=d uj[ˊRR[)Rrpg\_5 \ҥ,m:n]letְ]u2;ΝҪܕ֘/~_?8'v~ĢO\gFv{Q}淝sĔ;nQhw_C(1"s }0 H(er}sv)ȥbRz<J>Whm}'ZFӻA2RV![Xyn﷜8まC{/ՙj4hJy~c}EZ4(dEH#zM ,,ZKgP <ɔV8w[<%)EiG|;ߖ8-T`و/bKDȻ9@a 1/0e}s?f[N|K%<nv'޸a}eY^F}0<]J~:YOKE`H%SS W5@͑f@Suso}P05)WmZr^%$Bs%8")AR=;B`&!s̬ @fe^ ໎Ohk,JkIröN2"wkBaƉX8\l72텭-g((*V+wtqG./)IIj%l6k!Ŗ4 i&eFi07FpK'a"9GΙ~2(K$۾d#VSա}9}׷ʌ)[Z|1!kaFE)8Nl7ri,Z'P}qIdBVo[YD'e4$'_qA&JYs4 G${^7U9S LoˇPJy#?#_u@+ ^ z߯{'VWcyP3˲ܶ^jXLj- ,Xr3o XVsg+-7lњ7;t Uәoe$>= C$a ,0.qIcoFN#Kz1Syg-&EɪkEﺞeVz趝M2Lkᤡua/2Ƙ6.gYD_+sfٰV(mZjl9HX4F!B@m=Ԓmﱇ> "}&}{yoy_ 8@]ԇpBdHk8Akqd^}o{6=S)J]O=%C9A[+k^:wUeK\l!+F(o|Ȟ@\+if^2sL1O\c!Ԁb[z4ɮ0ƶxyKI[^fNˣv}NZ1&AջN9ejlh4-50rWT>$7;yZ}Z&yZCv Ŝ€ ZKҞH1 9 ZNnRƃ^*$ķժ)PZqDճ{[K9-:q16N'Kw_ꇮ1xI17vֵp#N88??  |7S_ uZm_yyrx"duXY^"NtKaY)g :9ߏZdv>R?n5һ:My/4R66D *92-RbdIز~$"8݌ #Dɵe6r _J9JXg<<3 JIv^EhC%ӘԶ5 Yֹ֯X=%GEV0`{GLaX*"Z'T;m?޶^yrXoQ8/`t% :0A--NqNA߉$kz MJu+!(Aia*-F j.1 k\#-2w ʸ1pI1'7j-Sʙ܄qxmHo{BK{AvRN z=FՎVt-`J0RV_ rկHMw9K0Lv3CoML_wGx_ՏlW*w-R!:MSv_b}$^z_o[T字FϕSz)ބ?;)iCQd:XjCpݠj!Hj@WeI@k$kSZaeUne`uϥs%~\92.9&b,T%͜Kn;)_\]chAl2x{Eƿ.V:߱^8)EAHzG êgQ A8Z3.3WP"gs9vCZaO\\\03cȏzo MݝD'bPmTAj`,~bCӴbe{GXhT%WkX|[r&,,aDQ,'$XemRZEGۍ\!k?!!#nw`Gn]b9bPkfY`(~G|rQLV_NbCO޽˿1"]r"%(mZ޽]ׁAod=:{?S?|Iu]~OZ_Z?UJyt}_kkS)eN9)Ok-q?s?sۃ??^qQW/-KzqRL޺;dձG^H&oкa3 X*X]H|HQL[d˚J6*ta{ۜVkB*!QPs`mK~"L,'mq%v{acKF#^J˻VÚiruqoG2a D?5Zu 0OPǺٮyh*O=$;bT*ݱ6KإHSjAhۑ{s="700l& һ1 ]GYu=`BkfaoFܔ"yzՕ~mZ a6@k 7՚q?&JX)ƓM-,~XGa^o+۫o :=6$3?TJJZwz9,`SϹqX8ejhX{\V7Bk;p>=#rxW8׍*qRZQPBN@(db`0U`(UV@[Zg5m1hŞV 1]Fg8p-rI%d`l/v{d-I2piq<9rQ^r:W:@,փ _(5 i(L:+hH1"r_i$Q2RwG(M>cX(m {EQNeM8]Y_QUqs?~{տ !|ƛ׏>O~/rR?:l6nnvr8ׁB~3 NNq8ũl96M vN uUr2 2+$dCJpջ6[YжrNm-JS|w}a&_^m6H{ByR[43HPP7- ζĕs/c(ȩiX0GyeFaږDqѴ5N#CQt+GUjʜbM׮{)EmDOck4bNR]yM #S\ AiB46r+c<_8zy z Zދ8Ⓔ׷]yt::.v9%4-7>@!CZ~59fv"`)' ׄuzNFm0`UxJsMiQYVPO%qlKF@EJSO/u~;B_=G2RwnUU^),1}>\\\`ݢwν֮EBX.-c SWMsup7B].ZHVc#zkQYf}u#&*'c0͘|aiƧw#^FQn#C1!Ba2^$Ve"cbZ~)kÍ$nF!gڵڰt:hnֲJhq z|t5+eebϳVXIa8o62cs cij%\.1x 'yxtQ 8nxE5Y],,&b\VHWi.cS&BAmF:T*uN* Sl/-if;^R( ֲչ+ ݚf{Z3b+63|S lM*(TQT5SeXU3:=Xnqi.6FKzZ!eN㤔q^\=b[9h0{izP}dn6V)ԕCL4R"9rQ bt^&·3ꖼq-+*#~v#L3Tɨ Xf*ct-6&f,8l;@ Ok:/î8\)iW ٜ܂Y( gcۑ.a<=%]6(=Z3qhV`YTȡ E,qHp!^ È"qN#?,# k=%N9I؄d/uZ/~de8`'~%7NJ>xoȥN' >ۿ!6{4u^5rbZV@pUF~F)WQi]-.+7Cbva=Fa+eDkQgh"[H Q1&{yXN7-G]-ǃs(JB?0Z?X N{L㌣e-)/-l֏wwh~ !-K xs8LA3xŏZYC 0BPY'8l0L8@u",~ilH WF-8r֫kׯoqssK09"!M]I[ $ c60m4>ߧ)p48idVAGHr_'ံmPa^J8aY֭P%C?y A cٗ?Ѧ mZgH9/-on8k&eb]mۭXb4x>ɚ= {Baqw&ٚȉ iz'(Oh7~(??7<_%_+2{su@8J#k &`M=%3#m!k D; &͒^(ɓn3,Ս!*hhR<q=ș%aTUcBuJYVH00Mעz/sF{q{ -siR!CQ ;Q'2RGض-4JiiavMMX:p1pb\1m!销H,LUk9Ȋ~?70d4F\FIn1Et]'X jv1sˎ#$+V- 3Zt0fs5Jd͓8.RIO'n;9MS4PXp/9Ejs%by?CL%qnL,vPCͯBд %wÀ9RcsЦoێ#)2gf,$n)Q"ScJ$ק9GvC5bDk`,Xΰ~ZQ5ъF+r1=|Oow7`=+~R/տq/zL}>ǧ󧻐 ;>~p YB2 _&Z}t+>E0TFֈb _އ(!qC?O$z4qέiE^F$ 9g6\_6yTq檕fTX B"MӢkF^F\ŤeRB~gej괌Hb""!nFV_OmV~c@ekݓSOq=&\@UH~tɫiMZqr땰hFW7)Q֧$>Wc B,061FX IΈV pPq!&ĜQJFU5 % q5oq gp=8,!ƈU;֑JXp(4‡H;*\v@):*( u&CbqMB &t̴tRXhɇ(i\p[*\% ݓXyp&i$?c:%z>gi0g+i{Wx@/[T?x7朥Mٱ3CVH44JoU$A lݒxRL̗2+䁡VHofLj{KOiٖ ~02O36Nbk՚5k1SrC&jV_r(9kk 4B 8a^-֘(ynR Ti Ӡ@9o)IF\7|` X'886UsN`Gaq=`8ɋQVaC-$W?/iC@A Ȟk8z8 Ypţ̚ z4zB)4zJ+lv[8sr#ચhe` EJ i?Oi~2b̸;0:hj]Y$mM=|n]L5!QeϢ,7L&RBiD\ C1&|?7H___p+yx|\*6ׁm~|>~~6šnF aseh|i3O3fmwxj ]ӀF.wxm)\MM2_)jG-Bd[wm /.*ǍZ8W5J8vzԕCIy0K&њ?h#R}ӊyBu|s(ٕ6k%'\u]iKsV"ffd隄Q1L !Po E^qhڦA6ܴGm6 I axsWC{TaJ޽CXu.PJte&ٌ$Հlٯ2Fp{Q buaYյPcNIbvqCU'?{TβR"Cp\:H+md3-yM$Ip J$ At[Zn0 xU 'mci/(&׾?gk&= iu Jk%Y zi]}p@CAfֿU&UbRYRk ][*MxŮʕ# N9cxF !fhմ)iAk(ev;3pXelY"!>o ]uO=y_QU/~1p~fĉFֶHVqi1M#E%6Mt+_YW9M"@-z3ѨaFubZoșq2 JkZЂ tkȑ 7w]Ƹ񍯣m[ ,fʈ+\2fO7:$@ ziwpDLƾRfXҙe0- ]۲ٰ;i:hhVNqsF gݠOA]#;I<b&:ޱƊNc&݈dJR2RL7TMtD3()"ںT(2JyU/D!rVg!1 iDTJTF^kZOבv(8C_m$rI&5t3ZY4ZDofHg=(w,Ƒ3x Nʹ`'0tm{\{ڦ+Q&l$C.IXyXL3[y9F_Uvŋ__]>|9*R੯<5˫yB jzfxp}s N^nWWAm ͖ܺU1̆-[GNP<ӎU1w`]kl#`m?{LcLLgąt%lMnK9O_ALXWrY6X:(3ArR@D @'[xq k,h7a܉N)'O=ooV( $`=F uYRhCI_7(yb 5qhi5M^XEZFnwU0%ncl-^wÃ{b)8I)&NRa,U0&Aju~+ IDATXinpuu*4nTyXp֡a|p}j] (&V d r̰5{`bYiqq~qk oou|#p0i?&PJa?5 x ]+|IKkiC? u0Om[cg|'+Hh᰺^/1'ɇW8{MOBdpVc@?pBDOlȌ8{f#wh;ģ.KԶkVd8H[9^w0Ju9L@)Z}G*僸`E];4mGSEӜ 4iCy4]{O?3Rѵ5fq}{KaCbO]\p:p?J[<V21݅04^z ݬҢOơvksE3a`_>ACA(Ɓݝif{xm2a!&(hYphմ- U+TuNHM`Ƀc~-nLH<[K7j4uK=+1p_GLL4ZL ÑNNX }Vn/9 ZK1%c P`isMӌ%}0NEB!њ뷬@B𸹹 ·Þ./Gz KhY^JĹgX綾?2` Z)#{ɃmBcka Ok#MJPT5#^SFIsL$H54 >_a4l1 NABfkk*n;q.a b LC1NfZ!!,Sjqf׶`ulotedeLsVcOÈ\EaWAK7#e8=QxU\3r RDUעQS-ΒZA}^_>kc3T;8Mh$ZaTR5kJXM B`7;-ҮnooPee"4!~f')"5:|_ ə)ˆ10b^p?"I0ZdqJaZgГ+Qm1=6x䁜`+')2i\[k1X4ƑQE4;h#҈a$Zg1#- 46[|OX)|Bm%B3ɇ `8k HbS8hsH׍_|M55gx1* Kzu|ͣ! -d'H\{go6wOqmOg#L[ɇ6mAd`Ni2+#4-71QmVV8s%' \U+Z*#o03Zk`B8Nhj^x%lu陿8Up@UUy-B3 |s*BpIupj;T])fxt]=n3I0X[JΰuM2fɫxpJEyFk>0OQ5JZ4 k=e H8'ҽq`a 0 jfڦi`4qO'ME^Da\N 1Ĉp}slu<YTr~b3PF\uɪ^3kRz%.zM+8vx8 ޭ*k FL@@6n)/_0H+9Dơ`3W:%!#t-ζg&ÀFZ1MiF5VFs MIHY/_g)1Msh9%1+Vh1L#%$yq}}iI< jqԶyFtEib)L8aMױZܔH:Q{L_8=;FL$W3q`8{vBl6{ wQcӏ_fw4"gK+7*?OPl=p]ca۶e=R dRɌ?ZV€q\/icTm-ʇ,NjX"JcIBfaNd#Vaj F3eʥخ5TFV0"iQLS2`gQ+%(F3@6]*l+y&gx?bÒG0O"ڦa rlP9+1:@{FG(//=DHUޤ]UƐ7bJl_ܲj9z]oK{k@0S@=Cxzt:>p/"YNfFA"\$8Ai03*+1!iY+آ&urhLs+PY1{//quo&')`:??wOω'| S.j^nno%~n=]v;ߣ? oؖsr{Lۻ[m: ÈX&:55RQO.q&q/Sr^K؈ԂPbCu3<@)0UQpiVwxCO)Lhk,mJ(>l62rPB\"^77PСUn78ݡX?ul6kjR.L1ҬW{CFl6ImU#t9u0<%i1`b̤_az|qX"ij!V8?1' '^cOgĸfR()9C_G$(OS>Obe^sяeTE+3{R(?i@ QǍyU/Xx?b{q{w# /p7ϯ˟g?ח|Q߻>??:~>ao ]jy/.y<~zl]UEt  UM p\ysJF V O:JY*avA?zlwn&dDmd4k Yn2y DŽQKRaVx?X[g\">톦A8R65ps5#.{,p&CB#!df1F7F'+/ t PZr6.~)e=7$i}_ 8"ݎir`02oϘuEq93+%[ޠm[vB5v52ug Nf?cbFYC[pu jp:|C)gg6!qC (F*L izn|poO)V/S|\eڔyՋŵ.DZXbK̘gj3nStHY+(=ZFuͯҸ`{7Fp@jǠs6̱a[L8h RrF*@ab8(|7$^v®W*C Q qc{~<$;at Nq8 l\( 9Fh]0(9"Fύ><]? 9zHgg7٩U!r8P{֨4 'qС%"G!+ +G1RJn3?<@]w_ o?oﯿ>uTrxz T.SvPxC8aۋ=pyyE 6&5g= g(A 4ŋ+cqZPs-P S,^%m Mӡ} D;'Hs1bsp8$bb0i)%59p8`cftbb\)eddX(Ș8cmp}sH֔QRyyIf7R#=[^qq{8RRT], XYp(G6-_tBYlThWtQN=LP xaEȔ1)<8 }Oh0ΒZ.FA{Β-kŎ8 # ׯg=4{~#-h$%örNb@>kϗęt3/g}OoA\ b94ZB"v-r+8شׄ];\h x{2D|իo=&7>s<_$F<;;Đ/_VwUWw5[ 6e@%SDӴa/ ^^F0 €V^qaxٴa[&MCdmI,VuMo~9DFFx"MU䍈7oCu]C;\V8W]4x&`:ML$c{{t.P^=6kdLJB˛r!%Bws:aÓCƣ@#t"2a<1K`:ѵ-dV}$<16ߠZJP)sl6[+eY>2#[R,4|xxLQH/3"X~"l!3HqN(|-$̓} qG#o+,s"$"A8kHIXF((rf9Y^Pu50vwy"ĩBv](csi ]Gv@K_ZKeQrxtLf-7 -,ôe+Aj7+ah8c~tRqX,{>k\Ww-1DOw 3vPIH'v=*ze+q'EGn =yeO 17~IɆSY"MhQ'yprI&FXUѲ=H+&1)9yp9_{7Fׄ@=M*yW˫O4Md2ynC}4EM(l>z|{/[1Ф:'jhaҠ%*DYXA@2FX -(Bȳ>df/$6!J | f2d_xjMsBHuݐg{m aYk9y႐]i2o!9MPB12;a. IDATY@ 1ܸqrISWcG!ˬvԚnִRTS4ߵ)4$d\4r+}P؋@zqgK]gYsPb Š7YQtAKRg ¬)l&(]to11{9lSǝm"inַW!5c3f}f[B~APJ(y/j\In~wnbVVZD0 !ܘL  +J yp`9*atEJ5aOJ"Cdwow֚#yz,T;Jl5e}(%qޣZ1 #AWj`$s(Eg7WJ žD8蝌:jm2ݙgeDOan9ԳjyAă.o};B5\[M(JTׄX%C;<''cd"(@)PeP]ɟɟ~'8Wdk ppgOFD)]ϫl{?$@=|[]2VwƃNJQӽ()$[) P; a4L& i eN tCF)&ʢ}E9.%aDFQ"|YC*_U5,( V _PVĴ9'ĺi!Ҵ-;;;B~4{QZ4`hh\ޡ"+2zV5ya8 Oh.%Rx" SzEc@fL'A=1Hd#&Q54jK! L;(~\JiP(bFCr6隊$a1L @d<]I# s({kxj_&*!AɹҚ֔hnFB:Cyop8WdW .>V|Հ1~fdxxU{P)mrMOVE1k Mۢ8A0( *bޕYCZRj兔esCzN'kUjY1B̆99l =#+vfu= 6ͣ YoDg=os-Gֆ=YB4V8a'`j9&UUB+ƀњݝ] LRmÍ}aGo"n*Ɠ M0lpLj|y R~nݺcwoWF @;goV>\VT~t}KY Z\1?9m*fLJ# RjVEZ m]G&M(՞a aۇG%8xcã#asifM }Ѷ@?`ȢNc_و`OXZL'A]f'! e\ XEY㌦n\=LĐIPeQM]߾k[rAYvCCQ x}XVKk;s6ZRx|خ̹VIvq#@4u>s!TJ|4-ɘ ohr􄦮h}SӵlCuH" -m4O코0s^^i(ݿrU=6TVHkE!k+cc&Nݕ k8ExѝEAYK}{s15:mg5UWq+v)˚gJ BC@g4MCY 1д m1 0_eZFBMRB1L)ZA>|p΍H@J۽]фčBk =P {(5模!x,f}@)-AfGR*+JE9"DCv\M[tmnE)$83F~ @Kˠ,KL'§"F+e'|1r|:%MX<4HCw qQ) qgyN^\2{xK 3Y&R1P#j)l)q&EA HMR߾;=FlQ{a~fzI__}{?._;lk9mNömx<./]o3_mc'g7?2u89d׶}f$M`MFӊ8͛7Zz_eRDX\q^fE$n>dt.Iᕂaf(wl(в!|HyQ1sFF,,GQ{)4TPD@f Xm16Gͬdl@edJ I'"#B&f}<"5h=(ꦣ3nاi5&B)5HB۴][q,Y.C6S{j<>᭯}KdVd2tvV I DqZU~S*ܶz`B]6?~i(5MCrTR-*NNf(Nu?ߝ#h4׉Vs=MOS7F%A4La';k-0NX7-> A(AEB ('#qZ ,D]W(e|pcm \/8>&P,n-U݈ĭʌ;bF j1}2k>4oJ  eXH0SE1|xBPDiky1GVBM0q}+i`P̮?Ayw?j خsNOg$fD(K 4e>\eYބ{Z.hc(G#B}ͯ\i<'h$5%ee޿qv@֭[}3W{l/]wsyPj@pzzJB+ò :!DbyL)?@!-OOORUJkvvv#JiBGAC3 0[҃Ϭd(Os5XV!ܿΜW#RhzlRL#s>283e{LJBeaٙr2>﯒0YLwoT}^ -nsz|뛁n@:Z& !&5!:XS=|4GX@a2bbg:b0 X>re_<}v"{^EEk|.HEx!iZxV{Q_6X(F% =uyI6Ǣ^cD[Kexyu]EfSe! {c@|]n!&$R@~: zy|&ٺjsŌZXi/| .SqAT& Uy*"rguJ{C/}'E[U]c!@z u"3WM7ƊR iTթ0n4lG4= ˺c2/$[oV h/p@}~`5NȦ#?o#:ۼa Zܮ5&wmɮxx<% Bz=>Fhd"ҲZA2#E!SfumnZa]f;H5YػJsezCh3 W a]3rh M]Ϩ=jAp50I =DOSu2{ n._=/^Gߋ~UG?K-w4mx4&JzGVlkQ (x:Rk*MUHmM^ԕ[+⽽?#e^]\5?|A=W7UU>889m /sWhGx:eU늼qrz aNwE:xٌr>!& U]| 2 FD&F UU1L;aKQ$!dLRق1&D`ʢdQ-)mHl\[ Z*6=D {t:"*@Y7~W~+ ڧ콳o<6 xttt_9Ϲ_< !ui}]|`<YJƍ#/Gh0qt<#zт毛ZZõ5M]pP.ipZ\Uد2n ah {?-Y,d};XY51Fn8s4*&Rc͎WE)BƍU4zav*rѹf뚟FpY?:^/ÞՁJ=bhbƘ=x vj俹 Pk)G#ʢD B-hBkڢ,XV5Vk&6eX+i%7h m 3QP\Ydt}' PZvz ;>OpNDbI'KBpDm4U}nu Y1˛Az{'oV<6 pn 6۶Ϻc2 BD۾a\|sF$pS$rڶŇxlɆZ5(Yk **6dA낪0Z\UqÇ_T9)R7:y@u<:W {Y~>< =xD{rBQdR$ĵ23J?cѪIýZlc4NErS?~9`9>_ tc2e٫<>J|OTȠUcX=e) $\/I(1p2;aYU(I1ѵ &;ܛ&;S"b2-m4}__>g zy-_?y X'U*"/V)w]Gx'ۋŒd" %үo񬾋Z1$֐YNQ>o淿O;*G:<:f}^ OȬm,;u]ۯx)ʒ<шh5DD !:ʢMEk I4AR͝'9ݺW/o|}|*~m\Y|Yg;%|2'a%/2/1pr|4(eppO>·m+;>nwLvW9J~M!^-9Zk jX-\;uӀXSd),0pQk"1 bTdgOZʐbQ5.s{l69ɯگ}GMpk{ 20C IDATW=u'gWWCg?2U]tm;(A=!oޤdvcƣQ%#A6[2hC.BTx͙ٳ|[+ܽzWqUVد̣ ?ow:;u= ! =x=11m@ 1xTUEtF@,`2b\K{1 iiM5% 'ôBqxoµ@{QMg~^@sco?<,c;wNieZ5cbs= ;;߼&Lƌ#Zx<TZ3Q!}"nBLh-j{<'Lst}~Vmjluc EOg(Dޚo P)˒h.EYcy{;<~o x2I$2G  /11ٌ~~{g2{b@WM6{Ju=8`%guYv6R4Øg<%%17){ .VsdFҜ1!rT,D5/%Qs#F̎<&KߏV^>l^>>,v$eI){0ƓK6+}O1D~.p}bE2csڶ5~7><1>WȓvԞ4`n+^T 8sw `뛯m[fz~eY9J[vwwwk1R m+ ZN&%E)(˜9]cۋ,-?e /:ګ=Oc(%]׳*Ud2d9F(m)ݞNޔe(mƍEӹHxpXKֽ?>>?~?#oz/;YƨTmyʢNuc0:h2bdv-M=TSb<5p.F19t/{=z Mǿ76,d{cٶ {`–m;r俍 p[0pvym5;zH!PUbI}tJ׉NӶDo2crbA:;^SLހ\׸-,~V-T@f3( \@)q9Ge]QUmSpo*Jý)xO hxO3 `Vr˝Z!躎tBH"PyVk%E"8i`)˜ŢFkMv^@,r\H)bLxu Mw?x/p [<"_"y^GnU BHLyH Va^H@ .Z+JERiBhޣi?l;FDRhH/)ت,3S3S섣xxms>ܦg5qp`X1Q k Z=fɲ HkJL'rDSU F+^ʠ'_Ο>{w+Zx`dص{cg, UG7673YkN/$eQB0CRu6V8]MtQY*T }=dyA6ysNNPIIх(f V_c'yble73!81 J,NȫPYz }ύ7(#V,<t2ƹ,4M3&:/xx./9߿)}CW˖2/) MSԭ`2̒fV}Mݻ~hUME 7nQ-+&GGLc4uR" ܆H!FtQYq?xT\ۋg =]-' 5M!T 6Y^mhmm+E;w%u]% @ d|wcTex4*EI۶xh#TMKSlF۶Lo3;`q}ڞ&S?w6HCP@΋(dNQJW,gY *BvjML!2AESI0ti-Zxt11L $aF[b C+'Tf&n5hq,3IH[Ѩ)Yf99(FqM~M~K=&O~Xf?؝N9-pcs $B"pGB dx2tQ/2 1P#'Ğ,jmgΫ \sOŞh _'Wn~^)w[ʓ)fE^:) ډ#y>a>_0b`4w[,hn=da"%4mKe<I2c/])%͇9[Ն1u_㼔Cmuk3oDgk3 !Rg1_8,ĠpUC 5nlFU$`4[TMtgJ")arK<ǻPR2_J0 fێ,Z9 e1i&̛}29Y3O mՊESQ#SeP lT]#p!2;:~޿MN0B]]SRࣀ>䇩0;pO N_U aeAKc2, MKJ@ z7i<8\Wu=Yi(s9ځb2HJӻ]7Y5u]_MFӝb(dCb4qZug<*Wc̐i"'/uКΓWaGM):>P]XoCB UE[7mӒeMӠFDYܸ1N<@{?vkkqͬe7^ۜJgg?W| t]wggg?_V)|~o[^6ЛO)8wFVUKl1BkMfsZN"HfuSaW8Vr0ڐH]f1|- y._(a .-K#Ht$dLp!:@K 7uyW@Q,48h9NNw2B"$@eLK͛Եi{/"01&" ,M.MӬƦn֪E̒[CdLJx3ݙ2/PU41.1Y!N PP(meV 8 &<;t<˄Z[+hEYJ1)wWz޼L;9zHp oPw΄|9'|ZO!PUKԀF0!%lBJem]J~6NL?տ[lv?p~뷎ݕy!^[ݔ7x{uE msgG۶wrEmU6ݴUn~w#`ȋ{;mGb$DRhD?n̒y%6 zjp6n)SXf<QW {osamU_%;h#g s wG=McDz( P"˦f2tY|A9 ˣNHAzm2Lhk;NE4eI۴Nz{LZBJiN/0A a"(qלLS UCU5((@)A4Ͱz5fx vvX,u\M׃JyA` ?eX?}~wsr&LQgp׭*k {lg(b4ږd#ʠ"Z (ҷϿVC*^ 4 m_ZX.onΫWtgA{vykkX0IQTRhmzq*Im!{h6KJ} Z Ũ$~Ooyg9O_ݟfGw~s|t鲢j=sl.R34M(GkɠG1bV#/J,Iڦp.deIҚtJzF U{XId[z;Ý""7n9ݤ(nіD0=&-( n0 ;Z{gW4 XaX It~C͙q3zʗU^ׯ:@"3#ndވ{}a%A+hIXlUJEk2-,%B$,(}0#18h[Sc^fBtcEIyY.Luv;65)%BL~88'aHYwHiv,.ƒ؍ 8,ÿx^I_?⧴l(J,Vڏb|7)J,I_W޹$)JLSJ'??җ OT O[1 ~:{@/=}*\\|MT\ҿpyOZB Uuv7ȍS B M ]PrZI?YZ`U Ư/~W2)efX0N0I4횤j6wV}Qc#$^ M3FP>x("=19gJan Z+ GGyEyf6BTp|tL?r-&cd6b[Ǣc1$T0[s&Byij ƚ|Z$;f{$- J{Om899 BgְxO6 sxúw~IyvRqGСQNDN> Q*['k8>>bݑiPdRU)sN~+_? ~yϿf|$/ xc~_BgUU݅?I7N`iVVܿ]S"jbzNNm8xH_mې:,)ljd&֫5m0z臞J#m,'o??R:VJQ5 u`m+PÎY@P.FRFە%Lݶ+AЬhWSLjv:Qًb^m8?? ;u'נRhĻ~ ƱXz='lw[JVTV4aeFi+OtUET75˲0;QId4H Ga=5iq^?'U2Waر9:=>Pڔ*ZZk~dյ8;NYݍwoj}@h m, 圻o{¿eqS)6&mzFkCtZ.&!eZXLZqq~J1 mp||,b,uMLy^D A;G۶,;R0Mod!Z1'Ϝ9>IeW_(Zp"v{ZYʗ* b SJQ轀.S.C^&S\/:G8^PڢE4#V1wx9%*kX܌ZVvp[Q*NOO"QQ`RHjJ m*Xumv$٬פQ@zmҭ:Iv~8K"/>pΓOLUUtuMFdfk ˲vk..\m1-"NӼ6-P-%)qqASn໿Ͻ6G]4oAeUE׈2eHX1Eb-n*{Kl6Ge+TDӴ Abg?S/|xv ZprP>ix_*{Z~p5U*<|u'ɻ_3dݚztE/<#&j* kU-˲7Tha{n0*1ڎ;oCW_CJb09a gR*9 wiF4 ]iDi=u0/̋#DZ3-ef 1H)c/qPZ/kQ[牺j@I""Pd8C ŐVB {WJ"IJՙYx:q]<| L]֥=I)#( o?˛[Z^u]Rٚq ݪiAv1`]H16 Χ_v %zL1pt|\CCNi% Jk\IxgY,DTs7?E8O;SpM˲x>bKFM123)D VLS_@?ys.P/?S6èx]xYk7n:*ꂿ_6z^S뀀WA/:>>_< V[B DLBUUFXv^AWsWwNFVTҵVLx)qsOjXhҷ2Tӄ0v>)ffOx1,~g\yvX8ۍ&޿ݸρ'vdr 40 8\ tm,U]1%VBZx1=Zie2 #0w^eT+mO+6mV뵰I2Tuњ +Cw m[p#¼,T0(2!B)~03uU&D["$:[EiR(zItSjvcD45M2@䴍ѬG.v= l27jGΙ9Z3>1lW=D.5JuUY OT" BMk )&ꪢm;RiwFtkk^Wmu]Y߯JH~,ޕoS`m@=v:mY'yvܸ' U׉b\ϋC2 X}jM]lAݮD/.vn( 6Y 9⬀N !{;' Jm{)F@9eK[V4FFZHQ́eVS.D۴lԥn9J99X^UM.t}eFyIdg|C-xzCuғރ0brJZ"bb=˲RB7kk3.c}Y͕Ww??8TFS++rSJҚi %zCd5m݊[5aRkE-I8<ó\R# uIUV׾N^42U`= xEw5) w"xV5ҏ)1 MwBɵg2O(8Ncˤ^נdnN8A /F7}\_x7׾(;~b;̜3yb7y.&nޣ ?3l'.vY?1NlM'ہ9XB わH<&ڍ aSU/q^JRo[șclpj;ܹ-i zqH^1⦄<էBxt#/X~~\' |ydm+kkJvg*k0VaəiӃGw۵0JS뎘] v E'%EzT#m`LvG'~$s5 l~rdm ~dr)qbi!<~3v%t>c0&0MⳠE~95uUs|r})4'Nk9^u;5Oq CO]#OG;Y癪L4ϸJ >D9 (nR[p>ж-uݲ ,̳L9Z(E)ͲLTG9:^~hNV r&!쥮ybj:n:R,~>XPRƯmئL84dԦ0V~ud33 |z Eox!B  9'-ݲkuE]KJ,*kQڐ{SSל9%Ą5D {v%Tpk7x `/ \n|iA/3/?v6{] pǔR%FD{bQRjUvQ)Fm6TUTvHZMq>1i[kmۮ"bZÛ_eguôUg(bRӏ3hC@B t^K[גPm9>9egܼeխ!J29!HpP8¾$= &׶-{д vLkHM_ D[7Tb&*۰VdwـRdZ3O_Y46A=DSXml]dyk^qmqαެ`mEӵBi֌MJȬ<4m1w܂+uGJT3J u+ ԍ̇yĿ$|b4- x>"تO|ۼ>DN,iV"8J$|sm[Vpz[ėTZS7R$:/TU3/0ӹ0o~.+^W4>iq>$ι{sW~ZJQ\q@<P~EZ6<. )lh,ˌ.؀z;'/ѭ.yLVqvlw#4CϭK=# un)DB13TBAU xiQJi249cLu@M_Ce-UU:n ~C4u- !p|r 1uUX )ÝBi;d [ x9+mۆ5 8? gfwh]Bۮ1UY<QB6` Dka'5F䐇]y{^I~Bk%1.u]є8XkIYJCJ.&Ձ)FIMSӵ1%b_3ci躎Lfũ22/$iVJkUEM|t7-| ƫT py3_4݇H `] 5 N!Z"HI,`+BE2M0RWPnBծŔ11eZixLē3ad}3{{o~5]$agJb?'{2@ӓl.sv[P򚘥ġ:!J43LRbݶCǡͼ,!EÓ3~x̪8sJAvX)cT5v,n[߶02Z1[Fu݅%"¡S+)E,2]'{] m4ֈ!ι 4,LӓSL]c,Êq~q-tX$C#!ɱJb6|I pHM.Â[|qLK`O~Yͯ@ZQI0sz9a>GۭxHh]bW-mUɜZy9$g9%(]#/|~/KW +"۱7g@VuվUY_+קiKU5bΨ+twzʰެ9>:{/jO =Eеһm,ZüЖ|#DƘPbླྀک'蘒%yf oYkM4dDWSt`rGk)&YһPՆFqKB6Fΐb;^uuScVh/BU7EPnI蜙"OUSbFr~:Ъ$]CUOF'bVҟj!"V{+1/STz$`c$sޓTesTbQE,@w uJ+K>ɕ~u?{?|]\\۪q%1+Wg;L H^C.:=F)hCyVTu#(!*03< Vb5hE,\$R*DKY5 yϞ+/{c\o_ 2.dqdqe,*'iD)WbŸEkC k 2Ҧ'`lB(R8(V(@ZP)]dHhvjb4MEL|KkNNOק_<)eȊ'pbJ)U]͋|l7BI\bRire6`A$-N⠔F)F"3lJ2|>{ae>Pd.q((dMFb;yoү}3&x>)z]iZ(̉e҂TXsPrڈ5t9B nq(cU/̕>x|{^7M_k Z ǯ;:a 3'zu.|;804&,TtF,:ho6ժиR.u^nE6/3m} Ѽ@/׾eHĬŸ|le+ڮŇXh2(u1Mג3T>#]W0+kkS@ HmYPhfѭVa߳Պ,f!̛oQ-PI5㼈Ӽvڦf=>&q:i,j֫c06߼E) Jbh+bL" ]Z/!%nYc w@vW<^&x2ˌtCnb$E/̫B@/"|y543DK+` J|o|x*O=>|Z3>vb.E?_ 0'keg""!5mbYA]մVubaF1جV SV o0̑]=soqdǑ~tmE i)/Ut>3RX:@e۵h )C*ZO!xmUpn}Ӳj;%4{1كm2UUsD]dVݲ֛oW@.@OiVa02/25-붣k֬7K+`T۶-:"?meXoVLTu8Mx =/XE0'Z4i(6u#r11[us0Cꪖ>9OJfCԴ][غaZQm #XzEuܮWkH|q)tα>:~|k|틌GE~mV9*n>$c k%Ir͚ix:'j;ܛ#)$V{W[os:^/`|R/zmՀ6`ss IDATժMݏe(a瓢Ǒvw0ZGUTtVJ|x0*RJl6GLӵy{gYn $Pۦ[^ K "S5 ʕi;d_hPJP8)Av9Â2yj`C.*bHlM՟K?>y}x a5U+H} MWDqNXUMӡR s݊]Xs(DJBĘP⣗~w꯾[[q|j!=~ݎigR)_MVJQ]s.R[Ue$]цif-Zi{n5FPh]Ak*cƉ]SW5wʵU O<$؍343/9lgi@Mh+l68x 1CNڅ"kj,TJ =Yk*qkPkM,PΌd(rlD9Gk5id$8MӉzMJ|cilUZ"34͘Jl++ VsjV'A*T;[h|H|2)`Y Ux2T<l- 65͜HQdON6X[pZK˂2OX+qh[Ril#cҗKovbvN(V̒nw(m_w_IǫH=5ċs&'GKs"XbaV}4O38>ZӶ {)>%)UaD3=z^u]1,t>ie>f@?pE&Ǟps3Jn4;RXJdKOONytmٱj 'V@c~8ԺcƗ^ ӎ/寗xiU]<, 'Dzh YYH>Ӻnoߏ`+kqn@)ǘv( )BbyYQF .!Q.#7Gc.1K4[zW7~ʼn8;2mfFlQ:TŐ'FaCM ڐ2 m-+M[!R7uspМ.qآ~|B#+ ee/KF+1}%!TЅnJL' \L0@T G B2JQH"˂,uXcJeL˵!xơ'UE >u4M VR ub %EUt8lklh!SbV#YDg-P4b:7zP46C Ԅo{ZƋη~e؞a2'*ҜX¸(X#w-hBҼȜu]m/ h4R{?w/}]E]}/\wU*M+yY9xqx9ETo]1FE$JVSUQ`k+KkRL Q.߈|J(a衠ԵBLԛ74#_ϔ=臑yՊRm,gg~رn>=Bb{|t$(L*v1-XVu]wS譥_Ybl|su[5P7-C?$bZsrJ r3MKhm7t-M۰ZwDb<~rV!{N{uɦn0"$Yo s@#f:]BT1IB`ZLȪ(ˌDZX)u%Qp<>>*)ѤlniXz+E(LUbbASp"+A`L)~ǯٜ}5E\~mΙ{?,},. |֊4V+b 45%`9QVdPrYWcBhzmVn|Yzlbp $s|56M'h/,78I9W@L"yrv*⢜eYTbuy[6'7e^>#7ѕM[ەEi$AJiڃqM6#|n]ߚiUd^wz"gHO1SXʲo.kI1Ʌ0 ԨVbUJOPۦe7L׫dJ<ʜo/ =]'m 2>z/zKt roYgq ͚kFvmWӭ$Js1mMC.$R%%K0+qV7;Ȅ'_U{cPKkCYXS:B̘JZ a?Op{?dմ|(9 o'IPcH ł0YK,FR-b3,4ˊ-Y۞ĥZ˿Yܴ[V ^^x&xU_=j"@וt!&|t=Kk·.&>Yk=,OcDqDiO}?6-8R7~bsƻ75iLc'O,Kxb'뼨扑c)Sb^hӌBf\ha(@f hPoi*FLB?4`^h+i,Um[PAK\G^QneѬ戦iIYP9%VteiT?k%'6r9e?|8FRTst|!8̈́(a')&HUiK$<᫘ĽR暄yiŴ$mJ#+uSK5qCq:-̇ @׊(TS7gG!Lp|ޗQQ92-ˁYR9ȴ%U@~9)0W+7.MӐy{^ _JWo?r_p{ ,sM.?vyߏ0=cJ)In*9A UȠU`8qN:ixAqL [8bXjjmlmHch;1y?ByӼ:- vۋIX#&6uʐb 9bH"3ѵb#7* SR*^@(sM%!{ʠb&|_UR֬V'qPhm[*"9*-Nti/bg6bws^zz)I3n/O60.^;y*jr=Zk E 1D<;kVXSAV4u#3uUtf؉ʒUAK5;aP8)13Z+l VeS8È2Zޟɦ7va}&_&A_y{D0F@v%~9~N$ږ9ѡDRJM=;f$lU@B1^RZhD@{y1 k+Gu]ǯ>axa&^u?_~<ܤSmS@U9g JI? s^ $~=/=Ҷ4NVʉDl=M3u✧6~ycO/>-[ b]k[ɅS6цʼn ~1\,e똊2` bۮcrѤ(bQ ˶.N(%lh8&}n['gg$ 8/ĹX wR焚Ck;X0(Pb;{G&Ԣд@մ&DU}1Ĝ1&ta,EzUqevNt躎i>Ͻ:a8CLދyQkq@.2< 9ڦAkn?~&<=~4lI1(z\b<$LnqJZq{VxgSP=۶@NnjBc Z"c4m8|Zky7SA ug0> Juwd`{mu㦝ukmʲz'Q BW Nv{mFz`&Me))"ڭW}Fj֜7>O2n{< m4~W 9"(XBb" 2 k<;o9! Eٱ1~Xo6eN(΋J+H S0(jA(޽{~q L"/svݐ \ qmJW_`Md2hƱKFѶD;'o6ۅaXiw xjE#wO;>?hYu+zi9`$V݊P̀Ӭ*Kf)A X(;>C @4N5ˬ*h0UJv+=` O jC,~q K }M%q@ qDaݮY hsHʲhh'd{箔Í%LBkzڶ7`gFtܭ8=>h]ъjfÝSb3}(-mC%KJkƔ8T і49 iMm680zf>h4}?)]SQ1oW2/^t|Vý~EX}tNMCXW9#؊X,Lk˜(rJƐ"f)4|/X5ۿ-x=^xU]۰WK)M_:n& tSbr/Gk97 )|aLBqt$Pޏ9MP5⓰o[%|y^xr~7s(%'@i~Y_jڶrRGԶ5=J\ˍn)DeXA@$ {t5M#ED}ArUJ8"&szJIX֠:LDa9<Ϣv"86uBRǴNĀ0y)-%3iW)yE],I/8IE \⠄xϷke&H]CΩ0</I}Q[wr<1<BRִ0̉Ey(sB7!jL5Rڢ梴|dYm6x/=:UU_@|66g m?b[ -%8MTujbK)1< )g׶ E!RBw2@0 ^}yi$wұ/Hzf *,v@& d0Q+|^\.5uϋXf; f2aO,,  [[b*FL2{{j$8k,NFC0?>v_rpp𵃃Gh/p6G.>~R%r }DS}W/?$ 'Rnļil@G6|&(>ڠꪢ,,X7 1I_ [ eu}Wu|݇kݦ!E q$;ib1U4c|-wme:il+x,LٌYl>c<}Sf- ˽%|48W<Đ̈́*u=u]SV"T4x?y͹c6'Y߇#B9(yN4-6㪒~2/~bGꙨVMS-g1~4 ,wy) &,)ߏ/sq],RMӡrHP|tJ)dxIƚ)e]JBȌ8;;( 3Qڰu dN0/W9(49'!|$}?d,:`,}(u)k:JWPLf- 82UtD]:^ʷ?q>U!sdGaDR WHF(g vs~IvK^"i @~Գ^+8`hj1i|;~Y[2sRqw=*Eapo%uYLgYÔmTX̗$8B^}QdCqmy@!ų:"g(m40`$6Z)JkIJt. U#$>J) (K!{&NmYA A bKN4P2K`12fKH7$i2C)8\,4-~P)*j(]a1`]/|X,ԏ2s`TgKBSڱ*P,Ze;iyۿ}m>?s׾mnH*o0JIDߋ<4 0 EɘʭͱEҼӔH)a6_2w3e믿< p9)x<,tUZ/z}RwBÿz,Ϲ֚8l!n%!PqzAHk5TYgI8ݤiA͇rIH5%뺝᫏_bGy[?B[ˈ⭣\Ȣ:1ĝK0 $ҲC3!J+eJWfxzKW̪DŽV0#C7_j- =!z䏑ZBvqJϐMQL!D[Bvr~SD9'>1a # M?LlF|̚Շs)@"ks >ϔ>( m)<(o OqŢ =!1(eh+wDYJ2XNiGAR S 5~bo-D/ A8E.QӔCK )$A~?7o89j9'GLҢ al5v׺B1yOL))Jg!Kp|z0Nޭn.:(?, Z!z`KizsQx}15iR>{k6mG ,k(|hNOOp xE92?~"% |`JqpsA'}7v'J{z;o){kE3NHF A[l>lc}eqw!cE W{ic8bNTg\!&7meư+> \j-\/|MUvSrb 1B E!m>xFll{KĦkes?ψ) ̧l+ e-H ,$=ǀ) \iwVMkڮ%t0Q:'*"y]E%SI'ѕHb;DX3Fѫ_w+b՛Qp*1 r .D1 w$жISVGfZ8l6kY9G]ׯI A<>=yYWQM}]:0U d/{~0VSxٜ3PL4B]7 :}?&qrYkʲ{]%mUQ2|8W 'tgw ->ٟP ׮(FHy3NOOQ ٕyxMΕ$P Hu2Xj$$6uMӴ }F}bRg*h`ÀFvKӏ!J:˺iiZ8+;qE},*qψDu.WD/Z)FRon_m妷N1&,1= ֚99=(щSuHTazta>l|PYVyTZc[J#&Q~ܪnVL~DC醞|nsy8N'kiE ð|ȜH:ǢB,E&Uf fI)RM A<:bi`_}~~G umSkρ .]Vu;댁Ǿ_)QCʛIsE]{nC|F;h Εk @ ZKYK]؁_x׵9{x~_%( `g 1]ΩW_~08W3pݱ$Ɣ~4"\ .,ev}b6r*9'ֹҮ YW_|،d/2Sӵ]dQ"fJ gyx| 9,(RmD#c,P^BՊaټGqBB Z c8;?lAs:=a4SLIlaKE$"{0#U-,Wn`a$ nEQUgooMWo:i}d45Ui I+Mi2cE$az4'jґVe[hR1b>GS5Ƚ;+_EA1q|^,E&p]]W>B]* a0q#+-H48*,3_]g޿޵$~KA*YϾki֘Dk;RUrQwq'=~zC6yly1f]WU {aJ8_D)CȇNI*Fg:λء^}G 0@Jv'9q&=k6R—绮iZHRޓp۶ɥN=fD-+C 59q$f#ca3>wJ]O q4-M0M`)f-_E1ڰ^o0Z@~`МKy9AL*%qIuaH5C;&|` U~1 Q$c.!-);c:Ϫ1++.C\_Guգ7P*R f=>DB|41;wL }N`riD.bDfWYZC܎T=~{j88<<:> xww=3y/,`Z_JybY J.a 1YG7Ea0~$e?M`ݹURV ]FQ;imW5~[.ie@Ez4^Y?d!%BދBcQߋTr@tr4>+My6Fg#[A]D@v)3^)2^Bӻt1RDLst][&[=;DtB_ZRJBಥ8v|aKs:NFTVX.h,*%1}Ik#%e˯ 'ߎ{/s(M͢s"䷱.1⻐̪JX)X r8sm2яO9k͹Zm8Ϫl]UsM@㪲6n=RSwG1IBv7&{/K|6U޷;_(H W*tA,hO ->qb~ڵu.>m9_=]2eӴ/xQ4ۢR@iȮfIB4NB$n) R:F)QK;m e|ՠt)` #!%ITLvM{(3qIrKpV+:KPK%DF2 pe8a(tՓV*˼ʵcp]'KM쬫cyG(Hdard+!\ϤCf`laQQUh|{PKum\-jՠԣ8ĄHH0X{>ͩlaX]?'J&4y=>>LZ2/1l֡!q 0XZ1\'tU2b<,]<~9K ІV7WQ܎^<0 8aM!`3J;RW)FTcӴm3"zs 50”iz)4\_~+O|Ÿ u6?# k~GCUVE߇aQeI]Sjȇd^}Õ8LJ8;6";2* m FSUe]c)+_)Jy5 Rv c #uYa4uYSW$OHN@,$RiDJgQj8 B3 0 _gu=J+UYQ(1i'sbvMɌK ωqbu') Jq !y7ns}{[gEYu5_U!ɿKך]w]ZEા*ES~}%6I&4Qi[$NGxsD'@QJi~x%7]m AP_Ƨ~of#Pʐ$h)yfq޵/ߗ*&en`T5Ŧ8MY\&J׮@s]Vg Gq{ 4uXVT.S|,E]gUՊҬ7 f'gg3g^y COa)]i6:/D00N-g36F,|d+S^q"hB%VRM!&QMԹG=k|)$T!|hچqv4cBu0 iR߆OD"&9Z=EYZʽ>ypӹI?ď-QiZQU:'^fUt3P3>4m˦mN@6qʶ֖;H=9yEgO /pӲu\t>w T*MOn< 4U hR~0}˅Y(-k+'Vv:0Rgl@QUgTx^?#RF{~?GSbwT%a6M e{Af1#nCL(Aq$,(S r`rR$׀ "$nUs( =-riۂҴHL,Ev Њ!+y՗PJD\R 3+KV+PO$R,3R @' }CvWhbwG?z$miPlq%EaE0|1TB  kt?,GYZcA*{,sq s\XŔKsaeO=ȱ(,b48§~؀i;Zaʦb[sBJklД(9@e h>8g@MѠ@B{,˒osuPN~~b MO\0\W ]_\񝞲;[۵}'>/(E;zfZnug-YQZ* TA]U۲1RCOQQde뾻jtgc۴wƏo?7=CUew -dL/sbIMQǖj 5Mv}9Ov }OJ+u2s9Y>#qEe$zE5WuÐd.x5ٴw [gU>#lY :8Ziaz),~S 0_gb=_YS})1ibBq 1DY` W 5X[dw><|~Gqr%eM-)Nbql-l,P;EÔҮf V€"EqL)*`V{4Z|uf>|:KkqB0BCfmG<\߉."ҵպk-pjX9ǧg4Ӂs,?gorup"x͝jaxvބ pB@Y_W mi( M*|gTeM=_t@ӴhM*'JeG+Џ4MCFkJi˃%o:>М'nuʏÿGrvrZM~+Oz|r,MCUθ( C߳\.8::0 b~rryOsb4mzPّqFCUqiۖԬ1wepǂRBF8n׶! Øwz&YH֮լ&ٌbAaD2xnC`\ux><|sAg霘(A:qJKEUBqq"a5eYᧉNc|hOhYoXڑd@!.ԟM=q3t%M6 `ȠDTqXt]۱G68+µׄi[Z6BW<9=mrA|{z'KRk[HaM!mKaRpEa4߶nmD?mQP:GUA[M ]ʲ2[Tu8RdTS͇!,9ܓ8VLa*'˽=ڮcDTTL^ܶtH x<Uxx# UYRV{{UU/s"@]W)gg+ah> չ~peIUV4l6-EaDϱg.slzq)g)B NUwvv SJ*!sOCo+v%埫λxol+ړPbB }-fәh&he4Mֆ"b..\AYW&2}2SڝQ +^}~.񛌫^cjWLrqDy:oͽͯ׾WQZ`]׊ \a0ʰZOFk1 > 9^s"hڜ IDAT&WDdi6mxX l( Ka-e]μu R8KYWtÖxr"mfI'Nw(ʺk;0]7^9k?`Z]1mjX%:"2H,\VZ4-F)IlȕbTՂf⽏]X)w qY\s;gpޮ*c!%7a\<~9xZ:FVhqw})kj  D!1f;O iYE*;0ͰNta@ߎ^O;>R9aON?$[O{,ܦ0,^eXd(-c4q.dS" FclA5p雦e}x6s W8RZ~Z\[xeK|GAUQUl6 !xONv)1@^0Y8Hk`b$"1Em6pvz8$嵋(싘Y-}hO~>'>1|ԯiVg  u1P:rFKR"S<;v\4lRJUC=^|#yp~-'xns|V +,%$W_eX1}JcL40 &qb 1FVȜϲ4j*|I};Pr&4+˼gqlV]1Q8l8h_!v7?V)^-_僟/y_70~Av f )1 =GG/ѵm OČ [R(8 ÈsvLIZCa@=gR9]氥X]?>@5Fq@l%)HO>@DܓJvEaz8 #{iCtZtNeY %N^Z@6kݮjP:8&X_ɪ~nv}F:`4*6h[9pb 4!ȒsDKglSL}!<4&^nbhak&ϻ: @wyXI(9>>ٕ؛v$ơhhYdL?Mn fHPJVDk񃦞( Ezݲuxݐk{4// 1\\S^'Ϣp]pUyݽq* | lk5._|,J)F^VU J2.A9ˍLvmN-mۂ vB%p\ljFTTPT%}+|H"1n2>d#NK^{[ofjaؽfXv%gciୢ( m&5, 1I$CEQakS #:|(cxp|Ja4u4m+uVu\߄=Sc`gwP,)F.(l!v8R$DN]9[~虂r}Me4MūD3K?`s|{8{͹taBWƘɚJSV5$- ?.9cuH#Qh~3|wnr}>s>k\uy;zzFHպeiu- SnJĎ0Rq`g\r~v,*w;yƟw[׾ux+&EY7=2r p)U u쀫oE4J)4Q4Gi !rY[}l{vvECm )%9mǺ: _vkHkOLF =3;"?3_2_ ۢ*XjV+6MC5u]aJK+G8Rs&X>;;|&c6+fUOb,Δo[DU_CUWMdǝ(@z?!)5ԕ |VELI4a +(\q) p'yaPBQ!W>OwVƕ,sVs拥 =^M-Ϗt8s{pzCNDM~$ ;m]dZ-۔)x5C u'M t3v sf9C?f? rYsZٴZIUb=[Yag;ZoQe6'?}3%[k/>sS^o9'm{& w@ͅEQ(? *ʺ-چgV,I[}+kW8'?[X^~e4@6t DmQSJ㬣٬I$u+o_s_5~]U:?7{ cvMJq} crrsn5|˿ o}׿]f/ rTJ,}Z+rj1YVu8M&fjqa#>&65)˧Iz(HZgA6bS:&V3S0)Q4&A]FS+qpN]2 >m !~dqhkxzC餤-n(pyo,b'rw9{|lqL)ɢm%:E `Z'.<*_*5a:%pI:LӸX(7Tl߻wO66rr%m>Ԯ.gt 7/ÿO0&Fj;nz~#nc9~hahaYRT{[d2oop6gݘDobh- mmnգ8B˽=)+2ǡ*8TeI]h;ql}8XWl$ŝp{ iv2I;"Fb b1~Nr)z>)z0QS&ja]=rp +Y*ivV JUѤ ??k^{W"W۷xp}|>>WR8=~oEb}Jš!PIUѐ5~זAX Z's14x8KK'qM `,iK‘8>Kv\nIz}c1nw;},Md gN͎1<6fiJ;=CN"s;)=Q]ӰUSJQU3 ]08zO|W}Z~M~)_|8oŷNw MrOΏ9S'}r~?!W ]s,8)0N#e);Szv'pOgُ}Yqdsv.}-^|[QqX,LG)闗k߾*F W:^d S/ ylb$ Bo[ \YqrvNƈNuʔC }KdXҲkH&ۣ)^n6-Gsʝgs5a #eQWer×w ͼO>·LukuΧymhP}Ei&YXxQ$ "DUUvI)R@,pe8(!q_T7\]5t=uj @7ƼVEYxT\]? pU;,mٜ,seBoE{K6T}QUb!*i4pMA!b`[ zh? eoD9G/ÿGS'AS`<-a@]׿~f͝w~̝w[?{x_f}˗o6xĸ\,ngMuUiЎb lr4L!P 狹/ֺ ,lN5_Z_i4 8[P-3 Q(3na[O8M~ y/vUq oTDim:| XKUa!G(,Im%IStX'>{RV[} !\fd٪a>0EJh+6 !r'?l~W_2Lc9TIXnxp r2'̉lFi(JXJ5GJ;yf۷b|yTb\z|e 4M˲|?|igto"6U,HcTi9_)ÏI [kbﻖl6$&|Q+%iԕ$4QEv6 Z}Xni1d["_;"o|cGqyx<<<_q?ko0?|MǶ]Mh H9ٰ(4NT(楤:8X'y菬W;4,$P,ٌi2UK\Z EQ) 8g98gu.} ľuoaXH z9>FP$' btBx>DB.ga聭Mr$)hЅWcPڢP9/b` TJ#{|JզE)b/ɗ2?|?&7iH)q|i0麞DB+M {J[ИչhTu fpxx69S5)F_wF ɉ8տ~|d^n4>ip'niǗ]a/ ykm%`H_\5k\$::ycbG AY]ҜI ipc􄺞r-3\%l~LPf3gX0 cPsHWX7oWe7b6@ۏ<6%Fv6")jݐªe_CJ?}| ѿ?:|/~?7ATcf;9 NpΑbOEĭnE}$_u-@YS}/mDCEХ ,e!@?NHVLÈIyaӡ,l-%%X5bH$ev8L_ݿ_q~~ٝw_/WTmT}߳WgrvC$8\s *cج״cD/%v"<Ε]Q<:&بoUۧzAa- !>Z%Zk6Җ .)p~~͖նx$=]d3V+BLI|tn4j8<%=lMZT aMi-Ui)0Wh?o>R Yr,ٜ"Z3Gh:B/ u(ាmJ{S˜ouqUݚ[$6p||L4mѿE*q τ x${4Ms/1{|p*Jo__kMw~̕pk[A1R.+B [mYZc˩* )qN 6A8Q+/yɛ< )J,x@"%(V$GI@$(FX6 RU/2o㚇ougSۮ)-מ{7d䡴XVZT*^Z1]gEȣ,K u6p $$ M?C7}ZK 2b(D]bC3Yk1,K1ɮ|!!Ŕ nE"q0O3xezO]X mVT?CxK/{P缛|p1;,2TUE"TbBk{JEm?En'ksXYʅA{rłq\NOcl6Nm}?oo- !<>H%=2Ml0v% O X/SvOB{ *")ED%UP[.Ѧ x'h꒐Ɣ:NvE-%l1v?tM+{]WƏ+_Q>m$@>|EG臉4 c2ʪ<*$ѵ !Ȅ&&k)P͊pV^^e*J@k+|˿Xkږ/?bq z>+?R:(qB,8>V4-Pca)ZKEhGb8.uU3MRG^:W~AWU0J)x'V13RG;J._{$WeuCqUtV\Ne,j**1a'A솵$5n!xiURb-E!K$(b ? O}226 xϣ?' l,$l-1ZZMUUf(c"M]%1( zb"[0ϳ Tonl6ct[_7"|K}]x-i!Ƹ7,_|[wSxf2`Q[jԭ8-(pm(B@q^_KZmC6˿z(LS Ȳ(AZ/sV@Y|~??{)Hb IDATK+8̈́(xU2ؑ}?#HbX;wfL61m{n8JCr<3e!Ԧ,HJ,rVLX1σ,!o6^Oف~f\ffhۖkEЧ(ˣ-oӕ{VW"+ B9dX|c9lPR0M#g\]]gʡnj3I &1Dlf0ӌ: ̙bCDՊ<[QЌ.{)~O׶D-~dռ'??/{X <~8O6OwTeC?[UP|$;ʲ|&$1Ovf^|^ITuqu5?S$Ç__]`<U:>Akömϼ=I]]̀Njy!x4qGV:y,d&Y~V([| -r'%HZu PGz+w^z|os?c|/|[ CBlEeg"bw e`Licbijh α`g;'j"{c\]mX 4 ͎]aGNxrqAZt˂ߓcg=)%Śqi~(JEmw8'gL!!jr{YZ. ${SZBhꆢ8j5bQ7()#d܂ v-MSm^.h&)'RX;2 =̳0\("QYkEY(U8pR'/ﻖJ)_(?/XT#(1I_~$D%:|$e(fvEJRǦRbzˬs`z ˊ3aj郎>RJm \n`!ENZ} )B ( 8PJS Bcb9&kmPJՂkDiLRe%R1jB`FV1 `(GkŜ-Byǝ1U]3 31 JeN&-PJT8qqЋLvB =OӔu$NkgRJx'̢H"Z1 qp!%/,E\=yb@b3Z0S1 "&W$]n5ZgI)JGMIS^"<n_]oOۋEЋp};(lPFiBpx_XvP6q~~0 M N\5{ц }eE% >}Y wס  (E"ˢggl=a""@E#} r="av$;,)L5*)6ӖTk#FC6WTuCg|"x'#ԙ=YBmI1d%pg8^ƁpE`F c0XI|VD%KeOG=)XDȊ"^[+= Z\E@%f֜S̆@$kVFYJRi$=WWGfJQ֒E#DӴB4B Eg_iqqqb'$ж-)%lZRҘv'?_z4ܘx{>5Gꔶmp}0YЊGIڦAGis `h;Ϥq\bI? ǞmS|DOdwao*]MI`$NחUg*ˣ,-O.6"ӴTUd6{6,W+9b!b),M0=hE^[\]]a;Y"sҭeyڝXZ4!zvq(FLz+ 64m{ցnXg5m;'௮[eJO5E^zUVY.:V`\)JCO)\x(r0%س\cVKxQFS݌C].>:^U^82EIT ؕV$NOTeu>p~~Q n$G4eݡƅ Jmv>: z1]ˆTsqHBt*݆uNj %\_K,:QĆ) ZHK>| J^-)Bf1WHZVR5Ȭ4 Ð)͟r0'~;{yWx퍏rE|h#07cq 0LzG$XVEl7hclPZ^֊3Pc? =D{7tsT RTJ- q݀o>kUT\^]Sڔ\o6TuJLh`.$sًkThJO.hKOQ$#qw}5SJ42⬸9E=H|!a'j PV $nreYblntMCSW=o*Q0 {łv<V,;{1 Fv*Q%:'OhFYd(4F+dq*;a@-UUK(E\]]65sߟf>яn(R0cTa늮]@vUkٲ蚚zz,+1:ad6%M>՗g$mSm!u}@,WWp R6cg->$\ CaK8 .Rdt!TyΔ;Ca4E%Ұ ;*DPnOQ:{"%UHiʪdr ~ z'scP)Q ZAS7FhԵ髊g%OX.a%|7AUMpN98D7vK?M04uIY.=h-md1 {?CB`i)#(t]&-ڟ`-n2Xb4rߥ>aѶ~k[Pyp>!AR$V"uӰ*@v :$x9N틧vqp2L4[w|go/ι|&ˮeYt- Ès*@64H+uf%Msɢ#h*>VD>%j[ 8;/Bj\Qd^7{oJ [ߖ ~⬤xNq< #vh꒔c^Z㭔u4LlZ4-;Nroz{?gk~Dw $2~lnb;ѱ~bb\dZLvKH2iC"!ɵYˊ&S؀c"sskc&~̠:+cPZv)cfh}uw,pV2e?3¨$xoegBRE8͐ґz#GJ,!gމqJA8z!F]׸hxY~gOyʲ .$ҏ3M`3xq) 1*"s,g'' u"I$$<o-(2 Ytfk(r2űb&BRd=}'=N™Īk[C)a"0qyDǘH,)ہX, ӈAƄ"TW`v,)4ɘFNZ"9a*KC.C tVZRb)c00ϲlyRrIs(zmWdyeX,:4 W?BX (NJc(r8}8W˜4D^yp8Z::qSZpUuiJ 4fVqIZpXeB:3$Dr>Ҷb$-(a l"c'L뤒EYr@[, 4(.*4,(M%JAU쇞q麖jr=(?}#os_؀GoSLb!dO/SȘ+q =NWR lJU634]xGfy/[_ÿwٛ냺]`ożUpkZkm@A .fQ(%;[BQ0NE)nZ( e#}i-aS0yR,  zrRW++{wٌS>m?Ph)Jيﺏ$`& cjb yzYbL<+ b4ArEćH b^TW(-(`3eՆP 6-u] LxT;ȾΓ͂!eG*9 1fTiڶ!F] qPn3hQu4BtVA0!D|pY.e vX9N#(uHG]i*J-B˸JbgydXC@^䶫'DOJ=We c5u}B]ʺ`1[HdIba Rmĥ2DR1;MM<޽ꫯr{<<~~O/ß~Y/nS!}>d<{|:w=ιYfxZ{/&wnkKTcpECd2J_¥2d4{-Ng!r)91Ilo'}P҂,f~I%q(Y,G"]d[Xbn}/meN=̙c@WkSH [ o}g,:m >m[VK~;y5yĜ̇kPh-b4wrLq AUJ T:O*a#!+* PԼwhEhoEa ۡ5a%%eQPM!(žﳨQ+t-S@Ru+;ꐄ>z;1q 038ck,ڎiϑE<<5z2w{4_phM.)ib ġ(r 􌔴:4;bTh-sAC\9oZ]s?2F)R8;ӴM˘yLĔF+bA @pU vEi(K $V˕ ۶e\@<̧JbX|Swşy< '྄=nViwwQkh7)~Zb;V{u-"މ4@UZ3LS^,5eUwHz5k[B.x qUW.RHS׹\.yCi8OlS/~n80$iiZHQ4 Cf=jZL;1܊h-yǁy2g[x..7(%Ruq0"G,Hp<(-BGFďP]|:4O"BBX8 jr1F.//?xiGP 1_rQ bHY&ZrTV"ܒ(њy2⬨:92G|+'o~hF$cᦔ`(YyL)#)cȱp,U=~Ib^\n/w>x _kkwc O}?w:v"pZ  xen/%є<d> #0]W^*[>O2in'} >ϲljq1FTRJsU<[lfKDyfVDUQ`"`2Q8Q~0JvJ\*ѫ; @\b̥߄%Ns__vRF*٭e~Wu>S(/*W f=~#eY,4bRTU1O1ڮ=z/K iѐEe fЕu-rb"m=y++iBk1Xte\fY~2B3{34P#ucsFv~eXNŇȔ 6 uYKle4y%87Kiq^ L5ΊS4MGY@)Kja{,c8HBG%&i[8 W+fJQ*~bQד@ 42˥JpH{4(T_"_KnD`iu"4w"\T␫FE!t1'>c,n``-'_G7C`E#U/@H":ca*:n HLr4Đr,^ql )LQdg%J)}{Ѻ#K>ifXQ,-^vm1 8ϺFAkǖhH6/Ill#[# Z,e"M6 Rzzb}rBBcTlLI,iH)Ͽi >S%m[cr9|-a3rZ TY q( A ?!Q%cEr%!)L\QVd1b?I)u-.ǁhV噁̹WYJ%%|E*K4 ;YTJk$ %#M}:Zq:A0J,u]'ʄYoav"MRvGr0 = FցRRjێjXhjo|,O^ZY-aq+JhʂLL hQ0H̚d魧.x61HJfݴ)[w.FӟN|qt*h}/7@ޮ,^&4F+;nqɢLz[7\nՋGY̡ź+b`bѶ$6{a,KW?*;Y`U197wb>B=bT- xpmsQJVumfÖ;:',)˒hIhف^]^V$80Zb"s1(8V gh2бPҊhO.f&q/L)88"E+QT _}Uy'nsGKaa4BJcQ3@*p+EMSDk((R%eYPWUܦO㐩E!BC.SĜs pTz||q!=nwL+Im2PP5nāIZ-Ey(Z yqj%!ֆiq*ȫ8b7_{s~w~(.x>|vh'Tʶigw^γ;XjG!1BI,Bmn91)JYFV84&Se2u\߲lrTgȎt$,YV̾+uDan3:~Xsɦ+)?e5Lӌ%)2Dn߳{B) R|ZQ,+.Xh%eveFtaii;19Pv&c8AeĔQwina{\|)~bYJ.%}?*>b l[<,KEU =U]>C< [HRb33}Ϯ"[W$fkj>*.Y`vVdSzE垧)>IR$x( gNB{(ћ$HcO~{?^t|-UiXu.8YŶYlgR'2cqhDI)FbacD4HEvu <'྄=wn1 }V:x˪HhepJD{=ъEgITQV+0$j[,eDhcZ@Ee'1 ]鏢d'YV.qt䭷ޖeI`67MCQNOx1>F2F338cPu,޻huI(2@&FHQӢ ^L״a2eC#JE]8$8$FEY=>EEbWlgith!n`Y]M8B!>Yc<ɋBU)gq&N+zm|NjB61Z?w$~:Оrrr"ib&q9ȓ2A|8(%; 9&?mXu݈%6"L~rq}y7Am%}&>94pƮ,^by/b31 CQxmS<8;?E)P2Tmt>M `Wx)(| nᜓa`NV L0M^x g&1Z+##!i`eNrE x1W0Ϲm[hPU3ZSY( \B9KH Ez#̂@46q:r*0j2DoJL@^6;PPP03rQuCꟵWԂ`f~eC884⭠%-+om+DA gNpaG"qhZʬ \T'-Ą)4S*^68esf,T\P)(T~^xųТ9_(,I8.i7Z{&Za4E$=# &WYօ43|^5Wg{ öak~v/[)07u[C^)TH9"3qZY֢Acĺ|nOP8ga8 H2sw(E]((U ~8ͫž8-EU~yϤy AJ e,|hZ0M4XEIBQZuXD*Y(x~.D5w]qbDJM]abFX(vȸR#i@tX& 9lhu+K] 9k il~D) QOS8LS6d(,wbӬb@ف; m5iZ)/h@aa&b/%Z sGCǞcaRBJU]cr#iDQDRqD h ipRЉk0KGc'|d=8`,|}MP@#3oLxU2yd 4@˚A X~FZfǦ&t٢9|{Ǜ/b@go>箟W9xGUrATz YT.{S70RrZjh| GT1Ml< 4۹ZIq8dh3(C5̻6~UB[?7P R2Z)bӲZ MсQՍ]gDd apX~9K9#g ,I;s'&rZZuӐ63M\0/|MC7=HYdkG!;Z'gd50G*Yg6JZ K$FI [ xFKM]ɿǖn N P.r`NhYU]kTuqBxD8\?F{+"ŊSVjYgs_ ی>ק ߄SP*}jx pǗ45 0α5xW{Dn~g XEqsvwi~0ĵ*m7 ΑfXDw=| KfJE)J*H! `.ʨՆ6Āv%a54&3qޣvޠ56~:okJu0 o pwoQm RRUR8iyv;nlv@X@iróĸ!_ʋ!a#DND@3D6JQȁs71'̲V <#?z{8P׋/#=FlqR̖INN(;"$D4quv@J)QyJu-mZNOOaqQؔ"Y) kY hY -0bf88L35%Ed gقsOC)JMZ_bD8㇨+(AuUHEI1UUUg;a$ulPӄ$QPa]VwiVP L t6+CD`qZάq4ϫ"XD*akvxEP9 $`,* k1E(ʼ v+k#= F*mu<7]?E|'>]Rw+JOs߆smd,xb :'pj8󵒜-d]Pz2?oߢnZheD^njVu%kYS *j%|e Bb5#T,c46J#C`w z'P6?;\\^- 5i56R0L.V"gښB/>@ uv匘3i[ӈL#B 0j܏ x</adIC]8?!Zn*4톳 [GD%Tnԫ4xp~*mm[FЏ#PAre\"ii›~gߧA~o[۞oy| P(^ϫFp: ]*o8 U-,l8(mӺuRSIsqo-(vU;=Z954TCA~~~yTJE/y%  ;_\0sM"0ZBnx_:RH8 `~((qQm]9P NONm {μE* 8~=O30pq8M?@)'H, 1 ;d 059bNX#21QV!#z$PHn3982b[ _@l1Jh~{LӸJBO%_82Rm-kh)D|_ |{1kOk@0Zi CǤ@T\bQXW(3}}M(`j_)~;O^?~Ǐoz]i7anvq{3Xb@ h˲ܹ%fn䙕8b[BCdҞyªF(9<N<]g/^i*(Xmquu/_@i7-۶9c{|K?E~v]C)>EQaE]mrVɖ>JϠiedO~a|%F? 95Na sNzLܘכRe"TDd2-˘9GRk(v]_%~PpjaL8G@z2JB0`$IFL@,Jx䄜# u1a0)hc/|Ei1ShsM Un V}O>3hRVl4b)MN5IrKb iE ?iIcBǜgm PDoɨUUE|!g: Q|@y͟$8㳻TI'! wn{ǫVoAJ{ F-ꆆ5fSw4-60bT+pP Ju"vfS`9/EjPϠ:4k0}Nz)R"w.@nֹn4$(3Jl}+(4MU-|f0 =bJ4QX:[<|ps+OcS߁Rll~0ǀn1͇(@7u hݖ@+>x1}8NV9c00LFE)nUywúa/ C/n3NϠֵXm Ri?B]9CIyVK&0ZRƵ8*c,6 X9X4-c-~/B@]!Xl1Mg={O0ŇOL&ײZcX@I%"h 92U{QuNbAi۶R(Xs6IUt\{|_%܎5?S׏"]Zkͯu#M:h5A1Xgӌf|yKVzBƬAN8$oB.+@C #gvhp |ӓ1t !Eym7[aD=4oEӌnv7 a%("Oq󈁊Z`B1>w;=ř0D)/^Pq ¢U]#$X0vIN#&0bEMۮY@Lh?#ZSG?_K]>|0Za6m_`%r|U0b4<8\i8O.GyRLjlw ]mcM$[i9x}]mE[^wU Ġ&7!TSyƘh)Ҷ jqpVMmSBWWDV/Xi wPt=AzB@h+tlϧ$Tk7 ,\L г'D q498a}yд\] sl7bh2 ?a<>C%s!̤NJkC553]آ$Da g .20q\w''k؉_Qn5sP^ 9MM։2&IbVT5cӶtD|}/-|9PwbFhV5q+h;_cjQ0d?Y BUU͵8ˊ}48Z g1Irwm*F%cJ9m0x|},r?={v@np? %MJ7Sw#J, ^CUTw\&8nxdeU8N39j#ʩa)ƑݝB!ie1& Jӫ9ad_c/;GuF< % h8XY:݌ë(nT׸qz!5ˮ%Qq4EbUl ~ |{ӌѨp`'eXQU R$vg@~Sʀ77ycG~ٴR C#q4җ?x!7>7}N{|+_Epk3w>=ToK n&e{yo:#|aJicRJy%{h4mn(6-|}5JIaL_amM+Jl~,$( nȫQ7;P Έ%v [*U]怮)q~G1MAdG4uC Xiq,T)E”F+B;)'\8̈G$<@r}1CY,qs 3xۗqqy9 ӄQWNq1Q2F`KhR^gBɐ8XG6J5;b(UzzXS nؽ?;^~QWFP46톸q8q8vPš4bL:xdhM- /0Ohj(WR&6Ib <㝟}Oxsmj'(19jMP pp81,IRhe)b8v_5N3:rÇw ),:s7?^i) x#7߼x(<-RVrNv;΂BNOhm;5۷ҝs>r?u4}bi5F; e U塍mH ^)lk&JB8idƷZiaE/""nKXF>v x[K (;91C8; Yu M;8(z80E9U-;U 92Y )0ZzuaK1z=V(EPA1"{cסG&"L2Jyv'P`  c|7[8mȡ~s?^R7w޴J nGWL a<ܤ:lI5++ĈKV"OKk[a`nwNtˢඨP]jy ha/DX^s)O;X%Z< zݣGD?@[3{s`VA+^ƖsY\2q@\gk9،- yDCh0 =B1O#Vo<?_txo_=7̃$tB)E,"4 aȈJ~Z)8(e50ˋWq(D𾂯 f#zJn ټvy}/~!R eŔVj,DGv';&8h-DPZ[98ᄌ{~umw$|]w<۾U2dJ!r?8إqNpOqrzs&]ъg~q$YK{\;9gÈ+햎}Ρja)Lp oUQUgg)ȿ0iwA)شXj.q(#b)62|]A;+H_ŝRd' %qu8۴qF b2呷g7z^x#xP9&zץbL{4n8^m&,cS±;"R`RJC9/ )ƈ}}mG3|61~`q !\?_7*Xu࿍GrYc0vP bJ\x,*iB)jgK!|}߯{4-J)І0/it+H^ Ƈa}ӻHD`^_6m+ }ϖ#mhmaɰjjҾ"X+#pQϝpL iJ4S"m6H1#~fZ]!{ À0К:)?vimCFyu]'q6~@G`w> qzXA]w@Lf1΋eL3 MPTSFqw?E;jL#PI{#J*۟>W@d=cDGL z Qh 2hS mxNHAIH)/8|i rJF;X1]l0 |ZjMbUWPYKS (|W+A#H1aF }_UQ-k#)B\x(phEzN1D |4w2w7+^+K}AhZY)X_ ؏v{ơPrBJ+X\^]!i!H7ܶx #s ƑګAms8;;y|\M>sקpznvV*`÷i6m]q1xk^eFcf È!?q(#si%٠sJl{vg(EAh; lgEws?GpY^ޛHjVI!DVY H/84-r.ĤUVҚ0XmD<8;=BΘ#3EbWr(n}%s*ֵRaw8/yOMSꖳ }ιa*2~yq5MsDZJ %&`)(ǻ0f +?~~KjC:0BPdMcsN)㸮9,&|%Xsr; )eb ]NanG=~u@ׯ۰Gx]U7|9MppI@]e4NaJ E!d\*a|mj4GXqN^;pGιS09h@)T{% XUM-:T)}[GZd&2 l(7N3Z 8Ծ5]g$u88^ ԋ{rKyeɬmh}U# -;.MKe4#-Eqx&p~E-2u؋P"_589ck"N?|uURn@) C'r('Rh~Lb\8Q8&a/aġg̘ +E!Ą9f=Wwu&\|ij?(4)dBPcq Ρ2'*YmPJLi$!b0#DvJg;xO9Ld9X񈒉 hQ0>U ~y&4uCe|7(1αhb՚es*5{3r^}9|_~ ]g~:=y7~1pS 돯vH~?X~o>6HHWUZOdʕc9M(\2GrIDmXKҊHjlw'4j*zomۍ...G|Mpv/>94)1("n`(M9DÄ0̄v$n+yp<chVZh^Jˎ)'QڳlZ]ܔR(Q u;ǦfB΂R40ʉPK| ^QPֵ`NXfM&5#A#qx81BD4xl)w=I Lk-40GTP`r2kR?-|]8kفW 3b:mX5Dk%}w-D"rJD9T?6*<#- ^ 篯 ^qFdMhچV@ñ88?? VToV祔UWM77oi4B):h9`4Ewg'0J#.#\x6 nBk=ںA= ק@l6 M!¶m8ez]5\g dēBɁR@F BдTГ0 ۶zF1gmwk/?ɧ~w^Y|W>كyl[S,]ݼyP-(b5֓FRpbGe?z Ua IDAT *./ej--M(`AQTFzDJJ)"D8,T'\FC*ˋ0iЗW G$pcHBT)R會52KCH}r΍8=9! c) o4Vya?!2ƾՂez=PBJj%HUJp!rh{+.1ёpΘH}?}N@}GǏcr]%a۝8DCa)ypF!BYGNN`8)FXqx7oܤ8]ҚAy aRբѻEe_$`nŀOhBAH1kwpv8ؒ`mMBr,r(ե5K ȁdW%ʪjhB$cfU¸7vPp~d mӢd}DX< oHI?mo=2W 8wj}s\~pյoHUtxEṔUYhM)lEFq޵Rl5LkB7x!"shS9Xf?hNR(Y+NeÙł7cƯVZ"8888{ 02ٽk 4MڦvvK,Iwx >y ѣK QczQ (J)JF$8$Pb8]sAӎ&fUWaжSH08ƐBZoՊ䢕08d q0iCt݀ma,fA7:@|&!ʠ:0wk?W3 _W});&B#b&␩Ds<SAXHE[.x\Ӛk8<<@1x ~I!QR%8s)#GcJE"UPH-ʫv{p!eѸڟ(/x_dv_5o pn ˧O+םt']35G0s_shMH[hLdjE'1%0}BdNlIG+u,vvC(RJ1OA*(ԧJQH(cma{ }G}FV}ˈrI #9W^%$B 7-Z)f5H$&box"\fm7dȕR#zV+9m{b:MJ;!9*VłuC~%E "HR)DG@qPF#C"('ā %CM m-VeRA W% yYqX. T%^YnQ,c+T_W}9؞#^_ZSS  !D\r$ruIJ]_Jqn^~v5ZRy {_#2qx1LAn:*ز@Y^i3yOɎa 5F]װ!j8(9&Gç#j=CŢ&{>혢@4*'7c"౨P%n`-8XMѣGHB"贶|/@q ׾j)!U=s'TC? z@}סfa&0#~-6 <8wHlxqp@qbm}^?YV{Ĕ.V/ ĶpW{G~?Oq爝'8W[׈bu[I[ 9g,KO`R7XjC*Xk,KHH)CmP517oLx)D y@QXǞAhYއ{#[\%uWݷ+4ܽ2៫|F+6 BVzRXɧ[">F %#=yR8grR0h۶#.z/Ģ>FFK/ArR9aX*ɕ*KTU*ж- o΍(-Xb!Pg`b)ϨcF0%G !@= cqrf `f]&8h5N8V, l]AjjΌp m6h͗,%3ҐS^|Ft]p<9. TeʺBY[TuIҚ!fa?㠍15R{#lar83r>Dۓp@L&0X@384Gn7/'L#w^ţO n"J0 TEtd)¢3=KBńqޱEppA];V'e KW29O;?eFS__wپuxH7 N= >¢a {zc:-XcH}{uQ?ME:'?2*`~zIkcfs5R"<ڄ#~dl\/(0@*` oVU @)!LXH3ٿ !Q%arҟ.7)O1zTeA%f(͖zF[[ '"G"8D& `mcr"*Ȃ=Pʙ8zeP 30 aPb1W"&EkxO=׌8K*. Fcp> eQfuB^H`"@^Zq d!FAUYC+i@N1jZ q0ֲ5$&g]@L.D4iOOPm g t^W?3qup0:,!3 (œ>ǂ%b"3"= 6G``,`D;veftΣMpi1m߉?^\}§೿mtVg习%{䔹]$4OXKbHz!$vc@ӴND\S'U|&=е=K(UU8o,BY PPtq { -*87BpHx7ȈfEi_NaT?ab{?PO3@'>%N\=c(>9% ^a?{81dj؍C b1!g8p QT"L? KpΑ#cQJo:),ucƒG( EaA˹N3C?P8;" @sʁk1Ҡ@ CON-b0¡D@$.# $%|$~Sd]tug4.?}?L؃KNݾ;C{_ ;ǫSᇆOT6 9kǛ=- rՊ}7BICɊԶB;fgN2@Rҙ|G khN U JIآ eY3_)x?7}mm< UU^p>O8? pU+@k מi5L93y%:;G ,瀳 F n6 Y䃫偋$F$T>v$"2Ai %Mx'u)KUUڥX"h*!XP*9'O IHuUAIEb7$f\M}ҁB888D J+9czC4"vC@ز$LB2`, e>ĸJj%A~Zc88Łs1rFP)9ŁīHgQ/ !KchfoN˿k l>o`xO|cƢk))) |s}]9}2mxN]G> ƈr!4'AYV6q%-yme]?Ȥbn rLd O:^\6}xcDZ1nO ~ſ_2O) 6@)46y>&IL\Z賓v&mn`I7$,lb$g~~UW|"o )T#˻ A_5bGnzZkt}c  6ԣNs 9|\L KjI 8f}!#!%jSFEutUY"vKG]C+q2rCt-UGB}vCkh ޏPU !qDmfjE4ɀ%&V/xHHt=2iM- }!$S/j:zZQ ҆h8D>jrz>ff碮Z.QW2AhkEq f%?Ԓ),ޣ(vk08#!lK8Yo?/o~0#a\Nm5=q|W~ 99 }ڧWڇo|uiy >,(nȦX136睵bh%$..M!KM*eUAHG'kl׽aA}O/k<6ޮL/vpuwuK'K6}v^u:H%^9glۖNց6j@ L'cmc²,X,"ysOM)9ѣG$=rX.G]888$LTF1 =+R\vAmRѴ Q%Krɿ{7C?k{ZC[ c t-Yjg~:$񔻶C۶[mR} Uja$@ U^V( r  8 Уf, IrV=c/hTZQA Ez uhJhsX0=od*$#aiƁ̀LYb>gS+T6' IDATX~u=|#caMΔϾ@ RkMΘ>yC]פD8 T2JbZBjC5:qn[ 7~r˙p6kh_(oK04BCe4ɗdź~RWT-J>P]׳wX@Hy>'V+{ l_XzT6UJ51S0_8Y+ո\#x/@}g}eŊcɀsAUUOʇ3:~)bb]?Idbss,D(>zSԸy[nٞ"șԹV*,}' J)S{2Ot4$ךg&ڶ#nyΰ,%%$q@ !T8=ֱvB HFit]#'b^A~Aa9I)#H0 d)#c R8Rj$dq^={bޜ`m DUTq8=;V 7n̸/Sf=!2!q@ѭ8 -0:eYaPVB׏R`'JRKC+C !0:ơgy%_CqZR*'H^ RdDVSsB 8lu/5޸}R BI1$<|G&Y?Hѣ?,G簸n˛/## ,Hy6W}"|,JRzdج9'qxN]m)CkPea^HfCt܃CW?s[QP֭[_[cګ ToZ58v7eI/8HQ6Lm:H>hJrњ]1J2o9"2Nk);6q( hH~n<5s5 爔]E"T(XVTFdIt*%& (,Q-rjr{CxI_6I9+4] ? 9+X,jgk56p@'nVb9Z~I0mR%(LL ж-̓IټB eLL ! gFGhmA=]?;+L:!.(H2p겆VJ %?M$Mǒ"'B):adFrI-q@Yhnt8K__*+i @;(n>Oocq^_"la\wO\'(36͈EXV݈e]cq; R#%Gkf]ym@(nH[(0xa ~̟n=::zߵo3=`n|*}T ]@/`omv~݄" %6J E 1&u7~ ]ϲ1Qi7R5(Z!Fq^09QYK˲D)mQ t]Ig}X`ˉG;ֻNR8tI5MD%GEvrBg d~=WUE)^@&e:$[ qb!+F{<¦ cQ()ɜ'eWFqh5dKb(>appu]XC:Cg`-Ѧʲ8䌶k5 BX)lmZFLX؋|$H}QHJ 22QqNc-`,U|* ΏjK !) !͛Gn70>YFBDe$UῌO_?{ ޹;FǟŸ=f`s`_ezW/j U|JCJ )Ьy@ 1c0qb (z MΑ4'RA 1û %>ZS,[|;<weu{${ˀW/ ^5%@ 4\&{_hSLH1:N5/)1җ0G7nF*(ـ', B 1c4@y^Lס]\ t:^m,@HGQZ ^+5Mf3 lAU7aN$d,6MM(7g'!f}Yq6ə(;m;@*\'b ڬD|Q%,$d'g8996sݍ#$o,֒i);I:7-Rʰ@tmbHH0#rI,Q5PZ`Tw~8̽'1mۡ:`&iaѡ{eYFRUcʤmC\tOqRBiK qA' /n O$2B`aL>xl7DF7@nf;at(%&bAi8 nfg z;`;@Ưc84E@0|J TedeZ@s¹aƵTYgwmRB<6%`)ЏԳXz˴퓅%}=u))? {>龱 {fEQint|"]锊hTe f>`{޼ VNNa-y%QjP% BT办롤Ļ^z96``Gl6[>:$UJ4}xx g5d[k5R sovFd$ 66S;D fяZ INwXѡbRk CaJY@(eIR$,99NNw b̏ǁei>8cYlG_D1&kÈvCX9()T_CIE.J eY_VkD ֆba8Oq ;Y:AB+IfșdzXTq }atH,$t>dlzun4}@?&?·C:y>0%^zuT'Uv^~'.MǽkS@Ҝ0|vH)Ѽ0 ?'v<-wu'!EQ0?=a.>v7yO1 ze@'*LS~H'JUU!Y,I?c E'7qt)EA-\p#gMۢZ: 1W!0)6{[H)a[%^Xo6,pG*8OIyЍS03O* 2ʲ,xHM@S/3=Ґ`muSz](YAВ%jU>)9%؂yDJ+jKc jg=E]a$ 4BICCUx cDVU5ǁ P)=Sn()HqXsB8 JB 'wcvJ$z]ٍ(ʂ6\ZH!0xGj[ ElMbt-n¢*.ן~~ 3f{)1g22ʢ@jPfXCs 2]M)}ןME8%^5bRt{熑Dn?8yk|_W[RW|s}Հ)sNWm{n{iՀ#NKwh9S9 7}B#g0@yx|n4]8 HTpޓS\ |(j%ʏ1UY`]:F(AY4N$;*7"bSdF2dbK0ZFDGVlaK,a{ AΘ y@=VK' 'kPXcRV1X@qX c6r[R3JE%v>p%b[ejSUhwVT9)8Y^^)C( k b$ZԫWZ2#Ak*hM-=X4Wq'gۆ0.1|o2Dޣ҉(Z-SBȒ0';{58mF6#6U-etn of5OfNOOL#?#7ւ@oup˰**`6cT`vͲ]v{'R C{E`m[ G貜ߤtyeZ"Ѫfj1KK:H 7-/ۖe-) J *:Q1 8 ?Tze2"2'DNB>dJ#$99qx!8]>F(F )g()A "RLXT$5' !XMLk 0c  yQ=  B!DYRRBӶEIqE(^@FqPR,ʔ %8D]INǶm"( L1"c PJ?x^ !"lǠQ5yj\Zs …8䔱+qDT-$YAգ$ ƃcpc$r8KRj -|~֏g?w_\GbrמS,R[! Ǟ)GQ>BYXZ[Fk{׾l/} 7~ɍ"(m `osUO4g1Fw^Q>6M=0 5X9M)V#ZUF8l6dt}O -kSBUॗnɊ+"gggd#l\.)Q9O!bdA!Uk3w+.y`ALM%mZ:ENw0sho$[]֒ KI'Xdʉ[8$0:r'eYBk)c g<8Ea˷CqB!@,52˰Nzԇ 1Dd61$y,28Y*S9, EG{l{7?vĝ5֝C3m!ctR3P?{5 -%&3͉X-\9_H^{{<|wܙ7R?Ї> #Tx¿],_ *{eMO-)Ug_u*@<:c+ꇀb@1U#TsDhNe ێn~1h'08@Ҭ`!%%9% 〦Km0 i=y:&I=E1yu38 8G g. Xk #j<IMXkX{ޣ+,x",@? ,PBZ0SІ {Ig@IMG%wB&JeB!=!ƈ^71a;qHt]URB Ȃ lTU!"YjS61z!7rbPuE A+@@2I Sc# ?k;!krRN %h] 'g6͈Ee!l۠0OJ;? |trTq#4UEלEvD՞9Ɓ:Z5f^ X;>1)'~'ɟ-\6J.`u=vNsXߗ\vߟu\19t0J;rf(,NfBlaY.vhB gtmDz[11K) 'e,vmE]N<qpBבAfFYxx}7`\@ D X.F* IDATt:g)qH8~CH8t=y)R"=ŢF) c;B]-DƑ1$4AI4۝$d&)YHtRW@X7X8>`": lo/_Y|l89#_D;:L'Ή)sB)mJ z0/8:e;~7Wخ6؏{/{Pmx+*O:ye^q.'$26trwӴdr: .`u8X,4 KkjSpttNNqf)&&:ȼmK&9RD(%$G@iE)!@tX5 -a$a`AY:w@7 TDTp`?,E*NB?h?ײ,;DUYJ)h@ ajɁ и4 ["ha"EbUbeeѿ{:ƍxUxx9v^[߷Ze&)kIAkUе-咲,N"g\v!!ソ|c {{<^sR!:CV9==e~Noxd|k}^]n7npzzڶAEژk[aʇUv ̤#IT;H;ءmvE.vh-;-;Gv!B9RVxdZ6,K/9ONq&ggS"Ũs6] ubO`:cNfCs"χRŶجM> dVZX?[:4Lcf~ݻwȮhxXgv⟋?|N@*yey<u]oE{\E$j9:}K6i4M-d}/@b7Lr 7}^TU%:Ey<z_[ZI*vdV=N^'(ڍ@׵u!&hmaIr$1=]} {)K8KS:סԕP0/R$A#>[l9]NijRkxяp ݵ@k6ar6YQ>atkn ;\j݁Lp.OYsv6eMqM1?;L]}ݏxWޢ( Jp}|x &4çOFßZ}w;ȣ + gqMomΟww{HgP#4q dTc *wuEeL|C$qyNQdxS4Cq&/oO=I>i;'8muɫ^/"cĨ,K|ak7ǒzn:ڦpxTsR+gu썴& oZJ^Ӵ(ȳ[?/w>~yoW9!?|~'̏P p{'Cd kS:ӹӣ{ts㳀?=m^0#M۾p[lPdAыiF%Zkyoa2結\ xxZiـhNowA \6u6`;/acT]D J+MƗR #LMFTv~aT .ƽ$dk=(C#"y&\Q)aoY{,'a˭&1v#$LC$V䇍1EA=ttm5knrzJeBV#]rU] Lxh0Xf%ݴuے%)*6YDІ,Q!(\[fw zFg9m->&8{p|4` _r;y;Ha<S5 iw Eem5dp}T:Q|A^$X0hsјz9yt{wO9]@n(Tip.Y;󄡻_*W vw4b,o}6Gsځ[mNk_iXkY.tµ 5ծ6*@)in}6d4 $^>\,ilH뜰!-z6IhDQ.FI+CӁiZTHam+x-u zp 9)BJ%&Is"v[q IJ HO#auB=}?i0>< xS}R0>I:ލ3:iO0|3VU+͉㓳MT֚ij=N>H6)_-["q51<^v$a>;%8֍~tKۥ2.pշ_J-_c sGƘU2=,mۤ?wy@DFi|6SdyziSfZ[-y2}#|gE u97֬%%cc턛^ iJm#bT$9ojιAixeFmې)1 5899C1$#fe9p0Y*EiLtpli錃.Egggm&J]UQ-}.nza"3|==mS5T')w16a[7 ;\`<χDgA|f\nC OkzNz<ݼGlpzZ$g<떰j0/M"d] 4z_~xG2vڿ[_g5E9g=y"F ymxұ_vMV{0Jd%:?DҢV-W赢A6AIr 9y\G4hcA+˥կ{ʢ;ф_K'5(J^%RD8^iNHYEoC\=Ԏ/99|=؋Slڔgbk[bP-d ]no ዑ_egv O!}hhoo \PZ`pY7cvOV՘$kȊ1脪QLώ&ϡ dEQR $&<}Z:sa`W37 -o0ʄtYGt6_/=]Q ڮe2SU#e1I$X,K!Mt]w9͉vuBhy8Ӈ!d7V/9FdfPi;\?y􏟥R%;v/zޮ߭Eޅδ}+nwMʲ+L%~`rKH# '9m!h+(% ndY RV2 7ؽ|',p1C:0R91FNNNI|Ab"Fq6GC5$B{kP(<ȿMvd`(Bz] M2ouEXEL3EZ3n}&)1g)۬NGO3,໙. (cB:!r%Q2:tr_i;di*4KR?6]̉nQPOUWx;s_9)tmrEd>plq$ƒS%mddK~'wN ke7%|/c]?{2@۶GI\SՂ 4||T%Y'rJM4SD rLgҔdJICJJ:w{bVAM`37mKYI|.,Q,@G,K6Qb>0HFrD,cd1Bĺ -]]GUU$o‘YJ׶T k':{/pgWhekS~~ў(L6Il8G5{@Gk%TGeM$3۰}O5y9! w蟑U\zw.kzahmvIg6C6IN}׹Xc̹u D$|s6'^c{׊WǞM綃'F5(mIc5IV2j390(M8^%> (m6,w="-QI6]Vd&l6-I GfL&#IJ\-QJϴ1]z{ +Nc[] |Z㽤Vkk֬!x@n9wV'MR"y)%!0>>nyQ_, 76C-b,9(e6 Kmt^@bE@f><'$;VW^sN]4zr!lk̉NiQ 8I7yG6œ8ݡx h;.૒ x2;v@[6䥭Wi}no{.~Z6༖Bc }D壡 5l7jLvRqs&IBZ 9Lч( k-e%*rZWJҷY4͛Lg9@ *ʮ.˩za2ȷjm7ȼJJ64MHӌDw`sSy.3,J@ "@Ckg7d2f:1r/D%ӟО|ur_ՉG|]1!{?>xow댯CZC$kVVjmײG,WBij}{T'0ý6/bfEhV0[죋}LOS-o~B$׸Ʒ)T;is={X,X,VE>h4<M/2' s%PQ9Mr]KMMX-*ƈwuBXgQ >9~W7.Nbٿ~{'ggg%u`=1{6?_ e\u8r n+bpss*8ƶ6`}ָfC]۰7S+rOZevsNCEM,"[kmq^Z>R*;8B6 }G&_}xߌ~WJIk?_^[^2^G}1Fۭbz .im^ݮJe0Wr*Go}64ݨԭV+>7@b_d*:'?&=_ryIx$ZDBQ.v]77 ]qj"\LCVGctUJeFLp=꺦ij1) aP IDATއa>CM2FT卯} Xk9cكsg\2G*;,هF}bu}G [|~|Ο,ϤUs1tƸN]\ ݞgg+ωs=_l~a}rO]eTJ6EIm"J W |ߣLROSi Kvj)|V:kicJ{,oo ?K/x3kk^py9}y,t]wx p]_ 1F1.%uMi=i*B0(EP%#*qS7F'RE&t]KG>D#Ƈ>v$J`]+`n֐9U#$E9x4b:@)Pz.b?aiIkTuEeԍҤIB=x,&1 U9Zc͒7{\"֤)_e%<@fvL=;{A{79|mK·fz Z۶"% =tYRJsb2;Эξ9{ k߆nd3k4AEzֶLB}ĞG5X",J{Ơ51ia YRտWo  e~𪎗)=._teo?] 9w{?o\\uq+`=+qsSU1y SJam~- qp ;'bF7԰kI^k;ȲDejA \F[(5?ΦZV4\$FES(iy>!NϦtΉf}j)QE!c7;M2{'ki٩wmEwv,n9Ҟ݃Cfz[?k>RM&gx)1BQ&8OQL&c1Yี1 YЊ,-0ϩ u PL3$@:$-EmB+o26=јhD{f#|cڳ;/etSړin%O#fFbn5;O~ އtMLv}lzdB{':D@H!+ωbF3|g62ӎ?[x4M[D=LSM&=-\GZ(kSUWI7v}Xs=EQ2*GXnocnO{:Rn9_F cwn+昦i6?gi\߷Ү$zi^Fjӡ0I<<>3[%Bk9NIB4U*r4gW(%1F]?쌲hiyטf$As"Rr16BX,(bjwI(jE9/hmB( 'Ij9O]Xk(G%siwY,Opdd"=ipv6%ReCCbpOy>_]s'[=VO?EF7(^:7޸Ji0ʹNJHP=H g:JZxUu#+̉'_yW==RP&آiFsl"$Us!IRxB夤Ln[yo?~[7 x5;> /p ЯVpAO.L2c;3p`Eb8:בS#׮J{l"i=bO#Ūi k,r1,r|ľuBrB#yA4%FhfHKk_Ӵ1ƐX;&,ˡ(bBE,#ᐒ̃ԃGeA AY7DNJB/"&ѐZAsm)B³{?vzR[^?y1Nn[`=T>,N9:{77`>RV{d*!xMP:@2-Y\iNwIq{szcԘdl(|#q[Ewvmț64];7e$*ѧYlXko~OkwnoR=^fy.HiiJspxcOK?-pQ@Z=&(U/Wͳi)˜~`8֒yis(i-mT!Av ^R1B!2D% ;VR̉iF׵4MK$(dyA׊КQpoo釺_!@+MIR y7PZ jx@s,( rxlN&ꗦ] h8'yQkvXC׵88=œu$I!Mt>& MӐ$x$D. Ǝz(TuQf-\M 6tm'HJqÿbuv9W-@xf'#)-tbOhSՌAk`t:_:$N)ij)aM`sbuxg~/52~7&6&' a%PIB2d MSk=$hRs vPn(z E R.{|?GZPh  W *w;@?''Um {@.F:ˠҊ"jrvkF4Ūq4 ДҊ,QJZU'뺧ω.|/F34BJ1*K[-` =t0{N;(EU58hFL(V@ s $G~vÿoN` s:^ecȻ}Mx<ܹ_~"n`{\v_+kA~r,Ʀg9u]l~o}Beb4~]7" zcxL8%$֍&3boo"@"$EmOkͲ]ĵk8=;V,+"VcPQ۶eZ #фГe9!6勲(hnM$ڑp>@eІ#Fj )'O@kHDRM99-YB -_pE߿M$ҹN?MBU7΃ZU,+4MJxfHzX RRuɬE1iꊦi)FVõ5?gc}{#owl6U.}Qݟs bFPCO6Q1.HY9X~`ucku(2\$UEZ];a'<=~׀?Fl^cv[wK蟷pw׿/l\=B8\e\D~W(#OI蚆4 go-n9/(k?0kYpOTD%Bzֆb>t w@=dXG  9q]G`|䄾'D0ZauuF#Z锽4ibZ\pg?>7㳍ͧ#)| O]Vk4ąUԵCS5hdco4=!4>;1JzBIBL9gu(>x009>|{뭷nJ:x92g=vئp\>! Omϫ > /Z)UU+q2æ©ꚦi؛Qjs>UݑfԼ A@Y\t)7ӶgdyJf̍4M]GTM""dZؾ+NimHd @Sy,0Zu^ĂM(rж"O<1F2B$Lg3bT$][3ɭ my nn@v[MȽPU7ױ5ʬ{?s+z~tr^oP3#Xf3gVUB)HlΪhu%kkMG6Ykpb̲\?>Kq/#B/xVjTWI/ g4* "mbcdWv5XTϼ&^tyG6dYFkH&Α&+"GyA"IS+ǵ Qh<+V++wh(M^ӵ-EYH"8;P!d6 Q"t4b]6ĕ%9 <0J1FB 4 ڳOQ&!l 8.Q)nI {^/~>9εiϢAu5nbjf hΑd(]6ta2MqkmVy+D!JWj4tʢ( Q٠a iݵҐŒiqh^ZT}{g^j9Hd9^~w4,HuO%Huv_l~| 9_9uxD% EA P0M;QpQ6)MQ:oצ0AEBuPB2?3e2vm$ k<x77xJW/ l+v]wd=w92O# Z?R k mE-,Oae\P"&yb& 2MϹQYP }(DmZK,WEdkk,2!XkiDT( ǧs6@iNHGVKjE<x%jpIb }&M =v $r_)Ȳ`  i ׮Xʎ9 ,Ĩ ?G5/y^%UO1^)$$Cl1-/V{Qϫ v52K7>)Ѥib;IS;[M,Ktb1 }9uBX4MMS:W Ȫ'\} ox|ZJN1;vS>>p]|I},v\JKs 2!, bEs,Z"GHY4uEXƣ%=F&dmJX,PZy ah TD?3& &dY~6׿[oy_( u iWE_v1|.\AϙσXﶷK/j{7~a؊OMi;|tf4%\maG,M>3ЕyNa, bK^ Rfhϱ(bxnsud2FkJKq !}`Z!hHvD"?Gh<&HuMpqjU >|)Yݦ{Fƿ ^>_i:Qcl>"gZ  X v6΁0ϋoDIY4 k }O^isNeMp/KyWybU/ .rl?~wQ6@k}1(E 0ԱFV c,YV)^&e׵! IҔ1j_,8'9e4Prb7jeYL`z(imVA,i 3hnCm[ 0ׯ)(&F Fe?3mb|~>/*9y_ʝ IDAT;'$5y5XeɪPfOnM臵AQАg{m,mPeB>Uwebʧ ⋝/wKiqʮ]ӂLhu=}HK=m[0mjuE&F%vshK NNE3ɲlb$}L#@2u]aъk{X1FcmRۛ繐CQ>b٤Qڳ̗$CzNOO   UU+S1;ɏd[~9b^l)&[hK! - --$ °v . aA۔%Qlush~zUq3{;/++k|S=O!Q7nsMvù Y Rx?`;#s7P7^Y2/z߯|/_6 0lkycR H6*#{F)bAgrI,hs䘙gٛ%w\H> ?Z n0 شȊM/;|x9W.oJx;Y)xVwΧM]ꥷmzTBhRf0@Bs3ͬ+Y0H۵S&xgwIj{s솁8B]%-^TJ)lN*E2lkLyo,''ǒwaO<}yMws:jAF{BĕLU$86i4!١4%眴 amZgBv{-ޤӶ-F"傶>><2ݻ锻) p _Ao2Ee^ \Szyg @fr[.yU1QKmX~?\(RXpݑdRl4E'*um蛦e1#c8;Y{p(ȷZhێR2hk '(53NOOZ3MirxԊp=J)Lm/1K& J+#5(OHL>1_i2~ޤygyO{O4;_o~ !RǾ{X! >8]cYf aPiipA䘇IPhnO.b^VCo:v8===~'#ge+U87_}W_=֍Ys79tg)>_IGN kyGʙ'@Ήm9;;;Fh+=ysXkd/+hD0|}'`@c-v(-n yg, 0tilâU7Uj,rtex3M6v?|F3?M\=_S"HjxJĜk'wBٯ{)P**΅j9ermWOu]۶~c^pӁ_ঈY?nn|88lEybx}/z ]vmisRgST8Cc)f1 Dc -łܗ8)9ӷc,͆مӢn )e60WB } R1G'Rߏ#00UCNY81\)=#bx#?㋺R/$|`fTmR؋R)V+Zٛ|'g(J )Eư\݂I m:h#BCh__U|lSf,~xeo=0@Li!K#G}价\\\׍UG02赼{ |p5=CSүhF3c Zi)4h#9g{k-JiN6YZ/`{1U^8F9Z4tm"%X cF Mh olS" +{_\[-sJGZsU ˼N}iOSZk?g E*9$>3Q:PQ>h[/EZ[{\6i k/(N)bR*iZ|O s7omx5&LW(幪/_=dp 'O)MŵsŽdYG׳V+n:Z1b:EJal6\nwtm8rPH.1wu*UAuB*T`ĹPWVUǠs>:%'ВGE vi-J+u=~2i!(zE4D(mEsc g4ck; T</_x'5k&9>g>ƫiZ~*?{ܾsO>FCf ݈m-Zm;.Y)J OH)1&Ydo鉽Iz=z 2(PQTOׯm[?sYڤ7&Ksj'߹{ܾsoqv~_opc 1|ʤh~d~H{G-}˹`KJk 셡XvP]B]ٛBH,W+&׽i&8Dr< {hva%ن9~?/ʟzuw/yM=*ox\z+`ڣ*`u|^~}>gkKk}L㿨5p.ȷ'Hg Sn99EWA:ZkEmwyR(-`K躶Ffo3RD\hU'*A#R.C&`a@3v0~ąHʅ,{>|$d_9eMPm;_%/sk7ul"׽ɘzw-mײ,)%n:GJu/coz^kMrWTke9ްl{%N9T uT E׵麮idӵ] Uu>4_[Z0!TP0`Ad8YouP3-R?Z0 -1&VkC/W/*8!/?eX}q}w[:6<*̧T(jy",RĘQxH:v n0 q;Aaqږ"GY(nd#%iX =b~5_ߛJ)(-De-7EwS*ڨr yB, K(ca^w-mTG:"nR$#tq\m[v \k}5S"@!(D)t͚nGcN6iZMI0 wỸY0&쑯zJkN\w!w78u{AX!O 4VHU,9J\k ElWF|pzkY6hBHTGb@٣&U'TkrB3xƢtTm[T,"J*[gj0O׶h ![t]8~7iu%68PJDԎ:_zynۖo}[' /f~/~?,ct1˦i^6"'2Z-'Ιa? t솁~b5Ǘ9ZfIJ_&_b'!gA߆PT9Rl6,8\ze?hvj"4Yj . 1fѶ!qVZ1MhvJQ2´w~5"(("qA._0NC)⽧n5-y6'ۀ1b'Fx3'Lɚ&ALÎSs]q_xެMx"uge* 4Ms/N?u7DW^?khXk%m(.dq-$/S c٦\łqhEkrmSI@D:8{OSojJq >/zBY.XkqI6ӓSybcte5jRJI5XŢg۱^x{Gw:U6/\4q=vr6+]nw9b(}GNR֒ X w6W1fzm,9bL6U#ァLӌQ:nB&QTs\ j).&$t)elHu /,KR")iggrJ(s߿˙>­3q 9k9'C) q+TލzIR98.zv7jMqcŽqz;/T!Y,ϑ2FK]P~:ZRlC&2\m8L"f"v7`B57N.Pgm!GIq ֢P<ފ#Th+\fblږ|D+E(6(T}qrr~?%JU"L߶ΡǏ/qαX. Em t4!/d*b7$l*bGky{Қ-ZnN }1YdZw?;O_ xp!_p+o]'zY*u' }dzLf-ɱXH)raX\|| VhF H؆Bibm`O%h,1FiX8"ݾ_ж!(e^ڮ,!8 Q69C4(}}6w~ܻ567XO>E zڶiHUi;Rm`vN+ӹ@cu .wPkqWw3}FZW (ʝ1a9֫`Zci8(0ZY1zL(>hPbJp^!Cr*&Ndy*9άW+q懁z0ki(wb!E/] Ү|)͢H'o8?ʞ5(6W~p|;΅ pㇼ@2ssOD\Q ( @@w1nzY'-H>gsyv\,k Ϙʋ/ѴrˢbLLx4`ci,9'ISIXpW+!=C6 UJ0/imiXvҌ5 9r:~|mnR[5=n{߹Kۉ>8ڈRU fi ȹ`l0(HY@)v_ |6rf܍hs9V~bW oC8I1cB-1B뮣:(B3Js IDATNÑGQʣg_[ae0H*\j% $ .8ڦ%<]I~!r?$#UU%TuPJ0H ڈ.~X,z$s:p^jQ]GJa )ct , >!^Oaޜr~>sz[q8}[w89%NRlRA1!$r):Ѧڎa( קUjVs4!zaij yNLJ$e5.%ݔd7'OXNxcJyKFF!IzvqOt]GӴL'kbuMd ]wz|NqvOxBLYo6\n(ږ(4AS(J!DNOǁb0XII~JjD,m.@bM!X[}=ity/If/jfՊ?Y>_vmAlepoxS"?]}0<"Z^x/0^#8=ѯhmKX\XbF4i*D9X䇏7ܓŦx 94MPmR|e)Y9Bϙb6IjotB+"AU4kӓS-Պ);B6b!}DV( *Glcq̰}rc`0ݹ]ny߹{_GW\9SɤFJF(ɚQ: RЪ-,3!%N"a=s-)'.%<v/"o!cmU3!q9|LʓmS&cPV1M3Zrg mq.Mnm׈vfѱwf 51 }-9'2;ъw.4E8:@J쇑5s4?;,.FO.t]K4=.Hj{CpTZr;R(u4JZڦPRychCsuoBx{ֆ\#c4BHu=!v|m[[oƷ~_םx/[_}ϊo* s !|ܶ+ xƳ/*Xkrr#~O1;ݜT\ImyiZ)YS\x1/R?S+wm(zVxc`rlHW@RǏ6-^wrR&9Vy&O3|rpOEZ+r29ǝN/899T΅7 (cɩLKͶ(/(>V)EepLm1H gv4 ]R D)i0DY-SkW W嵷EcwI$PҦ4:MXDl{wP24Rr%MӲ6b%tXsyQHisv vXh9 aViJXQajbEpiI1; RN&z"hrNpFEZ S '%O)vRb$iE 9؍3eZkI0G}{ϋSpCޔ "|[ ψ_{EQpן70OےSPe/d"Jx!(fCd?i.s=J!Tmw3m!܈1.k4URF7 e }uc իo'qђ-k| aV87kqX5ըIIaVßxݮɋ=^wx7{/^ZneT9R?UzSF'6ҁ&ֹ?;!;WJc;OdAj}B݈і) R3;A9dcŶ~v,:$鄉/ڮA5'J-GM"XUׄjH~/IVkд9D1U#hwsURb\֤5&b: 1EҌDH7)ӭ3Hf\3 <999F?,$:LrNurn?urCdGl|`ѷR` yPJS$$)ֶ?1/kc׿}WWg7d𬡵9.uGrkߤ_,)SմyR P0֕x|m;IWcD^` `98[ɱS{zC!3NA/%v]+) ,xfi?Ѵ-֊ȡɳZ k3ϞP {̕(%RZk PƲ;i79NN6lr5 ?\,H9ӵ"%,5)(rCd?7kJZ^)@ttMimON>#NNN#6 R51Zp!TYODqܾ}^f٣B%J+ޢ:t4AC%yi|Y_[ܺ}!<>}mI ,oG1A(bCmv-J/[T*d§Y@hhM$L5O0>=Qa5K.&d%Fe~@.lw8ٰYl9 }Ov;o1,%.84JLL,kkFK{*#AFP&61 mShׄ'ڮܾc'a\4ffUk,bAX˾?MMNĹHWք֒ ^鍱޲{S({G*lZ%ך3EI| j8(hTz:;EauJvR۴R6rQ5I7BeiO \?*'}`FQ@!zs GxMۦ9vZhidiMAIlJTXlړܵ9 |KJ+<֌Lu5u[6bL# <;.#a|֜s~=nݾ}m"p9uR9cLG2_V 13O<(m9c2yBV$$-xiCJA\ Y6B܀0{NUZ֢*;V0*U &^(X[[{EY{(IZ-iF@}9Sb\ѕ%8֌!Sht#׹>5kjm (Y{f)xՒEb ҶW,{_%yV1 \)YKsT-UkI.k"UNR'')u QzH'XBZOXK >Ψ‘k!:uia.j/?Z.i[[B63iFu\m-cjI&a 5sH*tF12x^PZډag9Y/o[_4F__q3\oMrUQox2x]y6O7] uڥ~ږղ>H gn a5''(Lgv{{ymS޽ÃbmURkEj_)"u !$mHI3m,Rpwm# F;:pg1Х߫Պct"F#Yv ^2lp.RBhX.{IPrLi+߼ܬ7+BRR(ysZ-H*pzv·}sc4'Ę)9@I@+ii3\\GXk$#u$HDN,1D&D۽pzrRS:z䒙R-?TVҘHP8;F^E1"mX\"XVr$lDbtmC*33jU&-hQE5S$ж ..,X6C`mEG?_>>Ms .W>7g\1~@Ԇtj;_4ڶ%_GoxS3ǫfn* T <#pE՟^Oe\@)I!m\VzxW(9)}0NTQ"ixbҝMMp׫58)QE J޿ߏ52w5MZH䱰 '-OG#* *XfkEkr6uv$4johSzfލP(CAY:Bh:ix<,`{qm _U9B %He)YbkѰ/6(KgVKQZ^0NCQPB r S6DfX0;9cTE/%Di 1 Ejr-{\cF6V&@S)VB_躎aw<;Oڠ`7&UqnϪp5?<+`n<39Wա_%S92=YHMEk6~ (YVGv1Dǩ"2-λ#1m\J9҄5;nDm4SBLza +5~;\+m؜]pz.ws>w ]{J#QT#)BjUKTP12LݻHak?#"2i0D 4x M8  єq%}23"k?=X9U]ݤj YYX"S#C@h#Qi|8bs?5x7ơ8Oo?-3UpOQ/ ?hg/;}m %U4Њ-a&kFh-fG8T$AmH c1 u=5ڶA=Ɖ3(mۻ{C4=\-9Ծ#m8g^3<^\a5ýnM"$_59X4?BA2xR#_ZߴT:d"@cF Qh /P ["0-(h98k Qv<% ^Z&)g qD] u7oѴ @$8kF0~ }Lǟ߷%/l] < 4蜃J35;q:ً8'<{ ]TVUfN([4CCW#|V)R !Fi÷h3FCĺE,D+WWT9c?=AZP;~8Gw=&R¥^i'Oh #C5o5ƣqhjBNӕa=j*iglR"ۆqu^FYFk̤Ԋ 1iqBgv=I" 佱Ў x_|Ti8F54҆o9OF /Q+a,{$@A~nw*(q2kP$r!F! 5 y4h=etCpkL dFf%bokr ;PK4ćX#*k/, 4pZcUwc؁ 4J&@Ұ`&` ,ۨE`aB7!18Oq؛t:ACG;E<@m{x .Rg7~WMJ-ov~ק|LE7x}^*`Ji9WX੯_~}w_^ZL[9n=N87NZt.[s1DL6c ,j)x 5U'hfxc, t*R P }gʪ6 C[:wam'q[ ٳ$EХ"VQu˒ _ϐ+yƪh6N AN2OM=OGLӄT Z)#.MTQJc 2Yo$)ɰ۷oŁ|mc5J8;L ayOzXR߉C~:&=+py5J=BQ 5-^t<8/_L: -04{(D[5vn,dOOƂJaYpu#(%0 o5NƐ#1/"[k`}h ըqFI3N(Ɵ.6o֯S?H")eSsskPcoiׯϹ.﻾KZk0Vk-aD<([ )TP洖c4@@tP+UbJhF|Yr4[JtۉE0%AWt-7ea6+z\.!SĮkm.󀯿[PEw)UKF! Òq<iI0AʴÂ8"g Ą`jŢv҅ȅ0ZX'TAg(rN \F۶xھgz9x[4;i7KCⰎK_a8(},)ĜęQa8O)cGIO~3bH7p{ J!H}}Č8&};J;wl#qE1zT8\_ߠDdYPE00Ϟ=GqM}'ww"SaayXVP2T~AJrc̯DXDhLÚ{qKVRpW )%TE~ C,qF?I,cA.I wzGJNO|)|mxkXX\])38\ ڦ Et=[g-i=P*&:Kc (i[wAmgˎ@įt/&mI]?}N_(*<{>& >b@eTUaغ.|J9EnyӄyDB!?{[}O4Y)&:qp Q²Ju}{8Ki NfMKoͦ.CӴ^0nyZPkA*s< !WޟqaH)x>ӁNA]*X@kBTb,3z mwꫯP2֙qۻ[t:k2OB)]YF:] ݮ1c"Izh%DIGJH-l{XP؊k{$)Y}סjPZcQjE Lc (82JF6y^&5y=A-8l ]KZlsX6܋u{cj՗>oe<W|Ƒ`j]Oqmc;dˏO}z|썺>Z(ME=Zfsq{M6q\,Vn˲`a߳蜴!݁9EGsl(yMzEiWVZq2ˉ1/A0|Rܲp.q٭4 mXb,#H٩0MZA[K…IEvՀrɘ癊{~':qp_l-QP)fSb:vږuNgT7Ɓ7zqOk:7@RrjdP-N8[VqZuk1N(eL! Ȕl84mKQOԚ5y{t]8z^ФȮ<^"Eh*xBA DcB?ޣwu\cq>^<&Ú\> 3"~i0{M?-yk}_X[h{tIf,ڦmCL e g)IZ`$G}"Ƅ]C9kſ;11׮ׯW_}5_O1,cO=$`RJN)=(XV*K>#𱉀1qEO+:8PH؈R8@ 4G ҲWbe4 v=慝5%  W8͍0',ФݎY80bYL]/t&Lk_~-T$-[Co*2/?"3i&Y'4kH7˙qUau;O>3Dm7Q@0#N@0nF@W<ޒyiE?n-8XK *J+΃JfZk~{<^BuQb0;kEXH5Z($aYp?m,e^0 h*ΓHv}U뚨i0@Cbx%V5/Ÿ*I|Î<*?f9GVY n6[;a2jDkh *" `[ on0 k"s]X& JUCBԊl#?TPN'zjw?."SP>/x*axy.򽀀6 X?XFv򌜙}o3qp:#qqD^ k ([zΧ*?{֟/yy8]-^~2mPT(4^x==SNg{7Kt8xv ?/ٶ ]pl~ e:e K Fۜ351{IA>ge(Fֶ۶7UPd4 g6ǵi%bR!IKHJRϞ={C<wBX9F(b8! ]qs}SJ뇀A:./^r?`4  |۾իۿvO>W|뻾 c \$Ƿ?>t=uCUUJ"Z߫nn< $U3yVhL3ѱn<[;pY*i`7۷hFe^pw"K H9-+h|'X"HiY%+Vխ/SteC[ v.i;,)"\9f`t '-MFL%cfXƈ"fEi ([4{NJƛ7oZ'OGL/` q_7{Agpмt'q9=AHEI8n%Ә'lX] ,J΢!"R?Ȋ{SIJ%^ 4]=b`A8G%%J=~^m{5#~㫯(˲H)%>:? |2ק&q]_JCT 4M;7SSb@_uu./_*πڡ،sQ94&(+b4xK{lC줣8F(y lRs 8C7U3**ȵB8ᬆŖoUANZm^qJQ< "B&AO8F#)'.=ΊTv{Ga,U8XQɶVڌ615NJIZ8f:BPwU33RH pCAoqzG-Tȅ,nuC%$(]`E U1E8Mg>m Z *k)HF\/uMR3j"ܳ9V~A%mZreDuqd&em'5b{u}L@#XٚJ2"jt㌎z!xl%5A-9y@iH,81J"&d舂W !xgPjrSk\GZZfT(1#RYC 0x&J" XZXL3n:$@tBDtp>oGȃk"BCbv@HaBƿ݀~s/o[@~Xu_76*7~|%>p_ki iGF= _ ObHX>3IlIV#9Kf Elfy%yb)(Phy\a+@ Dt9lGZ|'vYA抮a#6#pZ#]SQ hUww-y5vm'L2qBtHH< kmp{w^61Bg$(@=7?] |Ӡ~.R7֊ ]ٴlMB[tBA$"R WODQa|UF'T{dY[")ǴW8lzFbOAw@oqf9<~*EKn5eơև8-PQ?)xZ;ӄZ)$ҽ xO9g$ q4M߸ }-k9 ƢİQt1ĢiZj%r?tt֊HFE,fA5NGdk{hg_ӟa>.o'w}#oɈ7O%[R,˓@]>}~s t*%JN4M h5!Py܍$m㝸Q-J["ƑRTCnU+[gYXin Y(hP `8l^Y ^H%gK?vTɠ뼰ͯ@MHD[p}ufD.˼NfCBM5y Vps )d^Wo 23IyKq5GrOUip[$iYZ[t\faGbIyb80i P BA(#_]!*CB?S6ƚM2q%qP+05Dye/,#ޕ-X?4Bbk[ Qsш[_.YrH+T5hQRƂ8R)DDaICXm p$㊦UgkE,99"xTk8 +D)&eYu^j+Bf{S5"5@DFuV B[_?3| <5x\0O{$x}CTiƟz\ߧ L΍˗/PR__6 on5+BvfÞbKblh (,!7ap]>T1&vGiMiu[f8 HCXg)5z֊sPO@kV9 )aFh[ŵ* 4j,;8d*>k4]_9mOBv_)DZ;Opsk8Ȋ,AZxgRp T-U,aQ lekT x?cokQRuNO ZS0g7/!WIx8iKϧ3j| k[ J.A&CiiY10*+[<9$iKW'1(URw~ơpys8:U0yk9eۦ|XV bDH43$Q&QyҌcYIX0Y1ƠW&Țbw:Ѷ ^<k53@x{R1鋠6Mg]sYٸ`uCIJiӹ5R5Ra,cġTe39#,jEJNħw}ġB[7!f7} U3nœs>[k~Ϸ}Ok5,AY_5f FZ"$ 5t\,iƮo%ק`B8bh 2z @ldsGN(i]Q)gFH0^yhR]u.Pt Uw4PTJb͉\m0O3 l]kew=JbMk-ˁRKG]>3vg*`q{@)]Uv J&RJNMKZJ'VYp䡈hfIҌ]㠉qX} T*+kY*++@+ U3JIXB xm`gҼJa”3j0#H%%5YEkQ~dKN,c1v]łUq0q5m㑶m%Q.H9C{G$J+*y2LNNb(jȅ#!aFU!**g\Dzb :Wj1d]H=/Ό2B a"K.k-eV:o,muEcrlbkKި L+k+bX0".#&xg|}g\)>&>oЇ@~ݗ݀-)onj C*^L(#|ckLV, ji9 -A +NyQH@NZ~/&")1&{hT9ɠPY̦ Z| hf X{*iv~ZQTJfE#c]Ӓ @ R0{jcۖ@P- D6xм,4Z$sVO9A -ˡn5ԵFSL+;i$HtBՊy4mXU8GԾ5V9PVC&J$7-Xx, װ1ZMPbd %N؊rk(ZZ75ȵMEr/rpY0w \/u]{ejLjLx!|>@J2.11%:oDNypls18;ƾy8UJ8$H{ A#/\v~Pz} S2=c~S3;SL.m_wbΒGBqsuMr.?!q6n exJ )ݹZ=#RtF~7k-=eSs(묳" VR N ~Rb<,N;nsPpc8gh6ka@TNH1R`'%1ql5tْ(JP+a9G0(v1V\āKm(% ̊$6όCD-U 3JcE+BmZV/2?6ޭWLzHxG~TDO&K~oseY^W SS e`Q5MR #.֟?wmwrJxvsEG656I*Y8M΅Ne/ҳDmV@YӰ-T\__oHh-ڦA׵(#a&`ԍ}Cj y[SD6Q]עm;CN뛭0"pNbzcFߵ0 x9uC!g\3ݮGJ9<9ԗqX&/B>C~dEQVCȦ&E,»b-9OMcHu2L'm\-|1#j]UEO x@ ?F%.ĄO5_QF/5k]ZNGvQ6Wf }θ\{N\# Djwû mdwK8LQ~ꢵ5B +{Bb!؄`,pT db[W*a <_ n{,MEˇ".c>-w@:xx8@9N 1|fx:_p^֧5/H30{<Xy\H*{Pc:NX DzPq{%Ԃ!(4ābINX)n] )1,`1>o'o}ky%/Ab'<I`˕m3g%'T,4)Y.i9|w<9 \Q1#Ʈ(8 xLT<6  NG(ӬGTES;uYQV?|ć}c&٦1wc?3>|WYq<w=@c!=>=:e](y*Dбz4qqp>R 0̺-7w߽@AU&l Aa=a`4Ƒx||ӓ̷#y=Y- Av?W^Ec:8EC?=a-)Pנbw +c˅3P R pRg)dc8zxx\2ҳ51[=n]1>x5<(Pc4&>BVvӖXzHK,4DagL(5˺CaY)iht]OX2tmM)k(a\W5bs ۮ pz`y3RP#kZ çKj8JT?um/L\Xk.Q9vCI 뺠 P< e(3 }M6pn*.%`M^!>1'jxYy#jFג_Z17(9>?=&o[@ i3M=t%U|cqYU@i(i1HBvȄi as~7cDZTF۶rG2]yQsC1%΂)[3SŠ'jҋ@iC{h~`g5=H'dā2j-~0N-QT߼p秔nav8_o3^`d qh#3}/yq L{Q/S(p"R&TeF yۺ=1&_+p^v߶OXQ+ZQ k î5)CUwH}!q)!%qKn&$qYb Lxx'F ECV;Jy{A@tkN]u˺@r>8kh$(&y${VN ߲}kڿ@_U>מyͶ%xl,˫n'*P-lLOЉR9%,3篗:G:p9׫È2Ef*gJS RkqSmZ"[BAKlPc\+XQ''޼P, 0MNV ۆ"(xnkfjM6&|V"Zlq7HjR]# \oW@.y{:o1wZ^>a6ʪ. RziVR{^KleMXL(Au[e%:FacK+hDY}8iAL Ba L"mƁsQ*یm8n1FxI˲5Z W QX7*jH{g?p1֕ ZvaYWƢri[ٚǢr98gQhXX+#GqO\۽C YYt^QaV p8L dX8~_{,x}H!(µ[9bkPX;UAia]6Đ`,Ɛ%SFen딿[N^^ej|jTk _{XE [o1+-ZP2XٌIDz4C] ^YIGjac^/˪7lhL>OxUv/ZM.hΥ;jFi_z+Q,x:7cZ1 DYa)_+B6dOOg,sxz|a0w]0YPZcn?TP) @i~nC7zZud"xϘB:@iM | 2{EE؜}?teЪ=9~+pz5+I> V-sT ה ~`̟IH;J χ^Rfh(T/IF=/ZA3-Wc!8*f}+1FF=u8b,x6U?vL "BTkkNjߵ8p5[Q=CXT@{K"bFeo'eA.mMi:tmMOFcy:'qhQRဪ{(mӿo[֌<ܗ} &aWo_R?AOЮ/%;X0J Vnj^Y_v2ߏ1vE`S%`E c?5ʪz,@0[$FJ5gdór1&ˆ<r*Ej ?q"jau^hsaTmE agI):Zn YeϷ] ~glm[ŀ PXe]є"Rv89ۺb^P>W Bə;84 U-NG4F[=qZq.cZe0(+.o7|||iH4FZ#@te㶡#|'|29:K$M{lmf5 QYu]7qF챘I«oIζmHh G mc؄ 1p:~22Fb^BsG5fH J5!] ?>}8fhc@zG<%I1"XTv#mTCeEXWܖ!%YFYF1Rx qhmM,$uaV1;m/:$/f7xwpH񳮀_ASi(QXTzpˌؖrƗeco( KVVlO1P OrQ raQiVi! VMv4AkZ,ll9c]V^%:)8_J&Pޝ^rFsbpTcX, &ѷ~' TVN! $7a:`YJNXÊ|$1 0b"JIeY')R(l+uJT&|qXS4,z*Z+r"% oj[%>볿_k*y[5 H{^ ! Kҿ"s.k-rAU/ H1;E;Zxش6j'LYخcq:0ҙ̾9p̯z|,4ucr݈󰎉釞a&>)Ez fHP8 8}͍FAE=R!9kbS P賮|~o}~_|9\KɊ=_.H?z~zz$^PYHֽVE@Ǐra`Cd"2dv5{yiUҚ#^QQPyZN@@%ݪz8\`DzԌO.J[ᄧYFd(%eLSUUWLz<>~,Aa2;:崋4SZx`a:gH 0n)QGyJD&>H1JFk<{CD/͛X#&-JƱ'81]k:p^a1 I>.0|FVqF1J`8XA+eRNz&.^yYݯ6B6GL&rELtb]% ZR +tRoĂkIr @0J y^S{,+(c)"FOipFbqZ8?]u1qzwvO[9*`;Pkv(:B] #M 5JQˣ-F\EpBv PP=ֲHacm*ׯޚ)Xʟb?gz}X&rfr>x@mYd6TvMnz<]iYq:m@s"cuK5!n'CBNy^ր\FLVE"rZqp[L19Rz0".W8GdhEC ˅&8dDzŝQHrELAvy GP+-ξUC?Z!%qh&TSb/Uc`cG0ǣP!k0%IF'183eE"V{!q0ދKdõ*+BH8_n՟}Yu?|3Ri'ܮWX3y!wVJzmss%@Z'>!T 7c4Y֙PWg5q8BЍ8K"q8p6{q=k-y[MF*YPQجC0R$ B*9 B*PB ZSfXʊyLJ21 :'"}`rEEI/c9CnWLe]SF,yG_;k%〒(da1q9V1f4i;l%ps.R6)N@E8Γ1 u@"+ʃp< i#,yǡ ] "H %{_-9èf9J1dHoQóX]Oj%d(QB9^G'IBXHqW(Ţ qM(BTd@?Hǝj * Ɲs8 $I@pZ k!c{,ښR"|>Ii{/ (hd aPr^`hT2Q"dE$Xoܿ[@^k?K>g{2Bj pڷoF% ueOF=͋`s !lS+N˦L%2Vg[Wl|p@*^+]j:kbciK#k'Lc>]r";gds";Q]sN-I.p9wq7m|QepmCb8YrRM16NW _j~+ N?c/2xL>GHs?wzM$@$]`=yt]/,@zDFyO#!UҜ_Q(jp<)"{N@b@N tBĻR a[p<]o,j,|]f8cQ2c4d}RgVc`"HI#*EQa8 UԼQI^um?Sc7ȰnF^sV4kdkqX@bKps@l xvpz/7)SBH-T6]䱯 BlL4CUV Ag8{wC8P4YqqК3^1軞bavw<=c!c{,4r4J ˺8M?šbSl QjL A| }EWİ2!%"B t_,oﷰVk\agK j5!ݤazc4P9Zi8{DX8v%s0؅fuZ[Bh+/ d\IdeaO?RҸP9ٛC N??m6n߰7$//u]!5\/%  [WϬ9%xgey?Ǐ UFU,lu4gGTwˡ`GI%FDs&xzN!ȼ-TkG;+F_|_iC?${j՗ F6*r4We5E aYW΅AޔekbZ&+c=Iה8p)op8t][w]'nG㧘=@ʝRP2BE1/󮝐AZV ^)23I]ޥT0Fx<h^jA޽CG MC~V_ġ Fü,wfu_^x]DZe,&ag]kĤy;v6;;g-El(M=;9 ò!?8( 뗷G F,DFO|&UaR ppz8U4 I,hǢXlO3z3FI)LF0Ciq}4MG\כ-7Щs?|=V80Vt+hG+"0-Qm JZJ;\.XQF\4*3w[ %k)g ~mM8O:՝Pr/uıQZFZd. PXtŽH:#xuRt0¶.zϪ:nDwHDkBvUن{okテTlFA % (MyY);t-bNmM}U* YF0 DvuZW,6VJ~+`T%ڟU_z[ר[){~FUf+`5D-Z}?W]{[2!, wA48ݒ8Ӊ] [lknn3xT(#֟TĔvc4yZޝ4 Y RTl7cާiBMfN9um8;,TeoZ( CY21q f;߱5tx%bF@}!88&V1(EZk9PJH)a\.A X)@iG)r$AZa :'ۂ{lfa0# wN KơΑLb`48`YQ+D ˶xhTǢbWI@LRe/3*-"T mE;2>vRP Uqc- À1i=E"cb]ɠB붡N쐙`@آٝ 2 #Rjkm\[- 5C ` nǀeݤ 6}`\Lr718jcRؕa.'<m 5'd(:ɨkOM| 2MKca^ ZJ1?H#U%V3Uʖu!k˂Z 7fF+hmp(BCJ]V,QZٺ$bԷP2/;Z19: } ^$H bBۍС_k})B e2GLk8@ti)ūh<˞%̲UO'4[*qQ"%!ejxMJmɃuq].RT`UZy\@0J9']G;$Y Pp8"$~HqO㘔bRF"逜q(qM-X [tͭPȹ籐b2]|>`Pj=DZj @kUifXVQ@L)Q< J;m2n tiȣo :^x+F2 Qd4FeyL>105iE@"c qs m B'-C?춿9]nmf{}HDoN! kzgN2fR1)mzu;}7s-&oyMk6x_c|r~5XϹHD_TR,}q)1"eAP~43@(-2m0N#Sm>9% ưy:v#a8v .2~||N"(u1bN(딒dJw=ƾ3IfOe ` %[Ήq53-uk IDATk-ucw4ؒ&A,鋡va|Vt ,7ѡfM(M$V`Xk\7\$8J,8`HTFu iGg'q.I; }Ga,+U<6eEw(?r맧r{7[KT?k[}$+g?/=>"JVİ"n- r I^1Hv-m  (hI2zxU(ܮ7d!Ƅ TγpIQ:єtO+9cG4sNTT-7&@1\鶰"刧3|u>|NyY$H]$N6ՆMh: ?>|^@4x1m?#º `@&n2Rqm vid”-`]VXpUE=8)y~=. g̽8Hrpm"UDy[ăuCؐr|Y K1RN䔓;={\,mvP V)}2 º"GΫtyZ&bK;Lm]a 3Ut=R (c,޿a +X U;XCZI{̉=k{'G"qO7\ Z+>>E=@cvEn9R{S?NHV ( 7ۡ;%!l3 O3k@o*% f_;y_;c۶}S>MEz9g+PiHB]vJJ`k;k,|`;?Q iDNUٶec m@zLIڶ9k)"N YC5ŬX58pv[0= ق%ZڀZ\P(0 Ʋ̻1rUU1浵P"YBV(U!W<<Čq,c5x]4 9y?ơ@D@O5˺Ak`oú >Smh u(%/"}zk%,?;VL~{>>W^^C?~9Rh٢3*0Aagm馥5jK[nkT]ܔSɰFzvjQA LbHn{x]X)QU}#焇#PRI۠l[sbAAIU\ tP4(*r-rCp8[J ;k&n a һ"eDN8K^O¼tu(D)F;` {iks鰣in%3}Y ੤b&hw$|0PhE5b`E m,R̸3Z!:MH﹬4s9Z- ,3TB5QĆXKW*#-Y Z,:J[]9#;@VCj~L>&Tq? v+  9@:C?=;kf=jJHیrܐS@L?(~ 0~ _ V}P?9_zͷ^;_KJ\p` q;Z!C}\N}l='ޝxBڔmDnk!l#N#uA*_iZ.t|gH;H6JE h&콃eJ#CQTXŠk3uQ97mrL]aI'}\#Y SBjPx8<'6$P+*qΡȃ6VKw&z<ό8VC9G'oIS3㾧6/r<62IDAU"$)mm]ۚ[vXa&*."2OO|3^`5_ev<[QRsiι{,ba(#&(kWq\` Fӝ#z$9kX cd7F*[5aVbakBA sP󼐱vrYVMI,B@FD㙀߮C ޒ:bJ \ OmFMԌunXn\OیެGlKpFcuUu7$T_ /@< @jꂆEWu5Tݡ2# {[縅y3Bnv̖^k f C~  )cT2 U)%w~& p~N)R,E= ]aĻoY+sչs,Pcd B 6}IZqD0!`E)YI8PԮo9YS\@!0ɻ ZZy1G-֣ˮ 6̠H*E1ejaAvr.yUr84_q\m]!Fz+V}7Wt+jDёA 61u cpׁ6]f  \h9 qhښqVG^!8)HT 68 (^Ȯ"{Dr"8tMNM]TD~`IgvIR0O3>|B](ŭԬ6779 * 1](C6.[D/ 4cfК,lp POa8! s {E߷im,r)9\m=4,*{ 2="Ԅ9wG_;_0\Nȹ蓅LA7p ny9XyJ){ҝpaZG>ehmӬ2l=44:eѵ˲?'hdӘ+m@2e>|.<|mO  |n>'CYr;|$w9OGT% U{ߌ`0#j[\]n +Ɉ;҆ LepdeW .b A09L&j É(P' 7Ok۾+@ʦnviMt} c,qdZ8bc>.l t̶PΣz:e?Mݬz(#Αe:U[p 8@`oWqWcTC@UQ|EjlP@e*iS/;TU8)< ym7UR:HJh DIJ m۲nV*U.Ҡ%BfNw(Je-*cQd\D<%Eԇ3-ytzsbd.rB׶,:!qH! R *8Qt\}0 T3pĦdWiG,FQz9 @66-,qW/hqs%RĘ$EY;Ʋ$QM!Ezs](UҥqŸ(wDFSQ)a5g,ߏaVdN nS:BӸgq[TZ!A!eLΣ69d 7<9~FZ\ApOT,4܄yW nGdࡀg?Oi{] n2&?nrs@)}I%x8XO/-1ȞF9%&Ķ2T p+c3y~ \_n# D\ꗗLdֹ(9@*l朅6V-Z43ҸBHH3ڤh/Z WyF) t"*Fd6-Bȅ tD) ]Ku򗖭Hk1aGA[4m m/.w \[tKyغuS;ypAT x*$k1i) wPy1eRr(Z"XhE0\"MTe qߴ5_gs4CBF,NJQh[+o;s^|k7*) 'v/iżGDaˋ-fPvbQF֪%߶`U ꦂ_}%qp@UWdeQBc (X'RI '2)!k#i6c}NYYzZtϨG18N7-a3 (eH  5N'(4p<`8P)'~8:TF{Ldb BxP9F +h]R#H)ۿo?q|:?C7{8EWphMS"-SqۓZpw5͝IOB 1./1#JxQI IDATq(FYls.*yZt{yCN"6wqտWW\Ĉm5IDhHSZCq@%8&,qa ;Gx,`R ";m*3=+=Y)a[&Ǥ*.m3E)V h*^VbHCbTAwBhؗhn# ֤(cE\bQKJa⦔2pLG1#9ðBVrx8r9pMҙly8Aiyȫ`zj 51MB ,DO{z3eTF۾no/7b7Se:JsZu}ϖ1}]b㡤9K. @ iv)cSEMD{"bG[7hxZkE_-_ȏu(r Ή@`N6PmZFID䄢u֭H+`FhWP.//115RHւUж=v#;h.]q_L2_8g]JFNkwQEޯmᄦݦRhێ>IRM@)"KE>D:C#Y?)16;X<}8@E mC.K:{\] 制00ħRz8APS״*BzvQdL?eWY AF!FIR ja5iR6N]%(AAK`%)Ah- SSB8& fM#1!c+  "x}# &}f}d\Jaӷ<ջLh-H/tM't0zP`_(!G@ bM$^ J);6xs}_xbۚ{׼$?AրP/_cyp_G'q\ @B྄~~w9~> >}_r78(#^V^HuξD^vfXN>t]#ݓEk$XK[9sNow1w1u=M3AO)H[X+-8ASX(EEDT28NTa3>rwB_vC~i`p<hiYbv(5%e:hfO缊Ј"dm8fF.@4 AE"WfW U" .'@}m,qN i$ bw<v;㙀鰲'йPQ."`a 1"a׮TR!W]՘g$$"IY7 u@%]KBj\lh8c6uc'Вd#"4)4p! %`p<4KUk RyQP@ėP]5iD~8O֏ӌ=wk 7@E4)`ټŻ#aQWd)EuV=޾o.x7=I"%9_1>M;vOx8ˇ  9;(O1l90EY}nZ-ㄒ3qtnvqnn'@ 9]|VD]Mۏ#bd:ɳ6_}%xM8O1Ԥ%4vCDu+К.1%hw֪",ږi1et]/~pA7 9e}C`"W~e1qDSUpLw.h=#f7qi[ӈR"qb/L{f%4mקU;Jpj}TP xviŝķo[0#!.믿^1)AЀ؍w5P`OHn{ $1(cr'B12֎}s!`ӷ!g*%jq9TE[Y|kl/z7]E\!RI_7d):P~Oa|TpL' )wv;wmfD GD>6x^u]p:Ml mMqV`*2-q2D2Wg"m%kVtATDt[dN(%Sg=3P 6= _x8e GJ,kpuM}5 hc.C(% ʠm[B C)- mC k4M k[9?(cBQD6'Q6}afQRfc b ̔ժRu-Gˎ)&Srp@I `qsz)Ç+䢠5v VS.mF -o4 *(CJۭ! g@G4QBUY,hq[Uo[ 7770֮ (@RCs.*RZcG:*7"dp<R";k\ H8nlY2*pncD MH'nv¡w~?iڔRb?Tɂu`t3DC@5T ^۴ۋoV0^6M߽|qy ׋@!o5y.їYQ/~ *rEtzK$~}%FQ%zdȎv[)1p1^l`ЎÉn}0Q+8hu=@ɴuf"#S7I:G09rVYk1N" )6z{\]!S, eu!:|l7 .^:|ŗj!5jI/IO/؟T_[oo~4T Ǐq x~]1ҍtN1>n>x~P!m#ӑ% @t :륄|jHa5b$:MMmf+w{;G3B'S6 ^ =nb_US ^:dQ,KA[2:qcQCc2ZWL}LM!45IV½80(U4  MOAm78 Q&J#ۺ0V22Ho{{MݬEX5Tz (C*eF CsA "F4/)pn7e^?;)g@rHEXbQ\JXRqV5F(P7XZIkc֖u  >|Zhcq cZ].//q=y%`7<ڦ҈#ƈm_yTUWBPc ^|@]" 'UUOG9;r㷛8wS%"cۺEQ)>V;B&;> Bf+ZDc_9M՜);ٍ +AsA; )~ !GRdUO>L$L!q3BHPA6'\|ϝ.1 tXЭqH 4OZT.v!Pp;>0ڗ_eZ ~q8pb 晶) $YQp&(esd@׵!~C?ycPc?iq#01[Uq@"Ci c\Mu< P]Sar^T Rx XRϊ R($ݶoND7"E3bD73V>1 f)q!㕈5hE g~Q@2|=Mbovxqk=hT/I'ﲛ_nc4txqh:?q^wC/TtchxI=x p_!hb` 6E1Y\أg6),'oYAo2h* (E9g< #jKcZ: )RJ)a%xv _[Qj[Uƙ %hr&J) hmp< jUa"׈/yjEuqlNIh{R21H-ef s EU۹4zh#qXhj ,t6 iB]UR-xk,5;M kJ3Qz*k]"ƀ9P˼tI9^+Cz&$ odie7T:@𱗄$)ysI.|)8Q^g#tB!:IutYcʰu݈0KFkJGE Rl0OR2W֠$l{Lvk84 Jiz4$0֢x')b$[C;bA ľwPp5 D6I"lSWo_o#6`PI! GsH jf\S*3 X-6m=#@/Q,<v.BYwMn~K=l}۵xEZ 0Zu,?3ۖn?.: vmmfQ ͨ2J1P@]S/(f"rt4c@]7$%QV4M / N &s /P"'ȅ שUNRDM",*JZQtk(w5s&'t_w[aPE &a8ao,΁^e)%ئp), \Pۊ5 8+n6=UBJ5P b, !2uE7+A #2v6X*%JlANw$/gJ4o"QD*ҙ<!f<"j[ËJW7=EI= j|!F}o-R&rF"=qRDaelsMqRVڨwLq*$so\b۷5xoիw߉_mOŅ㇩/__;;?_w?Zw<;/? l-y݀ι{}KT @SAL")5YI䝼WEY,f" SzleHrS47!TT4zQ.tI`J$Vmٺg7A[9ZXfuU!(7u (|&'SyӺWYT2\TfӓWDrYȱVv@I9f|8FBDP`'sRG1bCuׅq HQ.1"SJa'@~a3d];&ytEVTmGcvFwwa)#OܞwxqZ TpC]T^vj2}]ޓmAh8CYy8 C,_ ~!I1Vk{>D@W:^C[\puuElHNuS XS(#]pH)9'xd sL-4SCA TI#@ele13*lC۶]|}.G/ۑoW\|_߽@ADڈ-VF%;ydo{έb5VsIjR䢐rYDvo5ͯi*3M`:`,\ZR@@@^NF9&}']f֠Ā8F _z4,}Α؅l556-^;euu?~?N).^?#6PyW|dJ}Z?c:OWB<b@/Qt*)'B}% Zе˔}Yq |p<ֽ.#쑫,jmTt"5L3QQwp,`"bSrFuUV/n0 #~îF-$G/~A5GPfξ`k)K͞Jv sy7u-âkX s21]K\ y~>'3KN'xq (t5U]CnYN3iF490yTWT87]Շl6Di8!Vf6J@&0 HТn0ʗw;s x|XԳ'SD+c+ &~[\mZ|]~,ߟ?G]nqX׿2,(eO9w*^Ee>?r=xNs98Aœk ΢*E~8 Ņ:UP`ULZ?kٹ J9-'ns%xM#z"ih=yEcM^]kY@ㄦm֤iaAOࠕƦ|ÊRko./p # tN{\ hn8`Gj֕į] W#2Fq;z )Eĸ*b1jv-ڦoٮūm_n7-MtNt/Yo|o@*RK?^=b oqp`g13zaK=nrH*5)E4J(唐cb <R 4Jc'l[8GS80ƈ]DUAgMqP=۵b;K܄#V~i˶5덆g.Er#Wyi{M$"#P}Oi v2ְ^\q:0` JYh5paJm\#ueW ?TCpBH|W@ #kb#BB+G@g)ESUr1y/3YP q:p ~Y("|?QulF( E.Ekݴo[E^..=|wKtW!?oqmzG,Rf}<,>9n N踻dr}?4xq~/@OӓKS/?x0&.Wfx6t +щR JӪvwk1l2`2&4 es32Ǯyk( gm%v*h0| Sm(S``B)UJ 䂢 m]4ha4J7[OT+P qѴcp<W _hӀMU;qXh| )+'ŀGkrRr}?DxlGS).?OɟC2%mn=?=*Ώ}S.ΏfOuMy>gu ~`r |j9'$+in#ǻo!Ō`^Uȃ&ZDV[P䫨Rca&j7 1)mXkLngbbk ӴZ x_Q "Zr5y}p82J",^ospt3P ({ӄ";1IW@o3x砭ES7ȥdE<)*躎2uyQ޽"iZ1Lj Sטyasv=D!}.)x=xl7k4Nn ͙r Њ^k&Q7j#8ѠX:1Rq|mqK\l,WxqZM̟1^V\<5?ƻ7HuSXr#w}Ǐ:/OxB }^uιuB3wу_fٵ<&JFITcH9i*l[T*TJ^Z +&51į*%:Tj)PJ&FBL6%Pm-GHWA4L%?- UUa'M26㑮{1`F$O*  jw DŽ|"6!P)8]8PR PPHX0x}h5C?m 5v }=^_t}sݏ-Y>P.ŷ/csh6Pĺr,_| g Lձ0w~xSch?cX| P9n>d^\*9RH~.%'IT;dd1*z'sbKBq(ZkhhDƔt=JIMS7hLiPDZ!; uhyRVkնpޛȲa_Ddf={yieӴ`XW /lޚs#-4<Ȗ!0酵Dm9w߽x!#]$IE)Zò(ea>!DQJ$.<ׅeQDIeߍ +L)4E^bpl isxsA:Bq.,i*TBCv}tv0wp7w˖t[~,Ä _}uau`N9E)Bϑ#gg7'v&tXǵ?y, H_lt:=EŘIEN& P^UzTr/B|F(a"tNHD]\<㈌(I`۶L-dY vBH:`!M{0` uGl&;a,2+9i" Ȓw( I#'qE1X<=:4aY6Ǜ0J $hW-fe@w6(F |ED(@sdYD-%@눧@,DQ1P,ܰtMؖ% e)r zxǻ.;T3Z+_ ЭTy=gq? ߲Y,OQP"'Ipz؟~.tWU29uQyU`6v{]#!(ȃ{Q,b[,ǂt%c[ `2Vo;6kr"UOt@p"K t;" EDxq \^a"LI¶@R=1+y&ӻ-b:,cֺiц6e/"!"X }iEe<!nongMQɀ-4YYB-I (; 228/hN S iEwe2`XlxA \LE/T.(eq Ѵ&C%`;.$EGm$Q ((mñ,tzbz7t$I$,pHŐD4FHa_y1EaM,A,8H4aEV𗦢+]FK3^r0EA;v{8{C۳۷ M y51(s#?''[X?]" T  '&y%ȟ\ G׸ʊ} V9@kXvQ@aVY_X)za(%f9dYxw!wvUd *Pٹ^`*]X_@UW:\OBf)=&Ɔ>$b1eYp:]d)za86P3$GD!D<]O($^R،"K"ǟ"Q<2` xp,DU:*{h (8B~Yʑ1(n;8eAH kmc0`o.w~"{q5́rOE|izp|G8:%ήp|~8`%-@s*ϙ-Ι-|fR casf~0]?FG6f *,LJgCMKTDVϋWC49&Ih -R"oܱmq^fƒn$A sy@r-J,[Y*a t<,JFb/XTr$Y$vsR"2QsGI(0BE DZ(!Hhcq]5iQҖsi:*D[8@Obj#Ib(wk;6v3Nox[it6е!<X> >4pz~Ósήpxr+`N%aг/Eca/v{tmDI<9 Y!?5/lEML=UǒAШ-C[[0`YB9/fE.yY˶`on6c 6e )SQ9)kp lmrxF2p7_ 8oG7z754]]hئPM1Н`8E]tz K0ȳ 1Q K` q"h HIȲ]I!́ s7"o?f9v=, C%H(@!G, T8Ң72YQ#GˆhH(]>xH^6Y~/ pg1>|ðk te>s3=>Eqs|w| \ GXxK=ֵ-&/^hzRrB ,u].v:y<N~^QpK?/yU*j'^`&`_3kcs%I2qiS7 IDATi:1Ȳ,Dy!Gg` ϐQh2t f18z!#0˂u:H IH7w.Ȓ#G;OSA;`3 &zA!>C䉴4&4g_ɍENf}LD( )l}v7{]|,-mk%0^ts;wGB?:ćK_z("]tV|K )^j`OVO1!bH?㌊ ~б :l0B).0>GG`{? _}.o|ҧ}ܛ\4 ''IĿWm 4MU@۲S)-@0C9H΅ ),l>C?@ z"SDQ 4v-_bh>kc(\أ|yMAyi+^AjН/W5yfi +|Yo0i@XQJ`QagBcaسp,q(pq;w?q"bTН|]`9-*zONؐyU@T$Iƍnڰ (y3WG'` ㉨>7/"3cVH"8,OhQ$"k-FEQ#$t0MlZeBreIae(BEY |tl s8'sf=~=qB z޾;ޠ/{r6hQB=[zkǧ%\l'PǦ&t:w"0N3PV^^̓Hm^ @ƒ!&o1 F%SXSؖmb<1q}uۛK܍nYW͏?Way^iϊ^ЄLV}~ 0 G{{{7^P+;qJ WeE/ i,fʖ7h4ۯpvq~;Ā }aXv`>! D BY`y nS[swG8<%ήq|~$t_4y~ї`E'THJ.|&o1 ۢp i#t},3܍o0_#DprAS~H,UU ) ΤZQs/)6 1I1Yg,g8,Kç2eGKy.dYb $IDnO "O2F^!Pd<A\Hzi0´/@z ;+>( ߏ|υ.x.C-ˑq(4f$ʠ 1֩{K_^KRH\v#F@kn"B1e!<1ľ0dtlQ{lF5YC38~qa.Az ,sc|ύ89OoGۥɱ2?ty*1Q!Ӣ/ Kcd')/;Bx<Q# < Ş <{{]}#~U,SŎ5J^ɧ*94M'66%Iϗn)H`a E*b4A2dzY# Ő۽.#]ߌt \t׸QGO+\,IEe֥^[%ȫL <!<ׅ-A>]D| 9l QP'r|r__/dm_TnD' (}U],Ma" CEQߖAZc U@ YyFx"9@eHB (c v~(1bo7C{ ǧ%c}xH;]ήptzۖdvt<"J~iňr*lw (Jw]~yCxQO#8&{{ ̊R~⏏Ts &+|UUcjЯ !mUubEѨ?v|Uh:d#cDQTN ~$CP! @@)p8N;d×_ v)4c ՆUs%9/ yٴ7Tv:+@>n6|TI fl &_mVf;:bb>$q^ *mP.0iM"o2~8FW?,_ S@^7u׹ $  ˇvmz(VVr$fp]wuu%I!, }}w_ "W!@'6xv~ϙfj:݉(srq$!WZ)RۥӑUWͯy闗xigLɯEȑ <ׅ_߅_8Z41 juJ`_|$H#wiM$MhqcF囚}&']7j)'l`2rky0LVtk}D8y(x `ƖFAL˽WXG۟s$Mqz~oW8>K{w/ΔJt:aʗ? /o +s"NUgwkwị7/|!U-EMI0=FI09WNh Zse,Ӯq@o` Dױ@LjgKTjboNu-UJIc+۰(z#i$OWO[nr"]q@}K[/5x&ϳLB He)!~=*Q#<OYϟy^ӝkqu[NǴt:%ʞR tT<y"O^3T4ۖ`nx]{=|qy]Q eB{Ws.`>4N$Lw4ZAd7YL](P-kT.[&GOVxT@ZqmR `v Ӎ(*_)Kq.RǗc*pHAm^>ƽ]5,N$R-CX>p)L;<9>\Gg6~^]:[t:BҶEm  ya/RN,ޕ _hD9gHs&" d?_^|^yΓy̦;I4ӓ M{`jJ~6nS m:>kd E@T_Ǣ 2P-#}9| .Y ӱvaYvȲX7@[V ˃ Pou)4RQRϪk,jaŧDs]t;5n cAt:th˾\^͗w*KPysnQD]P#)@J{ 4|yixw1 W`t2qoiGWukUL;yTX>Wp}T}0`tk1#~uUR>oR˵uMdQ9f۶1`n ^䥖ϘEAURcȥPjRŇ+^VuGoNGhNGX e dτ^-,VU9GxB_w".@GSj)pxpD4$tNϧj'pӸ[>05|O@n^TYRmN7V mtlst _;UMU9L@8tN)cR W_b8qضhWU0_*`/[{U *T|-z;`nc"%iӳe+w~W.}-MԿr  !e]貌m>噚"Ha#<\+ ℡ >X{lsɲ$K4&pz:.'}p *z>j`5͙}JүM|n& @'tN(TGO8*~䏏ܲ,t:Oq">zV5_jrNA j0sRPjK6|m(2&S3|'8:qί'tC4-o\ϞhGOA% u*iNt6c˪w6SRӢʯkl7[y.|CHӬ0/ᗧcNE]Mw:FǓhv1nGp^hoiާUwu[5fumhyh _G/MPI:@3 sfYvG)}Tiܶmt_߲XK`t^XUО<ëV4\jM%i(Ƒڝ(sv׏֦Q$NġJqJMjʖE-VlE@ιjfYȫ^hIȻ4xt8. pU ʜ51W &@7~_WOU^% TDU³,ϛY v4 ;7M{aLNomn['T4|^KIXZWZ>}>9ՁQ?7]/'> Su@1zcՙ8$Xڭڦ8mawwv}2Oți享ֿ=63<%NqĜN٫JL[Ӊ{&>]JW@KDEY|FwIbPRZ6_:1 0+Bowğ^Lѷ`r@=:S? {i{뼀>u:Tuz>_} uG'-|N1e6SH CcO۶sBc,nYvimzezoc^1E:zW8!xt2` U}+_mGZe=U@>_qqj `β9 ȃit/hq=gcI49ocTp&@] Z~}=u@nOp`zo*ɺQչKLt^Ω<$_eFp5P6q뢨s9(m/ʎ|hfw7$J'~ٝg c4S}tDwf227VE}6/#8BD?ye48I|/qQb[ ȗ6^-7 ݛI<ӓ{8Ʋ& \ğԜsp`:o" MVw ;;֝W'L@%o^o_)U,7Z}$狐X1J|޽;ݎts_G;5vN'RhNBWӰ"W^T,nYGLcL1#'}YCĥ-|U:f繛iM87؝V&o757pj:>f\_k==6k鹀?L 䫬:l PKA Mӱ8_NIǓs:zC5m_"EQ,:t8<5 1;_Axh|G4]FܗB ^ja/Zvlk -$FKsꗏK| uW;)x/p>II8Dq09/nfv[]Շh:l㋯63t>Go٪uܬ> IDATu&Ucg;{ */hrNkc,$IFmw]xW>\45hU&&@6iUnl`o2Wuucgzq@vcY8oEUmY%I,%PfԿeKުR/\_O.5gteYy:]RWNGGYТl7K ?LRګ~yYim$ANy|繈xWkWt'4MnLO'jLG744:ۧOY Ux0g\}MչI{m"0_'/T0yԣV 2dr]6ؘ @Al6Ce BXls?~33K,8=ᱨwxz%"O1skGٛQԭWТ<~yNgwwdoY TO<}NQ4Es 3bu'wi0t쏎&jOՏ< 6m쫀 kӺ:WNoC7 1T7Uj ͵ u\PS7Q̦*?ApDszX,u(~vR_jtt"N49L롻SFWj+gRV aEi[S0E;ǶD]YFW[>2+E[o( |/O ,euKB{qtw1c OcU m`4u9סf^]WQuȪ5! ;7]W2&AyۀoSۆoϷkz]5L<t`si7Ї˲e M>`u>|89+ڿ4D f4Nwv tCttR"P%iQN[Sr^BXVYα<2Daw"w@H2oW;Е@o@m;pIMlN/h,a@ ׭xt*}:@MhH=_c)l2_wn^7dx| Lצ#OB@nA..vw6aT;No2+~{>"N R=)jS֯g6-cZREoe<UD +>+ (j:;͒pwğ8u%h5WcڳNS&Ȯ_Wλɹ>ozM׍/9/Dh(@޶ښ*j ;]P! @o}R縸Y(stvlM:*-]OҔ_)e (1YV4K(g+mp)R8B['@> yk~taN$g8^wc37Mx]C7u~ӜozīCV=jM&sm\g&suL/D؂t@:APb,],?:88X}>>oooS÷"ng78<=LJcѝq xNE:]o&*}>yQ*^jڝaEXjq#ˑ Y̊xNb>Nػv]FdVlgҪ}{Vtyߣn-*us}%i>O!(4_eD'd>1sE G / !DQv8y@xut)(٫~$FٟYo:Ǯ(q?_ғ*FRc<壯~?kz^y9/ggx" ,&*# k-LcLxZjZ6<q fOED <i ߃,Xc6xv3g#GV&nu@{4GRT@ ]`2𮼩H)88>>~@Q厕2hH$NEA |ׇ$i mmCB{OEȲ]$n]FwW#r2r/8JcOy(1`3oRMZ|SM}S-޴cu}|՞u|mvcus/a)^E@V a[o!s0VT(19֯cl' GӇ@7-4:$ ?/Ou/u=4|w`z6Fvq͘|nbkjEP7g $xnk6ݣjcqXs/^!@^Hꏑ*H_tW_}'-p8D[왈R ۶aYV Yf~y]BH!:8sq,|w e' ttȒi,Ʃ7'jGJs:P& nkWo֪瀶1u5@߳oMncm36l\]_" ~ߺ=T7 bupwzyehE{ :cp*s8.|w[8Sjґ0K@OR_,X,R,bqp;ʜ$KI,F?wػƽNm3$PnS-uc0!yUd- 뺈yb'}YM`>Nŭ?p΀^u iUciOXS% ֜$7~@@kZqM /K9"@z@yt,NJ@94Ee4:R,"$I$I\`@V/ϫ_փz1x8WU|zTF#fCxޖj ǜkgmZݿKs @j`X ]P?eY#I7/R so8>q]0 OL9rmLpPYԯUA{:uo:ǚu` YǷܦXcmkc)6KG]P7&W.Ka@圵c!cͲ]dBc Iega~f_q,[Ъ*؛4~u*7MBџīUU7cc͵ͳ 6m}=G+Oj0Yxta@uA@Xet:Ӳco({y[@ !$I.|?}%o1opPL|&u_~[t:M6]~16o[?~?Kg@za`Ӡ@UW_d| vQ}1%刺* \r.]p3]y9_ׁckm|5MX7uӱjmkc)6)^2=szi5ErOU%bXpLnv]˯{y{m:- 7ոU{m2m{mkc=tMkbh` RS=9ྰ`!Y@82e Mz"J.ՁU/#}a8 `d:n&sm\7&@ l L kϭ?-z@o3 MTAJVw$[ [_kX UP%Ưi\'6n} &sq-&cی?\{6>+,z@C7@ݸM Cvf8*bLZ=VA}: {T@ `u뇬it-C_7|Smxo{c5C/^؀TWA+E%rUR69_&?u@]넃uk6{my}̹y6{6>+B _c@ i `d\pW"P}:j4:ŷcmkc)6ۚ^Ag!!xMp%Sy _hiU~Ɓ?m5&<\ p]OTI~BFHj1PPTǵsuZhcuV*ަ̙Zб6͵1ߔgm^mM JM}O!$תp T _׺UBͺ"j WSYPHL5M_o 7otmژoʳ 6m}=WO^t/*ZcLu~jc~S@m:c5,icS5+TzlF& A}/I/ר:5*{LUA{SC_7|Smxo{c5+}YZYXuQu4jo[Lc͵ͳ C״)ܘ^^>Z̤kUUJս&7nKvn++=-VXSi)nC- lz&sMlû {_> z z"!|Yux?F^ImZ{nE JyӫQB>T(hrn m ;5m}=7WWz:z @!4{Sk]++mK@=t)hm}=7WWzǢW6=7ΩHm6ῂ++} z;IDATPKB@Simj_S+߮0 POEPHvm6$Hh\r_yn% b.Գ Ǖ:bA yIAEEnBM0X"~e!XmK%( &@DnU/ȡ$,1 3-]!PO(TF&ϻ4 /M!؃wyIENDB`mono-tools-4.2/docbrowser/theme-icons/GNOME/monodoc-32.png0000664000175000017500000000323212413742070025326 0ustar00directhexdirecthex00000000000000PNG  IHDR szzsBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<tEXtTitleCalculatorJH^tEXtAuthorJakub Steiner/IDATX[heW9INͅ$'miZ"xaT:PH" H;*PAo#c5I4$^k>1?l]>绻o@jG[G%y@D" Qʎ?sq ye}^Rc@\*}֯_!"4e#}ӟbum'f&tp@t )˨TQ"M`oowzD؈ Ad&[]՟ceOr7IW01Y~J]x2*@WYoou v_`0wثSl GHڎoNX=Tkn_ceG@kH:wܱƘ|@rV?MGy_S'NP+Wjι׫:[KB`tqzgk7Xa]Ea˅ c.^#X x7ھkM)ZƘDLLLR.WPI)34q1Dƚw=moU$$ʵ(W_aWxt7qƧT8h`X*qRzzzH]Y^}lv% 7Gggp$}POvv'D^j FF;G݃(/%4 Zj\Kg='P(,ϔjV("$MÎ#c.[z!)riZajTQ'3TiPDPX9@ܲ<1@b5RDe%/Q@#Qa)H; E6G b^R/_AmQNR vJT!~G $Iy@09>1q$_>eQZ|7B`YY,Dh+|~~{ %M=K7yP׳V.=^:CYja(@@s瘮|ТabD B,~,2=9^O""E"6uЋ7ZKwc.Zs9l9qe33Оfip >yP74J{QA_CuB9Qj|~T@IENDB`mono-tools-4.2/docbrowser/theme-icons/GNOME/monodoc-48.png0000664000175000017500000000473112413742070025342 0ustar00directhexdirecthex00000000000000PNG  IHDR00WsBIT|d pHYs B(xtEXtSoftwarewww.inkscape.org<tEXtTitleCalculatorJH^tEXtAuthorJakub Steiner/ IDAThՙ[\u?3^fwݥk H/.`^5˃4Ũ1c|YH nuK`)%-kw;;;s眙93̰@%gfw?Q"Ǚ+xX羙8ꇉx^-4>_}ufNRJfg-/_6o},,,%=XNn~\! HoQd[h@)K#V(s5::l~yNOf'J), [) @.S"`mxmiΥgf\" Dy )B"(lP*XYɑ[Ya;weƸǼǬR-Ũv<=B x>w]lˤv>_ 'O*;At:q H!(˲k'11AA1ǸN9\cuFܽ#8Z,KM_g4Q P]L´Iψi[%Ҏwd;ROڴ|T*a۶^YYY|ljMNۧp`"væQ`D5n:}t_*<BjEfu{`0bvJ"5Q+S-q0,m[vN,/\?>9ws&W|;Lt<_-n&'&'$Ct0ea+o1u{Ϡ>%ZI=@Њ@V7_&3]He;{< c\8`D89wT k>h:*Ne.zv?oRԣ[f`Z8|쵧} S{IhR 38c4 БK 5Kۉ.4nB^Mw~{JsNd,o]*!D[A;4X' gG ES[/_9Z41bTӉKUqf4Ο@?FCxI{TmY6OĴP;]߈ڻ;G|{l9qH!CaO[]'cXh>mцJq5'WNQ6(8vK$ֻګI>RBum#V\廏|٭m,+0R-{BBIxp5 h3ovne%ϯ_ n2Hp@ua]Y]wP/X/T_u$avx'p+5'k>SUJ 8\T>VbhTtDZ9 Б<bɌo󸚩ekjΌo[{La F.hxԪ0"2Zh2Q}T Dȇ|<IENDB`mono-tools-4.2/docbrowser/theme-icons/Makefile.in0000664000175000017500000003243712642235731024156 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = docbrowser/theme-icons ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ theme = hicolor themedir = $(datadir)/icons/$(theme) theme_icons = \ apps,GNOME/monodoc-16.png \ apps,GNOME/monodoc-22.png \ apps,GNOME/monodoc-24.png \ apps,GNOME/monodoc-32.png \ apps,GNOME/monodoc-48.png \ apps,GNOME/monodoc-256.png install_icon_exec = $(srcdir)/icon-theme-installer \ -t "$(theme)" \ -s "$(srcdir)" \ -d "x$(DESTDIR)" \ -b "$(themedir)" \ -m "$(mkinstalldirs)" \ -x "$(INSTALL_DATA)" EXTRA_DIST = \ $(wildcard GNOME/*.png) \ $(wildcard Mac/*.icns) \ icon-theme-installer 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) --gnu docbrowser/theme-icons/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docbrowser/theme-icons/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: ctags CTAGS: cscope cscopelist: 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: 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-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-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: @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: install-am install-strip uninstall-am .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am 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-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am uninstall-hook .PRECIOUS: Makefile install-data-local: @-$(install_icon_exec) -i $(theme_icons) uninstall-hook: @-$(install_icon_exec) -u $(theme_icons) # 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-tools-4.2/docbrowser/theme-icons/icon-theme-installer0000775000175000017500000001224412413742070026047 0ustar00directhexdirecthex00000000000000#!/bin/bash # icon-theme-installer # Copyright (C) 2006 Novell, Inc. # Written by Aaron Bockover # Licensed under the MIT/X11 license # # This script is meant to be invoked from within a Makefile/Makefile.am # in the install-data-local and uninstall-data sections. It handles the # task of properly installing icons into the icon theme. It requires a # few arguments to set up its environment, and a list of files to be # installed. The format of the file list is critical: # # , # # apps,music-player-banshee.svg # apps,music-player-banshee-16.png # apps,music-player-banshee-22.png # # is the icon theme category, for instance, apps, devices, # actions, emblems... # # must have a basename in the form of: # # proper-theme-name[-]. # # Where should be either nothing, which will default to scalable # or \-[0-9]{2}, which will expand to x. For example: # # music-player-banshee-16.png # # The here is -16 and will expand to 16x16 per the icon theme spec # # What follows is an example Makefile.am for icon theme installation: # # --------------- # theme=hicolor # themedir=$(datadir)/icons/$(theme) # theme_icons = \ # apps,music-player-banshee.svg \ # apps,music-player-banshee-16.png \ # apps,music-player-banshee-22.png \ # apps,music-player-banshee-24.png \ # apps,music-player-banshee-32.png # # install_icon_exec = $(top_srcdir)/build/icon-theme-installer -t $(theme) -s $(srcdir) -d "x$(DESTDIR)" -b $(themedir) -m "$(mkinstalldirs)" -x "$(INSTALL_DATA)" # install-data-local: # $(install_icon_exec) -i $(theme_icons) # # uninstall-hook: # $(install_icon_exec) -u $(theme_icons) # # MAINTAINERCLEANFILES = Makefile.in # EXTRA_DIST = $(wildcard *.svg *.png) # --------------- # # Arguments to this program: # # -i : Install # -u : Uninstall # -t : Theme name (hicolor) # -b

: Theme installation dest directory [x$(DESTDIR)] - Always prefix # this argument with x; it will be stripped but will act as a # placeholder for zero $DESTDIRs (only set by packagers) # -d : Theme installation directory [$(hicolordir)] # -s : Source directory [$(srcdir)] # -m : Command to exec for directory creation [$(mkinstalldirs)] # -x : Command to exec for single file installation [$(INSTALL_DATA)] # : All remainging should be category,filename pairs while getopts "iut:b:d:s:m:x:" flag; do case "$flag" in i) INSTALL=yes ;; u) UNINSTALL=yes ;; t) THEME_NAME=$OPTARG ;; d) INSTALL_DEST_DIR=${OPTARG##x} ;; b) INSTALL_BASE_DIR=$OPTARG ;; s) SRC_DIR=$OPTARG ;; m) MKINSTALLDIRS_EXEC=$OPTARG ;; x) INSTALL_DATA_EXEC=$OPTARG ;; esac done shift $(($OPTIND - 1)) if test "x$INSTALL" = "xyes" -a "x$UNINSTALL" = "xyes"; then echo "Cannot pass both -i and -u" exit 1 elif test "x$INSTALL" = "x" -a "x$UNINSTALL" = "x"; then echo "Must path either -i or -u" exit 1 fi if test -z "$THEME_NAME"; then echo "Theme name required (-t hicolor)" exit 1 fi if test -z "$INSTALL_BASE_DIR"; then echo "Base theme directory required [-d \$(hicolordir)]" exit 1 fi if test ! -x $(echo "$MKINSTALLDIRS_EXEC" | cut -f1 -d' '); then echo "Cannot find '$MKINSTALLDIRS_EXEC'; You probably want to pass -m \$(mkinstalldirs)" exit 1 fi if test ! -x $(echo "$INSTALL_DATA_EXEC" | cut -f1 -d' '); then echo "Cannot find '$INSTALL_DATA_EXEC'; You probably want to pass -x \$(INSTALL_DATA)" exit 1 fi if test -z "$SRC_DIR"; then SRC_DIR=. fi for icon in $@; do size=$(echo $icon | sed s/[^0-9]*//g) category=$(echo $icon | cut -d, -f1) build_name=$(echo $icon | cut -d, -f2) install_name=$(echo $build_name | sed "s/[0-9]//g; s/-\././") install_name=$(basename $install_name) if test -z $size; then size=scalable; else size=${size}x${size}; fi install_dir=${INSTALL_DEST_DIR}${INSTALL_BASE_DIR}/$size/$category install_path=$install_dir/$install_name if test "x$INSTALL" = "xyes"; then echo "Installing $size $install_name into $THEME_NAME icon theme" $($MKINSTALLDIRS_EXEC $install_dir) || { echo "Failed to create directory $install_dir" exit 1 } $($INSTALL_DATA_EXEC $SRC_DIR/$build_name $install_path) || { echo "Failed to install $SRC_DIR/$build_name into $install_path" exit 1 } if test ! -e $install_path; then echo "Failed to install $SRC_DIR/$build_name into $install_path" exit 1 fi else if test -e $install_path; then echo "Removing $size $install_name from $THEME_NAME icon theme" rm $install_path || { echo "Failed to remove $install_path" exit 1 } fi fi done if test "x$INSTALL" = "xyes"; then gtk_update_icon_cache_bin="$((which gtk-update-icon-cache || echo /opt/gnome/bin/gtk-update-icon-cache)2>/dev/null)" gtk_update_icon_cache="$gtk_update_icon_cache_bin -f -t $INSTALL_BASE_DIR" if test -z "$INSTALL_DEST_DIR"; then if test -x $gtk_update_icon_cache_bin; then echo "Updating GTK icon cache" $gtk_update_icon_cache else echo "*** Icon cache not updated. Could not execute $gtk_update_icon_cache_bin" fi else echo "*** Icon cache not updated. After install, run this:" echo "*** $gtk_update_icon_cache" fi fi mono-tools-4.2/docbrowser/theme-icons/Makefile.am0000664000175000017500000000117012413742070024126 0ustar00directhexdirecthex00000000000000theme = hicolor themedir = $(datadir)/icons/$(theme) theme_icons = \ apps,GNOME/monodoc-16.png \ apps,GNOME/monodoc-22.png \ apps,GNOME/monodoc-24.png \ apps,GNOME/monodoc-32.png \ apps,GNOME/monodoc-48.png \ apps,GNOME/monodoc-256.png install_icon_exec = $(srcdir)/icon-theme-installer \ -t "$(theme)" \ -s "$(srcdir)" \ -d "x$(DESTDIR)" \ -b "$(themedir)" \ -m "$(mkinstalldirs)" \ -x "$(INSTALL_DATA)" install-data-local: @-$(install_icon_exec) -i $(theme_icons) uninstall-hook: @-$(install_icon_exec) -u $(theme_icons) EXTRA_DIST = \ $(wildcard GNOME/*.png) \ $(wildcard Mac/*.icns) \ icon-theme-installer mono-tools-4.2/docbrowser/theme-icons/Mac/0000775000175000017500000000000012642235741022601 5ustar00directhexdirecthex00000000000000mono-tools-4.2/docbrowser/theme-icons/Mac/monodoc.icns0000664000175000017500000071612412413742070025122 0ustar00directhexdirecthex00000000000000icnsTis32081/4:7-.j1ɭ6.N1;45>544@4.N15744.O18oK44.O0~}}wB44.P0vw=vxO44.P0qqrrsbK44.P0la=Rhs844.Q0b<445@4<4.Q0d s4ۭ.e0eg)ee\:.w7-987543268'.t@U 0l5CWU!0/.( ! 7>76e:fX4m7f4Q7<34A433Ce4Q6473e4R68O3e4R7E3e4S7>W3e4S6S3e4S6Ck93e4T6@336K3>e4T6 eܭ4g6)i4z=4eca_^[ZbgU4wEXJ6o:FZ[J766?JK8A;9W6j:ߤ6N9?34D433H6N84׶736O89V36O9J36P9Ѐ `3ߤ6P9-Χ\3ܤ6P9ͰK;3ؤ6Q9F337W3AӤ6Q9ɀ Фۭ6e9)¥6u@76rEW8km4/h=g}mnonmlk|4/h=fB4B4/h=e74455M\`SG64764/h=c74`~84474/h=a74tX4474/h=`74K|r447}4/h=^|7Keox~zxg447{4¨/h=\y}|{tgE446x4/h=[w{xzy|S446v4/h/(0nS8QꅺEY'N``hus/3/]IEN򫵓4rq#|h*?$ bc$lu%^͕ط͆G!ʐ9ZtvCiǤMV+~hq_ʚ~Mt..M{p}7C ەƀ{i"\^ t `;VEhPiLHȵȷ|F9 ["\7|ta-KtcNR 9(vT4PUYb;c|$z5?7L͍ar;zl8@;~f4gC\z@[%ͤDR@Uy0GD.|  HilF`i=:( -E.6GfT/Yv`,Aޭ SX5ԭ>S[bd,.tڨ3dSY \5 ^̱hApΚ e+X<#](sfbM3DX˥F GW+;(l+"ZEvbe;+n')S&b\T!Ш؎_ǛA$協2b~f}]ٜ4z2L&G֕X{#)4 Ŧz4mAgMgAݿa ʀ'ZFǛ+*.o=Wb0.dJ3IDuĨ|\U>ͺ[A\ QIT-۟Ј*ylXyWEXH#.npgi+[?rüEn˭.NdQkc.pⓡF{îF gVD_#; g9j un$ۣ9 I(d[Qo^GB.@ f;GN1aekUW+s*kNxD|Y'{P9%I]xV_mjp>>B0΋b͝s a6v"Uqign  K-57W%v_UML8,5 >c\XzE'4UŽ&Ddo9x+Ov֏d_<93S?.1&{:MLHY4]佛gNcf>XCd(,٨PTib؅ÉB,1D)D=gvvlc5`W=)a3 n<ݱ19xEmxC*&jJrd0CLNgԾ}&?g5gP$aj.s~MYc-C ?}p$z&a5:r@a9ISosӣE#&r(@3+QU:2!WioeSjnJāoU;F2F>Z]X4ۊ\M?K` sXoh,Ehgl~9zhz (R.4lmt5^<~^jXVBLD&#Mzv&{sqK{6-:T2^q?ft F2 ,N8Aq IiO ר`SFZ\21{ Sޡ#7PFh"v[xϪié` z 68aB|4KĞ9[[|kwPEڋFE^ӚvY|IC9:><j^̙ 95]zn} _ `rl:y5پ^-!iafi{CyGw$?򑻸w ()쁭9G¤iݫ"l0f#Jŵ)>I(1^!qG@h%WFF$!jn{vG wfь X°U..S~<e*Rʦ HA P5@c(Uv!r^E~ }!0_K;X4S"Y=,"xOcf=•G,֍Z3} 6܀.D'~am/WBTOAG!=}avP~F^ӄ: nDo !F94D|OTE9d>8$2$, ⽪ jl=" vSrc7wl (}7C1^sq >E~~>$W}"S慦~tZ)IW28չ @*䢎I˜~[=G&X>2oL>CM+z_G"kp|H^XFOt0 f5 { |WIJ3^$M?6*iy9y&+XDiiV1tdlǬ1 R`oS7%`gbA:i< Z_:VcӘb&3-YON>X*ȴC "e}SñYxhE8Ϲ_R<8j!ż"WnnNPbk[Bm݁#+g<\Yo+: ZqO<(Z!16$$+>ȮR4:_`)xbe+#:i-UіmME@7c KCL*?`6qLM-F^_TN `2LP͡vGLKLxteOAl_KhHjfL9>j:ey?KnL4}7NYw}j1>yo Ujbb߶+~{q6L*ILjpk3A{CސdVߐi`)^ԸP*S حy콄1QQӳ6&Te67ƑFwHcs'ǚvov^5X+t4l^__PH7e9vvˆn°J啭hFf2#3(l[)w)|!!G/G @dX?K>]F](pK$01!Nч@fAC1I$Ԙ>y|ϗM| 8AjYl}]+JVH^k dz'E5QW ɘFȎ\MoT^ HގHg[|W?IV߂m$,ӔOMo jWW^[Ͻ! `짬h f*kB 9Vub+>a>4z8IsϟQ®hs Z/&=De )$W\;HimJ6艕zEBK'7Mk+b!I5Cq4N#JQ @R!iHHZuVJ0y)ɉʃS$- Jor!ɸc{XR]%76HFK[3y衋ה"]lzu᠑hl? wN }48 ˹z`vfHFmaK#M/*bn;8կyp:cRbN}_$JsgZ3 +hn[|x̔8 mo{+<ׄߑk.x\ f}p|{uDAM.wU uʑPy,ePl5] cSM] 㡟HCǦ@Levlg͔rN/Rk<_)x+dQbWZ>iͱ}xI *v9a:LMq~sQLdžT4_.WM"]ioXD>yo#C%O1*;bjD:!$NZ N#8 9n_9>iSx~图LV o[ߵf'}YbJ9ȽMJn"T2wb)P?nx'~崖1S@8hȼ2AEZ`qk YN$i31KKNshD]H^MRa 9ՓT aa8X.G!mFkP hL[|"pF0QKA F#S*V)>r sy <8Ns/J'9݋ɛ-**h[siX** t8 6b*#.Z+mꜬ*VH!l3{7Ie%[*E|=zxp_wB:CTZqqሙҤP{$P_iVGǤ&u@h~BvQg!8\9:lR9i/p=i~e"R1V>?/Svg@\ϋ̻AOOZEwR/2s8D0QJxf I;Rv{pu *pI" n ;QmsM4+`:̶+)af'0@M  J $|A +7׳\X7DX,E.%`]("g0؞6mV2_4T|JxYeInx@sQd"Mxtqkus 5>eEy N:" Pe 8roh3/m>UnechBOTߛthj:t![ŐzF\{W~!t5+q2<{[,:EhN7U@"?sѵƟH}."rYc6W<*+:ҽ!šhK6md 6]Ho˼uc~EUiW6'x-R|nSQ!tNn##`VZUOZ4ao"?29#lfS#u0$5"~ĸǯH+m/"'q`6%drnq%)$z(Ío4Eԥ0基g^ĵhnNn(&ҡ՝Et$v*ǥ1=ѼMo ~s&] nތ]\*nrduڿT$HMtUo*~u&JzoBX͸H1S 6'):S,rj t.%S2n3+E9 +;ŭ\5᳾ry Teι2 L`p$(ÈF䨖4Ɂ{=#5>V@%Խ1*<*߭* *9E4. E`dJ'3ыZ Ep exĹp+]^VWXO32̬qT>Oλ`_T߸|zhފ#\$&9C-`IrVgeĖжyXlgT]&Q*}ɀk18at3bm8nj-tOHH.+۳A[Yݥa1{K CVW1ݕH}Utrٽ!x- WJlt .͏@Ñ]?ƦE7\ef@ -*0$uʼq]bՒ⍎SюwTw@ꚶ:醵ѳ}hܶ9BkA?FD50zٱ/糑GuH-(rH&kĖ}X%lg8n[+~f 1HzNG>ebHC01$=0LPKHzsw}JgI^:|:qQ=eW+ I]}V&gDM1Ӷdy]0Zn3.Sx <58-:~k]w&Z:]]*wf +.L]H_IƝjlN=+>p4G"6p0;/M:q%[8n= dɯA˸54A7 PU >lViP*͟Xk[r[Ip84Eq.<Ǔ[홐Ltk.W7}D7^+ڀF>uz΂oCNB3MX+Wi1Eyl1$ +Dt{=Hopw5w.D&?#s&q*w|Fi`m@t76r̻}Oq*7S S,S' ƅ7[MtͺΥRYP<߯ßmު3֖Ĥ (rpYLurfuD[3YߞQ =^J/77>\v@vlmC -8 E1&ږxidF/`i2>ľ!D?K-ķ)~/N- c zO:rrm3*p z0Dz nxrwmGHQHJs3y,X7O#%0Ղ}̉eioOZAMWQU5#ZCº X+ K7p/%(nA]mƒzF} RKfbQC}K@= [p'Gzvf2 Wlu)"5@''Mf0Ac@FZIHWNXc˃ GK’ _/ɍz"{ #L+y#=>sk$:çE[LHhďHXRFi34@!i0LnX<o yH=>}V>B,H-|g:I DTŋjS>TP S(۟ZҜ՘{yۋZ!arzf#(iZhJӬ>26ֹS? iy ,-$Vޖ>:zɠIHe~_AA,Ok@haZyoD҆JHẄ@ |r V>CK߬O4#`s@aH4]fFlꗴPDB#?=i'o v W̽xKZwE0/|}c e:.F6+)0f1,_aLLU%CB,v.7._p8yݠSp f9m,6vB t{6 i2"N޵YO.*/[@yߴ뵴L/MM_*hb-KZ[=yʰ ó,|Qe;;a!A)[zE h"CFCg~8ܼ[~ws N d뫏.a|3=-ihpN!qKWzD@[@sP^8#yw˿$[~ϓT jÝqS뛝4S!4yk:,z흝8l%z:^Tjw\8*Yb:y*Q%K3h/ Ui b-VjƆϪ4cPu4 k|^#3}s6锏 EI9;*xn͓:zRMˏzΐ^Ō^3XL;4,Q@9!x'v16)3FK5>"NMGfYj ogc#,r%_Y 90m~nK/p>;Hr`(L%v5+Vv\ڈsIQv.үgWGɌ3\jHuYhKFS!xZȤ~rf65;BW#qے\\Nln:i+Cӣssvca#b'>n%"同僄:賒q$VTH4[?WܰĶEu` 1t0fb0&m8'I@<ϙ%|x./RsΜ0~pTK]/+n6bX&q~Vl\,h3>g9&A(dsXyCr/8X%ԉH޼p}D6Xj{m 2AJ-(dD2b 0BhѢ̱BSCPQxhEdO]y;@X 𕝛քy'~zy,?:yrt=_ȋ%Ԫ|tA*8tXC1NPOC{oMbux x- 8+z䜀uLWSkN.M8wzPH9^žrlFi'ifGlOt;]76,N{EoݦR9g ˗)͚(97n(O$&SȞ+⪬ EYG!۠SHA.Ns?/TZ6dl\R\LUy.5F Ip\熂eXOd1i#"vp$3V8 D(oٌ!r̯e&"nL?2@}% `(T3):y4RKܖD?|_ASUʹ'gjAKz\HM|13IKhTWZ LZܢVNO`蚹̲)N]Ijp;4YI{TZ uNE7f@G̴_A |MNLS:@#mx 8jQhVQmU5N k^~S9ɫkQ[C_j-=Mf_3͢x(,x^ۜuqQE9IJIcX0GLf z6OO,)[_ _6ɩƊ@-dQcC,Yx ◸Ϊ~+@_V:q,^q3UNPDSU+k*A 'J*iMP^۹:FU:/їeB y'-P.Oי . x]ŃnO!|Zg"ߞ=0[d岍o1^db!гU)}Jmixi8tMazLv Q1t Y/3.{=N_ z } rrCK2}j&L'to=vI1Ƌ% #e'Fw&V5ë^!ٍ _SW- rP}7멀_8 huH׌ ~HO1ʎ<Εɠ֌ (͗׏KMUz鎬48$?A Ui먚: CrIä.{m1: rba ߩtӻڊg>8[?ILe__E͑CqmsT@@FieStu?u)YIao0Oskф$=-%q*Ib'75fPטZwbˡJYP͑2"9謹O-us <}u z<`fMUClcP\ݝcg'PooIuyiDᾭ5jtf"W47b#3{d+no]k D}I[+OFץxJYXe`hߛRE4`[>+\|)C74tAR_uyWbRgFX:"#[p.٩Y[+a)=X\}o0d`2Kp/K.ٰqSǸ6%Xx5sBZˌw^j(v 3Y0m4qQ !gv@~/߬#+ d +DvsZqGxr&\gFюR&TuP%,qI'nJJ*caf.67w,D#hPM3D*0& ӥ ŅHSZ|KN?"-%oo{]XZΚU,`gGKg5rnn19[AiqjL\˽8.~BL`yR.䬠P4BP1U`hhu :%5iGo3\BML,-%s-{z'"w4Ƈ̋^ZHqF?,1/=ɯ[Oj۲V!6 b }D1WAA:zn RS0Jh=gQԦ^P$W܁1Bw։lԆQ#Cj)3♆\^wks(W#qZe016~[U2 4`~ŴjnN*3y^3:tc0 '"hQQ}憽K7jC%_Wf2 pq}#= WxG'ozNo%54ߘEҠ/>'ѝY,%8avJsuV[4퀾7ٴBߊtt[]f[z1+X挦|wf'(b w+eÏ{b} I,|Od ֎)-ġU+N9EQ-~ QcsWrPk0d,IöXdyBQH}S>tͼ4EVv}kGxP>UM,czJ 8dW׷7bHp|a^vV_D } ׅcLt.~9d_Pf#' yD]imDM '1vĖc!L:',!koXD\dAIj2]A12`9Ӟ6DDm'l?-O[hoƁKpޞH;+5S&DE@ёdez)%BU}2~1Gňtixџa0~vheF`F& ƟҼ Htɨ̇Ap7#"A#ͼgQO\λt1ƒQ4-D|vu^f Bs_={?XXZ".."y䯨Q9oA.SӦKMc%"n1 XN2y{/LRQ_E.ᑣ|-l\ VCɄ]F ź堺{QlHi[W&+ngz˒89V'~͢\Lv(fGF֠6ypsCbv;AQ%AN *orŨ;$7۶E`<d-p: #뛨a%{8I$рr>*"+Aj0dwE:"zKS|^&5(cn&a#>Ӕ#vOb40\_-C|c1ڝ6mMWW_/M_o eqVRH'1! o~Zz +к!Jܹ/o[N:X1jٻerX#2]cPwEVkDu o8:w g a rSUm>K~<,,=\z€UHʧ})Xu;uO &6ʹ3#jb@rUvMlm"Et2t)-U[<=w=ΚV~ZMM_ԳSa3"D Tv.Acf/ 3jY |Є5F] uT$y u}JCY ='Mbl<'Qjak b|`7WnK|f,>6FcU`>ϏjmN:LCV|VϞsϺ?dJ;˞S>aʓus|H 1w:oT0rEjKj7r" aKt}meޥ8fvrn.A߆[,ZG'0T{F=z"?J6)RigePJS\MhC]Μw EGk%6tz.X,?-XP:06|y0Mi[پZ4Fe4BB%whĨX,sރsX52曛8z=r3@TJ-煮lFuLk<KV׊w,o{ L?XȏfXFN[[aʪ$a O,B ų!Dj*;(La])D@O~`{9f/*d t\9-$E5{;SG3[>pY:zp K.6f!9yEVw6C~F>jRF6F8mz,$M?CzaAYo+~_տzIMV +)2~$ա=Fhl>zC piۍŁe3yGG`KfK%RIO´V` /#ܩpkr1dO'|FO?e7˄ecIm#&D#|X#^(e^G^*`\탻gŒ.ִUDP>i7(nRb` 'iwh^3 hk [T BtzQ!&g&MNdbF wH]q80l =͠kpEp12Λ5Y'L/f9vDkU J)킉'=վZxm?N2{GA5,;[5,[>~m2>zb)u2y~{iQ  B@R% }X-*;~8~ ۦTG ZӦ: f /e*6| e@`_I6+j~h{l1XH%(/vu왺M|x%ڱbd#7aCh$CO8B"͒)>7hȿ3sϦ!lg'هg9"i[pHU^rJ~||k tW׮y1.Md; N ckSKs<5^?JB69|K2@~"+6on>%V5 g3?j+~Z+OdI :Y>WV/I"VTuc|磗G@*WQ\'ie =s ~ %C0`Xǝ ̳yw QG1@5 (_Գ$x'BVkꣁ^VEt)ٻMQ6TFu.aw0NCQ~xK)D}ows&Ĉ f[S˦@F ԁ]^$Mm)}RLa@4wG+_DrDIS'ƞvܲvl8~l !;5v2Ʒć YCr(ArkI1[ƜrnAsDبF\X0ujRڦ;$ x: reڙbl%j $_VՊDz|?J - xy PJ.ڹ<"Y^2(tۮ}h6_mp+d 1M$X9Jd,]f5җ1eT buB6ЇC=IYn#5rIذnV.}*K`AN=B_}8.!!zfũR+s?Q2U"9Z.Cv.t6y&F̉bL=<q 6gdbLe0d]OrfߤAK }tmU#TpFK\a d|DTMC|1҅)IJkIT⡥ 礝c_bnf_; %$;V !$gpљ!{ՠ[S,ا<T:D.@˘˗oƠ}D&k˜  #, 3t#;\!75Nov]S9l$q }kJZ^`nR&~e4^)DqH{Г߭@x1sǹHpW!U]rJZnyoի8݉aKL/GGSu=DrBߑ=w#XDNWˈYsStH_&犏W6׌#[l'5~kswYaNinўZ^$'8YRBQ ;V vDbJB V3:Hr8%:#\4?J~R?_/ƱtMy3^yNd,zٹ;|͓.Օjw+-&_Zk¨>17<9@/Ϡt@b+*=u$49EjPxWG!'b"LiU`{;/5\ f3Zyz{;~5ix`iMw)fH~Կ*y B'|Di}S>.w abonш6 Lb^:y52qo}Wu8^ lnkS !v:=T~29' K.zzI=kL%jV ZRssb{:<#Ӵ#G֕`ūA"?VwHc9> o#OPb8mۓuPEP#&§IVj5:].mT#)[ɦ螂?y6Ĵ*\~x="MkA5WKd4DL/QsKU_01vNJw,Tf,{E xr&97ʂi(-YPپ{EԱLrsf\5C-鲾7̝5 sL톏Yu"9Em4py9;lb2fm*N8s[rh&w,fso&l˱))+7<.JPGm9Z[I 3j#{@l &wwю/,zנq1Bc} |gkj* %|(bP я/\ji4@wE .YUѿy7Q99vJg zxӕ7cE2[,ZiAb~1PMHXIșm6-~N]0lbN!ICQ%1?"eN,7|;07U_ \vyM7"G / ٖKb:a1až5nHv+PC^_(lE\|p>Z@+?)&KLQFW_Gm <+iq;GDe?Q,[]iwBQ=E3sD+ 9N]kӾ~mOKUZ&-Bs5zOZ6DݼNCȾWIhxV,ǝ/}Քg-0-&y:;'FǜT ^T,x㼑GeKwKܫvj-)3Їk%Wio`ߖ 󡃝զ,rT5(`6 t3Q`jFU~!_ڜHZLX#w^dbw,oPLeL~KIү9>n ęV#Q iWQ @gQ\}P %3i 'He wBjjp!WO3k vݬV1BnajD U b+ \C 2/1K&iXse3"c%=څkҚ nśO@>?285W8xHz@9˖Љ즒< #BpSudӻ8@ZLa'dN#o>։{Yw_^>VH!5hF*]]ʩPj+gPAV%"8MUAx L &^} q~9 `W_2md%`\Ď,;l I+4(}RoŻ7SomɓPTae/ધY':XjV+XźjM+ cW_X>꾖c RxQ[>oe8х`yo2-GsX7/݂yZIɠ"PhgYU|A Ka?fu@Q]$ 547aֆWFwݩQ.^7?YkR~e8*-6 !L};.w8 U^ `@JXoy#'3V 8$i$(["_z^l=۽4*V`PzY-/Ъr47U"gh9aMaD{bl55jYRh;/v' Ml'H%ɌWzf u}| ҝ ;?Q gQj A^6\m=])Ύ3+滼2m]'*BrRA8[E5 ؂q$ݕ4vAykt%gV:5##7D9`=)MEjཛiI/tMb238Iuqwvl3n;u{&tQNw%0m!!^bDW޵T̰ˊX%v/gm/O_syh (ɵq;$/v,z~.'K"KiZ6C^nO+SI2.a6Q*}#QT"\2ȊUi9+S=ܧl!jsP6h'~Ak҈r@G?x%M,]!(qqWh$_T~mr% uhT .1~4W)?o&~\M-xtX*x\6ZLl+sܰ8fP=vLQ0k)֫4$Ӷ*=pdr|B7cE| WLr))&X*þb'1 @pa5Ui4#J>r*6zɉR(D[%aaqzJ,}yܕ*3 m^0I=5,_C G=]A3f7Xm@zvD=%}ÔMhx y+ Eq?PKĸ]o{.Т䒘܇DE:zEPW,ta=KݸC.J}I E { dT[eilɗKP[2'V1-Y CML6K2{ciwT\X_;߃8MdܧR؞(yx$='dR0`NK> ԪЮ&g+"; f׈g%i,O3kCiI.`_D): wPؿC+"o ^/!r_87=BA|ƑͰK *QLj%|`g^bIOY@նf6I@zh+V7Q ז0dυԁggBqFӢIs5ݨ)4 R>p0>{<$nmbUƜt2L dMc5%!3c,BfŦtMOc3K ^w1JR؇*yU!7>֞HQuDS)?F9ć_ÆTնX X4˶]N6=<t=sCY NGb̬%5ԮMOXa0!{"!'&Wn vF;މq $$3en7nPa tV>D$he\G8GYmOV.₩Ւ#poWNq (XaVs f q&"ffFLFiTeuC@~ ded  [Ufxr8*s6؂/[9u 6PW,A=]F4d>;~F\5V{D37h*W#)hKG,j[:Zj2¾5X9QQ ccIspZew`9&KحRsۑ{ 6 s:7P6ZOs2#ZʍX',-پe3/}12 [$XH 9.U9 ǝdʺ}접.xHȣ##`L"F?X .7d?9,'pX`"!^y~)<Sߑ#N|ߡKSҳo#z:y%sq cfk]θW*R/4[e vh6\uF*cwVsr`qv{`Es}Y#7LtG˕X]]dv?zcr% 9hQmPwD`&  kL1TV ma_NhRA93 |ЭH *F6DW;AwFh6_5ո= ENi<)G, {Չ̜ØpRvG<$M1-՜.u? oB(TRęT.եs4jCռx @$\꬝ӂ5Xv0\%3aЫ]ӭ86u}TbB:d[h˟Bt4ЦuBkgY1֚v"URnOEdK>مK_'ѭ]?>w!ulD3*^z~ خ/ƹQ&j SifWR_%2Uջ=ԫX>{ETMn0L)]}9U .(̗Y i XjeNa5@ i>f}R(ҿC{͵!yL WV`꼓#,U3E_{*1U}wX䴔n*}2 ljgt= (f1oZNg/\ZwzrA[uid.vǤg' 4%ۉ}%hcF=`<c28ɿi; H)Db+ê],BjXP'Ĝl햾'0b^jFDD& U[Ze8s+v?GoG9MI MɍK6z|!O'hxY:Ǒ\#ǎ?s\[#ߘ)*dmJ\R0"~'Ӿ)b}d#' ,S?.Jpe&U-5zh ~Qu 0{`Tc2q$0=?"W56p>k~"g4X _÷9\6#K4R =LjWs_f.4yE,m$)f{ 4^ EO`Ȟ ny̞֯ۧIY:\rkص$],])i/QtZ2h~b@FV4RW36v)͛ڱmsYB);in3?(Eӭ|ޞzy7mГ`K|/lq􈲓'2[u\6Xrhߏr  o|P|0 T599+̨x{x_wI9TP)W,*qٲGr+r tdnu\ŕ b}偹 S>ߗIi2rI) JرuJfo%[=h!C -;dA/@^*E7Iɟrg^emm-"D$]zM̋04{pA-.MߏmUܜVu!]Ԙm2)2'C [UBET"5pNGKPd\WW*Vy j-E=RivNr8jj=;WQA\7o喣 Y\b gwzH({Cah~ƽ~ڏY5V5"q= '. {~𓳁.(H+Tn's.UY7HIg9iyґ&9[TbMn:"7iNh>qߌ&'S^q!qr̢éL7n?r=W@;̒,xs*n*K ¾Ii"g]FG?Tk +6a= ͨB )Cš{'#'(P 468LfiI٘|O(zvijН~ƳiHPHyo`Ʈ+GhͭknpR_3)]= NXP"ƚ?l$'rKU~ m3hǔ|~#xʙJL.DmbZR𘼺߆>4 :y ?Ni!2 iprshlrNJ^庾<+ZN{Sda5!1t:eɭA][2 驟{@i.bP +$mNY)R>D2]M I>t'JܛLYcO-z5+O  /JBl ?h% ;u{㍟OV(]e)#TA4;~!&&`LRQxfk? {Pm>u*;76ڍڵ0~Ug;]5.p(䍁`p6yv,˦,n |rY?=J`xd(4Ab' xRJR9 ? FWs|x) ectax!: B"{kC86٭G-ɖr OBT,.5KeWGJZ~NAj0wr퓟ឆ^~2(a1 +Yoq52>Nq (04&qmD}EΆ b A-L.d;P D;(i 6XG:3H{@ܼ\|Ȍž9XB<&>'< ʍ5{F 㴶Wுyѫ/=}F\p \N2&9`YTJu]_pGj:?p}" `=Bm~ Wӥ6k߬1byt~ t^7Vǧt:0 2pƑ_R᤻kGř.ObFJ/MAb1x.(:J|_\_!Rdn*"vq=$/f"G59(AL,m0R4`/q3-陈Ăh )LQ;.[|lΟmKݠ9rI]-?$Ii  7JR'<|- PWs\r'R^R.鹱v;Ǥ!Ul[!ApԊ 6VPs9.cFkqcg>8~4pC>Aĉ siGjS X̚LMi.Thne"|=aT죃\qwHrTĕQ4$JQF4@xDEg>) #>SdY{Q 1().fH0N N}2rżz )5YG*XbQs ݺ>cV}wB~tjnc ]Ǔ]Íiہ1_)cGb8?Ey 71S^ehQ+n'8Kh)&?n'L5)yG"GE) \OkA?]n _z3X-( @4";4;m~d])0X݂,W^NUm91?vJt,Y2QY~kMx*cu^@kEaPY;UVE+kpx=k4*qI<4-唁1oRߨW%~2E7Iͅ#le<ϰVa(+*tꙞv&H'{{Cst_w}JM ]Sb~|6g.mA8%C!c(`.+9l9c7n$IC~.G#l5VYɮ%qw˿+y(P3!sݩ$e7Ģ]o[*>,eCńpxb9ܢ?lqAWoPJ*YmӰC%S.|a7qٞm/-JOe?AVqX7jLdύg/>quI91^H<+nzyIƮ}YA}1hhH-_ߤ(r_YocZNEM~ɘ d۬+뼄s3ܥj,l_#=q({X.h@&G){J1`)'z{Z B3> 9N0V2\'QDZxPEpɒ'[\2N~{'<:(fc%CdЪ|)aH'n)5] 8+Thp{ A%$A߬- IOg1WmIUGIa\4 Gl,RmӢNsJ3';\K^$9.C%H )j9%7yy|0ש8 9xg\?](Qi g.GSq[:ju|u^ ^fh1 eX({1nw;H$nU(iax.ZrYx@?c-:2ݷjhsz8R' JjaL"2ABy73Hš]XRrctK)4sn%Vc 6n&gf:6l _AЫTǑ|?dV`k%9U(uW77^7-@&EG1U4li NR{/QF :?08%@jiUz0 ] e,)`uW d.?8+Lv"Y>.( &`S^F#)t@cM,)AV{jQ"0`j-!7XbNgIaǜ2S+H"}]L҃ӽJ, !}1XG0k# ܐBޟ$&HfJ/щ߲''Ûv4n%:7yc⩖8'׸P8=]քJ2]GmtOٱh 2V]ܷXN3^Њ=p`68GM1CM(`Bp\Z#7$g 5lMmLk}֜=K5Jɣۥ z#W]UV IA޿=pA 7eKψ`-xE=,OB] Sx(42y}'SnYlֿF3Dxzl.5N##=]2F\[y<| ۑoNU(pENTK8yZ=Y̢2+-L@Qul]WR3ncئ?ERLW_Kh}e=OZo2b 50"ӡ^iOF< R -F#1}H-N(νNcq d]Mm L_&V,ts|_ХHVQ ˊ4|LtU;[:oORuyw>eVKׯ??o o|oG//IJ-\7R&>vkӯ8<ku"*f@xM$EpM=fl 5l&L I6%a!Oͷ}.T?Or Klcg^R#(#vt"M+֫s`>+/En%I&2LwiI#ms=M:\y2{(e"hjA[;4Xyo4f&dC q?%FŹM4YN0lӅbxk|~V.ښOŜi̚1O/s߰|:瞎8*l谆B^Át#;C#? *'[_Z*ݘȄqMUuRD  dhj4:Ab*lP:hHdZvrFwE6~\ȯfYriG(HEGptSERG*:X*cTO$Vgϰp5>‹ͱsaXLJHAU}yz$ HQX!V yGK8A/Y VĔg;Jd.fSw_a4dih~F6m,NJ&g]S':rJ1(GGC?U%5F5UP1MKYs>pȟD)lKf7tW\ԯ!8syq'Kʪ7N<=UM2-KQF2 ^רMV>R{g;8H3!9,) (9Jrm? *Zro@ql>Oӵ7^HeGҺ<%::*V7"}ɽ /^)jqHz  O-"ɫ1mRwiUR^ .IǶ"8u5fհǰ[yMNpfะRW!Â]Et+lYr֦\Piz`)„J *cmh,f=rH,|Ywp2>}}5m榆J@Q$Pߟ[Z\B#-(24Y!x^YO5d8z /1->^ƒ1ߋ-A!f?dN7/(57@ €$zH\2@`q\8ݱYY}ePIDs-m$˿-8O`AmpgNR/VMi3Q $+Ad/X2^h w2qk Esj?ځb$PtKoa0vscA}hkΦICk(GZWP÷WCoDK3?\ښH۱7$tvn?? Qq,$ZLS2nq:Bjhޏ-Tm3h} DG⠓ BٽQ䥷6J)3qX1/ "$mb\L q,)E`C0@䯣f4HB ))\.wpJRjX&kN|waT TgVh";7#4\ץxuO#[9D6 NՍԫ3?2g7⣵>Eb - r;Bo鍲 JG`qjaf=1b է1wNޯmm 4X..aR .Bt;Z|՟(TtDhIז{[]}J׈l1S]1 hnwt U;j&WaG2nnN_OQM+.nJZ7[kYpOhXQuWF3ỀӓW mtgv3splY 1kԟynE R{Q68_Jcv ӗc<\^2[6Ԋ򕩡PnMn~Q#\]PBʂ9rA^FOW!Iv|]#$@|xf,1FTLy2Wwlr)Z^U0)GU?ut(>)VQGIu[&,Ua/V<(+MUw4Hٮy$`Jh[&~+Ts6=KWJ)aUF 2.u;"$۰Gx?_bgu&HJp) W$_w`z!5jly5><5l{X#@Ȱl; . s^`A/&Dͫ$܅0mc/Tt + 2~![ =X&HZ^[&_I>ZV;;&MhԞiHa_4,G<86-DZ8ʘ"8f">x`ZJg/Rgya *ŇiΘiH 7ZIq"+l=S}*O`%T`&Kޫ mqw(# ZNޢ̑i) w]]~+|S?ڵL"IV/aBE~&e) u8  M@pRrę2/Vz\Cc$1jՓI U&98>4T[bEmXPnT8C%GQF!VcFŖ+ PsIL92Ŭ^o+^N1J~Z:Q:EuGo6H 5$h+wo p"_&Y%JDVda5*[7!t7'ξIݽ_j|D. }k{qLINAj7jQӟZ;DS} o䋬z)#Mα4llZYg|`Lz>u#R'<=#MV 9e,- |K夭EĪKeF WsڶdTt./seƷ4ԩvoq:l@}H>7#\h"&(p`|L M,&LS+$ւFŕ3"D*,%|26[u ҪnAY'$eꜫn|21JZ;(`^M~ Qˢ%vfE> &pWޗZIWGGN2K/>'M gMr*ov!a){x?sڴit})ewsE@ёKy``p@b.rCl3ccOxi߹>PTCTf@3ܯBlB~ae|+ ͙ޓHؒg$ae{iyA6^Ms}; %|h1/;܊# "Jt:p!h,[uYwcuğtPC[lE ͉ˆ9tpDSbp6=_ Z1Mfk7'B':~l|n^x>crsyW(A*LEa2@is"OwSfL!:Ku0r8N-E('I+9CѝDD`&Cs[fZ6qMb/GteW}䋟1 k?wSBǧ#yo0!3{Xwz7GXdgJ t [ĺ *1+؂Lmv/;*o1јyeIRlRB⾵LZE=)Fi~wK.l1 0KnT{vN gsJ4-tXШn2=w\R$g6}_c~r죡cFF#B[7nq KQ^$7_T-j(Li KZrʽTZ (2q> J=ПqJtXfZԒ#ş >УO!@I|jՐC P<qGt Z 6Ӵ5SP{[R2KcUP}}p ƒV F^3-a{$/KyNjjpJf58W Y}=Q{"Bjs&w=Z6;Ot΄*rtJ^0 v<_ REjj@hV:.uxm " z+ )@b')Q.T^?8դ17z5SKۂqW+[!/%w qVf0PmS>[y|KO@-k EHa@{S<H1}꿱wf&?j &`3 *F:{ 'g ,GN*1't=(}5s,⫀ }hg٪,/I"=!x \ȩj<(gs7Ѿ*5賅6In_K9@IJw%$/+#D>y;_'RA`rnv#C;etΰ٧<͗G D&gcet yݞڦѱ% ލsݡ[S:XvjqgXĚU[ ?ua?EEVsU&ZS՗8˕^Tlc+A;5M@xM)0! 3|eNW,/05&=3G3|RZc21Fq$O4ijt渒·F覶XX1Fg"nIE\ q ʨoEkY>VeNYB1j/ptGzxIy6>W>wbpJ{ϤZdۊKfO)ܢМ-ڄx>*w}_]ϓG6L|a5sw<$*r<hW: IspY,5(b֏ų7,]-5PqI굡 eĀQIJAVD]\xqAeA\j@UCc(,wKΠfBvs#-ʒ; ~i A3W6en}׳@.'1'@~H>墵y/a\ ?= r-]?oۯg2~AA&_'r?<]3P(P6»Eűcľ67s\]Mڻ3Z1fNIn'tJǁ31g)FL6Kη|2DJ*bGy) Saӵ+ۊA4t! "`΍ЃNJ/_g6 Q0gҀeYE@rR pT t$C_~)ivCw'zRGzk+8ޣ+zU@@=!=Z+&wVLͦZp50tu%=\?/c}qSCZ]23.yЈQWսVӋJN241B8 V7TwsC)Oo| ' ](oH( av_nfQDH@1""X([[߁Am)n487~RfG6x?p^nc '`_y4ɔ?#$r3z5C$̣6gFX_Daj#-1<~s_{9jf(.-j=FLCY3-/1f71v=%\Z7 6H0d.>>Ϙmf2JErÁd}4WF`s k9kdaYQDh,G,Ψ}8)&6YKZ&˷x]Խ\UFVecP/3pBjwB`z3A+tU$Hپ.uvc=" 4  nIaf5|Xr6ДxOx MQN CF}=3cK{,\$3>.RRr'j9?Ը,&0%nY 'ez.a4 6~h6-֗ǭ5S٫L)^&q -!o/UvBN<1jD^Ҟe#NR֮W%cYlhPs\Tv|T.$mml6WJs YaTY]cG+Tomy%y/[{B0^8 V E!lK \H-%T'FkD]S =)A zQL\+3kZt7J8)2(n_>͵݅,u1I;jwE̕, SqP552cS@]|c;u.&m^~1$<0h憜Zwk$(֓g.] [ v~.ي6$Jr*=h(Rax/2|Jq͟fQ9[JnjiM D3Z}|M ɧ#I!咪Tz#nFhzr.jz>I 8 {gI5rmJq7Ԋ?n6Iʕ'q -S9g'>h<{iLXNF/4cY};_zq*3zGEqՆic:>Ù3HRJڢZ09x~ԅHq?&XUcA!njj'|3 Q%2gD.,Ewr1ަ55=4DO$|{BSig\3w:ZCa/kC%M q+U=ɝ?aLcsݾϯ"ѯ{l/Oq8%r+jzXB۶E/DIQ>1qÉR ~Qk-*sS_sqg9[HxܲvU, s|ϒ}J<~F쾑R :J[,\^0Ҍ a4&o]7U ŰmyqqI?F>Ad?Hf\b8|sVki(_7ҢL{auh:3qu $ZbNpgr{ra)Wg_FqpUgrGp9V஡쳃,gQl/-)a*^է|)jJ6M^݌nCiIP&OuQjnPR d-=,:r1tbaM! 3 9<'흳\Wvvq2J⢽gP^ucseȞer:)ƨ3ƃLf0Wc8f/VXݹ$x0pƉCbՎ.[z͑xXğԠ` apzHJw5`O: Jh7n`]J G.X.m%:Q7 Uݻ!h$N } PYup3D~?+DqWLC*zg18+kRkM, er7y-Y,>\ER^co`Aa*h-dCh~ژ;l0n -'gM$$,1y2}Y'FbP8&p1br<~cdޝ ] kXZ+0X0 Vs!ZվiVE`Qߍ&OB|<{ӚH G+ RmIt.R[d;w¦&Jpc1n|{t{,*%Zy֦FI7miUf`zVͼi8O^}HԖVۙ'Bj"όaܾo9¬JGĩaoOl>. Mpsb@&]r"U!gFF_,G5y}1Nמ H#3 ?ظ9zI,㾓 cy+ةUu <a]r-9v2VPq®T7P$͏Waq.0*n?OlVt s>2g [&w8mPNQb>jۙ:Ub͖uh=kqsAA `|xK U`jlL&'wջj=̶AۜF!Qq/ s !$aszޕ=x&/(\TdZ'_ @$09 @Bl5f1J,&('F>TI :Vy e~M' / yW)I~/#`?C@O8 *T%EzJ'piMT@X + 'Dہj[H?GF_n/r:F>a0|vAW2>dsH)|+)y*dztv$ԸR ;o^Yw<}ݥΝ-vDPčo^n&`R S+6$*+.qt'-_cAµ,aIa'jV(@/A\dd<%k(X}d9\/',#\hfaQkZT9yD.;dxQ>e:6,٦!-kljc~zfQ$uoJG1?3̨lM="?aLjjuW}*C4./%VYPQdؑJݣDy؜'yzVIȋ=} (դLg!tC7T!Hp:94X=6\a` jc29웚xhVȋs#4E>y6EBnb]֌9kfxKN'8Ri@wBEԕ&4 aRݚ=aWqd'"==ryS +aIa*1g[3 Qznj "!//,HϹG/wc7t,:Ѳ${=\:1a\cqK6 .6wgĐ cۆM")59tV cwÇE1]CRPk+um>~ӏAzo0&g* $ Ԗ Тi<+HjL%`'_C ai\0k& S=6/Vh: e? >CAH*i7 1C{2BNn۬$uk.Y?4u'~g?bb),k:T Tvb"4y<~ꆤHY~p),QCz6,>٥#8YȵU@Ŧ,1+]_R"-:\LNZd} ~@Дe05zv\HϑvOC?6I;]ɞ H:LH7ύdi)'襖 Cqϭ𴤞t oeYq3Ok0Íx:79C"!&!Gݡ`)Bu hYqGn 4z=YdgԆpZ-G a' p! f3XEA 4јy+ NZMQl88U1ay#a%tgW(AO#J&fqWr"@JA\7aHMv&D48:bh ?LkUa6Tb@VAHkOÙ~aKK=xEཽ Ts#Wzfh*sxl Ukוd1N jr.1l*k\DَrM8g&XL$1a%"nxh$sPIaZA6Ef 4H/ SSb4k2ÇnA+ff)K(Q.{:JV1w!dNۢD8nH\Ekf,H|/gu]ۅczLgBCg2ȁbEkG~Z:51x&:,qңWGp>W<˅*6*ypP4%>u =:OȹkggzRm)[EkIݛB쿹QYlFHOWh"9t[?#ao6t kWr/F%f) kmWMڽߊg8kge[3  P7fЈ\NÙ3QCC/ -McM7#f`FQP]P Rc6:ӮcL{sS p[ S@UէPUN73v\T0CA=gc6mLy&#JG6F>B&Vv)*ዩE 5gβRm[((F8udםuDޟWZ}3k7UDy PT (n]x,$>CO#ԇWƔb}C ̈Z8N@<eALv4v DS>TMwV, _ծ[2 hZJJۯ[XQt,?nۓ/ TB>Er25NJv-P/4ޛM0-&V@6Ӫ23) rڎPݪapYsV"SGB$U=DCrwcFILu24`!3Ҥ*aV;fa pL/-@q9'Ƴ*y6S1Ēi; e$̈Fܨ2@@`S73d`eܕGDaiS0,F'3Vo(sX&V wٞ_eC]d0DyGC1y 4xo'^|VYH;>Zxp34t/a2e(Mף$_$>f,U1"ow݋8ID AБ&ꢛP;a:!sX'hz$h$w ,8lmm"'q~IX֋̍i84i:tWroḧ}@~~բHGpoixgIĪ}p=3¤=?8Z7䵆EM'@JIRb=>\ F^̬Bf=Y3r ֶA6g+*H)b&c^Z7ך".LQ g-N/ڒ)Qd/vثיqJxe ǯ5 f4[/#j_4<&Pxٌ< Kߜ>8 3oum9"kEB!f$3 )4P}{(ٞțfY-g$ a٨8+ HEpartiU`kI3AHXXpjs7\{_gYZڀOM~9XZ$~/Eyi_wh&TՠH41&rIdDCj 8:GTu9gBiɴBΟ4Ϯ4di#=y\:2.ՖBS٫=xgH<*jUM>@.YCYGFT zetXH M%*pEAz|[  Jdp+JmH,v %,jzNm9ʉ߽ PThގ^2<^ .[}}+/BֹS_=F} =0s >(n]WC 5lbOQLN$ #@ٕwG-ClnŤz'=>/~$(^ rC2&钩G5(FRnKu ۋ;h uL;q\h/ 0Aj]hnlHw / 쵘1` 4 Xs**(xn4=iXPY^ ˏL~Zt_HH$1rRs4e}3mY똀,uÚt\ 謁0+ GHQ<]֧bΌ$ Ogl:Z>5:S[|gO GS.Z"pʂ_ơ^yZr`PK5}aIݠWIa􂓡#T8A5`11XGI0(p&\{zʅ~w,*2u&!3U]1`TD=V,>-bYK*Uxǟ=[I4ƨ*ץsyukў߽\im573U?"x _>x9l~[x4D€|/$j]0Ol[-E mdD_fg ?:ʓRT*o.ڡ@רK_zmfRs{#S5E|)T!C;V'w]WPW/ !N\Tܘ8ƱD5_xq `9fgdEf疾>$WmD4}~ii&W!%O3_yԥN={Dh3ӧ\ O^ 'OWl$#m~k 'X~(']ją@V]֑z2Y͒f QfY撟Y䩣dnd̿ő%Ewww É4-J*F-Bg~hNCxFdz&5kf( 'gn-:Kݸ¶_Nt)+c7Ԇc!4'0v%j7c3a$b6i9;AM zI "P_'_b@q.I]r3k2k+I:xd5z$.~2ZTRʜi#  . KuIp8ßqGW+QHލauDabOs}_ic09 jP ftypjp2 jp2 Ojp2hihdrcolr"cdefjp2cOQ2R \ PXX`XX`XX`XXXPPXdKakadu-v5.2.1 ,B|nTkK eT'u@.: @4?;:P[dn,墾ݘT!U$s^԰u!Mr;:^أ3ZbhlQzB9Kd8a<`ΙH,=ۦHaOx^U}URq5^D#·/7|] redD2 ~˱yNVԯl`!2ڔ0( !#V 6B#UK_U2x,$Hv\@b5駆*bG7isQK]ˈ"#dͩ1LpZ~a (N ?kގG H=3 3O d r@66!_Xr52*Y[EΣME)XB@"=ю|JDTT#ߨCJsm@u"b\VřWXN] Yd1́o:QogC i75]aWr~Qya'jLuLY/9qq #*P)ag|nCr/XͰҧ &\ɝ%vh{cM5MK2ť=ppL1xn9hO%0OH!'7bxS@WD}!XE/ u="2STёԪ8,.Ɣk.%uɓLw|ʤO\HG_B1|~Ńo+lZOןΈ*ylXzZw]gI3gXcЧ9`쑄H!]\G5E!p==FjxADE.} 7=Xv&/?t2RE80TF8OsѝgVi)l-S!~`[cWW\|F x%vEhgF*~pd#͍>β8(<7A ~RNOj+ Q'k$^zF&ADNV ›ZzozJ ).1q̞ 5URKJ#ʼnd7O|^P>/=UڌNJ%$PK {YGzzq8#8C&w̤6 M4?yJ,d婃Hw'[G`ǦJZcw>\9,ADM8qD}Cbu%F$K )@'sׯm-rMf;%ְa< H$z^>h|KKSf_ieLV~#"G \f,?^7A%('{aY2ʬ ae0_[ύICla =3F넧 "r<8w]rt>z ?E"ztiGtd7 ' B(“044XSW=l!ͣw:^F!VcOv„K,Ӈ<{;柮2q%ݮBIzĬB(j,+٤.9{7HzBQƁL]ii h7@{q2+(WzhY Q zxz=75J|͏OHnp(‹}Op>6V#ٌlPD2i|T Q"N g-RzwGQoD?[=9i؋w7BDf-QHJ1 40aDdp1y';"oc4 Z"Okvb:b5R*F:.G頯Lgv3[#Ŵbkjyh'hMT[h3oڏRX.AbFy77I\U v+ӟ fF/PJ:`#;yHm>:A eEfIZ*jXJ, uWƚ%&ȌCQq1e!'KS5x%6~9 SLwk:^dzh7cz5JOI#Y{|u^86<S06`ޣ3 0rOʢb|Hso*iH{$#t_LL]9N̬L *s{B? Eg}l(:}l7jeŸO:ijҫ'+I}+.n`?=zXbJ^R/pMS@GbI/ۀuHzqK( tgZaYudĚs3msHQkA@Z 5<0m[re%֊7UvA/ǡ)g6j&|1 #SjJL^HB`(Bm>QKg-ݒ3JGN~].9 oSYߍ:h힣V ,udiaTBSX-E30kmBz$LI kMLKJ)9 ׈PDf΀Ը堔"v;ܐ=r[B<u9NOnk5ۻ&T7?m)+ V/i{6K?EҍjYx)vQH*hّ%*Y.e !^:!9!LPSI"/eРHe{]?wx|@MR{K}ָyfJ!%I(UM]FC[o`MCa%RGk !fEL5Y 亿Z@J D4F;K۸:Ы6MlrSTvCvQGnvͬI_3=J`XaBJG6:V1g9R>t z/ӶP `l.0 M>'92TȔЈd7]tDoJx6zέB!}0451 d"(YNwt|L^ohNW*nEOgi|VAb̂Zv]}'Ӄ\9 *Y11)Z:20!5ӉJd}YDCIž y<)sNOq=s(0<,72v -V~+)|!dHvrQ)2;gx@[́:{叭NJS|A_qa'}k8JU 4 p5Q٠{diHc8&B2I[KWd1ȟե.EZɲ-LwoY۝\_Mof:Q[nR5' -龼07d{V0.uo/݃}ň婺."Zvkc9pV ,ĘZi>sɥ,;[[ProȾ@w igRpYL؈-P&!ii6ue+fS`-w+Kc6R_U6ȿUS!.C}oG@Z@19Rq&'mdu8swY{LfiNO_:cyG=Tȝ[BU@`S0g|UAt"]Wۆ%Y.$ՂOLl F>wҬ@ jB-YR/DvSeu@#mEA] ޸/xiaŠ3 Q =c8 J!C2ܛⴿ$@#^ :Ua_ ;[Hh+Ys>8Q0J)Oۭ. x_sܚ7 l-"ߪKÁ0Дfݜ@jZA!cZgq[kh~mq(~?Y0!Nj/[73NDeqEm[gߑ˿4ׂbkݶh/J1URʨ8'fDIn$Ht+FRR^Z}}}j qZ>9I#$m\h1V Bn]{np[ j<))REFz05o#@eMH {X1)CU3~W}LLi->-N栕77D:4*-LQ3QNTd* ny.j[#bn?qfn~"s}@|^<lγؔͶ漏:?? Ȟ#Q넟)]+X0?ZrjէɹtυF0}JMXTO6bLt_"z"@a 9^uOC N7ĂwLd~8ؘgXa%B3YcxuH^FK1hz|CEWgcx,GOa Kiw5z\M=) eW(VF¸fX4ҮoY;dk_/ǖyYfF'HA8kgNmUo}xM _Z'0`37 N^Nqoqv/^1ID1|6f O܍,.^ dNȓAH Mm+lKc+5EY3A|֠1;RVj*Zh^Pv%lKi+^5LW|;U}Zar7ڃ/$D(@y UgW<۽씓5XBܺۍkBk! oHoo'Pz}!MB ps]Rթ\ܪ(5-H@;l(]6TC4`=GI<,w#JX4H}9.H H~ tk5[y(uNrmt}:/F-L;[<;>o@ 8cS QBY:ݵ&jϐګUJ0m.+)rShR,J7ʉ R8&yi釲-i`'[^<_ᕐU:9GCsr/y"ԝ!9ɼF/)Ŭ`k'rCUHR]PEe\L~}Oizo@e,N ۢ^d .csgkcOŽZH!$W.&Ă{Fઔs/8!C4|A 1UjInN% ԦPm#Q?x;{ާӘT'VENh@9\v"NXKv %{qOU뿾 E _KGXq}+5 m9Н&: I_b-vpHaVK'׎80@J7MT;壄ϖD sct9ÌkE)Uiɥj}QHeXSwVNԁ'}hYt:\GGþ|oͱNbysALYk䬣3Ⰻνqgˇ`1[ID? \4`QVLҋzsA@ZXbG.^TV>Gn;;{X*H<[_"9+4)BI{^m@KTۖ< -͋pse<}`ydq3uYMٴIk`z@ncgkPi,rfNZ2[wqhRqЧ"\Г{m4&R" ⾈hqUˁvV4w xͭ@ hcKlZ!sow8!ps0eRrAdY 5N`BYP# MmN{| :J3,^[8UTGkGD5`/9}9 z1GX֫ERxiPs`0ly݃+X<[EߐyaC'Wg brnѾ(e [e)U#'ge`Vd\_wR&# Is?0m粅zܣt4&1f?BoMZUX N:9)hD:o-h+wxxΟM+[E[՟mbaXҁNui9dWO[!Sp&VK?p}Ce\P pb y/0SUG{2hxvC#RMye*YFۡ7mbl@'PoLd2P'՗1[(Y"}cHbA%)Y3x0ਞx甩IVق4&yfSeTc`fbDOҺs1-BԻ-Am1a*S{gӛxeO|PaM;dPˍf)o+„swXF mP`D:0Y; =x7+u45[kQfNw1\ J%!6&\wzN*Cn3?0#% q2%lL M 6!E˪HoX XZ>-eW*(u$LY/<] m5D>aO<Ʋmw :PCЊdXn[H@ulA\#x:UjZm[7rk/e ߭( qF^QkS7.K] ]8xuW5ΧqcE^hnUup29yy<8bх?1ѭF?_eX sz9QM_d^KVvk9uz}%D'pR͕f:Y+e`Zs/BrQ|Gf5AKK5X-ege2%C&ۮ+/_' Esre %,cXdߧ;a+9h!ixɜ1Tp|Epk+7,标M_V-qH b0E:?ͅg[Mi &IAGY.JѵjEyseV JŬk'8=!Hy^1؍E74GhFF\N9OүUģ'ߠr L47 IAA|묉t/;Ack1iyl}"Mk@#xG׳K>PR|n9Leu=EɊpЛETlJ(G)[R +BZ(-K}\+,ð_[!Z_z dIZwX0z#&ΦȜ7|7▸PhgF%BrtZd=xq\AP5qvS_&rZ "x*&ġ(r皣Xsp hak{Gם˿ȣ4˰d~ :baPK0q쯹;0_۾?+xۉԺ-(~V qBwV;a09a" MÁr)+a~ìUz 1pԶ02.cvtIw؝ ?G06q̽.zP<+#>|=yfsc2lB5O0jp$~ !wGd3&w;(˲GT>SP2iY1*OCQRh=`U [Ah-cyzN1$}1L@zK اBɧb^eEW-E}j|߱Бs3147g'Eb^[CȌì=]*'~tJgC?n-O, KBσڨQ[_ `ͭ{1?7X~$d#V F<^i2ZDd5ZOyt򫸁 Rd(,ӭ~&Uz$ 3QCi#cƜj:"VDC6ɡrY*dU-EXOs[F=Ηf_tʧ@ Ͳӊ(Cnɥ3[H%D8ԟ `!z_nig=):VǰU/DM ,mDuډ>2v$4r BY;ޯ ee_}b'ǪÔ=D3 UJM0޾Rxb-9Zu:]NE+d8oJaߖh N4\WBidTŒK QsQ^[3w.cU`ErM>'BfyMA(:u]/h0VۧU~::|:MAJ3G%Q_ jAZGsF^snmA8$@zBV6CՍ\X_%ں #)K]?J#{3ȃ(9Ri^tz\jG3/my A% q72d#4 ΃v1N0cG10f]$XwOE'V/FfG \{n_*šw E%L[h(9:RQt|Ϲ8.l? .L0Rvi_t63mvDAXV-+\OC|oɾƺF]"]K 񅅇A*e+D,ؘD(moQ21l)4aQ:lkQ/+~YK7HBR:ZeDZ)qp-&j/@XpAЏzQ BJLM]*=iKVgZ]NftJtԻ,E2U)bN@^:H=HB"DvӀ>!(ZD,@B 4ÚlwYZ0ӪI#a#NH"C +ĉ}ohVVcr&.)XTͭZ'b.tve pW$Wvk\sGߛ/2U|Zɀ̼_UN'0wZxD#Hݒ `N-Ŷ1fWiR*DNzpy x( b הE#[gvDҺS*L7Ȳ;џ'~kjO㯭,$20F\V{y/~c{$x)_5/4QDC7F6oqS}tY5JiqY'!fͱ#fGD'<.H5' k!®KHƢO%7Y s^A铐wl*3!B' gf+=y'7u1[u*8Yeى6#a9şqcYN>6KFl*ݟL2n܋nf֕/*hQӍpm vx Sv'n3鍧 h'_:OfnՔ}/ c$ T8jEXҡ3x 0 t3 \ 1@w7٪{|Z*"4+߽VgJe>/cceA3Cdd$%`[>[VlNmv)5Z v1$S[GʓKHʲ$'"5˂q#Ձ.)H%C$Ǧ["X9STUDJBzPHo;͒-ŧO0P YmME ۃ6_MDT`eNgq 62YAe?4ZLABp&s::y1c)*kM5WOSsDZ\U7x|cۀX;=ka3x-Oj⦤5G9pJ>*8o!Dj$pؑc?E4R`xBvFܿܗYGOIA|JA}% ܪjCn|wSaBR"Ⱥj4o _r̅:q@AMO4~uKxm]CHMvl4|T2 `.N8QhGNAу3[QK>,`z\Ur}NbSё+^==0eE+I* `@rVouA}[t +!@3v`˶E%{|w5otUrX~B;']V^s~De75s~f=Cnݫ4,gn{GziENA G7Cң{e#kt`[?93r+vm}}ճcSf1-R՝pfGMx+$@m(S[:?AEb3K , :F!YM :,vfG߂(O; )~ZvLUXD+Sz+=Y񎸺s?ܦuQ~t^26!Ks@<RR2^ .(H21} .Rw8}8WJԕWC= .l – &ckgfmZ%7$\Hċp1(1 ]ytIVʪgr$Z` Ru-#IrNax]*+b%5#ZL6jC agTmldo(,M_j篢ޡ5_Ӹ853Z2TYJ*rc [BIyY7v\ W]@6`=uP|p2Fg Z8e ;QEq͟ɠ›K:yAj^4Yih; ]u<̼RN^90o/OkX9]An*K >4h &y\ZC@J׈9MDD}O#UμY8kwyՌbDmq* A=k[ yZǃK!7s@d1& ÏFy0A* HTEtd6m|ӕ׌rcRvxn ZRP2tɡ>s%4ܕ[jŬAzE芷@Z  =J0-(6,nPvmz,OZ#z,#t#Z=tP'W81tjxD}3^8~s gE^:^3fcʿ)bC=->lZH>u7mH|޽9W4 Z1= HcwY;Ff\ pj/.ƺl:~VnwBup[)dϡ?a]r-FT#(pRpzin x^3ճPb#h=q{fgS[_fHmjgp E bi 2*oeጸ]KyFr?FgߗPҋTnkSvƚ1P c6jG(J9ȟT%+QHMmO9E9S@{K<"i| g#[nX\v{ν) wr( U:9(ΰm]oL`=Bc>Ė)w֫^"v-C>_=gylm`hڛɘ1'ҍT=U ej1 w:byc_d9:b}hI ׽n"<@2UnV&(/LKFfnnb4ofx#oδE .s Ag$:DFk?.i`N l~gT23l^!:bxPCJ2.%AZ)8@ r27]4\iW571l(gxGgDIKF쾥C) ]4Jbhlö6-J϶#MqI^ɨQyۣ- El#|X8}_:\fϨ"gyVv깂WzD.LcxۥfcqʂX^jJ[7>,pU :y*)9^kFRE0xOi5~}~sJRKeYkuA|mGDs!Ncr UM*:>5S |viɏ<& R!4f93,rPi/eEt1# '7y |5Qe myp FKԡ$حitl1=O鳯662;1׊e;o u?7"`Uh(:s2shP⣖+91LB 9P%~ v`@6FnKY ޟͫ$k'W`ƫd2[83"ZGO{}K{`q⮝ݕzխ2ep_í&^fU-%CoqNt_F_С͕o -edJC:9q_pH'O#F)9e,R'{O*)]M*W& ȡʝ+ًL H6$4ӻуu9 xg}M ֪{{G ? h&1c@3?SѓL&Y9ZƻDZ+kM4 }`n)U' ф`SߦH3SCAʴ KgƝjk yt~5TMAJpvsS=e.;j+HXfkE\άn"ۚCXz""+8uT|" &Lr(Se)(raMJ?2J>@iPtt*PU7r]JNvA`UOƲvb9O=Kh6^3W eI Le5 6Yv[\ݸĤ\3rZسGHe H{ RU8#4(kR"kS_ ˸d[6y;@ddAs (*pu ZJ>dɢm n؜I]ԁ޳LΨďf=4QXPE{.w""ީ}W3Bk9aɑq WwyHqVɺDR;;؏O'ԙe(~&7:-9ҬDW#(¨Jz<|hSjh' ;z 0'P4mbňntUiɩ:*-L?%ϟ Ж,*E #mmϖkF13v~AwsY3%*e8&FQÈ]Ve,ZP*_g&Q_ plq)~Lq($y˩ܥR"I$ⱗ,P:RH7 Q}^;2Ub)`S+7FU.f@+`a;_c oW7`̮99R2g!]nkEr *˖`޶ŸC*}>gc_y(5ל0&KAD'V%)'sC~x@ȁG4\M`1& $&e37{`bBÄ[5># !zO~}S@GEˉW> c&.|7g I.SB:pd I|Ub'J0$SN"SEya<qػ<inKnW˶`:)TgQG;aQ̎Rt;):qŇZд[-Q*()Fpfנ25!|_F?h8GI9a@2 vd(z+=8q@zaTV3!oAg:;d 9ge4zDޣ/'C\"@ݦmm+#;Ԩ&v`R>g>ɯ3ORE&@,R7FH; v+uzF4)}?֐T?i5(cDfh;ޭӴuaOiؘsF&0MwPTd IJIņmh.T}~1 IЁxP/){̇4]F)䠙!dL)Od~Լ7sK]ppc8ɌVI}Zdd_mcG9d0Pz6eVǔ$~۞SqN3 5&]N &ao , 3kJE+ TNb&c0k`6󴺴RL^0u>p^QTׇ|'A_tY9%Q+쀍Cˈdb@9o Hx>sDgnW W歶dI+ F>mp~ƍo+))tcl[B1@N +I;7#Yb¬d}Q,7;CMQ~>>'@n YR÷VpܛR^8C>(F+ivy "LIH I%ϡ>,78[v}tw 3w~٩ade"UUb f>>5!˂8nhHe>j|D rfHJ“Ykv%VzJud&. S=9_0 ?Fdjp~3c|{c#LuKlOYǑB=ٗ,w3ί D|m׹Pgf 庲ZWQw\)Ir1˖[6 za^ 6AEFZu}qh"r1_L@ˡC{T*xDri*R'@Q旼m2a2[ԗ FeQuEO66:V2)1mc7b&"+?nie)0x)V:*I}C_v_|#I9' 9{K!{,iŜv]NQiEX(w3TkJ+~nC#@,=;d{,b:ć]i7[@[vTW4@]Շt$l!/({w,'9a2e+A%M1t7Ѩ11fkJBdjgEK`G yG"/Wpxvd: Y,  ڭLya;rƿWHBjFO02[B,#qNK0R1H#qbu9u_y൱A^Vq~jų$-wT,ƾʉ1^*%*3诏֫ٹXnO? ͊XES7K#u w}dHa9 sՂ?Ix`D^^{*a??\ s#oB~Ie9r$cZ;;g``8,ÛbU O MJ5KihݧTHcQ1In;H)dMg͈rdLnCF(N(00،l! ShP_F6qEXAE 0wN`ʣ酽ZuXHVLJهa.>=>>$ \2alT} EX1m4uN5$ ,Pe Cj*\WyCfd:YYA XIXk܏g#?*kْnBȱ6XkPvU@Kj8bQYU!%#_I+EZ`#xkv-?|ahڕ>m99a<޻"15Z8ibƷ{ZEgP6dykTV&Pjq > u»eJC"ғKX]+%JM>ÈxxRn3͟b%$plռgf 5i|C|Se3Y`xYʽ~qkJ#d3D Ƃ˸|\y]-xvީ7IИQSە+ v E I9HZ*~M&s1fD ԞU7wD:$U!^㔦pL)E,,i]J(jҥ>C`-R$c򗑪$heyף.~y*!k׌TxʡT>ZuC>O;oհ VE,cx;|1+T ouYc' -p{u&iK{$9;j@$;܂` K;PB[$1Hؓ<2+i5,+犫* hb> 5߉e[l$~h5q*)#UڞOm29[۸z~:v(8UP.FzFfcqvֻZģXyWZn&A>D]C渙M4$r_ z\ҡ،ٌ \h9ėR#V,Zk17 R8>r-ɺ@zxTܚl1|NXrٴF{0rA-OpIcBz*fDi6Mok :3 Fk5*-0-=a]:h53բ>vce[\ j^K2Iu~~^:?jͶPes\X#e+۾8.ت*Jenʹ~.qzD/_N,£pZ]4n{|yQ#w+jIpdNaOkzd ux-5av9(FrO=E⒝gk!,rFXEH )ťv'I6ˠ͝=M;aԔ 8˪eFtA qVmF:f._xݔqm'&&[o7ı@c'yu2J@z]s)@Ƌ6WFzn~Ѯo)g&2C"eìxa_;7€V1o_O+O@L7s4tx>r­O;rଡˠd I˂(7h>":W7u㷖>?-Y)Ư#8#⨔ت(5l\BMZg[:FNZ\s2J;\ixG/4SQŮVbRҼ 2!&*MեoA#ý 2T:V?i a+.eCh|%[iYJcd>i'^NIRƘ;֡~}oT/B *]/g~C7a3>H zWIKaew:8 O#CAΒ/F?tscPՏVi> >9S=wwzcr~kb۸=kȶ"һڌƻ,wQ^9ž5N )? tDLdSi_}dt _S[4jVN&t;L1NZU`xC,-DR}հn3sJu0դnEQi9I`幄UН} Dj) UYV=ֱH+amP99b^,%wY@1iˇZ~u>v aMQwXb9rAް3kn1eCI`ǶYVyoO (Q4ACj@CVvt Ôaf 7cqpʹ zHz9e] -/9Pyl~5yy;sſk'*Sd MVi愒?%Pd,={őW\pʜ"q[ D*oz Sr: s}KIFƁ0h^/Z^6G>iL/7_5Z㲄J:U ] Vu5&96H՜ M?QlB0o.8Pi:#;6wBqY G܆ %&cRېy bO  ؝PEz-܃=c8deOE MΨZRW25(&:<-~FN~ud1KuzXrZ[1I^A()ηB$%:v@h98o/eg~Boh;õ{VخkA?LyUt9xb[\2 3 1#EìP<%Fx;†4*QJ8PhnYs&,avjB'";1U=O;羐K ְ 3(M0 eAk2\GXz҅ZZ^;lnsF"6tw^4;Sd5B;9^~z-A[ K/y9LȘ*4t*-8ѽơK/Se.=`~W nh-*m3k,Ҹ=JMgK;7ׅPmY,?T*xy"V<ۇ[\Yz(9jB=`*lS!S1 I8fʈ+\ghãXR+%’C{zEٽn1]Zj SRLRb9'T JHPЇwKBFTy>=9 C mPdA> |Yq"w/k7zu#"mv] .K);W8q„c*2@cY >4H*Cabqg&Q8>Dۼj0R[Twz0UѧdETtv^1Uʧ3{6eg8"D> a)!=XN>-Lgm!e24.+ulɸ| xd\0@3eow˟[YpH:Mp+Y=,^e`*xq n;źw(@EfV` &0hFg6YBK}EP*@~;"oʺ.6HJ32+`Лo δpO.6@-uWNWPBHc;D-TW(l/Ȟ5$KQPZU=AYC#4zG8q]6Ω|+1 HBwoZ$fD|vep,MŽkzuJ=h\ea2e&jo>FOۥ)>Qh=)3C[D^]a?^+#lT&Y+J* ׂS\hA #JZL֞%"yHIUVT|Y ʆN^YGm2W%ƧT&ExKTbbąE3Z+ d$=vŝ`~t_:n#PΛ}~\sp.5LLc.nymg$}eNe$Ǔy僇pK6En:Ⱦ/ԟ]%q .44d;G2F-Q=;8Jt6ma饓h&OT-\_brH-lL~(4ʻv/_:V۴p@$"i^Qw(>_-106I[k̹ T9kP;CS ,cy(Ἁ  H8!Qlkn MSv{GF)\%[5] ZTH1eRp#f=x ۉmNJCu;<]n_wu2j^-7W@M񗄻W.568]3Q|v/w 'P|Q^ G2otDSԟڡ}a?0: znndk{g] tďdnL43 G0&b1yAl{Bݙ9^mJC[PoEӝ.ت%5`CQ*{kÌȐ;8f3vސ@Uv7A-q|̡uhR2"{rŢ>D"i](EU|~hH{L }C.-.+n4-=tL 6K`g6l8wGCct:eL@勸z佩zγItr)ϫˎ+rsU4OeO#'UMF~@Nh\Y¡8̇jB3_yQՅRZ CϏJgE͢j螸 t(GџRsu申~M@77Q!hO@qn{ꯏA5O/=e%-ʥR-֦m{.o,{D׉ lZevQaxMz6Tڿ }~ڧ։2PpZrIQ/]C@ 1bEɡ>djIlieAd=Oq>=߀z@9p\#Huǫ;au~<U1q&XL~@I1"sq$@= ^!HaJOCpTI=˛,M?3ѱN|⡱I ;"4B6yGQ&pTQr$UK4!ĠJբ`^*H6^CVmh93Owonr6:oJOMx$mK=-#,IYLTy b2T| T0)R]u 47<ޜw9tZI=#Qsb6fRl߄jbE@ Pq]oNaS&@ncͽwX2 'j{o-|+߳le H^F,2t~39 ǣ '^JWX:Fs*fF`_n'"X]"M;^QiX2QVeRU~& bo,H^)3\}Q!@Vjˠʋk4IvC2'⛈B²\55kLA%unl;J ;u75w(rI%0D_C!76ZΙiW##zQXwPH_S H8:t\^bT-AaBqk87SeHӊQޣ v뎙}i#?9 ~"eEuF&d幖@;y(|#t1>8nZJCEFZ%N ;q* ҳg.=kҊΉ֓W&^YHj>MLF6ZI"<{4Ν^^ YK6 ]߼lfAP_3քCEeU(oah1}^\cC̑br-Bi$㦍KB t 7sys\2 _bsAΎz< 0 % 6`ezբIJZ--}3(€#-} IQ>^OG,y&ŏa+";X'b>%&W7^R\Əϩ<;i iYo PpHɽf G08x=L'f0f@^ UYφcWU.Kip6Yv_ ,NF% G>4jKpiitu,+=6b%m`(_OŒ޼<)3NFqyJ6Ez0:㔄 W铼u6#`F4\qA?{ύo/  ֜="$hՃHC>$iHI6%JLj"VyPoF,0빺jlnn[F8nuu[ /r8G@d>qMRG _ ȝƼy"[zV,9МeA=(Ԍ&2F[GǩjisMj6sΥEZ˘ Pu׉P0xQu%U)TRF!5mv3nwmK=YڨoǎFO'ϖ!$6q~p4D`Hl[d~&_F!GdpkU ;+1ǪVPz 4sO :RsVCz7‚ce5jY^pc ‡4 FMcJ fC*Ce=_c0bnaTouX˕%Z(c}IFD}ݤ+-n6A"pr>"uuX" :S2(|t6 M>E~lat(Mtg_5);vʫB@u 4n!@xb皅=Fŝr_٣,s12gёӳͶ!X(Cc`P}!%|n!cTzo&1ajKZWo `^ 7Y}**I0$sA:2ixªB73 ܷS)KUE!j~CM_KD$*AL4$9Fb3$AΙ 5!P}V-ȵSP"QjLSxj\)/u-`TDi`ƄG)zkN'yjR?FB޴@HvQF"Pa۶{ QSPTRJjE(> :!ncy,WB} YAKc-'":ꏬ ʺtLli?,I8,=&`وC9grKqL4-dT8s_[S#؃iD@rĥ}4d3BUw`F6=X|+a+8 cpa \L N?#-)uiȨm((^yM]R3J½R..aipKfr0ȡ}Q:\87ɪ+J5LV t`ݐ*<?l.9"2=#~K:=& #Z P ad:1_j‚XQH)kNAJ`lAEZ5Og'p?As ͈4PWsAfgu_Qgx1tG.a詟% 6Ѽv0r(l-URNW~ NGUAH$ǵeܦx- p]n\ԵBKn@Y1tmif3 j񊱐n*ޜ sK3gߜk+d]`e[_^nSo"]=ы@3,kSԁf` =_4uoZI_,Sa[sݒdUfSkX'gI]5qÔ_Ό 9%/2AY0fp 6'9f Sȯ HvTI29Jxp>t'u#AsER2+#R@Lz.o~%EO߭ar>NF"9!VfWFvseF?Zt4.S f)v c;$f1`}( [ZSeJRJv]AQ jx]rH1G ٣I%bvUT.ҵBw!ڧ+&+-CvSY-"%jur6;$ÐME뇔tŸpѧl#pe;+d)'b "cY.y; Q) E_-bTCF5[|T 7kk2`ئ]{EkW!!EК./&,eZv>!Ȍ$*uII 2I)@iǐJG ȄH=YqK:bQ"_3KVS*"Rje` T%V=N!lj J-`ꩴf@Fpbcּ L47ae|H6W>"=~TҰA ym$)nw,KzӵC+ 1*BPr6<,j+4ME %VypQ+r_ %b.vNdbi=ܽ.IKd (A-UC e2S-TD hC"?v xn`X$™%zzZ92^>@xm%N2h_qY6x9;4 f6AL-tS~ QRQyFН/{+u,cS``=} xIMAjv1: ݵq">J` ^B+^|[ۍY)o}tA d:wedP/3x]195'0-2 A{|k})|prd/H tD޺V5=V00_1b+bcd +^fǵkⲽF@Vca{~Cj.p#f&A m$ц5p QԖ) r9|\4&JdErDNEL@^VFyv*GW:K]M!\iDJU`6";|xv#dvB1<ܯKU0d{QN͕dH5v{b7-sG?7T:aJCT h!SxS< Z'< J#͆s'Q@Nx1234i}EA(O!T6!bLJ MwNG!L 96uҐ+B7u|ܮv78Te [N4,!oW땵͠fX^@Օ!a\Nw@;eğ*-? qF_*`h3Ol҄!~cd5-Iα Ct W4FɚO4E_$Q Ce wԃ!vN4~4$H/#:)@ ϝc+BMq;~<##TR1. %a#u2r6G?ExwMÑ~. IHyPiĆy 3ÏL_Nv|0etg'"PWEnLJPZ'TN|\F1M&l 'ncLVM}4wRr|:j=~=H娑ݎm^z-@Ev.^n.5;ѷ$rzj:2|ϡ : M|;+ CŭX;+LԆZk!ޘڟ,XsʗBG LYBEasuA$k%Z79mU-J̫ڃnj{Go1p6>U<._aul Ӧ<<557Ɣ=Ydms_V[>lgB/ޒ$v'f3mLb\rAFwZٶŽM"A#g{M5y0'k}Qf[A hf#G'r6rAys)gc@4$KbZ:z-v52,?#7plNM|?d@!hvZt?]Y~+gu}>OJpT2ӓ=_)Em@_|W7qgTwE0([xiOz Ki W:ȋ|tMJj ob2=A ~t8҂Nt+pfEoy0̼1~lbyT/9> ! J\l? e~`NہN~pq.BxӬ:븂lA9,m,S@2~kwl״'7[6{ Z{$Yڶ &RZnB1aN=mP7 "/9.f(#,| 7lB0wnw-[Z{E*s&z|AUb@VL/<~kK1W2R}?=䟐OD`k>wCHh.~W`[``??iAG HE=p䉙@i ^Axd6d At[yq)uUzt6ѱ};46/T;Y] +MdG8{k l{tG}XcQڃE5,% ۸nWA/sufNE**]\]~.ٽ[V|x{L=[(\tj "QM-`$NhlrO)D/$ߖ=r;~B2M~\xnM+ Qқ,.4_i2_,q$Sxd;v&czrbxAYo OlV~ KQ81C | L@Ct{t ֜ǿܕcjue"n'sjO` &MѨ!TZT$6܅T ; T#C~<[3&yoա2ܺ0ߴLd߄";[ 6]!h_^ u[ׁRv"p.xSJ^ 1 T+=kv (͕j] SC !>F[5z N<|y(]p[\{'vrl,bʩ1A/dQ_<4몞?= }Z Ǩ%ןMB#@)=>8RK:t_m2XJe?b-CgWQ8m Mg.L'5hs\T͝T?ٷ-:EUkV:' !"P\hS?t'+c.pȨ1GT:g!b+T'5`)Q':*2>dl;ӧ˹c7)H^Ӕt'K:hKpF b Ii{䖘9 O =`[`TRNLUY!#M ۢpX4Ww¸G-L.Y^NjꄃA ǖN ^છ+q{89ͱ(۩ݳĂZT?R㆒IOw{˾3nHa>'bٚÐu-(2+F`mtE GC:cXWKJþ x5*e P;<6ɍB ` U |>RcF9$|3 Ok202[}'7:o/'`d'Ý%v/PB.q[Ђ9-שa59ȯdj ]3ƕ#:08Le\lTRZuǼ"8ʚ "IxG[uKW ÷H:$$IL}-f%U'npTT(8?'뗩%$Y LzkJv4aGhOV%>`/ 9 s$&p5#|W[3] 7΋WQghDuOJ7x& Kml.tyy^@4O?0;=w"iy=Umx+ZʶzHG%|IݏsE:r?/.#l;b!pC޼2;+X`/d=$ԫ6(q6"~C kȩsqpiϵ'yD*~9|PP>Hq&ۘuҥ Įd|QM8_j;tś.5_sQ.b;ÖO/6uOl:&t!8;Un]0}M!vm"teƅ".Aq5QHtZ^`j'ڰrLA):|t٧b]Ӗm8:ȓ޶keH]EF^.Ő=x"*v__ ?71H-OFJrvoaD}+˧L]#A*p^6< C\J4j|e^|v5FOlXS[%@%fC)W'MjU,zibD\bP @:ui/S}̕GӞ2shmMc6ѿR'dZ+5eU4bQ1YCHZڼ*൞:ItŽ6YG9ͷ y\s=q > fdǎ>G1 q *D%:x<aL8yӯry[8Awd*x"MD^*drY,BwŌbfCyks%~rMp B`;rsDdng??p!79n1t[-좠S~ҚOq9cyKH~EP֫%_R9{g6_Y8%W$cLE K]<$=/&1^n rڮU<;@d$aU>Vdg6ekfUk0h`ޑ10륈?~EEz>{&[Yf\ҟ?-53AKXZwQ/` !~.\$(SgWbF1YK%<Ơ(9~c|Fx*=6mL͋hrdzOAӹذ?,p8gj"uv/鵯M㐺R !%X($JX#[_G2`x'et6!N^sMA%A5+vya.YQOXVPkѝK[x!C:T>6;3t1۲?P9DPk}G>3s)I*OP)HlE%Q!Zalyp܋dҋ@9y,S_Nl<|?*#š%^W6d$B ?( ^v6fzҖGshFT)_0<KbmI 2#( w=ќ@v9F`bs{O5#Пb"0vC ]2"R)3B|j(1=}pQZKkr.WVu7562suV UemB,M!lEWp TP_ [ˏgeq=tl ? GΜsl܍fG<'wf?|Le SW@ڏ/UnZ( W<lɞéiwSi6i(}} ]tQ=a(59mYO8c^6/e6% ië_QxzGw+b7KZ) U,kr[!OQb'LqQEJJZɶvٹ 넚\J 4V&|=s&|ݜ(B\5On[GuL&Kq$twu滛_ܳcyxm؋v5p:g Ejn (ba3L9Ŵm{oRz~{.7 -HJIswgB*OЅ#e=x|ʏTSF\笕'1j e3uĘogD~S#FXQwfS~͹6{!Pgy^JM\.9A~,bb!`. 2x(;?QYdJm]o&ƈݷⶠ`}44!BSMauImmlWN-]\5D:+jzM›F&JNcXMmn/éj͉{dAY U/POk5TEϘ$ca\TFq \@]0Z~ m[n]Xd$ ~ ʊEQDp?@EnmD.3퍌aG5I ϛ~Yv1a>I/yPw'/,EYhI|B jS3Z -> Mq#W;{N s 9X]=cȰ 8- h !Nf"5vL&es˫t{t~O쐷*m4p% vD֝J4l .(Պ;t'**`”imAiaޱDOfe{\E\!z?hIL`?Ok?SIv7Uy*ZG+g~#l2L_aqBT*299IZ-e@cm"k?()GpڌqC?h}:H2K2X -)_;'UǦQ%ᅫA$`z)O $ѿ `1 Of@+K4X ?eM!68e"+X@{&71?3g0+X0w^RsD0T),Vo2'vz*/.~a*+-tj аlɮ'}+!%ܞJ8dY/xjȎưe7V1w+ Oe(Q˞i zؘf4%aU=x}0H}yaueK̪kuyM;Nܣ0Ԑ]Z{IL5=sȐJnӚԮ0:[%5]^h)e65)`ΊٖuVdf6 V JRɸ>2*$ FNE6 ۛ(%*H!NrFǵe.ngm֡SKUPk༁x)^**dD59vAȬ8"wH@a%bS`چx[/s,*bP"wwh-Ȟeiz()WF)!kq7[az -I)nK\(`m.V&eC#6ւVFX`nVȉMU5̈́7k<4lG1EPL)ɵ(p lIuy;B/VTsQ(aK9K糕?JL UkJv^ 0cV Kis%rr56Y Tg(H嵻|e®"bGq%&wxV&M8]w`IWCBT.b0PA4L)=dJ+.)e뽐#@-I&}T~C@_,/Q8h ϔRԸ!AぉvhϗJs}TO4r[%mD'<4$kG'cgl<_h) }Qo~yvlᅽU0׬Pv{쓔.n_IuV7A5 5 ;Oxi it>Y Jo`Hc|_+fF+W:|!&kWe;f鿍L$퉉!~ْ,踻F~cM޴%J?XFa_ ORlh59jguۘ1h SG?L<]; i87tsӫxgȪfCm,K /*ڿ0:)_|=ّqS _[qKVN`[#j?j }f7IԈ.>T72/Sы]iiM#0. Pm0J }9Hoysٲ/^1{$ ^duɩNq9Zu,vfH_Z/L'y >Ĕژ 굟fLpZL{D ԁ:/ﰆq̙ZZC:,J*&úh0UWyG;x4JLVHwKժ枞*6)#pI^+dѡ|blkcM.dϢjIVgbS9MW;w/n/>ﲉR`kTrg>a?8crF!q'x9f)ޓrQE~YWx~e>Oa_9zSGbw6H4_a܋_J[8l%EKuclM Ӫ xS66:7VS Zb4Oב앶i\Y⡃ԖtɉΨ*x.-*:`4!ՋD "%o*ڒ|p)rd6q;`}{RZչEgyl6T 50\Zov鱐pmo(Tbcplh^ <#^ >2$m0"^t }ޔ]Ż 8)'k+I` s8>~Ø+vcpaAmH$64ɺ)qF')| wB:GsSbiD2r} u A Lk0p\`|)+pB;q)%#⣷k"r0$V6a5 >$-l;oøYC[˅xKGLr*CY&/ d2iX,;v/W B9|Xz.S߮+.[>Sc(0x}r%O%۬FbV  ~CVΉ9N hs94D|Q8ՃOj6F6xy^&GRȶD3. j?>)=pׂ^lWSTΧdv]\9CpmkQ ?ރOT7Y-㪮D?F7%m$ }D;|HU2ž۲=8 7n7g /2Jq+{ 83;qxKq6_SqJ7T[%L A}dqne:2DRfh 4? d\#Z-2-suyV|rfd cA%5+Fp/Lêxē_\[!G삆I!G$6Q$'JW 5<Pj(/#TZ:|U6}@|@&9m`2;Z"p6.8s[|ghab)%!!'D۞h%Uo6Ry=vު'^OYJͼ|,01ܗ pr둓ԕAAr}R48;jnXap܎\@x-nz͏[:]VgL^fr9ј!=vfY~TRtt~rC-I6KL9z?98!i2Ŭ@GM`Q>h/Q M9~]D'i*!CAQ=="}jڙ͎Z' ;ArDwE.uvdVW>U(1겻`^+ |n-GjAh(:yr9(rwByBUTl) hSZVQ]*~1=S@d'|Kh6/G5V)@cyD` ?(P7QJHj M$}b&K9H)3sgkS#? M $}U?wyzK|;aYi/MĂe`("hiBXo{Бw^OUY^T{ 7YsYi&\qq,۠yne87"rV^\f^7p*lYZrW;F*kUw4=mhbNJDžSfYFo0I`xz 7CCJqhy֙߈\r:7}I`"+%7Y]ЃKoCvRn܊wc.&wz($O`µ1e \3 X ?1 呏Jbb%׼( S4li*)2NO/WS1ID*"qA9,_B8e;?60S \j5ZGHmVO '0X2|{_oĮbIMhZvlϰdǧN(oVVoQ8#i1=8N@a]^nk"x"r\e,ZBYegF2&<~.NVλ-V _8sQB&!j+`[37sс5yLJZ3-":Ͻw?*j5mxj`ߎx/&{4d#(yU#]I,Hffn0ӲZ=~hAa߃2 Ju:/[)Ibq8;<0T M5uIf0m.0a; FSXn}8V`K3Nr[E\~S8ms3'8X+SP@tR||l*eu^T$NFbO#FDLM&ˑ̙cjA#şCE qu:R5x)#)z=ǶuĀŪyP;wYė=[W}<9)3УzBSN/[;J65ϙRnK?hf=RIlؒz!Qmn^t@ =b3rh}0o ۷)l؇g PbK`z mu'7z R5ias,h7eK|AA'w:ٷ4RS1/PvaZB18.0-Nq[ɻ$c)A31w07U:88Ͼ {. c9״QYGXE5 @ Rvno}Qf8S7L;zT, Zd(&:-uIVئ0x@ rOj&"_F擦SO ~/{KzфbOm2nsmpM2{k EIrM[ $0\kEF ^^d>Jj7:0oH_~5橖 ഐXЂ9ZfwxUS>23wq`GN&zW* 2Ke!xi(]2 D`d(ݤ^ 7p;^;}UldRU1wԟl'a' 6[l+!ߥ$Z=`]wZ NsE8y0I=zw-7 !#ay:@wn EXn;ҁr~[4"o \ٙi> d&(4FKjh㝵(GFz};x7:>cPk("r1hc̶ԟ3=nMSDi˻jRcݑ[1nYO;wu' *\p4iV, `ė飬[ْ[-RIG'|jE~ ;vZ `{:xZ='9@YqI% ?]烱u 5y4&;{R]oU-iY2{Rf!0իFLQ )tv:kߑeu7x2ԯ/;0n0ý ]>qOKjNZjU 4Og01u:کyQzYmOsC]h\ t(!,e~Je}fatHa1ǻ>+2w G<{"+dбr!/*ɝ }}В YJ.C͵N[o X{<|/5Go9 -ؽy^۾S: BpXJA :?z@TŇ%ݽ!eX"e[uihhKV@7&5h-~#Tc%@?`ߏzyIQJdOWo2spqIחLzԻz\mY̕k\Yh{'Qǜ?ח2a do-S#dfwn㫔*.]ES|d`XFUtm0pyB%?Ρe]R݊-aF{&`Xt䋺rDU۔=xF,1Յp4R8".R*^XZ&H0SEmV~I:mjaIeQR7-q嚈&\s:؄ω2_O2;Fxpr_)'" IЃsB9ycMYvc]q0ccU57Xa3SuPK[5IU|X^95GBP(pp/(=vu#;@H:H*Y<݇yM_ {WdkAHIG/e9'v \ޖJ/]99诤fdQr5#> E^srma.yzJjYAR<;r#Mpuf\:9833!燜h EkN-k E8N}nNꗵ(=5dxD?1C j):H,EP k /)"[]YXnXrPXGh`nK, gy՗Ê<_ ht~Nɴʖȇ ~8G?Km ɲƼm h{n8#:yddьv?M˥$ DqE&^Z XǡO/\hE$nMWEuzm#3is. ـq 09T.@yk0 ! dEq"I;!/J]N0e{!wDֆSkϡx:\f{"J#ϠlV[z]ޑz ZR2 bM}0׹MK<<G07@.ښQX j,ZV$BƗ) Ff͗}/0>8؉ ཹ`º@nK^o |A 2ҁmz.q}8+viEQ5ښNS^fiSz7Fv cȥeuT{kv 7GT G9.~:DgzXv`"-h&`z>/00Vz"]y΍3*Vh\Jvig_B6֟|Z 6ElE{ S2$Zb7rI"βd 8 Bb8r4k3)Vc۞X+>CF.U8WwI[ýu*^,I 9`5~ḧ֢́2 <(4E%i9lA* j B&=V@ 6ҿyqXm"wtR>[z{4`~+h/ ik  iC}}?Foa[DZ'T̐o{0$p6I{hm }s @_n^XE*L Kxۀƫ)|.:2PjmhBY,QT|QNq=m$:13w_M$~SlR i7WCVL$(z6$ Ʒ)"Q L536ukǩWWV Xikxc h50Y;m`/xKZƚd3t?-c2FܞJY ӭs)߄Q>@K=53DCewv 4bkRZx2DS5dϜ|l5g%dE1 =g}Fm~jDK$+}vWOhM/tX~%ZO+<`[Jbhe4cV:x7@}#Pd2w~_8A :G` $ _g9Do}%vn $ܥ8d >ܧPe)v3IZ_l#`;eO23S>"6Xun_R W^|q-ޱIbbh D2Ǹ&hw3SF3wtkTp6xz9סbE3XL<{BΟЂYCD!G2H%g;$iY0!;2Tg-OHԗwwKJ rin]D4th_[t9Bb%m 6FsL,Ӡ/ȃIj0d. {Np\i]piPE }xmq/0*vSzƴ_qU!.IPʣKs!E508t̂iTQVIf3.;擕d'r"_W쨚z !l~N79y ;BbC%|'~=6p>E+ @BH7i|1*or(k-+b-L>ɉt#ɪ٘_6ZLs+ʹ [uE&sUq?ab@ o)4?pX=sZa_IC¥G'$.;l]5ӝğj7V YuB_@VF*:ByK-Nv&{YCتhB9*=n )!ZXxȓl6n|7Bz޽Y%UJ9#] $]k}P6q^ iH7M822#sBnD;Y= ;iOxp3#>md0d]9"}0 >9gbI z!E X*Y/U<4VտEƥ y#&^*ȯ\@1 "r,^!y{j[A04gޓpC` "rb@i[LiDٚbZnmgp+% dYQɅhZ҆%Zlp2nxye'3_"CaTYq3F-}a-E?aw7[VnBH8m+6H0W3BKk]qX3᰷>M{Glr$!:ǏHFA4 _~luM@[.,g1.⩹|F2ZDMyELep]P ?}T dP8ٟoΩ3M[AWG*?.~,ы t$:{luٚc0DlH&ɧB|۪0J =nmْ=1U\d0yfxn=l/aRCLBBtLºY޷]-Ty5e'8#D&5Px[{*)5϶z V}|i;&+3PQLL>ޙ͈<'J 4<:1kJJv-G(QCf;(j_X@*b%]yH7C͂Iw#gdP7WDCx_(nL7i]RYgIx=hP[*U@㬬?\s~g3_轰1F%wb$s ~9`3d1^>7ڸP&S}fINj^?W v tI`M^ʍL߸odIv TXTPe0U:ʘ$_7踅˟(d֮N<;;5nLbt-2j1) ^qp5A+<:܍w}8TQ%BAa<#ΚUn.7T--Jy5ҁ?O"P[v51 )yCP ،  FF@(XYC'#a𥿖B7ڍ0$wD 4nU&JGx Z gs|ܣzRYR 7(/(14kaԟ`|?46CơyOQp%"ʅ,̃f]NFvB2 8ˇ9ZOĦFC1Dk!{Z|blenҌYzz4"TBzw5G\Ml,AeVϲc2eOАjv™'~ [@[|Ng:{.d :7M@0~\Bŕɬk"O[A)LOՑJ|3债F g[]lG+¬^[D~*Q@T7J"a'L"^KNЙY:xy4ԥcY.@~?(ī.m k) Vu_ ʤi5 ;|V&hR~fZab{2՛14I+g@fl-,5fCd[Bn)"7'tdg`(=$;.HDލ4[]3dP6ނ%|lasB;œJj8gxf[oǤ1FHpˍQ)8v;0%ב]d| T2z<ӧJ4Ezm~0lPBfG57vdݨttR0)@b8Xm@?E[Lc7 u)rԿ8ѨׯL[bi}\w;\DY&~#eGk$ED\(aø-m"!} e]<N#Y{6[uNh4J '&>I}]{$2N&`v7a]d#mz')H+NE|ʒY"5k>^SG3Ьf*^RL%hgEa&Ap>bl7SVz8GUYL(VH.mRjwnAd'|QUyTKWj4Nj;i&1)Yސ6b)Gv#S4 eDEWu~j D\Y[4$cȋDԘ)Ma5VĮq`<xk=;$*GCWja5܆,D@;hoEm=/֓eWhߡ*}?:W>e7}/DS ~D}_onQå?{n}_I?^>=d_r DG^%_3v ) I7p떂nlD6c칖Rߵ\5Ѻ} NIKAs.,Wi>+|-Ֆ&/ M"%9Q1؛L%vXO45b42[‘"JG4E~ f%6+x=y=*ki9 7B.v}GQfKJ"5P6v̶2ԳzuEss_ Q&޼;9^ل_<j&b3Y\p U#އd9aVl#{:4OCگF+#,4!藰T] T=-@,o5A$* mn}>{pZcdۥJu ǥ픐 HP.ž %nvI_M, V(l5)~jaqDP96)`&+9cE&Cht ]GeߴYzJeJ@TE54DLp9U),fC/*S_;}ڼ2rhO:?8+7ԧ,}Vb= i.B ^ztKmA*LHMBc"-DWuQWwީddm"}'Zi"U-N9gJ2J慧3!=R&{AP޵DԷjt\'XҢjUJbR ;:P LND:`ۀ%wѶU^5J |&G 443р@%T&H]@wMu P5bׁX;0MiK0cBE4ŚXսsH7wl@.X!t]4n~uknUJ`WmtElQkQ FQJ4yn,);(4i*ɮSP c {3xyMwK$XM"kEs1]؈4ET{0[-72a)YԄz g^L~0LSc`2)3:8&S4] Ab cspVʛ\%+ = tfg-ĵ>PrށG½$~QQMb'w ?;-c6=ָL9q{Z|I̅_)on>?e&a]˶͟46LK|zi{ 6;zfy""爼: XqHĖO傱q/\+q=Re։rDu@LK$b!r.aq$A6uϥT)^-:謣SH/fRSBvbHAf󣯍<#vZyb³s6N8n5ML\C&TIEGA:S]j2C$n\L.,5|v9cG41^DP@G^`eEn{m7@{1 hQvfʻOL;ϳg>kQ $o+v_3ipcrhu:}HzDž>ȓ 4B0'/b7΍8xLBEJA9TySh1doެ Z7 sW׀=/պhq uȢXoGj@wS|7w$zHc0a/rIaGG7b_k {;-iE?LvL9M,&;^h9B.NvOJޠ#wA~YP\}wL7)9$^3jj*t){݋`v!kmI7ɿ=UzW=?_\+P{Qrgݸ D5qv$9'$fTgoA??Gz#mYcK1Ġc x7z*4ĕ5 yڐ2LqƽVv䯝iO&3 VDE1/b{il:u]:` >2 @ ى`ϸvRI"tRwwɚW]:Aez n"9'?s01BhT #o+p{$ L !o"$`| Rt[zWD|`Ӌ lYNTaj)?@Vtchne& '[YƷ__a!ՠI3zW2yuJvT/e@1(ˁGCbqVr]G #TKi 4HS2̑D+x`x=vsGGEꅒT&|d& o5~0:8sFl)Άs+G^@JI>*bLk&$h(hp0^HE/ݚ뇏OyNj$6[9G]Ԋg0s 640hJ!:گ7vdv9zw&-wwN΍3L]+8ډfMZ?nbN 3r(լ+Σڭg']8j_ǃjdPR@NK{bLl~jT_t@)xcNrh(Oz +&%i_ NJFib>vmXG! Z6׫㝢UC]*g$&}Eb{n@2&XJ:$1 دc0; E4YAH%4=oÂ(Z*K"Kә 7>xS^u<&V!㫿7 ^Ƴ#hbm,+6!"dDarƦ8m0L= j1w/~ƻ#7W_ w36M/Լq}`@ 95]ݟíc~JDʯlyPѷ!X~,t/r%/]J=N= Q͵GJ͒DX8~%HX t >y sÙnsRL5zO{7F)<@6)4z ё wz% =Ub 쾯a]:lK e;Q153z2k;_T!I#Z/-R/x]%,ef^><,9"r#D<慊$i)%m$qȘmrP r֘d'bͅY5p*M꼣g$xiCI϶v ﻸD!;*ig&[=[=Mh.woWZ+Lo[\'w5NH2GW$SAW["m箺W|hh1(8H4#L5I"*[,|1AC>Eiq(aX1Py0ΟEe"g~!U`I9)Q woiT og>fap^Dav9AOLc/iW`ZONea"K( V\W^."%<]|/T@Jdؼﴊ*lվfI&.߫@tv( cˎ:hJ;|!:%`Y6].!7Z=r/Iݿ,OOI2ru1BAY(-SD=X'ڌT̓g6I BvL5>[TLj{E$E59-T% a3 ā&iN[J`D4rnO|F vErԚZ R3,šC ѧ%߿U-;a}&?UdK,wwIJuGa0-8JL0sV)= R\hqz йƨ4ڳ`0Hi$`p0btv ުʧ+h |V‡ϋC5;^H*r9o,4c:L-FF9$B=-Ya$ۖU;jjVBU3T.ִ9SMe=KEgUWQ8A >Mvh^\:K1~LN_nATOfPOC`Njh|^;kۚQC(\GAep / $[vC ].j4sHĵa?v|54Q‰*`+'W?zpZs@ 9oHXeا h! M'FQ߈b8dku"9Jw*W`>f:7?PƐ3P[T)ID96oEםҏ&E8! .<-Eq{6 ( ( &0ZvNT-ؤ؅zL̫,wIqۯ.,Y4[ xkn{8FHi[HknygrX&_=V݇f#%Ɓf;/y98'4+֑D%/4rr]c׌mESC(g/y-=KDqS>a+}V2(G%u%&YYy\: {%Ne'xXy >b0N VJ$7"cIsR,)D/eqjݺh%j5g ȓ`_$$4gݜ/MNӑ Hv XG6愹G%CB.HzpyCds9#8b@ OzEY]2hҫgYԅT*i0b|%,2kB0wd$Ţ =0+9q龔Gy3j%_ t2e%4U+*p>9d+o.F 7Ϲ/nV?KR1lFǗi-Kx\mq̀4[.!@  fEJP_B /K:xxb6y;I->X=J_tyq?gXGXJw.^ KDeeIۯ'u-*LBݱ$΋=i,})dON1kv@|DkN1ͥ}SEZȌƺ~wl-"h[%. ] 7^f#}A `Mi':Oَ,IdB:wي:eXBrdB}k%F"Llb^^<9 Gr$vnL0ł|7,q z/3DXĪl]cuvTaZֽCNo_>0O;eB(O䧐L:ҴX1NN[xS) BN^3حlE}39_ r}V XRJ 3=]-E?Z7V_ÎTVb~>}#w"<]$>Իґ {̶:" *;&>:GKp^T+!uGeq ^Bz '*0sI.vsޑ(Q~JhSUD%lj7D9Q ,D ?mkWB Ρ5 re64z΀?qu!Ds(B V*uBjGP#QPg_n8; Qlhsg}MO W&!q94]`BTCgfyDJb$;-\{Vn=4nTwxig˨H2ӥ/b |b H@>Tb SɁKΉ&-K5 :>^5įLК[}^U;R@P_%L LF״M9# k;mf`y҆ "gFFiTI"A\vJe¸]Y3j S삮8v*" 9hm}6BrJ/:9al'ry!zAh]wlayzHeܴ6 I#d)Z(A) t'ăUGn]g$FnCש,W]n~tmjٺapd#ڔN q{< ј cNbaHj펬e}`bn,T)+D5*MlgDwwEoI'3@9~_/p$k/W,=kcyT]S9=E^k` \ X?j$In.GJ>U OYR˖(򵢮(`g6smgAh[J fk3%Ǿ+8@"1ncۓӰ1ZToAi|T"#(ρ9u>}[1f>)$+CN82 .iDyx8<ĀM*'q'vPSL,wIJ\J1-R29(QVK>]v0AkPp37=5C!UPpS_! ĕ)WB0|NJqj[paOv 1Y4Ub"VLtx\gPyOO iÌGWgICLXEPg憞t͆"'Vcm`>gAp}UV›ILx2֊܂k"z "cvfM”Ș.tooOʏ.ʀ%bR=wgU+> tE %W֫mXߨNyύ ,o/.$!IM4 uOyP<}I J A?ԓUzq4+Z .[l%8co 2=ړ,5=J2*6D; NRr.smW3ܙT誛{wWޢVZ.PE!""l䵛6=#XatO"uhgCw:WbGJ4͢ XgJ;e&ex)Rz~*"0߶39̆k|4ڴu[m&-Dæg^R-qw}?+c)ڱN+ԉe]dV rfJ6pNeDz|^?)n`tWYT?Թ[OC~;gAl% Jxb(]}l.,s?կ_K}"g5'oOͬJ^B!!_2Y Ƨ;veylc\:L~;WA~DWC #xжd*҂R1b/B}3|v]:/ }E0URpP&J"=s Sk9TH*|R3 ;Q'Y3 U3Ks,/>Jip U76U*ѧlVY0r-Z$>nP%~2OMFvhi87iU5ui<P@[Z8 dev8wS'=Qʬm(a#Z1o+yGX&@F8Є>Luۣ~9ymcEhsKFkY؁`ye&&`͜3lyAG퉙ՅV#Dc#9Ґ$T`k_bXӣЪ" 8[H+2cvȫNE.qS#n x A9k- ^pz)}(mYz&;R&䖼&K#i]u"rac|?(>Vc$׏49TNPf6$eVYάdo6sn7IrZUaZ.nE0rrFVA"A`бVK!G(uKK{%~z=Ǫ `ٔ J%gd7@f4rWfr R fVco2ځu޴IL4M!TD^@5(H hDZ>gtpJf=~.G'd IFk $rp{燌%R\$p08g7Jt*Eʊ(LqgB޼$y7ֲ^3G$Λ"RB2 -UcOw/dxsX̖YzN+&-4EK3b ݦqjX>攨o TNUa//qY T>o@$*xeEdzBP\,;8Lչ'G08VXG|$|#f4rMlfsgb),)3|@hy"T/Ӱi~B-O'LhMP6&TRgj~157&9N\B!ś,oߩ82eedbtX"5fU? EhzD6wtwئnݐTc")jix6Rܷ"IPaI1-|Q!ryq(!d$,_ЊG\ @G |J'\S)҈CEva)w$>(Fb~i,?hs/]iۈ?F*A  #3pOI2題 #?zj=N}J`;#*(iK`QoD9(IYJzg^ό@k`5U9%7yWcI_;(/A,u9JdcIR.s,7#sPU&ۑd '~V@G+9v< !AhS_9 ̥8({15*\q;T~ g/xZؽn;9BP:%f BhtYLݝ$YT c O'ƭb a- IER2ƞ,9cO? )@Aف{B$("NY?j[`\uQ~FRQ5vm=k&?-i#upah{&9Z=B+ ^A*7#W$7o"942q|DCsÜ=G~X1ӞH1Xk@1TG6V=zp.)+(q> D'R\.!҆HEDz;ò=PX" l2[~1vLœt7~{wNfֲo='o{4aOg2 m -* sLca I1)za:m"Iq:M u/M$ WdZ{hyd~tvu,oUyt)z],tt*\k?\+{]J$AzSGiz.? K4=x \7l׃O0^^wT7zO]4>_%oEA|eCY?ԭ`Bvus q}mpn[UΛ s^+ zF46L#ZE}/ڗ>A Kl0Dl> LhO/eoOw0 R!aIBNdԯ1.| ׺ҕJih}D^z @QVlkr{7b!'zN`0q*]*RwiY؝֓1;bu-[ˠlʱ:{oGI fsphFqqXND"%1}7yq y}ٮm&, O6q})X6!5L~Wa:lEl(39~ yգuG"z6#"вF MZڈ'kъHqZ_IRጧ\u7ri@Ⱥ&>i#o 3kya,c)jOq@L!ņTA׬ɵ>E=:(3 FO D鰳ӦF.US˳~.axk& oߚ9A!l(CI|DG!iRH>fTT.lK^V"rbg [mMiT[Ruݸ7쭲7ɡ\ d pE:VDQsY@)V!/EVk zUP"n)NsBbKLN{ğVG yӾk!],0z%Zg+=\O$7눗:-ctgc_ cӏ=^iN↶p0;?x-& M^=\HeZ58|OrՏM\ԷTfI:N&sX@d*6TB_c;bFllV:cĥk%i,S8񮽢̹my9uQ3Hh۔iUA*WQhaDE2A XCZ߄xX 0l4o =es<}%}u;k\CU8= :1W]AY8_n ~VEsLHaGå1գ2pJqq>u\o@f7t<'NⰔD;9䏎Cxl& HWӿȖi)ޣT͈8ASkrJ @,N%|m'rPFd_ >9s5bKx;V0$U%eflYD8]sIsf.!5ԥi$ZTyn :A#8y#F" Q#Ieug,YW FÑbJOz]" &inL fȒ8-;]:,Q~0+!%ѕ~ʎ'LdT]*r'%pknPت._*#.P0vvEBBX*PouتeFmBmI+Vݤy6xQߧ4xTk;*ILNL=$K-LIv"ɪG:fh EPto0Հ\ 46ʟ-ʬ 8,I\=}ku FyAKvUvPƁK,yr~&;xKTsN/eܱ¡$kvs7-(}'ɳ. l"1"Aoų۱!^,%g!sU 0'd#a#~m+_*$i+rg?ԷBDnTLm}&I^_J{%a0=0FiFu"vHЄܳ諠lZ~H-az& #kUPc5=5^YhUT;#{@5SE-.JSŭ,OԒ́F2|]pEƜcׅ5M݉~o ww n8Lb ۰1qL VϲiLo7e]"`V缩vτ}E3ZGBގ8*>>M&ɇjH]1G}MD4p+UpĖDMЊe~??UԱX) g'YjNv*~6&UGy}SE[2R&z>]s]HQpTX KFe %[H^͑f] !WTqCD'9=}z#OT uu4ߓKy8:|L WY9]"BΙp߹CC׵-./} ]PuݙnyrD$qu+ymH6E<%4H^gyX٭e!7:z[B/7a [mscpI*`rR+-8D!YSͱ/\Kd?#X=K^Öv_4sZŤr٘/qٷi:uM(a"PxvjveQڑYǏ7-e3dsYnӏΕ(W3ĸÓƙ7(p*+*X" *m/L?s3&2ͥ!)bo#N7?t\<%&M7 àJa -DDэe~"Uݝ:e||O..~L4t IBȈGGsQ T5Dž{"SN%H = OB?ܤGe_݋bH^v-_3bj30a إQFB<ZB`h2=|=,#SM_nI ^gGة䛈Rb~T'Ƿu^0oc$Vδ.C!YUPn&mhspPEMDs$NV%1GdiJ|m_O'FӹiMjnHޔFS?T y,AFwG7춇~HTs=9. h>frA%x nx $Q`h'0,qIS& }7 (,m!^]<"E|# ܣϋ(ѣqGV0nfl$L.rt)Nۀ}G^TJNŞG-".?: qPuxf\K^ѾJWlNmPu\1YěT(xFѓC(-qmH [AQCMd@Kc|Qo١ Ui"K~')9jJޫ5" vRZoW떢ܚTK1V+E~yØu n./փ2Vtr:8kYt#}tÆǤwq'(N881 dGSenhZuY8C!y3a0J(W|1GV9ROJ|xӑ {87Jr/sY4?F +݋}]ڸЫ.=A șՂX퟾'xob2f4'{`9fE4cogE;EeNkC${T^'7_wsE 27ŲHh;a m˅sSl+1P.>r5Q׷Vk/ez?J X$ <8@u33z!)׫SGcH/`=cS%`BIb<< SDasi4<`1 mu k\Gz,Xx eY aD X#3Es48Qҥ\ 3,a+(+=//"u46ɇzR4zhD(f}fO# p6s3ANfx2+]RJ [޴LG,[#VX*CluTdkNMYjXQpxؑNW= {<ޏl*v=%ؒw&'8fXFF .g[ bQc tRUs`!!(՟LƂٿfC͏UmB 16GmK o983DxBw @F<\HjPtGY[!>aͻ&1.4.*]j|5 UkD(фiLc +lcjX(y ߘw{d[·xj `e Ja]CJ 5,gy[4`Zճq XI*4Bb"P|эWl'#JLyC&Y~G\9R}L q5LVLAMNmCRzX(j ϓd\j}-( Y >bN՞L2ov1VN l7Ju+(F1'od߾CL: 2+jS@{նTlOc/0x6{m![܌PrQw*R'э" hqA $XhҟzW7=4#1WYa!'/tfm)HKXMb ,xؼunWNL6c8]omg/gtO<ͷGaG۴&qc]޵t5 0שiOq!^Xu5k{z^jrkա?*2gv ƓAg\ώ4 M9|<53)g"$J>r.W^\P?DV28c߯4t]F.62s.Z6ߡk"9vNLۊC'ph1Joh^7> 6c5i[0/ hIo}׸G5/1 - 'e;E|ΒP6-YX.B_Fqb|ڷiOcPê8/r8;,9s YU%F W7n=OK'fBKĽ}lܯfe^-UA y%ڔ4G@Hڕ>R7ɄD1E0xU섍=_Zڱ>xpEG4?VP8y|j#[]ˠتU.WGۼӾK HtN|FTctM\JPV51Z%kNe~ u7;˃b0$MNA kJK+f #Wd =i"A_5bE!39%(sҿSgCGyȸa~!iBq;{3q~u]<'S@ۆ@u/:dF[{k:T8/{8cL5y̿5Fo"ʜD, D xzKN}XA { Sutm61 O ;8n"ZߴCqAWYF,ǀ!`Dl PQ;^C{*=B{8o,b^?isn08J8̸V#;APi`S{ V`E72Y_b V.AjPWhICq8*>d L ]Zd-]s8O( Qj;()ߪ1n5fXH{`;XMi %4JDڬz*\ G& Qtz y7¤B#%taO b%ueL>y"yB<+v/fA?(``6T]`g b^mTGl zQ"ӊJe"KMkRM2b,GTY2MNnؘ=)γj5;k $~ 4~./*C-lqN Xn2U_OՍ(k7N;i`&a2S~q|u(=ҧ{{L//8w#ݥ hao%3}//g{2]m AS5/{"9WT!\Bed]\_Кg*`k]',w ȃىK5uGIpahCe5tK9XjE|nN2 PVFmT}v:fm1%iRm`X,"qUie/!]OYvT$辤G^xt6 hcRd)T'2|8* nqzwz!X\4/6sWd1tkc zCYp<42@RIb&]nTaG(1aF_ሶ֙ H~aFt;3'a.]R`v8)bS,;4f_dXK &RIa*[+\N$h}LgE<;Jo Q^azlBBwd1_.Y>0I1oZ+lT(u4Jxl({|QE퀓p6j뭰ǏJr?GEtV'iHrTB?SB`Hړڂ^ k׬VTAlm&s˗̵`Q)b/u^}kI-IZF ޷>\9Wu ~\9(4/SKye ł&43!bv1 jX6K^chTG J~Oq }^l֝MYxbUGvg>`V|@/Y>.,; pнunӷ(,gbm7ԤƬ02;ϼoo>7JH!.S/a(pB6'߈Р jFN޵d:e&ۘ(!Cگ |\J"Dݴ|| ٮ)͈fou#p01y5o! DBR?X;V동𕜨tv'$Q3y˶axE&QGQ-@cLA&갽fQ+%l1sb1terE `vL=B#"Ro J-t@,W!ct flx;qE/P<9^$~UL`gB,q,% Mv{s-'r6} Ү2"w>&+9biKʘ`wvʑ/rvׅO>~mOyMy1)Ҧq`QO 9K+VDS 1ڐq {?$Q.h!אJޗ}f#|߻= WGu8k5]\}t."xfGX\Ϣ ,_|z0C[pM$NxB mJC93ʧ&*OXJJ y@Bk J"uqA psM"ujMi KajIW&t }z3s OP<w(QQSFRE=@]_* "Cpܠdh$+30$STYcBǟ !}y\=MduT7"ZaPxz7S/rl5v6Op= 60Q껔>236SA]vFTrP\G@ٿrnD8W;0/MoB4@Ti# v[ 0K"LWzM>wb`yb) ɄKerR/I$_(oM=|I%2 0ks㓔7`AC#TH9ƅ3UmJ1׵+3-6ND@>BRn-C >{%_dkz֎ަH|d97F-C itNZT y=jPX](j(wxT5CLd$T *Gl4,s"$-κ\+:wJ-1Ȓ_x p$5N1}Jf3#wQmF4rL9{Mz% t#HXHyG!+%}k_tzZkݥ6v$M U%O꼊@q?Эɏ()T{=slV2}[,'(@0\N.4]ORAp3Ly)8te*Tfݮ* ?‰Uo7as]Q+T0M'ñ7bb"; 5>pJV[fs +:UNc]Xa?H=BTAN mH7?x-1lv,E FdILEsTg<7Ÿc83}>J?3}X{]mbݗ٩i(!YCqI}AW2[_%rI0P _*jcUfJO$_ͩIG*b|*R ;4Vryb.ԩYltכ?&KEA}S66Gĝ?%Jxcc\Q4KUPX MÚQmp\,;ԘDxY{)=55Ap^wS#i=vT철gtUJ0PPI>}iireQ;~rɸ@B J_y]aUmꞑqš}vM-,5Vm~l~R%vMQeԜ*2/Ƈ~w5@T+~?T@Վ4#Um 0)$EڈK]*ť#Ey6e3>{N-ݛ4PgBCc+8z}Oћwb> S1W,la؍eZ8 {gXN0Ϸ]X;$15G6D%wpjЍ5MJϣ`=(em+}3+9 G7`+殜 ?h`;MVTC/`` L H!-$zp/%XڿGmr=fu=0bSEXuMgL+SNU5=dUTT&W4a}aQ0wa4?a$:,Ύ!+J0 2}β{ Q[{n,gcrbJ~K1_.JYѾ@,N6BJWD;)xh`VeͦFE^~P9gpi cph[vpQ NJ^LLndy7% %L ^56< (Twė|RںqPpA,{E]*'*u:qTcq|X -Vۣz;@aH^JhY;v[cGXRޯK? GC"pNX,hCgX-&fB5`^Dt=ԉ*!WwHF>qe*9b~DŽĥY+ߕ*w/V:Ġvʃ3FRzlQV.$OFzř3B Vq -uufT}XaB\\>&!,H 7 kq_\ADgF‹9g3U4Z9ƼCd1 B>ٖǂhvʷP[!8Fq?Z@5ɊZ1}pBQ7D 3&*t0#Ipm~TVFP0IPMsn5p Wyӗ/ji(M[X2so"*n=% +k ,VE3~T1eO7Q)N9|dvWø[Yu9}&uǩg*G<`*`'b=l*?Sآ3¥ RmF[dulrIfjݧ:Ir8^:PG ]WlN&Rsul_obhg;"V% ўxղ#"3 (޴vI q v4B~LJsXg@~aPin[:̢cΜ,p+4jwluvJ7:c@wM y}sL9DtjU|E?|))?6N{IChSbG'f2^"W)?FSRfUfR!(#]r[=^;PG6D`y([TI c*_5ȗ2nIDfK?<ŚBҀ ꪟ+ UEt 5~ P;vu MQ[qe nHsu}%&o1A07Wq*̃n)hgU@u+4&ûi!ue$B↬\ߴen~b󑡣;Wq6٠L;RuBs? J2r"/c7A=V%PX!H!k-r IѠcq&#ת<| I _n*ƿM( ]i,kJ;Y!.}L M4C\ɴ D.1DLV'ݻ{W :¥CL_mn]rCgC<DZC'7jw)f|\i5(xʯoȽ4Dĩ?Â1 rxoq) ~ 8GԿ8cFn_RT $)e![F~h>#}b$dYP{9Rfɋ0-;U*ځT$[U1ndM`ty4 Hox3n̻g$՗[|%ӹVTDe49>EZoly\{ _amy6;Mg`` STik/- cdQPNfT-x݃1bq70n*42eQ?*D_xM6l 4@mZ'J6R<:v;Vut?t=n=%/ s:5I$j94 ne )-|Iխ) )t S}5c0NPYJŘ;kgS[4v @Ƀ|WI$f'd5m_V4V1lNh33[#%3ZʻnIAʶI2U *v )E5*4~@E}W!;Ꮿ\_`Vvu?=XeTeaEr[뉣J~Le̾~T uWeQ!ܯfچ`=Ҡ~{TG;{13&j-.%Q9LosӋ$SPmp["S&UDZxmI |$+ %%%y+|_,"v㤯&<E5O*H9]]g8Pv}K` ^-D6hڦ8Fl;}5=dkxF<# !. r8voHsEhsՏMْTg`E4[zӍСPP H-9|ge=vv|8sjk=E/}11cׂ(_o}͟8<KpO]F{_p/PhW'cvsFM|C0CSqbt-6Wj{NwEk$ĩ_;dv`pH&W_$RsXxaV{6PwvT3 w:t+/ TCBad~'iM4؝f*Leiأ`'^o\vrst ON'̢*fQ5x3 MG0iIyARK"7K`UBGbkhحh!)u*/ɨ͍kSaZ:SχWɭg9J?t˝iRSe:~ܮ kPF/aDGQk4`$ǍE< gS?&uvK0Hd[fM[t,^tT^a09g߀hn~HҜ*xO7T̀Μw坻Cd#q548aȨ 9'GNSd%xKaZ3n  [,w"j‚m oh%T?|_Mu)@)zP2ۅ)?<ӵX&S6g?)|GΪ%9+ovM̊Dz os`# _`M΁=\@"qa `1I'9 E}OZ.CDR4asxU *Kp1ywϕG%BM]-շUtB8 &a; {QUB;|hA0(.i[UXY}?GPPe;YTYkQsq}T)[ zk[) ar+GB?/(ټEm]!rxwFש#Q ^[J=ztrn-1^9,Q&Z#𙽺ox/,&r >dZJ1Vq2 &-ZYTG>Gi lE!ߺ\AQ$'X^Z9{tϋ B7kx~"bx@<(I:=,D >baW;ꍜZODn'͸Jn =Y LF rHIu \fEHm? Pӂ[؇Y6hUs#.nǸMpm{sR7\Gca YQސQxQ e|y &? ꛱'Kg7c@ |bWHI32$6S`;/% SH*WtL ?`)0NM[W!zHi h3"":OF 09 +s}bDT^B6{X<iATXD+-?5Ls?t`9pd8j j^D>X &,s~$<(?au7v+)3Y0V]O=l(*[p{yP6ʢc`$D%BضɏuḁA%h9O 0^ըbMYG9d l{< }kUqحK_3 ?=.w~MTn`E};_jjX ".NBHj7$`KO+UMK6/h#'P.zZ{qp~m ı*J 'ü4ѐPލ7d7\ "<NnR KC+"B*2@P1n.v^9A0f Id1-n U-Jr7gg"*:*c'AۍCWH2+?* l?Jg7=mә 3l1:ҥϞtzM6Ҋ=ydҐ:$Y3)9w{N~N죈/~[lx 9| 9չJ %E b2Ľ{k[; ԊAjf~|wo'X<"cS_O=| 0κъKV R\x,v2vy>ha٠CQy $1~Pc]d1Ht,do`twVT!LҌ!9<0.!(Ce)z>"2F8*nZ𗷥ۗ>2x{][v43s,< J.&t3H,6ʘ8xk3Z8ĭ)Fh8#i%x`Ź&K4y1vG[ "Гc' nl 6!ZS/M TܘJU~7ό h? Ń.oV3غYl.ŵr&# IRHp|<Ʌ*MՎPw.ïp)rL9xZrBB|Zv~O1yf{!Q]TΒ]z=Ռ,`p{Bqa)G;^`5brmr>|2-zluݖ_K_&?z~uqB;rP9Cs,S*> cl/(* y6ca@=_{oeǏx_Q8wuڕeL" /XәnЁ(^`f .h9gbH em%A$*]i|]4~Mmbx?R>﨎եUZt}~ K "9)>q%ah8lұ0.>4W2zcѬّTH sN}zq ܟ=7֙) EʵL~|J}Tϖ>aK]>6w;3YO_)rA}BFw2|o3zZ:Vn.krzzʽ%{Mo1bPքOvR1}<;aoW=1 nFH;fP⚎  G=MF4@tzwTĮ<|:5:K. uEP]l;C5,\5@ DD-nC^=@hip 7N~"my*Xq9D\ֺbnp@e0yp]$A`AwZcN𦁰vOw)^***'P~j+e՜ooHK%>[µZr&942nd} T=v[] x޷Ȋ1ƫecY/AٴBg*`F͘΂ "ź]s=ĕ4*Z8n+Î. ^W1F6ۨn*#I89|xBvBT\}n'[,1UtB5iI1jkp(аOmmkc 4g|~+*FiΒ/5 9*{3$5@=7$q}DxH9^xɺDç';rcAveNX#Ϙ(i~%q4E 0wX^>;~V9~awuW2Y -L\PY{̭q0 WQ4)f]b.Uvƃ/$kX1\W1͝{Gu:؊/Ռ[* TqXiW}l1 ^,8|_r7cW^nr'Yx1yDCI_lAF CUA9`BÊSpc[ǒ7Ow<Ʀ~6B @!*{c&_~ѥhnal t; ֏V 1 _ X2U_~F"6HW ,X4`WC̢BȾfdnΟcTLEEqâޙȅ"114켼VCWu'`dōGCa'aqǁfE 5oXPzDH 7C">/;mGr!pkYyRqԮ[| 90Pww,BS[<[PРΝ>=77q#o81(ɎfNV,j_l:[FhfOUw3z҂X,/mQL= 'c'|2(bu||2/?amUTN|(>B9X^%e9 ajpWZb48{Kέ︲롶0NӠyDxob6wYjCplKs\>də, LIo[m2z9H4~|EjmiMӐ3KɝߨO?+/,s=rh7L<E(Y}lֿbȁ)@fpQ=6f\?DZ2P6<  yj>P-osՓ=drSvf\ATg]p&`[GWgeV5{CpH0" b6RdZP93W8J^i8я ZX?zp /0+\TTyŵOgn>}JbF0[@NB6&3v\>nmJܐ(V:aJ( W\5 O>*ѵ1&E}1[3$7fGGіPu PfNGSEЏٕS@GZ Rw<3cSKB@ݞkfw4ү}#A_/YWIpgJ@D70\.a ?VMyZ>kkZ` ψ ٫>9;YcCψe5 ز"5}. ܌$oﳘ\Eɢ.$57x/7=Q)d{B Ap.rqg ݳtUnی迦N a-PĦU@6 v^;dZC1Z%)0^G+52gŽ1^S:C$gn'L^6;lp$GkoSE56j[9hq $'G{g %{+-Ժw#5u\<.0n˒Ruw4'o )"']D4- [S)[ +u9@i2dE*6SwBSB x:D'w.(`l"brHlZo4vBlH./L()j8^b>F)h/՜/Wn*'Evu#o fa19LށnZJn%>>վ@Dbַ:<* o_)^}4$Z%'Nsy1e}|%ikdG«NN`5; &K.~('&R5x6"ɽ]xN.q떩%;{N\/*/H~@@A/kJո`$2'#'<~$Ji+@:\+WHtCm9,1` Wjru|QE--qk7Rކ.I*a uG9 8 Б9 +$Q~" ]|Wrgn* >*-w^u 9@%!TVz "kt*^\;-C_$.R:ZY>\z"1[w`ljI;GL 6J-?o.Ek! DۑiSVP0_rRt}`hqd Ɋ6r3它%^_FзE99LJ/SCo5qpT3<\20y6 Dα7;.->y'?A+ \Yr5SRW`*3I' ZJutɞxM8Hh@ [B6޻$v&PtؓLSNtk9T0n o;D-)L]됚rT'@% rJ+r50$fU E&DL А}b,nE86d/ܕDcs ~(c7"/wN= 6i |q<!P 4jVJڇZN~C[cDeRc zmWkp9G!o &$ì]Ŧ+=qH<쫒 FpjO"|>v$.`$s&n}vHq:99i4pH'2;/K9sy+CL>NI#S:)oYl;E텈"nS"4&Ak,aj6v@0QU2PN&"mȲﲣ=UpqI2MAsgQp:"ɍˌݣH;(HlVz%>mX7N|r)DgTX?pYr/})9iKwsZ_5q\?B:N!;AgNTh`%O_0h9(0ZvIyPFΔ Z}x 2P鰠>{.M!k8 gTFLbt@hV)x[A(q~Z*6Yob";Z6Fi'5*ꥠ|h>_61 UOmC`)od6o#Fj*q$UH.}ru=CG˙G@ArYq0Q,9Gң9g(9|_gM$d/k/aNd\M#@ %mpӓ}r({N >@5μ\t)zsN'Tbrl~<?6f8>:RNp1xRs77$ t:;$ĸo)1 Mw=):5#3Vgk=_ހ$$/.?wFONgbQhr1y’UMD" g~k xXx=ob>J J"xcZ-`W"jʟ (;JwۢE{W\j%'O13D6c 7FQݣYGuМ"Ruw!lxz;U}e/ߜɗxLv?M륆f^:Ƕrv`$j 3{:`TFՅʢ u2QHX$ D Iy8*OQdMt^T!r91 @N =+vQ̒CΫ%NeyH'&$2zbC9Eb8ZABb!mQ2CIbU/M2m6NƸs`Si?pw0gZ ǩ x[9d%~ɊmQA<$ Gq%Gi4fH.e~Xނ#o}g0oǤCx=DvAaGW5,;';e 0&r=-%9@N"ZVstNLlnjX|>&FX e(ٖ_sٴ 3()-7Zg=eJڕ]ՂG t Dx gBA lK rFLJK OF's"~BMeSc[HQ.@'N,J~)y%pizQ7J(xp1Ehg Ȯ,?M$y4L>NrM&Q\M<i8<x ޯX85y8[\·<~h/ 9(1Put7e ,xвb̦$޶;g[L-:|FIv [{6eGӁ[y!%9zk ),' ѯUبFUߞf6k4q+1DX K5+(0S;i @R;Ko@SKJ E%MQ-*{uRSTM9+!^B1@츑gaDSA/fH h*pG}/촁#TG5ъ37v+> VDTB_lOIH_c͟-*?_m.n:EƴЎ'x}|K$mC a;'b0ޟа!Q|d@h)|v}?PUy~d*od^gnint <j_p =w 8G>[swSQ~`Fq:ϗql1vKPuTvP- ,64/YY_:ݑJ靣@ eМ_Vx1c90dgsV /?=U[Xn  HK`qwY1J5z[mհnóp9|r WfWN>a`aC&rY cN#JgoZPrc?WyO+[EvKņtj[_]L5;(;,Eٱ?"h^ Yp(AOPą\7x7_*X}}(,pc$@j1<ʌ%;]%BQ^my͘v1\26Q ~B2x/6Iω&D߰dQ|hP ס{H$zzz#1Fi[W-Ӊd L/}H5`dJ1>7-ý䀿A$ۖ›_֕Z ~GWBVZf-IMCDHQp!d-[ߧzZ\: ԓ9*e(E!࿻ñw k>6]T0MxXgkic>;po Xەl emjBbӑw[sӶHNBn J%TnO_JIڿ2ZgLMu1VՈv)6vwXmxU8K Su]r{F;SK ?-ƩWD y|ۉ(ytg^s*@?q$y~1ᘅ76gPܞ5XDU2m\-\q'r*d} r܅eepe&sg^Nk.XLƝ,}̮Vq\`"U?'żDʈ0W§P[~ji 1ԭb,cIͰR}&uML1ÉCn~SLzh#oRUtRڻCͫjKLwKӒ.x֩ou틅 o5~:4a1jw޸ƿOrG``K*rqqUpUf7wiqw`%iuYHV1z HG & : 7[+;2%&:JZA_G007]澆u .0{0@ԌQQyjmY5:^k~R,|>^*ˎJ I|r !(Pn-_S1%# gpg 0ܑp08K]ޒA3^ y] ;)ٳ؈Ңc."[ϕaj$~jQnAPnuq"VSF/8lՕE@HV\?mvGS2h5\T+.;Wߓjdc,t(hH|2*朐̻TMl.#ʊU(1^6:v)$P!QbJ'L5U :ys7GuKS Sν?ҋUC17#.TyĀtH_4׿AV*xYfX`JBXl_ݛe7=9$Ⳑbd;M>ܛ.'ӭgŗ4!AibE=7arL 5#: \Uy WX@CɐJDq^N^, %Lwp/Q0rCFYeάMZ7MlRYEwXJ3$6oWDX&5zSH-%EQ^gIfVpmw :>@(Z#gz>yL`i $]!*TɈ+ +EIFG93,Vg,;xSOqIauP, =(Q;ӭZL(<ic,- @ (sAG=Lb6,%L6ѡa\ .1NmoN-9p"'e莕(eM9#@ȨܕrX8:) eJJ`h߻AMQW9' T݁Tl6y=ݺS/MAc-IA)^oJ>i `R=ӃbȖ;5+L[̈́MdB.e8:,wϋc;7 h3o/({O],tg`?^c?aՒL7-ɥ3j5ȕK?>ؾ[: >4@^a*' x򤝚m{]OӢfHWP-˽Xqv 7!h@X yՌ~#"GN֕tnQZN|SҌ'[] *h(3Ӊո=I !Rm S`{G5vDEp@bb陯]"y &]r@qBgCu/Űkr P|-TVgVeZRխ)ÁDsiȒz R !6IUg{h $'Wo؁&M& Ol/>=[D6A,'0 EddķґNۤ/)vߦTl 0rNMUq?NB-hGT H8L<9տ{Cuk3v2 FIA>L'nF Y(ֱ8|f/CuQ0ohi]{~Mݨs|PACX2 ٦)Ֆm>:,z0 @F|kM<1#ʼnn 6͛,;;cz;Z\5uCaEg GlFuy+f QƄ\s9~bf" &dMIg_ZfI?"=_E$uqXtj'bgmEx =ppڥ8{v&cOCg^`uPjV&)"I2gv]MQQ$!heey"(,F4 nat"lHqSjN.Lo[X}%tl*wģbxER@k⫘+4D?sppfǓ^ɹ'a]zTT_~/ qM1T@egC%ThaX-YZ!Jdk5{EҔLͭ1TxagtMݽwFJZ.V&c(FaO.b,ALB%CxwRIBq99o$[iE2V{~r3DW;f퓿 ru莿PId0ӻ0Oj@gB_.&Ͱ `^N<qQOD^pG5L2=DZu;kK{^)s.$.U+fW/MGٹV`T 6{{,'54+ t%3zJRw :J3'ρR`Yb(Y3ÈR*9X6"k9n+S)UycǶd3}^U:]:Ssa0R~_"Q#NⓗЇ-to.tS ܣ_.;Q;¸mbdC#8$Epb~Qs)o7&U-rp5(d\Snc@?%o T_7 '|\ڳ| H&ͥ26̚{q-%QLZي_M`h@t <uP@.S_Ԡ#.77CO& jӴ$`CK9B1v0# &x^EdҌR~bD~HgۇK!-XY)\͖I#cJN7~jZ8s>9֦|/'pz׀KfK#BB_ܺmǻY u&'< s& h<'lM%BO,>vh6xUn VW8ⱙ[pg̟^·%CA mw!35,n+oLQyj #9y6)JOTb @=ڝAB/*|i UߛWQ7Vv9y kt0A'Xu[!D>eEI]NV)wv &.TenU\'cVT]PIcwvEw|anIEZR9_;+ՓLo؎^MI:CkW#l`=x tc ؋0K[,UU]}vİveI6(kqX[r-2rB#¨P&KWeOcdq#6DBf!yDVM~>u7Wݘ)kH`W1#yXh7tlW?J!NlrEe*<.NڧEy)$?v@~q%LFz{چmd@_4(}ގU~ֺ! "^.O0]3aEp,vkrbaG}p3GIk"L8[:ZʂckգW\/ bi?&B% ITKINӟEt+ܩ w*:)CSߌih-&9'VTR#XR(Y1WcfLh\Su+iTQ!SڗEVk'|..w ?3gFB ԋO"Sʎl\rqU8=}F16V%.Nt1t?Ȳ}E8Dw&ߤ5amZ=y|qsKbW=6˅tcNfVir"ԵC~~!'N0Ǝ]MBzm?8y㋽a?Vͦ@kCRV:.$dǥ9)ANZ޾3`Q4^LXwH`4+TX t xu-uxXPM#(-}ZMpr Lwf%Vg mL`o[WSM]C|P%K-Iȗ4TDL'‹$[CxaOt;kbfiF!l.|08r07:SZyd~0k] 5b>>pѼu@=S6^s)RG-W2,gp^-z!(JLx(!,f)ZљjVM.h'0X&]xY\ a!mgkĴ~m Njypka F` mG!kK[zzهħ~1pS?+Zp{p K|ߣOB_ȯ2{䂰ZPY[Z­?,' 2^D̟\G)I( {LJKؗڨbZ% }ݭ7@nvD+$#ؼz]hzsZmTz~kw6]cNtd! gkbzi7 m"^~*k| K,N>m8 sr kx.R4ݷ{etM]eq *RI%emsjfj'P}ʬ0at ]ijf}\AXqzxF3@w s~.[нYbas#Qɣs${50VԮ`I>l_]:BcRͯ9$n֜Ɇ~maOԚw%feP;vVh:~~-Op/7-’;|SpI^ǵW_H8S ;|)OBezr73"=\,q+}C3X sv;8Y,_908 -据pi1Q&gQBnj>}Ksh9 acbKg,JjeD]#fm'˷$f*ǒ-Pr/Nw4O4Yk$Ì}|Ā,:teWZ1Eb/O;#ECb !,Z䞤RSX.^cvX_=}H4b PpQ2$8s @<3 `YKziv4eBFM)L.X%͆eV̆?΁y5u2+#2C(R^1.E-X,c< h0I+0mal Եv7#c*,'ꂣ/NvRK3@M* g[B,U_"xN$:Lt#An8>F-柆lJ3щ~5KbbPN=F(c^J˶*fH4=(ݱwC.h\ CCo86ZPJ/Jԇ8&j%1V`Og%<F|A"L`!z`Yu&,v ae cFv o@Du.i %wj~h5T v=R$; <󂑷J\μufF/ȩc  JmJޭ.G_j &L|o,]~йA_eZ"*aA\9P?Bx E¨ωzuN2Pzʓ=ie:P.oyt†'#GJ>5867o,ڭikvR$c1_vi@\TT _ЮPMSCqó~ jTwj9@dae8S!S)3f,J!W%@.'[D2 *:?5/I8FW7w}@]R+I ɨ7/"326C*8$ BC,4>YZ#>CA[jM QF+RLC!xodn֍XF?LhZ;wnu. -=#2X ]**_t)EF30q_^a"iBFKv4 B<YG('+p6p;6#Q//rۿOsaRǦP]mkGxoSks$oB M}{2/Dzˍ1@Mf]̲wNm1M.N[4UTRK[=VvޮxE: %F.e-K=H qMctEO ㆾՎp^’O݉LZX%]~ǵGyq˪\py.XG0, T ?,[V C3 նKC<W\:O$"l&U5@ҐRL)&sxt"[H/MKE3˻Nz%=m JR<-^uעoJU]#IN"ivQB+K{ ic&NPPu÷lsG'8KΓ>ǿy65#2]i"liDxH"KT|ElsȽ@[SѣK}W~ t\SP4.Ge-xh\դ9UeTAOjo+ec d vg< 1h 0 F1wH$вxQ954qyxdZ+\N|o>M1>OlҤwۯЎGK?G}?|:|aOW'jL^g{'>gGn/zH 4Tq +jio-δi4:.!U=~S`K0BWס| 2JA}^ʨF~pX# !n2/2'//.m ~Q_jz,{+tٜ"~ztz?~AL2hp3HО)&@" ǣŽ>kTLNg0dE(B(PLʽ*>nrXl, JtS(mqRwo| Z˯태e66`;\b䨙>s77DZ F}܄G2!BQ.WW!DŸd6:+pCTQ4*GnH,ؽ7FǨ_)JFh&K0cvZw)\9d+% $ֆUxp'Bަ02xfi[ $J\87zNJ]?穪۔X) :L{9םٔk1c+~C 䜉:f pPӯI{GjW+yu~o)f&] B2`74(d4!A:yNZ_#Z,`Ȱ 3?Ĺes n|- *XS=LkddH2բz#ny@S.ES6盃4Bb+tq̏ :>s8S/}g\^\a;vB d7ERǚty䩨 v_|-滮XdT`=~$qBt1Lvj:9 VUkWEL66"2ݽLfŽ!<#ܦnah,-nlr+#`/ֲhNkōh X*f*j1LICcQqha;Y:d حGC,䨾Lh, H[i^P$SxĎ|[3nd{՞$P(t ?Qq 뽍dX@`üm(:kh8#p4[׬ñ8q+#wpyݟuإrߍy ?>tD^*_Llqv|II1 ;xU,[|pB:=y` /-QTiV,pY)GA'?iB2X'142R!;$1Fy7BV`! %Ͷ#,iz𩢙QCmCEy mAR0]Ӧ|zǍ2tjk7Ѱ{-X8'ߴ4_fFDp<AZlqkfu/.^LlEATJ3kY$vwn屪8yd>nROI:[4EVR"(QG5boT|8rעޗў,X 4z[=X{x7wq/ǂiVtOv}B*) FO?jq2lOOVy%Lkrb=o?ij}ՋIG!;`r ImZ^!;h0fӻl2G o+M3 V XA,S*;x/-hTI_%ӺAiO ~\; vAū!~1?p a|$} &'Z g:P~,sj6ml~a KV58;Cp<Ws37Z ,hpG_zkgjpuimYdj%ԗB+~YС5R(qU-u> ԇ?zXC2ȅcy4&XQPj$J"<0*B wfl{Y,SlSٺNlf׻a.̇{AcU<*3l6}rn]X'I%{AU‰r 8sP[|\"Ea[ <E0VEN63R6ЉGdH(xM%i>Lr!JW_zӀ)b>M&ڱZ@WIJ}9y 2%dEyKA0IIG&_5Ph+5ۅAwM*T3#*EⓈ;0-\`h?Di;ȻHY V;7}aJ0ǐ >{2::߀ձ K%%O$j+GG}T|?4hwTo7vg<cE$˝K>B솵s>XXhDbe7Oʗ/1w\S(Q Wi|i+I1m`ӾK`EpT029X<Y'`R1ɓ97HYZXI?YwpfakD~.5C;$͌=csYp* ϋ|{M }nGk,+J81%9~q} GrW U# Rl'HE, JbeɨnǜQhé5(<0ؼ :9}uп >_^qmt8{Zaڔk oMUz7h#t/Rrfx)yR8tF|St%&ӆ{>lsDaP[<;cQ”-5NCL3IԹ~NhLs"DRY?S11R ;fQ3pbe^$ Pu;%H֤?e=BV) `kQ|]A–ASw%1($nwL/P ~.,m^N'Ԋ1X$VTF-v;lQs /zۗ^Fi}r^BW$Z';BK\P!x{Vy$@, @wd>V@P1Nӷl8-:#&I 1c}*4մ-醥wIĦB<~s6ej+uH$&ݢd (%ɽDsFAٯd5ЌfI€$zĻ0HZ"fwÎ)Ogj႘%7xjiy5'c7e)5j-yٝx>7wqj!N)Ge7 4}tbH&MᩳIуѴl K,&#{ٷw]^P]o>e,N0VCӅFV2"XkCrIjig2dm|(U@4gj*+tO{\x^`!<`]Pc Rcu*Qp^zK̡AXT7>JV_RZP+cC@ qrlܗis\1'r fF74 Oȷtb(;o /J;Ň_l nY u|%YKo#DȒQa `PEjzf;3 iHڒ/{z1Jt:{Q\*<^^n.)댌.;^:6EI[i*lN~LDJ[ ]Άž5v+TKt۩ZxsUM|)' tu+#Df41jef޳bw倵ZsVxYk*mUprcmC uMm@2f/ze}{[c)F `7()sJ||tJ'"h1Xy?[Uv!8y}Y_TXm_vJ‚" .hTgk1wmHZO'־~$o`mEzb fd56J RZ#nn_ms62-ˋDcuϲ6:?4moN!7ƊhEY\7uNU/ahpZן=Mcc&Qȉ^a9U8L1!a,0ny~nP4Lϩ 9JeNWlBndm- տ| eX:Is_u6SEK S-uy43|pϐxѶbγ:SD*vovr0wg<4gWїDjR2e8kиӭkvҘ5-5SP6LQb5"jNg`$)6QP_2 XOw XS<2U2! 葀09;pG7p:g*³u&ۯ5~dJgaHA 6ޝ1H:{Lwa4]'7m2L 44xfA5Mk`p無G!I\ĭ|('в"&ٵdk {~J3/P$x%s+ȸ: f`zYDS7~ o,!c I(#\QJ9*2?5t)F1|\ ~cXAHDX19~FhpU1LjD,leGrќNkO#ި6'/rn5Isfy\NԦD dwac&NI:e:S%{q ڎ  ;?sKW0:J}UUeQO^ G {uU, 5<{H{a~~慐t/8=v`$/hŗˉIāa)FGp9tr &(n:AвUK!z@LOcpO0L T% I3"-srN[ChVN;&ȓvٴڀtmdˡyp;N*qsz|?#}nP/  mkvXN1N"[]bc;84=~0)^o_R0RZZyqX&~yb=u c//vGbPb3d10X4<?kgS*^/I@^T;f2!\xX+oԡDA?*o7z D[N[DZ$veafk8Rdw )}h+X "i12K{USڄ#f ZtC5wݙXVğJ9fB֌x8 k%Bx@b֔:]~K,!jf"b l1WIDļ/gI:2KX1;V;1t9N:4"Lܢ$|/αxy6*bZzVj蘧RnD40W֭dkqO!w2Bb29~E}c~ŋM/(yOm%F|yZHM./=qߧ18Ϲ؂[&|7SV;K^=.ft:*Ey)EcNj;v%Lek׭-~s7k!Иh2Tx)S nj\BCVGlMcpCjĉ;iW |Z;QѾ_2zoOϳ{Aʩx,-PlDv#h)p=B&s5\uT-xM]W9;1XDYO-+{1I%u2RݜSw/(}AVT39^Y~aC;+-&tt<>}i wD :ZJ<*(w%Aˈܫu拑\:/(#Ѕolel\TৢFC0<0!p#QbdvlGdD;Α䁷VNƣ5~ /X "I76^]u{ؼ!\gqʿҡ1w8VuX)Ԯego*r{B$S]x6Jf-A, OY.Zs9Η8OZ#iw&gVu-90W+dzai&Rxsa+):֨X?6KjW~{U/k=&9`R؅FƼٮ 0&?xs ʰڱOa}~.!yr";aPvfKMijC``T9r^Яޟz>2?ROWX ;*{v!iӸ\e&g(`a ]X& PbLNɳ%;xEƁAq9aJˆ䦂;FW` l~SDࠒvLhK;^o0}G/uMk#OU,XpjgvF_ W~jxܞZɮ#w$Q.:ٶ~je#smV&3T穀6Pr&8va-9TRQa]<1-x,<P]"~\@ ҍ2 [xE ><''uބ~4U9uG"tLMqqo:]5H(4΋x֙Y_ȩ"9Ҥa4IΒ'ٌS/5/S|D?*L@V=3b"TD?K\Dc 5K\ehaH;?K4T B+ f"rgX:in<9N4]&6\`8$I`c*mwm^_cL҇78Wcy W^> /R_v69-[~<xM}wN)lLaMoJyw*yv}{Fk9AƁsm. [Z,).S]MSĢ9%zͳB"[OBh7ϨOG Y%cgFHdͤ3毼nIiA"nb`ZxHȅgC\? e]"[Mj³~lOqp{Azaɕq,jCվݳ?1$MxI`̿XR;ԃzٱ`tHw !!*v?X[&LdнvZ< {eZwOZ'2|ӛ%JB3UJu<~0Cxfp}jXV0aRט^awuCRLJS9 DY%:!bms$OM^/a 3XQW!Lۤ1&c%XG`M7œhvpsdSkXL}9sI0Bg9]}׿Ƥ>F&I0"~(*'4Kv/'{6"Ù P{A p(/k`D\c&31~ #+RŁxVWދ-y^wck. ̰Z*~]7!74h>:k}$_RœLnJAl,W8$VtهxbL C֬*LeҍIR9{G_%-hԇ\H+ʹn=Jy;syVA[R H7#g(bi<OŤˡv2!n~z)EZ \-[gvN"gI!(ub}ռf9HC;2OFXS"s}nu_RȆDX+S=a8xf@{(ۺ ]9^ OU&KQs7Ϋ*6n[.nE =`@4Mv}\\G,ᘜ2HMWcH%xOe8԰\Ѐ+{ Z}-!.1/ͺ&nҺ2źcsHa?gTMkNBw2-&/ۋ9yEmW$'GȪ J+-Nʶ nԉ$sQ bb%d,!2}$v뙱[{c57ט^ZmOTz\IRQUK _KtT=Cߥ m^8Lb![d5锾LXos#15~OJh8)[Nޕ7UQo2J:%]ˏL Q=LR\1CGHS~'&O~ZOxXk/ֈ-4_V+zK܂Cb#H$D]S]8\ =O3̀sذjf9y* o~ ee#avPH%, Ɛ*@׋rWHy꾾kX!ˋŊ~2Iy5R@dTH7횑R"֦%E=@䷲9{RkZY>AL-Xn)'|1ukq*PwgٰNWjuO @G"78EY"輮yMS]:sEUn!YlG^c=6qtM$_ aVPdsCٵ<H[Cx.؟ Y<;=&"cTfZ``ծ*%;Dk=]_ya>.@a$m:T ?Ěˉ0Ÿ2VeBut2M[st٢Mϕ Hg.F !i.{]Ρ_!%&vN|qסG`<{Bw 'n?(; %F\aVy]Vr.(NWKq`x$4%mi,]8S3"a1Z &hbױt.ΑC̀VMBy;࿺m""_%Snp WPϘfzy>RZnN] 4/vgCŶ[F`m$gӝ fO hkcY'(h? b D7@- w6{.b Õ* L30DQ` [&țF_67C| 6с'kHy$|(xIW rlAȡ$i"P=+$wERX66}ʗ / gå-IEH0sYsHO@”͋X9DuB?נ<'0LJx|0 35t92^*-?A'm< lsn"ݡV _Ou3Rv0wvΑQZYUEDĽpXcզZ5aߥ}>*0XR\{|ƻ 7T07ѧʱp񄌴ڳ~ha);g𔓘͞A(,~]`:l  !-ͲX4:j-2/]=Y y$C]h.u2yL-^]OY_}У9,0ό5^n 39gݑiÁ;/9Nh<=` c)w@o\ . -\;CK ]s*,C1I)Fӑ[#]W\T^-*zOe&CEKG?^OKs+ZAMCp#u`-y?ݐ"z-k$yEجZ)7ֱ fFj1ەS#KϢ(hjY)bfD9:'z[ ;$ ҋ9A"~RS j(UAP@:JMVLuE/@"!4k)ߗ:VLg%WӡKYER|? bOg>)W0"Fj-Y_/nֲ\٫z\q^2k!PPEhǀЗ *?Rc;Ϥ3S=NpN8IX#(]D$wA92udVݵ "&_׉T}ؗO$kBx.K[<( ,+8AK(4bs1iUQF8gir͞.‡lw uz5Ŭ*Z4 h~iNcAl/6O2K"7{ॢxV[{h#H*|i톞E]같PC ݂$ܭlߐ4uvCD_22A R n8:J6QKLC 7{=:xDSu 6n^L|[5 !+/qiS;LCċ6hRYEA5K/1LHʳiCwEH{EE8kD|}[w?? mR*Vєp$'ˀ΅!%Y b^ZL-ɛ,T~uG{vHYXĊw?tG1WtNggq Bp;CF "{@ P!4ciP(+䯖XEOi3oDq3N^xCENL W,$۝'U>{xseܣgDI*)͘ApC 8^8$bq=puT1QŒ =DM ٫&5: (p};i &Q'p$>R^/fr!i31*"~H%=TM\,':5PW sӊ H ݕ?+b|W}@_~b.m>b}]gyZ zۦ?CIp<^_K+] 괟W5ڔk8t.H Lf8mF2[e!"7ՊhZ$l%/)СRʨ~lX)Ct(uEz޵gzs)2E=!lLKКxrlI%d4fN>#dX\h .+sh`a47@q$Omv%x2] xA'i:pCDTPFIg&-Cwھ+^U2SDO}vgq}{Yz5LlXlm'^_ucT@_\E8} C"0/}Wآ^W]e9H #ZftVZKPiFxSL`:+(X^!UN]U1舧0N 3%Y!hP?ؠIJnh4Q<G?Y'H*훓ȸyg+a·d? Q?%*GP-BvI,KcIGHAwB/â|HۯQO&d#6a ]4󏓐Il*X{V`"ߊĉc\I@.CTgpFjcFKjIa%< 1ϋ.H߽ 'ۛ5SpazduC B['E5j=+Ih jK %2 3]n%A9Mb{O:Ũt >J2E)c5϶s.U( ^CG7?S7g^A=!l9~،k#-\߁*PW+A~u y9p.e`)omSsH,>4ϣWfHpΪ'^uL+J _f3^dl۩-# @_p ( 3?t(/]BE'Vj? gn䎹?/]{3D翛 Dz.|(Ay?ʻjFb}~rO4leCW$ʃg(Sve@}FCƅP %;P}|7jp-c!Dr̭-Μ9W#f5_qqƻ|w_N]=# U:_\`F:_&ځ o6w\8晣& x$bs}5DQnBXEkwuyԀb&PP !E]+i8VL?-PYC. +$ 3*9e mɠn[+m HTn -T`TЋ1]y8gx`tqR8&[jN1R?F욁> M[Ȅ/`_ %'g.~RQgr/ѱ7By++tC/[@[yѪ!G6`aXQpi`xZWEa, n vT>|`֒cc >\=b6\ i"q6osIJ| .mKk@zͧaDo%B'1 рy{6iP6[r ]3+ Tz0Ȱ]xZGbӂ)%X+4[%SFӁ8 5`;? RR VOjt Li.POj6p*^ؾ\iGRnAߊ/ APgX1t4^K/ň7PCu(2p3+9 wt&I;Uͬ FIf?z 1TmK^ybbuz785[/gY1N06Ꝏ~'VG1/IWLryoYxXȚFs&%M+9+\,~mоJqfL6&ӣ(.,DpV-]S;YD#m' KuO PƳlm- w GtNMZѐh}•pF|BlDG5Oh&hnhk =<:&6gd+.X5Jx9nЭw}>"㢦>1?m%åda!B_"{ <ª0!wt3'n3raT沶Dkjfn-Z Ѭ N*ϱ&nHtODQm,=7>v\i A+ԈB7ZS ՙ7R;ʧȑULJ2ʖP "XHF܍q;h^Q$͵'C7T"37҃Enz~a!(\ dl;cKcq_꺊2aaUg*8WtĜxj'u$Nt QBnPpwͤf{1m8nc2T=-oϓwo Da+]II-r;- 7WA[;]N$d QEOd6 't+P uH^_ΰx;gO&eK778<Қ{ .9㖫f4;ᄖh6ą,z(: *n>+X7ῦ64o{2}Ω^\MVݤi~Q6 46D;0ZwEM[Ixov`spaUcCUмq!Kfǩ+W׻|/|Vu)8=ZiENOd+>HN=>`ij6 C#;B@smֲRv6F9su=w( _JTyqx%|i%TES,=9_jD{Ndw[B&vEA=/{L uqR9%`L.+|T>ˀ-2KRxIm}:6?e[mD9 Gi1/oǙu ܝ^10G0nܯmdr3^eKe]v,?4/dCy܍m)PX< Ђ+T(a@@3C4ټOӒwGy/!)VMKMQB8eR9=O0bJ\OdpñBk_f. ˕?4Cp J*\u3aV4MYU|6@ΪY71㈐rk{0&x"=7E3TxvyQC !ogT?Ҙok%)\ꯖ>%It@v"r u k_(9?IzUi3UIԜBl:6RQY%N}iϋ-m"~n {&ِq78hG-?9?$AOphڝ}"3L."񅨩ρ.Qd&rPftwugg[9QVD$j/$ǞA'>bIP6W2bKT.r|FO 44|K:.)zL"|ԍ)/xVn'IjVw wIt>UxM)rQTս2ѯCGk(M P6( s%⥸,ы"Mt}RiO 3h Ss p׫K*<OI6]Ǧ/W؜oLGXVTތ*&9{"Bexy& RD9J/TڌM)o܄bAcg'l}`,ӂΣp~*AV$)J(E1lL)Xu1׎!2HdvtS։ڶ; fBiEuYi*)d&[Ic?1"3AG,D#AqvޯRވoV5s#z1ϿѶ7:{?}j-1\5Y5OOp䣲dCdGEniK+|ehU|.(dÃ̀+auF: vf0#YݻN =b,\iXC2 _"#<6"4e䃒P({ Y#^d ls6Y]zsp列~ވIn:)e@j{,޻wco(_XlWY$W;8:;7U8' +Ww4KmAf(cNg1ɏXLxsՍ} 3)zGT(JC 7(%lZshGrJv%y&[Ձ`ǽVXyOFzfCqv:q8oPmdcL\;ܻHƒQFW1HOŽ4*h7lqdw8]Dو^xk( e6G#*eė`J{e-E p 2Ss i”0!'{ P7L!ל;cTi{'8W'>)p2 VvHe _YkJumiFi%k`˷@{fVVmN:'ԕX\p|k^J>ʉ[]@r(HY}e}<AI<N@}0HQ b^Y2VQ;0`[˥NZ4(#L [ ›8"/j"t|OJD1@I hX$XIA$FK,^".ZX"f:*N4?~޿"9z$oy47? F{ x Ahto!t23Rڢ:;#A&>k/ y&7ǦΉX} %AEXSVg]WM]A_٫^L뢗|IѴ2MkI}(3Mf^ĺVVɽDA31Ld7oYgng )UQʄiQ.R!Sn"DKq+o5xq i-yZ+:5_blۃ7!ƎIU2 mL [iߦÇk-La\~͗eV'PɪtY2ZF '߀<DD}&j䷻a'cR"aA0),wq:\F,"amT2U_~T~O9[qΐ׾JoX,u:HR^?^%rٱg@ܦccM4='ppIav2}"b᧤P:Xl]`O hk.t`s` AiP.S̅AagbˬTgi*|+iPك]^9$k7ڂ/cs7b&x+=?{+ W/$ JȺn>Ŋ%vtOW8ڨ`v>vuIxWy!."'P㭱O 'bĩC7bONÓ|JUq~)Kf\gU~k_>qZ0_?0VIRp}i~KfL)IWCҢ}_$z/J`Lv܉npy<bSTp`>V :%ג 6(~xC20p'[K֞΍hkG3d#A ͆HFŦb،31$u݅F #h-`Mc5 -.@S/|@P"Jn~Y+*:īy x5# Myb߸ o8n&8AKxAT%E Gv8lU Q.ouZʰ˛q7SSThtTP!I[ =˳QYN:NK.+#'QuQq5{R奤{7O*bW6o G9xR'X$:vQ yj[%H[<tq()#J 'h!_1zt2q 낃j0Q%mІ:u>ni %4(USj2QWRr=V ]`J'r_ꋅTo莚GP>CyrMBITˠuVZvw5u|oQL{].gKFaqw\e٧xF~]U)c;*JN&^Ç3g& D(H|vGI 4JnTA(q%H0Zro+H/v<:jQks[Q@I4cɥ|bB-+JOaXwQLb\#Ur֦^zAD F4 !Y/X BI/u/--rƱq{tJ]m7$aF*s)EGx k+19OE֗S#{}>)cex*>"~bHmAGp#r=|tn9u-mKv4"++ s K SG/׿bio5UmORq da0&Dhy.Ma&5My? ڈ%q-G<ЂqO]xtKȺQu&|VerL*(0'.{K^Ɗ$ AyS=mxb용Z2tF%y޿fAN$R;Ϋ,9ׂ gn5RnN>Cb/h*tY ӎɲ !:j Yvۮd.b?곑8^t"z ϋL<{r%Ren2Qv`ažGUma봽.k**ނL±dR}iN2cC#0ANpye~Yld6*X6XA$nHJv -\{Г"R7Ao^o0RKvO!%硓p@N/wl ,XRaB$f e ZGsV厖~$A~eGZBxapD}7N+nBW{yd JI©6ǯ4;GZ厾V/@ & eREo9;RzJK;$s XS4'[v 6ՒŊi~NR\4KuHSj|2ߤJ4UU4ChВS%zW!ww/BcSS"B͔,%!x<$˸SiAb…#4d'*{%^ TjHLcBx޲@4F}) 8H`P~QNQ]GͼbM|7"krz'@WVhw'a Ǻv<j rسRj/ciJڷqW hh›Z=Wms0ޱ Y Jt'"e*U d+lv=Erpk# ^8"l &"&aG}HKlU‡eeq?Xoe} ~\]i+]'?+?y??<;?|7C~~TsKw+v_'St=s!3@KET.&v}@Ro^ПK%s9J^KeK3TrXw&+TRoS(6 ͊:_w5oő7s{[ MۏOU).T3[㨰|@t9D>Դ:y[3VpdM+ D7xVƁV^T@%۸M&qא.m*] \=q%_ 3薃))o}RώR d6SZo7q8jyCgYD/ (/xe,` _TB tjˈLNo~x"_yS)1+0b#9o7[!sG43Fryqk6;W/Jq.ćV̪|w:87e\M j|k-zibE|eEyw̉v@t 별g â./jG6a?{oe!({4\MSXu W~%(Z}%D2Z1RٯNF A{p$rvx$nr/H:slWR.0J")UiZJk?"]aJ^tFL(eG]|ݯ1 |Fl/,.| Lύ.  #(wK2Bk="nZVҪU Zj&[Q`]{#b1v( WGDls_P !C%$ N]DO'S`8Onl+͐M/?u61h&GhK6BV $QX_FXPnė?MQe+y-LJ Xk|$HpBQxDU,:_HYTqnH )X =̆E m ۝xO(D9="}0NeǼ= \XoN}Ii0XAG1-Ax]v-#/q#kd}mEZhy-3XذqzpoebX[pKJu@ PPC SbY`}](uf![1.#necEZѯܙ_s ;}*g廥۟mGU+k56\mȀvM {o6e~:q{ؓr@Jlg=%ҋS ߻z߯}x*g '\?N*1pI,:_o8j9b-x"Zת~趵Es6r&yxH-dzSX/hR5)6j99>bב̙w^!2̀P!)h2Wnk FKR tty= yu޷IgߘȜ-{u3e&7tóӔI{)Kم8*5a{6wD~sBiaMWg@e9YXurz9jڥqN&[ {)1åǗJPe mU WC9gVn%R +8Dx`}O˕Ί[A앜mJ]> d0~6 S`lJB &:d!5{yB <^tgNf:oEwBjXg U# Rl'H~~6kuP8PzЊOYҙ3v2V݌V)vbu2hm6w_$u OKmG7cwm@x8߫֕nGhth5G/o9+>^j&C'Vh*q:AĭR{"R7>ۗ {ܵn#fCljYgXSFp ,KDyK&/ 趜Y+Ƙ9Ŏ4Le"q^/ٗh_XicyHΡVE>KPH01E삶[{\aϠBm Y60>pg֎N$%D=`#R ܚi2m^#P@F =Ñ˳98oHo|Ԡ <"K*LM-ez1.E3d3hbҡܝef!_]4;UcَL!e <<}u71jOZ2J.iIZMèk d}M|WL?# >묩t,lW6,㪬GX{]}"<.ҀqZK"dȂ`g.C׏[u\L.wRo}6U;Eni 5dg&SL3)?IbTY06 G ֕0s](I^dG;Ln${eo}m L~n:r<(8yYkV\hcbХ=zYsoV {>|@5 #2pOy3v7& So_Nk =`<\v)zYe/s`kX`[U᯼.`&Ri Aɰr+M8BkmOM$177J{`E1'^) Qg*x掋$`szkJq"H%Ŕ,|8t1/G/_hG}gӅz_ ɕlxg<]'9:/Ԛ.ZO'g[8g#RH;Y Ek'Q¶G["T Y/|sޤdIw dvpoX_Z{x >R3 m, m.Rhxf,mkYvtYɾ~^K*}2Lkhs=\|rW;Mr #'7c 3DC7[KNdK$( ;bI- NRU}%iˌг.QAˆTh?gք{&j=`F3 KZ\tz wOH%.Zr4r|Ŷ_<$] ucJRkt'Vw1ϟNgvmG0zA0@F&9:ڞ5ןfsVF$N dCXYm)\C&dRg~8mӡ?$G+] ʺaF]xT [©Uv!IH9є.MK3\ CnOXFS)6x[wBv~뷸(cOVn|:v[K^&wzrj` t/pQލAᤦ:r0tr`|1L gw PDw7ˬ5ЃU /$tKTh i;@j 2 ILWHs7E+ ǢE?YYa%Ḯt.l[-"2o1t#Ӭdlbt 4:Ӿ9oJCA3ή6Sd  /Hb*bՅLŷy30Cl7rw/db') OQ`+z,|ehS=L-ՈكFⰹr;LKXt;VEktlWYjZUWZ-2}$#wC܎0j@vFO{"9d`f 9AҁDJy5YdXy ~L^PS4PH2 I Sxv`k'#m<;UfGU{m>bE=NRyDp!zBr">Teb8yvv6iԾ[RoV:`&K `J-(kVgq)(v6lɵ?zYU 2\cuh7e1 Z49jM ӘNъĘ>@#!6ՠJ٧4!/f588|i''j *ڛ"gp=U4I#35; 2>ƥ'`y]8j;*+CU/F)^*wNʁ9.{>8ΎESr)^V5'a?>;_瑻X^Lo<ͅ8i_ w򇼾A g $^/,l|2\8ogyqW>^'rQwH<(l3 IkdǷ<`gLZ_znʗ>S nFґ"ZORdNy նy;^*?H m mz@mCZ/گV3x~3(-E__=3A q8Q>zS'>MU7Q߲]m)әl<++4PO_R:5c-ƋҌ$}ȓ@dP̹3CףfK+F4M/W~ae6wd0՘|gy0>+A!QVvk;e" n2$Bc_?` h[ӆ}wxs vѽ(Ȁ.\\Z եP.(`Hae7'Aqr*^ *<@8yUpo\Jx3KtKBzMtXv;30 vhW>pFq~WM|m{8ea$[o|_~zS8Cʐ1L#"_딗]c;Ԣ2ʘCfUO lx%qÃs좸LfiQ=h'BY4 [5ϟEyAKhUUT6՜!;&MWxY7W'9",iH5W@ 3ZyvOUc5ROt|>Sfb?+vsڢ7.fs_nF";$/ա'2lk?@4u6Wc@lGS<[zv>|~=㴷TU T䘦eS\^-mEZ p 8 tXVIMׁfKB V7OJ{ I^"JH 훃l{hvFv 6J]h\Kq" ۮBs"D =]XaB> .X%!' AݼJa讬|fS; j@LoW(]+\܇6_$TK'T(XjQ5ґweh0& X[j ў'QoU9dݴsB۟K;VrѴ19`:ގK尰NXF^5SݾC]þ!eJKBo{{ҝd2kh l;dK{C` ު茍T'K[v)_ &Lt< ܣ b3Y>4(^`54v72(S,l]3Ջ4B*"R8Ӝw<˜BUO^g#tXR/"S;uD;#yM?tp{n|,{z?lv꽬P`TȊXQ9юM@HjD+Ӎf30$%9Șϊxt.:9o6Ei#R,*`(pX i:Dw]z6ȇp#dQCtĚ$~p|;+WHčDwd<ΰ ²͖co2%*j"Zqg ,E5#ڊcu&aru<$*U9fe֝bP$gdj-t-vi%8/w:/V ^W+J6[6 ۥ)WNN}:꿮kX!f,%u+Dߪ)@uiX(}j0'{$˘ؑ7(;)fSK"O?g8Fr5OIK`tFϭ<% ^ cUv*>?%" ji&LCk >}ˎ^3+6hIZ= ^t'0m<; s3ȗf"4Fһ㖭Yg/R<-͇n=v%Fdg{ex߆}iko©)q3Lv3EƛGl}jg WMp35s1vb=;l;2xKU퇤E"9C)e`oD$3rv%` o;GL9|MA¸BqcWOplTRr:2..SC3{1%{$kʳS_n7>/f!k ct*KTZ²J?XF!fDUiF($O|Mv~pEncg JbǺrیG3%S^m~֟Coۮm)3}/R08/|գI9)#=cض֪`չ+l^W+!@*d|@`K5q-'zpB`gaֹ|w2dz/\I`f=qrTU4mR4/I> E??*5d RK7U{;6Kb(i޲F(޻DG8mƛ1+'ޭ")F\0>)7U-ЯIRk^߰7k"J-F8b/W}f$tWcN9C%7<;YYYcy?}.naɎ)xJίnM}tuRK<̃^Aq TaS c ٠ms1Y StaC?S,.Tr)h8W`DWϮY,:RAq5( )ߡm"w |=\dqI)@I*F5Zf?%Aw].Q vxC"aawbg Ni~wyo=z2@ g#Y hs]Ͻ V;-`c@/nliD#Nt`㽗9;D0~m႒23[: :S, ub@J ;v: egj-;VΞ:X JOܧ@ZNPc i=ZEWF](& 'mW*G Ⱦ-XX#a8x!7',o(Q p_ĽAzDM`֦55k ?h3~m۝mSU)+-"ÂИŖbf}>l7/-o1 `Nhu)$&p>dDw@x'pugq0>=.k6/y)P0ǻzDJx1eV?T>?PcoU -~[ATVRw:-ׂ퓌7v!νv4Ck{qۓ~+l%|zy}ɩ%&M g\]]o{4 LE)ɿf֕?7Xlx{gM^Sjg^rX*xIs_Gh PT4O#$JT{珶Y\T%mʋ?ٛzV{%c-ɒt+s`va(Gd(%wR.yi٭8H쮪D\R60e;!ly4ݷ騌ŎV4]a7ھf};Oh/~f;bc=0fU] ei~^q;5.0a/*ʲI?(2ijS!Yoت(XmC˳$ҙj䥋RWQi˕VG$.OReN]9cXrrVA4hgnMTk^f@5boG-#'+Le՟9aƣvzI346Yk>d=W9&2l2$ȍa8DD{0VlU R(wp+eXNREAp[%nݮCQk: ~AJ\P(MF(H,sGHr 4qy"AF6  wU T)gtL(oDoLasW':STkd}6 _BDJq$+! lE1g}w݁t_o$f|ePÅJJeOYp]+щΣuРc1;*ܳj)1z5`q9|NSIE?%J DS/̭*aEObvOa0,bd{ o}e̡ #hDr ['^Zh?~t_t?=Ea,3L>"um۷WtTXcqc2], )Y R/?{}fw7`Qb=&k+O2I XN$U#}يXwl,g؊: G:1EOpOߘr_RP7]̌&1 @}M6EMC]cALݳ rΫXŭXT+6,a9"&Y7t-P[]>,nBMx؂> x>ҐcaLA#nURR촍ζ*~x abL{Q[b ֪6?Šh<{ gbU1[/qP~?]t_$Pzcjs68se0KM9DKZ(Ѓ&ViE+^h\-^1,p пB^ô9=mWiPLF8@V!)_qYHPm6 h* >r-4DEY9ye '8@@T(P2ڵ }K~ɥp ԬOv|}>x;FXƈ,{[R ioi1m b0$ksfb^ D) %0'dȮц@no2CK~s$Cyhsq< 2QrN̆>"Uؖ=>dDrG9T!N圆&޳l?/ pAjILB>yu^ӞBƼlk І'ݑ-o\vZiY:<.ݑ#3_o~g1_6v_Qո_^]9On7Ј. 'mQh&H澥W=gHt%ux__{=vړ";S?W1Zshr.'l#J O"z`<$kΡKX*X9yH ѻ=d3s6F 羟eeYsƈh%Rl;*`8(3^I k8Ȣ5N@ /gvBن$ { ځk$7,Y\@lGk;_ؽr*O88Ω1۴uqOBG%?fqF$uAwxN3E 9.6L;\k,n&3`q{A,eaN$ݒ:b]}^zFDΣT g0* g+W1 ,+f62s2<`LV†qѕ;tE5Q̎"S'f9a]euDv0"o0c{OjE|A -f_ӞR/?o}B1P4?K-&3"\P,ʶ02^cec=Lv:dDha-I/;?0*QV0PuϷex_#!ZD1Xpa 8 ,DZgr;&Q9V>9Ei:GDӴ6n(upD5wP7@ q?QU9uLtЌ} L'({Ѧk H@+dI{$O[hX[81~NRУܬSö@4d:z%Vex>M q>3hP'y+6FJω"U৓x7_<a}ptf<5Ϛ7GoSZN"LŁ^- xgi9B  Zڿ\ Q } W0Gyy%39kd̈́'jh3vF1]?jJ%'|ܜAA~USGK&^5X{uxWäd{|)fM{Qſ.Е _t/@r: 䉵9Yߺܲ7 _$.~ŧp ygK%E} F@ :wNR!z]tP2/+̄tek{ 7` ̱چ91H_ PDT4iH4'V7XdIp#7Ple>8\d ܘuFF|+}P?OyC=5/Åʎ/Sdj5]A@3[MU&T (_GHiJW4$s-!&PU}dU ݬ(^rܕ@mIBŏ+3O{ n&_ZV;3ۤ:8"sei5NmMd}zG |v(^?њT썇3Q}FI.*B?xVs7je]OM-Hl(Sj_im3hK_pehnN}Jx*cD,ՔrwLD1l R)za╬bޱ ,v;0$W~C &I[PZ[\ŗJl,#瑹ѱ0G P2BFCm4{ztmFȠz ?FCS>ך] c#[3bXߥ?H^X2]ŷJyɫUdlAad6\T p%7]f,x'a[uf/[=ӓOPcmob#WFN`g@S6Շheݯ6Oգ#jq$VW$ҒE9L,#@N lw䦇rћhJַU;`F9JCzi2@B:bIK(W% $41mL# eݓc/zѓm1X8xMøny,6ugiԵxтg>2-ξn%c.|k" lz6+ZYmjW=⧶~TmȊimGw4F18_ W_ۿMm]^L"q  y,_zM|H'΢p/!o9/Fa롣@X؇7t̓Iy/pIn }ĸQIF N .8me'{{Eί ܏Gh+"5AMPO7XTqA9F\wXo8o#׽po[I$\ΐV9+ /lƐДΚOg ?r&|VUvF- e0pzNQI%3ZZ5# fz8,&DY[Zf= f^>̲g+2e}f_.?Y4|us4^8Y\ w||I<|fWK:dmr?}!Vgdoyln)EDFZ`Vi<"9/ ]:GFR?x"B MQ8508/+'%d NR[b\5u\sâ|sjH݅?X'~#2YK ˗8݁dStcGnF?.]u1<Q1_rl2xYݼt}lqѭ.oGs~nX#xP[Bh;5 DL2B^ 혛^gfIOU_vLJҁฃ桲0>^N٭oYrlQ*칱N˓E[w!( )fR+9oe o/Zv6MfEL6态>QЍK_[8Tg "gd3?H"ǗF:3*]VtڻdVVx)OCbpLC2@ YWeMP龐-egEBл3NW7GxGX8FPkwRvEFl$i_!Bʀ|Ϸ{z8Ψ5&O Ü[\`w[E#9VcBCL,.9#D=h0!:'oXK/= qj#"lepjZsa3LT5ͱo Эiñ7GX~]oVG]x'}OD&t]Rm.`Ҿ2M0S "%AE^1@6Szk"ō\yey90'y Yl7 OY]=:}RA=dl߾ʸ#!ei\ܣ% Y`ژάvVD?5ԫȞs!Ƌ!F,9ڤAM70vxɾP\o\*ca6Fc{͗l}E'bG5joԢmWwBRY۳d :/X&硙R[Z8!H',Ctdw_l0Zpz:HK6\77(R&TC PA 9<} okCE {cƘҕS؄ UBEŠ#n+ɓ6D9&2-d$fxhz 1GWu\*1U|{0YKDɇֹtviR5VHG-O>un3=Ai+\# .(b;f~-XϬG9wܗL9*R2?0TL"ݬsA>G<9`#JrBFpq}VIJs{}.}x?mь(< y `g}+,!0j*5YrRlSXO/_b;F,ńe8.O i0Sb)|"H@VemIa'y).Ƭ@->x~5,ˬ8V֎DouoƖ}M1jIKQS*vПdG21?lm_ޯԤ1 so,}RrP?Y¤A#ok F rtk *[YUP{V֡?e' D4\(t j[U[zqk*qA\({׷M 9%Qn6nO 661pQëe0FTޏ'?GCι1)ܞy:RAiQo( LHq_&d$VҡjqfR<X<<ϥ5/ x)KTzret1Xnl^рxC(F9xd>AE D񍴻p?@+bYJs4KN@apB_g W"vÛD=gcDO7 N=NEܰl(M+<}1`c_ק%F|=Z:7'Mђ# #_6: ~[o^;0+ Q||XH-8ZG 0I&Pi_HvYuJH!X=G@9~9q.`xL:rGF%4=AdVRYnA1#F,V>'h-u.t7ȻUJ n6樌ñBoN?VTl xcAɰQREf^b@[y&KNdݷmޱ0o{dۇqgIT%כ''g"ڄjp~FQn7&vsϑ.k3j𿳅H.Qܗ/ߋmQ ع **gpf*ٯ3YV!W9Q Ùfe ?wWٱhqOXuޅВ#2dh"$U" ^06pFm{X;Q1ˌ;̷4d^)acKRPEjo+9H1wQ7L|S}k^70%Dž8)_m TUkɉ̅WI1Eda.Ӄn^Sg M W|󈺓..~ԫX`9pZV>oRЯ gII]pߞ83nROEQ/hU\'eYnz+7r["UqPYmtoK9~ȄGo+V-\#$j<ɼ?j=3}i^qR$bUݨV EMѤ|TU e8 AxhY]KqYzǐPW[^ q0H"Xd88 л L 9 ht0u2K`W؈Et2g߬N6ud=`;IYxtƯjS]ZP!urӉDi[>V#ZM29dF}oYA_cFc:nJe܅q_ja&r-XC}L:d[O$n[N r=ǕBi%[~ 7X`In݄?Aa?Hm-ڧp{ߐ$@n~?k}ZQt|:>N >~ɾH@gX/}% ~8fRMOL ;L%!I}(0\bi_NeK7WF=gyLJ; V rzb/Ķ)1 ol9Dl"ƬS]иfjz?Rc^@GGC~o̝|Xu 0;#=g0*fs)E,Ki=3" K@P>qy7ߜ\!:^X'^6 5]fZm#zCCr͒)koȬ,];i.PlqM-܀TΣTH/:t(g'L( zҒ:_;jܘP8;t.@o_`ҨB?| Ir>%c2אŊ9!}<.AB^Bbwe̐ҩkXOrmᒏSQJn AY f/҇&j˳ ^4IyaMĸ)`aݟަj䑥cpʭxwq)ޑGY2lj#^s,w<4jPEX[%o9`E# Ua$Iid@ pAΞHuYZj~*hTObi^TL/uj.n\q(lUmЌ]we=ŭͪ4V#L-h9I,W5Fvo5i }C"*)=:q\Y=,3zM6J(tΓ^|Uв]-Zd(=mHl(u0WUzN G@*%%8IB. őyXp<i^#V{[nf>~w]7/pǭ^{CO"/? ם6,/CV6JScZmf ~51)ɏsSf[ne.0ۋbj= Aֿ zk~e`v;Xy&ʣE"^4aD/—QO >.1 xF͆"#P8bA!>6ም{'=[TfߊTHiCA3pֹT*g$79v-,䁁YD?l_2j,,vjspnWi%@&f푔w[!W YKN6KKuP bc|X9ŞE0Z1j$x(h| ʬ-"=XSuͥ^Y]󽹬V%.\/W.2 m'a`|P͘T:ȮM{G~z+*K$Q(ռy7I6 h`rL+׍Ȭz05<:Hx֥xc<ԉ-Ft2c1ej:^۱o%Ek'x~FM&?*`ҀiLJ2u7]HbIϰ#3uYd9|Fp7`^ˮPXA6c>vVd`YP}7SPM h+B%)y9RU5$~!_ck/Y9PH}gs' VV}>Љ%J(Ɂ\1F yA|[Du/ z'/Vq#O>=Mx/9B=F}>é>0 >g_6jR6U7ѳ=QvkuajN9>1h~p~$~y (10^p>5Éý8U@Rex d7 bA'$8/[:C[ $EittXz2m,^h?`oAPcTg5c”tܤgnZ.edo*~,,;pX Tsnj*5 ߅9RA(+٪[@} $HG Iq TL`HgmDZ~c Z]Pﴂf)Xx/p8UBj&QrO|aɇ@i?9#G#XFYb(puĘn;'9!΍5-ڗޫbOF2Uq܈ c[xjŶ2?4\V KJ g_cLTi:.*O* /߅6U?ϣOOܢ7 ȧRZmj11PF'Rsb)^W ‡>%I8A^įlXH)ޔ?'b/R=ڸCN33b00_q^u8#Ds)ghG ~[ih&}m2`k,l?njue/5pbįa#k P6WLȫOăj 2] DWNQ-MhԥywAH=*FJK5';˓NUfY{"_hDڑCd 5HP{Jgطy.Z_vSYF3m!9ʲnm |D {bv͊4)c-EHB!wWVwy H@9K1l'L$}l9nkF`#yӟZmA ZoNFwo N/yﭫRw.buts\Fm.܊) IL_>xwbSkԕ -@NAh__|jBb S4?4C:˸RZ\;3JeF0VUhn|GBєܫ_%5x +ϴ&'^IB!5hDH~*rͮiq;ׇ`QPh H"VYTʶ||45_`o6@[I׷[ӻ͘{E@WÊEemM7ӆ6Nr-9vfP/`;i J:5NE i,ΐH]{>/Dtۄf J@uSr4 qR@ uƻ ~lS3/N2A.dBqs $L_"3{v XԿ( uNuNk̦;1զ#H+#O@fe '=ijl8EՄ0Bdz7wڎ޼Mr'͊'u ܐ-^>K"Z,'MsL2]:d?LiF&v[HԌ hP_̩DD;6C!=VBx |$ |,ks]Hz9f*U8S|^P[wvO&\ԓ.$oIM\Fȝϴ$` ˫^ |;"pP6Ƌ)+'J;ɖ+!sM[pIKM1lH[SZC2|% A[b/IL'x{ ɿ-y8Ӂ{>,G@&dMN32B7ܼ@%$(_̠$LJ8~T/REy|2rxE+LaQd9f-KmNvL/(S Tj, g;-$D'ZmE0AqΤ>9{ihw̦V32c=Ѷ]$ DUןZFxk'8PvZydlK{kjduA(QN+0#q3ㆤ@*T2xR> )˩x] MȮX 7anuABU;K2mJ0Ƴ t Y=v"Sk=[% 4o55#AjK[e2]QObmOJa_p㋅Wb qRTg 99݊#tD58lsİ&}k cmDCeq,=#EY&L kȳ Tgf *G< >ɵҚ*L6J僜t(D@e3)*9xcR%~#g*\`2 <;~fGWu4_|e0wLDzoFx~ڦkk jj7\[lӽɛƤ"ϋtSL+u/wM՜:n#nL_G1Kg7c%c8{8ce`I!ONBG1h! Sd(ynJ. +ӡg L9#*A24<gEA'$yupu=re%\cHNL` ϶SA )0we[t}3M6dHB{NGO_[ $kkN`@bd_Pw=$Ĭh͠Ҡr٥Fzo'0IL) EΚk^D:?\o>ϯNWH\?!eVOYhQO\hEGūMPTNOؽY0ˁs sY~vT=Zg/p>hZrNm[zqF>}pyeۺj]`1k]-)s-xkne$L^?[b'f S'O=6N)peӓn=2ۋܺLzi [z$텚4|d6W KFs1UyC /}!Mּ BnbP3 (&ƠpA46_CeTO XGq Bc),@U\3h4cdBq`G`xa?l9~:]Tк \d0(=m'Z:$44fq9L}?$:Q6r+Ń v3h΢ =>/h\,V7O@&qf:ܤ{\uKB fdLK$ #RrQp #F><`Z_ wy*_&bv1);3 $lEeا9bC\i2>EA p$a֎?S] )*KH.K] /QNAr$mUVm&%& ywK."kYLn|h|;wNy9 XOz1@N^ڲ7 '⒉<8$Wx]L,^"(r=bN܎_Ċh^ |ymRNTVQ[*EV=XѨ^oǒ^A7$ԁuz>1:Oƅ % ńҖF>Þ}ӔkA/݂܋LX):ɣX"Ǩ#B"x\B,F,2yrHbk=gf6jتBĜk!-HYAX[])uw*+"QCIw%:$XhK~ZM3|cP(ފ3uheX[).2;R7Q /O L^nzԊeB9QZ{ 4Y?_8uɔ2'< hֵJhybEΗ / jN bC\`Οow7=D`P;fm &%m*Cr!ӷ[Z R3bk%E6!|Ik^3{QZNmNJa+D@7jq7.ܿ7\!Vzo.}d^L0..w#GCU;|fΐ8,=_!)~Q9$@Ew~X]{LQIs`f4 bntxVC=Qƹ75'=-a; h*fP8&m |g,ך '`~LWexzD%o ߩ\1Au{z3Sߡpy[(NA|s 6LGM >x6*ޱ +cgkbHvAmsĞƄP=nH2Mp-'$2Mշ8;b/2p>j|d~.J gjѧ\|mM3dtI L|qQ(d0_~Ԛc7 6utu$:'O( sJ$Ut#hV B#(uO58э=I;r(M\N<H,*_icnV Bmono-tools-4.2/docbrowser/IHtmlRender.cs0000664000175000017500000000200312413742070022357 0ustar00directhexdirecthex00000000000000// // IHtmlRender.cs: Interface that abstracts the html render widget // // Author: Mario Sopena // using System; using Gtk; namespace Monodoc { public interface IHtmlRender { // Jump to an anchor of the form void JumpToAnchor (string anchor_name); //Copy to the clipboard the selcted text void Copy (); //Select all the text void SelectAll (); //Render the HTML code given void Render (string html_code); //Event fired when the use is over an Url event EventHandler OnUrl; //Event fired when the user clicks on a Link event EventHandler UrlClicked; // Variable that handles the info encessary for the events // As every implementation of HtmlRender will have differents events // we try to homogenize them with the variabel string Url { get; } Widget HtmlPanel { get; } void Print (string Html); bool Initialize (); Capabilities Capabilities { get; } string Name { get; } } [Flags] public enum Capabilities { None = 0, Css = 1, Fonts = 2 } } mono-tools-4.2/docbrowser/PrintManager.cs0000664000175000017500000000244212413742070022600 0ustar00directhexdirecthex00000000000000// // // PrintManager.cs: GtkHTML version dependent printing support. // // Authors: Mario Sopena // Rafael Ferreira // Mike Kestner // using System; using Gtk; using Gnome; namespace Monodoc { class PrintManager { #if GTKHTML_SHARP_3_14 public static void Print (string html) { new Gtk.HTML (html).PrintOperationRun (new PrintOperation (), PrintOperationAction.PrintDialog, null, null, null, null, null); } #else // Fallback to the original GNOME Print API. public static void Print (string html) { string caption = "Monodoc Printing"; Gnome.PrintJob pj = new Gnome.PrintJob (PrintConfig.Default ()); PrintDialog dialog = new PrintDialog (pj, caption, 0); Gtk.HTML gtk_html = new Gtk.HTML (html); gtk_html.PrintSetMaster (pj); Gnome.PrintContext ctx = pj.Context; gtk_html.Print (ctx); pj.Close (); // hello user int response = dialog.Run (); if (response == (int) PrintButtons.Cancel) { dialog.Hide (); dialog.Destroy (); return; } else if (response == (int) PrintButtons.Print) { pj.Print (); } else if (response == (int) PrintButtons.Preview) { new PrintJobPreview (pj, caption).Show (); } ctx.Close (); dialog.Hide (); dialog.Destroy (); } #endif } } mono-tools-4.2/docbrowser/WebKitHtmlRender.cs0000664000175000017500000000312612413742070023363 0ustar00directhexdirecthex00000000000000// // WebKitHtmlRender.cs: Implementation of IHtmlRender that uses WebKit // // Author: Alp Toker // using System; using System.IO; using Gtk; using WebKit; namespace Monodoc { public class WebKitHtmlRender : IHtmlRender { WebView web_view; public Widget HtmlPanel { get { return (Widget) web_view; } } string url; public string Url { get { return url; } } RootTree help_tree; public event EventHandler OnUrl; public event EventHandler UrlClicked; public WebKitHtmlRender (RootTree help_tree) { web_view = new WebView (); web_view.Show (); web_view.NavigationRequested += delegate (object sender, NavigationRequestedArgs e) { if (e.Request.Uri == "about:blank") return; url = e.Request.Uri; if (UrlClicked != null) UrlClicked (this, new EventArgs()); e.RetVal = NavigationResponse.Ignore; }; web_view.HoveringOverLink += delegate (object sender, HoveringOverLinkArgs e) { url = e.Link; if (OnUrl != null) OnUrl (this, new EventArgs ()); }; this.help_tree = help_tree; } public void JumpToAnchor (string anchor) { web_view.Open ("#" + anchor); } public void Copy () { web_view.CopyClipboard (); } public void SelectAll () { web_view.SelectAll (); } public void Render (string html) { web_view.LoadHtmlString (html, null); } public void Print (string html) { web_view.ExecuteScript ("print();"); } public bool Initialize () { return true; } public Capabilities Capabilities { get { return Capabilities.Css | Capabilities.Fonts; } } public string Name { get { return "WebKit"; } } } } mono-tools-4.2/docbrowser/Makefile.am0000664000175000017500000001037012642235713021722 0ustar00directhexdirecthex00000000000000monodocdir=$(prefix)/lib/monodoc if DMCS_PRESENT COMPILER=$(MCS) else COMPILER=$(MCS) endif SUBDIRS=theme-icons if ENABLE_GTKHTML noinst_DATA = admin.exe endif if ENABLE_GECKO GECKO_TARGET=GeckoHtmlRender.dll endif if ENABLE_GTKHTML GECKO_PRINTING_DEF="-d:USE_GTKHTML_PRINT" GTKHTML_TARGET=GtkHtmlHtmlRender.dll endif if ENABLE_WEBKIT WEBKIT_TARGET=WebKitHtmlRender.dll endif if ENABLE_MONOWEBBROWSER MONOWEBBROWSER_TARGET=MonoWebBrowserHtmlRender.dll endif CLEANFILES = browser.exe browser.exe.mdb admin.exe admin.exe.mdb $(GECKO_TARGET) $(GECKO_TARGET).mdb $(GTKHTML_TARGET) $(GTKHTML_TARGET).mdb $(WEBKIT_TARGET) $(WEBKIT_TARGET).mdb $(MONOWEBBROWSER_TARGET) $(MONOWEBBROWSER_TARGET).mdb monodoc.desktop Options.cs monodoc_DATA = browser.exe $(GECKO_TARGET) $(GTKHTML_TARGET) $(WEBKIT_TARGET) $(MONOWEBBROWSER_TARGET) DISTCLEANFILES = AssemblyInfo.cs monodoc.desktop monodoc bin_SCRIPTS = monodoc browser_sources = \ $(srcdir)/browser.cs \ $(srcdir)/list.cs \ $(srcdir)/elabel.cs \ $(srcdir)/history.cs \ $(srcdir)/editing.cs \ $(srcdir)/Contributions.cs \ $(srcdir)/XmlNodeWriter.cs \ $(srcdir)/IHtmlRender.cs \ $(srcdir)/BookmarkManager.cs \ $(srcdir)/ProgressPanel.cs browser_built_sources = AssemblyInfo.cs Options.cs geckorender_sources = \ $(srcdir)/PrintManager.cs \ $(srcdir)/GeckoHtmlRender.cs gtkhtmlrender_sources = \ $(srcdir)/PrintManager.cs \ $(srcdir)/GtkHtmlHtmlRender.cs webkitrender_sources = \ $(srcdir)/WebKitHtmlRender.cs monowebbrowserrender_sources = \ $(srcdir)/BrowserWidget.cs \ $(srcdir)/MonoWebBrowserHtmlRender.cs admin_sources = \ $(srcdir)/admin.cs \ $(srcdir)/Contributions.cs browser_assemblies = $(GTK_SHARP_LIBS) $(MONODOC_LIBS) $(GNOME_SHARP_LIBS) -r:System.Web.Services -r:System.Web # we insert gtkhtml libs if we have them for printing geckorender_assemblies = $(GTK_SHARP_LIBS) $(GTKHTML_SHARP_LIBS) $(GECKO_SHARP_LIBS) $(GNOME_SHARP_LIBS) $(MONODOC_LIBS) -r:browser.exe gtkhtmlrender_assemblies = $(GTK_SHARP_LIBS) $(GTKHTML_SHARP_LIBS) $(GNOME_SHARP_LIBS) $(MONODOC_LIBS) -r:browser.exe webkitrender_assemblies = $(GTK_SHARP_LIBS) $(WEBKIT_SHARP_LIBS) $(MONODOC_LIBS) -r:browser.exe monowebbrowserrender_assemblies = $(GTK_SHARP_LIBS) $(GNOME_SHARP_LIBS) $(MONOWEBBROWSER_LIBS) $(MONODOC_LIBS) -r:browser.exe -r:Mono.WebBrowser.dll EXTRA_DIST = \ $(browser_sources) \ $(geckorender_sources) \ $(gtkhtmlrender_sources) \ $(monowebbrowserrender_sources) \ $(webkitrender_sources) \ monodoc.desktop.in \ admin.cs \ admin.glade \ browser.glade \ monodoc.png \ AssemblyInfo.cs.in \ README.ADMIN # admin hardcodes GTKHTML for now. if ENABLE_GTKHTML admin.exe: $(admin_sources) $(srcdir)/admin.glade $(COMPILER) -debug -out:admin.exe $(admin_sources) -resource:$(srcdir)/admin.glade,admin.glade $(browser_assemblies) $(GTKHTML_SHARP_LIBS) -r:System.Drawing endif browser.exe: $(browser_sources) $(browser_built_sources) $(srcdir)/browser.glade $(srcdir)/monodoc.png $(COMPILER) -debug -out:browser.exe $(browser_sources) $(browser_built_sources) -resource:$(srcdir)/monodoc.png,monodoc.png -resource:$(srcdir)/browser.glade,browser.glade $(browser_assemblies) $(CSHARP_FLAGS) GeckoHtmlRender.dll : $(geckorender_sources) browser.exe $(COMPILER) -debug -target:library -out:$@ $(geckorender_sources) $(geckorender_assemblies) $(GECKO_PRINTING_DEF) $(CSHARP_FLAGS) GtkHtmlHtmlRender.dll : $(gtkhtmlrender_sources) browser.exe $(COMPILER) -debug -target:library -out:$@ $(gtkhtmlrender_sources) $(gtkhtmlrender_assemblies) $(CSHARP_FLAGS) WebKitHtmlRender.dll : $(webkitrender_sources) browser.exe $(COMPILER) -debug -target:library -out:$@ $(webkitrender_sources) $(webkitrender_assemblies) $(CSHARP_FLAGS) MonoWebBrowserHtmlRender.dll : $(monowebbrowserrender_sources) browser.exe $(COMPILER) -debug -target:library -out:$@ $(monowebbrowserrender_sources) $(monowebbrowserrender_assemblies) $(CSHARP_FLAGS) Options.cs: cp `pkg-config --variable=Sources mono-options` . b: browser.exe MONO_PATH=. $(RUNTIME) --debug browser.exe c: admin.exe MONO_PATH=. $(RUNTIME) --debug admin.exe desktopdir = $(datadir)/applications desktop_DATA = monodoc.desktop monodoc.desktop: monodoc.desktop.in sed -e "s|\@bindir\@|$(bindir)|" $< > $@ pixmapdir = $(datadir)/pixmaps pixmap_DATA = monodoc.png mono-tools-4.2/po/0000775000175000017500000000000012642235741016133 5ustar00directhexdirecthex00000000000000mono-tools-4.2/po/ChangeLog0000664000175000017500000000204412413742070017677 0ustar00directhexdirecthex000000000000002010-05-11 Andrew Jorgensen * POTFILES.in: Remove gnunit files (since gnunit got removed) 2005-05-31 Raja R Harinath * POTFILES.in: Replace 'monodoc-browser/' with 'docbrowser/'. 2004-08-05 Martin Willemoes Hansen * ca.po: Updated to use msg_id: translator_credits * da.po: Ditto * es.po: Ditto * fr.po: Ditto 2004-05-30 Jordi Mas * po/ca.po. Catalan localisation 2004-05-29 Gonzalo Paniagua Javier * po/da.po: * po/es.po: * po/fr.po: updated. 2004-05-28 Martin Willemoes Hansen * da.po: Converted from strings.da.txt * es.po: Converted from strings.es.txt * fr.po: Converted from strings.fr.txt 2004-01-31 Sebastien Pouliot * strings.fr.txt: Updated with new strings. 2003-05-04 Gonzalo Paniagua Javier * ChangeLog: added. * README: some notes on translations. * strings.da.txt: Danish strings from Martin Willemoes Hansen. mono-tools-4.2/po/LINGUAS0000664000175000017500000000007712413742070017156 0ustar00directhexdirecthex00000000000000# please keep this list sorted alphabeticallyca da es fr pt_BR mono-tools-4.2/po/pt_BR.po0000664000175000017500000003630112413742070017476 0ustar00directhexdirecthex00000000000000# Mono Tools Portuguese (Brazilian) translation # Copyright (C) 2004, Maurício de Lemos Rodrigues Collares Neto # # This file is distributed under the same license as the MonoDoc package. # msgid "" msgstr "" "Project-Id-Version: Mono Tools\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-01-22 17:13-0500\n" "PO-Revision-Date: 2004-07-06 00:13-0300\n" "Last-Translator: Maurício de Lemos Rodrigues Collares Neto \n" "Language-Team: Maurício de Lemos Rodrigues Collares Neto \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" #: gnunit/src/AssemblyStore.cs:304 msgid "Already running some test(s)." msgstr "" #: gnunit/src/AssemblyStore.cs:587 msgid "Warning: unexpected combination." msgstr "" #: gnunit/src/AssemblyStore.cs:596 #, csharp-format msgid "Don't know anything about {0}" msgstr "" #: gnunit/src/FileDialog.cs:26 msgid "Select an assembly to load" msgstr "" #: gnunit/src/nunit-gtk.glade:10 msgid "Mono NUnit2 GUI" msgstr "" #: gnunit/src/nunit-gtk.glade:72 msgid "_Recent assemblies" msgstr "" #: gnunit/src/nunit-gtk.glade:92 msgid "_Clear recent" msgstr "" #: gnunit/src/nunit-gtk.glade:165 msgid "Enable/disable by category" msgstr "" #: gnunit/src/nunit-gtk.glade:166 msgid "_Categories" msgstr "" #: gnunit/src/nunit-gtk.glade:219 msgid "Open assembly" msgstr "" #: gnunit/src/nunit-gtk.glade:220 msgid "Open" msgstr "" #: gnunit/src/nunit-gtk.glade:234 msgid "Save results to a XML file" msgstr "" #: gnunit/src/nunit-gtk.glade:235 #, fuzzy msgid "Save As" msgstr "_Salvar" #: gnunit/src/nunit-gtk.glade:249 msgid "Run selected test fixture(s)" msgstr "" #: gnunit/src/nunit-gtk.glade:250 gnunit/src/nunit-gtk.glade:516 msgid "Run" msgstr "" #: gnunit/src/nunit-gtk.glade:265 docbrowser/browser.glade:1538 #: docbrowser/browser.glade:1917 docbrowser/browser.glade:2208 #: docbrowser/browser.glade:2557 msgid "Cancel" msgstr "Cancelar" #: gnunit/src/nunit-gtk.glade:266 msgid "Stop" msgstr "" #: gnunit/src/nunit-gtk.glade:280 msgid "Exit program" msgstr "" #: gnunit/src/nunit-gtk.glade:281 docbrowser/browser.glade:138 msgid "Quit" msgstr "Sair" #: gnunit/src/nunit-gtk.glade:390 msgid "Test: " msgstr "" #: gnunit/src/nunit-gtk.glade:588 msgid "Errors and failures" msgstr "" #: gnunit/src/nunit-gtk.glade:641 msgid "Tests not run" msgstr "" #: gnunit/src/nunit-gtk.glade:699 msgid "Standard error" msgstr "" #: gnunit/src/nunit-gtk.glade:757 msgid "Standard out" msgstr "" #: gnunit/src/nunit-gtk.glade:815 gnunit/src/main.cs:686 msgid "Error" msgstr "" #: gnunit/src/nunit-gtk.glade:904 #, fuzzy msgid "label" msgstr "label16" #: gnunit/src/nunit-gtk.glade:936 gnunit/src/main.cs:104 msgid "Show details >>" msgstr "" #: gnunit/src/nunit-gtk.glade:1009 msgid "Error details" msgstr "" #: gnunit/src/nunit-gtk.glade:1056 msgid "File exists. Overwrite?" msgstr "" #: gnunit/src/nunit-gtk.glade:1084 msgid "Don't save results" msgstr "" #: gnunit/src/nunit-gtk.glade:1098 msgid "Save results" msgstr "" #: gnunit/src/main.cs:37 #, csharp-format msgid "File {0} exists." msgstr "" #: gnunit/src/main.cs:38 msgid "Do you want to overwrite it?" msgstr "" #: gnunit/src/main.cs:107 msgid "Hide details <<" msgstr "" #: gnunit/src/main.cs:200 msgid "Uncategorized" msgstr "" #: gnunit/src/main.cs:408 msgid "No assembly loaded." msgstr "" #: gnunit/src/main.cs:434 #, csharp-format msgid "Loading {0}..." msgstr "" #: gnunit/src/main.cs:546 #, csharp-format msgid "Loading test {0} of {1}" msgstr "" #: gnunit/src/main.cs:557 msgid "Error loading assembly" msgstr "" #: gnunit/src/main.cs:558 #, csharp-format msgid "Error loading '{0}'" msgstr "" #: gnunit/src/main.cs:608 msgid "translator_credits" msgstr "" #: gnunit/src/main.cs:630 msgid "You have to select a test to run." msgstr "" #: gnunit/src/main.cs:660 msgid "No test results available" msgstr "" #: gnunit/src/main.cs:661 msgid "You must run some tests in order to get results to save." msgstr "" #: gnunit/src/main.cs:667 msgid "Save results to..." msgstr "" #: gnunit/src/main.cs:676 msgid "Results not saved." msgstr "" #: gnunit/src/main.cs:687 msgid "There has been an error saving the results.\n" msgstr "" #: gnunit/src/main.cs:688 msgid "Do you have correct permissions to write to that file?" msgstr "" #: gnunit/src/main.cs:696 #, csharp-format msgid "Results saved to {0}" msgstr "" #: gnunit/src/main.cs:774 #, csharp-format msgid "Tests (assertions): {0} ({3}) Ignored: {1} Failures: {2}" msgstr "" #: gnunit/src/main.cs:952 msgid "Running tests..." msgstr "" #: gnunit/src/main.cs:995 msgid "Cancelled on user request." msgstr "" #: gnunit/src/main.cs:1033 #, csharp-format msgid "{0} tests loaded." msgstr "" #: gnunit/src/main.cs:1051 #, csharp-format msgid "Elapsed time: {0}" msgstr "" #: gnunit/src/main.cs:1061 msgid "Unhandled Exception" msgstr "" #: gnunit/src/main.cs:1061 msgid "There has been an unhandled exception.\n" msgstr "" #: gnunit/src/main.cs:1062 msgid "The program will terminate now." msgstr "" #: docbrowser/browser.glade:8 msgid "Mono Documentation Library" msgstr "Biblioteca de documentação do Mono" #: docbrowser/browser.glade:35 msgid "_File" msgstr "_Arquivo" #: docbrowser/browser.glade:44 msgid "New _Tab" msgstr "" #: docbrowser/browser.glade:66 #, fuzzy msgid "_Lookup URL..." msgstr "_Procurar URL" #: docbrowser/browser.glade:88 msgid "_Print..." msgstr "" #: docbrowser/browser.glade:116 #, fuzzy msgid "_Close Tab" msgstr "_Fechar" #: docbrowser/browser.glade:164 msgid "_Edit" msgstr "_Editar" #: docbrowser/browser.glade:172 msgid "_Cut" msgstr "" #: docbrowser/browser.glade:194 msgid "_Copy" msgstr "_Copiar" #: docbrowser/browser.glade:216 msgid "_Paste" msgstr "" #: docbrowser/browser.glade:244 msgid "Select All" msgstr "Selecionar tudo" #: docbrowser/browser.glade:258 msgid "_View" msgstr "E_xibir" #: docbrowser/browser.glade:267 msgid "Collapse All" msgstr "Contrair todos" #: docbrowser/browser.glade:276 msgid "Show Inherited Members" msgstr "Exibir membros herdados" #: docbrowser/browser.glade:286 msgid "Show Comments" msgstr "Exibir comentários" #: docbrowser/browser.glade:300 msgid "_Bookmarks" msgstr "_Marcadores" #: docbrowser/browser.glade:315 #, fuzzy msgid "_Contributing" msgstr "_Enviar contribuições" #: docbrowser/browser.glade:323 #, fuzzy msgid "_Upload Contributions..." msgstr "_Enviar contribuições" #: docbrowser/browser.glade:345 msgid "_View Contribution Statistics..." msgstr "" #: docbrowser/browser.glade:372 msgid "Edit Mode" msgstr "" #: docbrowser/browser.glade:386 msgid "_Help" msgstr "A_juda" #: docbrowser/browser.glade:395 #, fuzzy msgid "About..." msgstr "Sobre" #: docbrowser/browser.glade:548 msgid "n/a" msgstr "n/d" #: docbrowser/browser.glade:657 msgid "_Contents" msgstr "_Conteúdo" #: docbrowser/browser.glade:721 msgid "_Index" msgstr "_Índice" #: docbrowser/browser.glade:784 msgid "_Search" msgstr "_Busca" #: docbrowser/browser.glade:856 msgid "About monodoc" msgstr "Sobre o monodoc" #: docbrowser/browser.glade:907 msgid "" "monodoc: The Mono Documentation Library viewer" msgstr "" "monodoc: O visualizador da Bibiloteca de " "Documentação do Mono" #: docbrowser/browser.glade:928 #, fuzzy msgid "Version " msgstr "Status: " #: docbrowser/browser.glade:970 #, fuzzy msgid "" "Authors:\n" " Miguel de Icaza (miguel@ximian.com)\n" " Duncan Mak (duncan@ximian.com)\n" " Joshua Tauberer (tauberer@for.net)\n" " Lee Malabone\n" " Philip Van Hoof\n" " Johannes Roith (johannes@jroith.de)\n" " Alp Toker (alp@atoker.com)\n" " Piers Haken\n" " John Luke (jluke@cfl.rr.com)\n" " Ben Maurer\n" " Mario Sopena Novales (mario.sopena@gmail.com)\n" " Rafael Ferreira (raf@ophion.org)\n" "\t " msgstr "" "Autores:\n" " Miguel de Icaza (miguel@ximian.com)\n" " Duncan Mak (duncan@ximian.com)\n" " Joshua Tauberer (tauberer@for.net)\n" " Lee Malabone\n" " Philip Van Hoof\n" " Johannes Roith (johannes@jroith.de)\n" " Alp Toker (alp@atoker.com)\n" " Piers Haken\n" " John Luke (jluke@cfl.rr.com)\n" " Ben Maurer" #: docbrowser/browser.glade:1005 msgid "" "Plugins:\n" " ECMA Documentation.\n" " Mono XML Documentation.\n" " Mono Handbook.\n" " Manual Pages.\n" " Compiler Errors.\n" " ECMA C# Specification." msgstr "" "Plugins:\n" " ECMA Documentation.\n" " Mono XML Documentation.\n" " Mono Handbook.\n" " Manual Pages.\n" " Compiler Errors.\n" " ECMA C# Specification." #: docbrowser/browser.glade:1080 #, fuzzy msgid "Lookup URL" msgstr "_Procurar URL" #: docbrowser/browser.glade:1103 #, fuzzy msgid "_URL to lookup:" msgstr "_URL a procurar:" #: docbrowser/browser.glade:1132 docbrowser/browser.glade:1360 #: docbrowser/browser.glade:1746 docbrowser/browser.glade:2726 #: docbrowser/browser.glade:2749 docbrowser/browser.glade:2798 msgid "*" msgstr "*" #: docbrowser/browser.glade:1135 msgid "lookup_entry" msgstr "lookup_entry" #: docbrowser/browser.glade:1183 msgid "Login configuration" msgstr "Configuração de login" #: docbrowser/browser.glade:1215 msgid "" "You can edit the contents of the API documentation in MonoDoc and " "contribute\n" "those back. To do this you must agree to relicense your updates under the " "terms\n" "of the MIT X11 Open Source License and register your email address with the\n" "documentation service.\n" "\n" "If you agree, click Continue" msgstr "" "Você pode editar o conteúdo da documentação da API no MonoDoc e contribuir\n" " este de volta. Para fazer isto, você tem que concordar em re-licenciar suas " "atualizações sob os termos da licença Open Source MIT X11 e registrar seu " "endereço de email com o\n" " serviço de documentação.\n" "\n" "Se você concorda, clique em Continuar" #: docbrowser/browser.glade:1271 docbrowser/browser.glade:1432 #: docbrowser/browser.glade:1807 msgid "Continue" msgstr "Continuar" #: docbrowser/browser.glade:1300 msgid "0" msgstr "0" #: docbrowser/browser.glade:1331 msgid "_Email:" msgstr "_Email:" #: docbrowser/browser.glade:1374 msgid "xx" msgstr "xx" #: docbrowser/browser.glade:1461 msgid "1" msgstr "1" #: docbrowser/browser.glade:1486 msgid "Monodoc is requesting an account for you." msgstr "O Monodoc está requisitando uma conta para você." #: docbrowser/browser.glade:1567 msgid "2" msgstr "2" #: docbrowser/browser.glade:1592 msgid "" "Error: Monodoc encountered a failure when requesting\n" "a password for your e-mail address. Try again later." msgstr "" "Erro: O Monodoc encontrou um erro ao requisitar\n" "uma senha pro seu endereço de email. Tente de novo mais tarde." #: docbrowser/browser.glade:1628 docbrowser/browser.glade:2013 #: docbrowser/browser.glade:2102 docbrowser/browser.glade:2297 #: docbrowser/browser.glade:2387 docbrowser/browser.glade:2477 msgid "Ok" msgstr "Ok" #: docbrowser/browser.glade:1658 msgid "3" msgstr "3" #: docbrowser/browser.glade:1689 msgid "" "Once you receive your password on the mail, please enter it\n" "here:\n" msgstr "" "Quando você receber a sua senha no email, favor digitá-la\n" "aqui:\n" #: docbrowser/browser.glade:1718 msgid "Password:" msgstr "Senha:" #: docbrowser/browser.glade:1837 msgid "4" msgstr "4" #: docbrowser/browser.glade:1862 msgid "MonoDoc is logging into the server." msgstr "O MonoDoc está autenticando-se no servidor." #: docbrowser/browser.glade:1953 msgid "5" msgstr "5" #: docbrowser/browser.glade:1978 msgid "" "Congratulations! \n" "\n" "You can now contribute your changes to MonoDoc by using \n" "the File/Upload menu option." msgstr "" "Parabéns! \n" "\n" "Agora você pode contribuir suas mudanças para o MonoDoc usando \n" "a opção de menu Arquivo/Enviar contribuição." #: docbrowser/browser.glade:2043 msgid "6" msgstr "6" #: docbrowser/browser.glade:2068 msgid "" "Terminated \n" "\n" "The request to the Monodoc server has been cancelled." msgstr "" "Terminado \n" "\n" "A requisição ao servidor do Monodoc foi cancelada." #: docbrowser/browser.glade:2132 msgid "7" msgstr "7" #: docbrowser/browser.glade:2157 msgid "" "Please wait\n" "\n" "MonoDoc is checking the server version." msgstr "" "Favor esperar\n" "\n" "O MonoDoc está verificando a versão do servidor." #: docbrowser/browser.glade:2237 msgid "8" msgstr "8" #: docbrowser/browser.glade:2262 msgid "" "Communications Problem \n" "\n" "There was a communications problem when communicating\n" "with the Mono Documentation Server." msgstr "" "Problema na comunicação \n" "\n" "Houve um problema de comunicação ao tentar se comunicar\n" "com o Servidor de Documentação do Mono." #: docbrowser/browser.glade:2327 msgid "9" msgstr "9" #: docbrowser/browser.glade:2352 msgid "" "Version missmatch \n" "\n" "This version of MonoDoc is not compatible with the current Monodoc\n" "server, please upgrade your MonoDoc installation." msgstr "" "Incompatibilidade de versões \n" "\n" "Esta versão do MonoDoc não é compatível com o servidor atual do\n" "Monodoc, favor atualizar a sua instalação do MonoDoc." #: docbrowser/browser.glade:2417 msgid "10" msgstr "10" #: docbrowser/browser.glade:2442 msgid "" "Password Problem \n" "\n" "The passkey entered is incorrect. \n" "Please try again." msgstr "" "Problema com a senha \n" "\n" "A senha digitada está incorreta. \n" "Favor tentar novamente." #: docbrowser/browser.glade:2507 msgid "11" msgstr "11" #: docbrowser/browser.glade:2528 msgid "Uploading Documentation Updates - MonoDoc" msgstr "Enviando atualizações de documentação - MonoDoc" #: docbrowser/browser.glade:2583 msgid "Monodoc Documentation Updates Uploader. " msgstr "Enviador de atualizações para a documentação do MonoDoc. " #: docbrowser/browser.glade:2610 msgid "Status: " msgstr "Status: " #: docbrowser/browser.glade:2668 msgid "New Comment" msgstr "Novo comentário" #: docbrowser/browser.glade:2690 msgid "TODO: Some advise on posting here." msgstr "TODO: Alguns conselhos sobre envio aqui." #: docbrowser/browser.glade:2766 msgid "Title:" msgstr "Título:" #: docbrowser/browser.glade:2815 msgid "Comment" msgstr "Comentário" #: docbrowser/browser.glade:2841 msgid "E-Mail:" msgstr "E-Mail:" #: docbrowser/browser.glade:2867 docbrowser/browser.glade:3169 msgid "Name:" msgstr "Nome:" #: docbrowser/browser.glade:2987 #, fuzzy msgid "Manage Bookmarks" msgstr "_Marcadores" #: docbrowser/browser.glade:3071 msgid "New Folder" msgstr "" #: docbrowser/browser.glade:3136 #, fuzzy msgid "Add Bookmark" msgstr "_Adicionar marcador" #: docbrowser/browser.glade:3227 msgid "Create in:" msgstr "" #~ msgid "Editing" #~ msgstr "Edição" #~ msgid "_Edit bookmarks..." #~ msgstr "_Editar marcadores..." #~ msgid "_Look for:" #~ msgstr "_Procurar por:" #, fuzzy #~ msgid "_Search for:" #~ msgstr "_Busca" #~ msgid "Lookup" #~ msgstr "Procurar" #~ msgid "Edit bookmarks" #~ msgstr "Editar marcadores:" #~ msgid "" #~ msgstr "" #~ msgid "" #~ msgstr "" #~ msgid "<_table>" #~ msgstr "<_table>" #~ msgid "<_see...>" #~ msgstr "<_see...>" #~ msgid "<_para>" #~ msgstr "<_para>" #~ msgid "Add Note\t" #~ msgstr "Adicionar nota\t" #~ msgid "Preview" #~ msgstr "Pré-visualizar" #~ msgid "label17" #~ msgstr "label17" mono-tools-4.2/po/ca.gmo0000664000175000017500000001124712642235741017227 0ustar00directhexdirecthex00000000000000FLa|PTry 6&8 >L`w &@C HV[n    , C S b o t {  , '   !3 8U            U c ie ! $ ! :. i         -0^!u*) 5=BSXu";$Mr *)Eo#; +7?FNU]nu)+E %D(4',  =2.$?51 *73#"> <C& F;/60!A89B:-@*monodoc: The Mono Documentation Library viewerAlready running some test(s).CancelCancelled on user request.Collapse AllDo you have correct permissions to write to that file?Do you want to overwrite it?Don't know anything about {0}Don't save resultsElapsed time: {0}ErrorError detailsError loading '{0}'Error loading assemblyErrors and failuresExit programFile exists. Overwrite?Hide details <<Loading test {0} of {1}Loading {0}...Mono Documentation LibraryMono NUnit2 GUINo assembly loaded.No test results availableOkOpenOpen assemblyQuitResults not saved.Results saved to {0}RunRun selected test fixture(s)Running tests...Save AsSave resultsSave results to a XML fileSave results to...Select AllSelect an assembly to loadShow CommentsShow Inherited MembersShow details >>Standard errorStandard outStopTest: Tests not runThe program will terminate now.There has been an error saving the results. There has been an unhandled exception. Unhandled ExceptionWarning: unexpected combination.You have to select a test to run.You must run some tests in order to get results to save._Bookmarks_Clear recent_Contents_Copy_Edit_File_Help_Index_Recent assemblies_Search_Viewlabeln/a{0} tests loaded.Project-Id-Version: Mono Tools Report-Msgid-Bugs-To: POT-Creation-Date: 2008-01-22 17:13-0500 PO-Revision-Date: 2004-05-28 19:18+0200 Last-Translator: Jordi Mas i Hernàndez Language-Team: Jordi Mas i Hernàndez MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *monodoc: Visualitzador de la documentació de les biblioteques del MonoJa s'estan executant alguns testsCancel·laCancel·lat per petició de l'usuariContrau totsTeniu els permisos adequats per escriure en aquest fitxer?Voleu sobreescriure'l?No sé res de {0}No desis els resultatsTemps transcorregut: {0}ErrorDetalls de l'errorError carregant '{0}'Error carregant l'assemblyErrors i fallidesSurt del programaEl fitxer ja existeix. Voleu sobreescriure'l?Ocultar els detalls <<S'està carregant test {0} de {1}S'està carregant {0}...Documentació de les biblioteques del MonoMono NUnit2 GUINo hi ha cap assembly carregat.No hi ha resultats dels tests disponiblesD'acordObreObre un assemblySurtNo s'han desat els resultatsEls resultats s'han desat a {0}ExecutaExecuta els tests seleccionatsS'està executant els test...Anomena i desaDesa els resultatsDesa els resultats a un fitxer XMLDesa els resultats com a...Selecciona-ho totSeleccioneu un assembly per carregarMostra comentarisMostra els membres heredatsMostra els detalls >>Sortida d'errorSortida estàndardAturaTest: Tests no executatsEl programa es finalitzarà ara.Hi ha hagut un error desant els resultats Ha succeït una excepció no gestionada. Excepció no gestionadaAvís: combinació no esperada.Heu d'escollir un test per executarHeu d'exectuar alguns tests per obtenir resultats per desar_Adreçes d'interès_Buida recents_Continguts_Còpia_Edita_FitxerAj_uda_ÍndexFitxers _recents_Cerca_Visualitzacióetiquetan/d{0} tests carregats.mono-tools-4.2/po/pt_BR.gmo0000664000175000017500000001300612642235741017645 0ustar00directhexdirecthex00000000000000=S89;=?BEGIKMOQSyUoq?N;<I#P    & . 7 ? S #n ( )   B = G L W e "|  )       $ + 3 9 F J M      v$XH=G"a'7@ O [em$,=2HN_Bb(3GS   #5!+1-0%43($<*& 92. /)=,68';:7"*01101123456789Communications Problem There was a communications problem when communicating with the Mono Documentation Server.Congratulations! You can now contribute your changes to MonoDoc by using the File/Upload menu option.Error: Monodoc encountered a failure when requesting a password for your e-mail address. Try again later.Password Problem The passkey entered is incorrect. Please try again.Please wait MonoDoc is checking the server version.Plugins: ECMA Documentation. Mono XML Documentation. Mono Handbook. Manual Pages. Compiler Errors. ECMA C# Specification.Status: Terminated The request to the Monodoc server has been cancelled.Version missmatch This version of MonoDoc is not compatible with the current Monodoc server, please upgrade your MonoDoc installation.monodoc: The Mono Documentation Library viewerAbout monodocCancelCollapse AllCommentContinueE-Mail:Login configurationMono Documentation LibraryMonoDoc is logging into the server.Monodoc Documentation Updates Uploader. Monodoc is requesting an account for you.Name:New CommentOkOnce you receive your password on the mail, please enter it here: Password:QuitSelect AllShow CommentsShow Inherited MembersTODO: Some advise on posting here.Title:Uploading Documentation Updates - MonoDocYou can edit the contents of the API documentation in MonoDoc and contribute those back. To do this you must agree to relicense your updates under the terms of the MIT X11 Open Source License and register your email address with the documentation service. If you agree, click Continue_Bookmarks_Contents_Copy_Edit_Email:_File_Help_Index_Search_Viewlookup_entryn/axxProject-Id-Version: Mono Tools Report-Msgid-Bugs-To: POT-Creation-Date: 2008-01-22 17:13-0500 PO-Revision-Date: 2004-07-06 00:13-0300 Last-Translator: Maurício de Lemos Rodrigues Collares Neto Language-Team: Maurício de Lemos Rodrigues Collares Neto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=n != 1; *01101123456789Problema na comunicação Houve um problema de comunicação ao tentar se comunicar com o Servidor de Documentação do Mono.Parabéns! Agora você pode contribuir suas mudanças para o MonoDoc usando a opção de menu Arquivo/Enviar contribuição.Erro: O Monodoc encontrou um erro ao requisitar uma senha pro seu endereço de email. Tente de novo mais tarde.Problema com a senha A senha digitada está incorreta. Favor tentar novamente.Favor esperar O MonoDoc está verificando a versão do servidor.Plugins: ECMA Documentation. Mono XML Documentation. Mono Handbook. Manual Pages. Compiler Errors. ECMA C# Specification.Status: Terminado A requisição ao servidor do Monodoc foi cancelada.Incompatibilidade de versões Esta versão do MonoDoc não é compatível com o servidor atual do Monodoc, favor atualizar a sua instalação do MonoDoc.monodoc: O visualizador da Bibiloteca de Documentação do MonoSobre o monodocCancelarContrair todosComentárioContinuarE-Mail:Configuração de loginBiblioteca de documentação do MonoO MonoDoc está autenticando-se no servidor.Enviador de atualizações para a documentação do MonoDoc. O Monodoc está requisitando uma conta para você.Nome:Novo comentárioOkQuando você receber a sua senha no email, favor digitá-la aqui: Senha:SairSelecionar tudoExibir comentáriosExibir membros herdadosTODO: Alguns conselhos sobre envio aqui.Título:Enviando atualizações de documentação - MonoDocVocê pode editar o conteúdo da documentação da API no MonoDoc e contribuir este de volta. Para fazer isto, você tem que concordar em re-licenciar suas atualizações sob os termos da licença Open Source MIT X11 e registrar seu endereço de email com o serviço de documentação. Se você concorda, clique em Continuar_Marcadores_Conteúdo_Copiar_Editar_Email:_ArquivoA_juda_Índice_BuscaE_xibirlookup_entryn/dxxmono-tools-4.2/po/Makefile.in.in0000644000175000017500000001760412642235730020611 0ustar00directhexdirecthex00000000000000# Makefile for program source directory in GNU NLS utilities package. # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper # # This file file be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License # but which still want to provide support for the GNU gettext functionality. # Please note that the actual code is *not* freely available. # # - Modified by Owen Taylor to use GETTEXT_PACKAGE # instead of PACKAGE and to look for po2tbl in ./ not in intl/ # # - Modified by jacob berkman to install # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ PACKAGE = @PACKAGE@ VERSION = @VERSION@ SHELL = @SHELL@ @SET_MAKE@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ datadir = @datadir@ libdir = @libdir@ localedir = $(libdir)/locale gnulocaledir = $(datadir)/locale gettextsrcdir = $(datadir)/glib-2.0/gettext/po subdir = po INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ MKINSTALLDIRS = mkdir -p CC = @CC@ GENCAT = @GENCAT@ GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ XGETTEXT = @XGETTEXT@ MSGMERGE = msgmerge DEFS = @DEFS@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ INCLUDES = -I.. -I$(top_srcdir)/intl COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) SOURCES = POFILES = @POFILES@ GMOFILES = @GMOFILES@ DISTFILES = LINGUAS ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \ $(POFILES) $(GMOFILES) $(SOURCES) POTFILES = \ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ INSTOBJEXT = @INSTOBJEXT@ .SUFFIXES: .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat .c.o: $(COMPILE) $< .po.pox: $(MAKE) $(GETTEXT_PACKAGE).pot $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox .po.mo: $(MSGFMT) -o $@ $< .po.gmo: $(AM_V_GEN) file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ && rm -f $$file && $(GMSGFMT) $(MSGFMT_OPTS) -o $$file $< .po.cat: sed -f ../intl/po2msg.sed < $< > $*.msg \ && rm -f $@ && $(GENCAT) $@ $*.msg all: all-@USE_NLS@ all-yes: $(CATALOGS) all-no: $(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) \ --msgid-bugs-address='http://bugzilla.gnome.org/enter_bug.cgi?product=glib&keywords=I18N+L10N&component=general' \ --add-comments --keyword=_ --keyword=N_ \ --keyword=C_:1c,2 \ --keyword=NC_:1c,2 \ --keyword=g_dcgettext:2 \ --keyword=g_dngettext:2,3 \ --keyword=g_dpgettext2:2c,3 \ --flag=N_:1:pass-c-format \ --flag=C_:2:pass-c-format \ --flag=NC_:2:pass-c-format \ --flag=g_dngettext:2:pass-c-format \ --flag=g_strdup_printf:1:c-format \ --flag=g_string_printf:2:c-format \ --flag=g_string_append_printf:2:c-format \ --flag=g_error_new:3:c-format \ --flag=g_set_error:4:c-format \ --flag=g_markup_printf_escaped:1:c-format \ --flag=g_log:3:c-format \ --flag=g_print:1:c-format \ --flag=g_printerr:1:c-format \ --flag=g_printf:1:c-format \ --flag=g_fprintf:2:c-format \ --flag=g_sprintf:2:c-format \ --flag=g_snprintf:3:c-format \ --flag=g_scanner_error:2:c-format \ --flag=g_scanner_warn:2:c-format \ $(POTFILES) \ && test ! -f $(GETTEXT_PACKAGE).po \ || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \ && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot ) install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ case "$$cat" in \ *.gmo) destdir=$(gnulocaledir);; \ *) destdir=$(localedir);; \ esac; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ $(MKINSTALLDIRS) $$dir; \ if test -r $$cat; then \ $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ else \ $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ echo "installing $(srcdir)/$$cat as" \ "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ fi; \ if test -r $$cat.m; then \ $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ else \ if test -r $(srcdir)/$$cat.m ; then \ $(INSTALL_DATA) $(srcdir)/$$cat.m \ $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ echo "installing $(srcdir)/$$cat as" \ "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ else \ true; \ fi; \ fi; \ done if test "$(PACKAGE)" = "glib"; then \ $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ else \ : ; \ fi # Define this as empty until I found a useful application. installcheck: uninstall: catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ done if test "$(PACKAGE)" = "glib"; then \ rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ fi check: all dvi info tags TAGS ID: mostlyclean: rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp rm -fr *.o clean: mostlyclean distclean: clean rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f $(GMOFILES) distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir) dist distdir: $(DISTFILES) dists="$(DISTFILES)"; \ for file in $$dists; do \ ln $(srcdir)/$$file $(distdir) 2> /dev/null \ || cp -p $(srcdir)/$$file $(distdir); \ done update-po: Makefile $(MAKE) $(GETTEXT_PACKAGE).pot tmpdir=`pwd`; \ cd $(srcdir); \ catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ echo "$$lang:"; \ if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \ if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ :; \ else \ echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ rm -f $$tmpdir/$$lang.new.po; \ exit 1; \ fi; \ fi; \ else \ echo "msgmerge for $$cat failed!"; \ rm -f $$tmpdir/$$lang.new.po; \ fi; \ done # POTFILES is created from POTFILES.in by stripping comments, empty lines # and Intltool tags (enclosed in square brackets), and appending a full # relative path to them POTFILES: POTFILES.in ( if test 'x$(srcdir)' != 'x.'; then \ posrcprefix='$(top_srcdir)/'; \ else \ posrcprefix="../"; \ fi; \ rm -f $@-t $@ \ && (sed -e '/^#/d' \ -e "s/^\[.*\] +//" \ -e '/^[ ]*$$/d' \ -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ | sed -e '$$s/\\$$//') > $@-t \ && chmod a-w $@-t \ && mv $@-t $@ ) Makefile: Makefile.in.in ../config.status POTFILES cd .. \ && $(SHELL) ./config.status $(subdir)/$@.in # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mono-tools-4.2/po/da.gmo0000664000175000017500000000732112642235741017226 0ustar00directhexdirecthex000000000000006I|60Mk~  0?Oc}  2M] ly~ ,' !=8_ K0 J k r $        0 Q f u    "  " ( - ; B X n s      !  . : ? F X -q *   *B+ n{&5 23 "  64,#./)1 '&- $!%*0(+File {0} exists.Already running some test(s).CancelCancelled on user request.Do you have correct permissions to write to that file?Do you want to overwrite it?Don't know anything about {0}Don't save resultsElapsed time: {0}ErrorError detailsError loading '{0}'Error loading assemblyErrors and failuresExit programFile exists. Overwrite?Hide details <<Loading test {0} of {1}Loading {0}...Mono NUnit2 GUINo assembly loaded.No test results availableOpenOpen assemblyQuitResults not saved.Results saved to {0}RunRun selected test fixture(s)Running tests...Save AsSave resultsSave results to a XML fileSave results to...Select an assembly to loadShow details >>Standard errorStandard outStopTest: Tests not runThe program will terminate now.There has been an error saving the results. There has been an unhandled exception. Unhandled ExceptionWarning: unexpected combination.You have to select a test to run.You must run some tests in order to get results to save._Clear recent_Recent assemblieslabeltranslator_credits{0} tests loaded.Project-Id-Version: GNUnit Report-Msgid-Bugs-To: POT-Creation-Date: 2008-01-22 17:13-0500 PO-Revision-Date: 2004-08-05 11:11+0200 Last-Translator: Martin Willemoes Hansen Language-Team: Martin Willemoes Hansen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fil {0} eksistere.Udfører allerede nogle test(s).AfbrydBrugeren valgte at afbryde.Har du skrive rettigheder til filen?Vil du overskrive den?Ved intet om {0}Gem ikke resultaterTid gået: {0}FejlFejl deltaljerFejl ved indlæsning af '{0}'Fejl ved indlæsning af assemblyFejl og mislykningerAfslut programFil eksistere. Overskriv?Skjul detaljerIndlæser test {0} af {1}Indlæser {0}...Mono grafiskbrugerflade for NUnit2Ingen assembly indlæst.Ingen test resultater tilgængeligÅbnÅbn assemblyAfslutResultatet ikke gemt.Resultat gemt til {0}KørKør udvalgte testfiksering(er)Udfører tests...Gem somGem resultaterGem resultater til en XML filGem resultatet i...Vælg en assembly til indlæsningVis detaljer >>Standard fejlStandard udStopTest: Ikke kørte testsProgrammet afslutter nu.Der opstod en fejl, med at gemme resultatet. Der har været en uhåndteret undtagelse. Uhåndteret undtagelseAdvarsel: uventet kombination.Du mangler at vælge en test til udførselDu mangler at udfører nogle tests, for at kunne gemme resultatet._Ryd seneste_Seneste assembliesetiketMartin Willemoes Hansen {0} tests indlæst.mono-tools-4.2/po/es.gmo0000664000175000017500000000731712642235741017256 0ustar00directhexdirecthex000000000000004G\xy6%8J P^r  ' ,:?Rgk  #( /=,]' !8  BPci|W  # !, /N ~         #2 V j  &    "  : C d x  #      * 2 9 M ,k )  & <#`q,1!#& '*/$ 4)  ,%30 (2.-"+File {0} exists.Already running some test(s).CancelCancelled on user request.Do you have correct permissions to write to that file?Do you want to overwrite it?Don't save resultsElapsed time: {0}ErrorError detailsError loading '{0}'Error loading assemblyErrors and failuresExit programFile exists. Overwrite?Hide details <<Loading test {0} of {1}Loading {0}...No assembly loaded.No test results availableOpenOpen assemblyQuitResults not saved.Results saved to {0}RunRun selected test fixture(s)Running tests...Save AsSave resultsSave results to a XML fileSave results to...Select an assembly to loadShow details >>Standard errorStandard outStopTest: Tests not runThe program will terminate now.There has been an error saving the results. There has been an unhandled exception. Unhandled ExceptionWarning: unexpected combination.You have to select a test to run.You must run some tests in order to get results to save._Clear recent_Recent assemblieslabeltranslator_credits{0} tests loaded.Project-Id-Version: GNUnit Report-Msgid-Bugs-To: POT-Creation-Date: 2008-01-22 17:13-0500 PO-Revision-Date: 2004-08-05 11:14+0200 Last-Translator: Gonzalo Paniagua Javier Language-Team: Gonzalo Paniagua Javier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El fichero {0} existe.Ya se están ejecutando tests.CancelarCancelado a petición del usuario¿Tiene permiso de escritura sobre ese fichero?¿Lo quiere sobreescribir?No guardar resultadosTiempo transcurrido: {0}ErrorDetalles del errorError cargando '{0}'Error cargando assemblyErrores y fallosSalir del programaEl fichero existe. ¿Sobreescribir?Ocultar detalles <<Cargando test {0} de {1}Cargando {0}...No hay ningún assembly cargado.No hay resultados de tests disponiblesAbrirCarga un ensambladoSalirNo se han guardado los resultados.Resultados guardados en {0}EjecutarEjecutar los tests seleccionadosEjecutando tests...Guardar comoGuardar resultadosGuardar resultados a un fichero XMLGuardar resultados como...Elija un assembly para cargarMostrar detalles >>Salida de errorSalida estándarDetenerTest: Tests no ejecutadosEl programa terminará ahora.Ocurrió un error guardando los resultados. Ha ocurrido una excepción no controlada Excepción no controladaAviso: combinación no esperada.Debe seleccionar un test para ejecutarDebe ejecutar algún test para tener resultados que guardar._Borra recientesFicheros _recientesetiquetaGonzalo Paniagua Javier {0} tests cargados.mono-tools-4.2/po/ca.po0000664000175000017500000003325112413742070017054 0ustar00directhexdirecthex00000000000000# Mono Tools # Copyright (C) 2004 Jordi Mas i Hernàndez # This file is distributed under the same license as the GNUnit package. # Jordi Mas i Hernàndez , 2004. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Mono Tools\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-01-22 17:13-0500\n" "PO-Revision-Date: 2004-05-28 19:18+0200\n" "Last-Translator: Jordi Mas i Hernàndez \n" "Language-Team: Jordi Mas i Hernàndez \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: gnunit/src/AssemblyStore.cs:304 msgid "Already running some test(s)." msgstr "Ja s'estan executant alguns tests" #: gnunit/src/AssemblyStore.cs:587 msgid "Warning: unexpected combination." msgstr "Avís: combinació no esperada." #: gnunit/src/AssemblyStore.cs:596 #, csharp-format msgid "Don't know anything about {0}" msgstr "No sé res de {0}" #: gnunit/src/FileDialog.cs:26 msgid "Select an assembly to load" msgstr "Seleccioneu un assembly per carregar" #: gnunit/src/nunit-gtk.glade:10 msgid "Mono NUnit2 GUI" msgstr "Mono NUnit2 GUI" #: gnunit/src/nunit-gtk.glade:72 msgid "_Recent assemblies" msgstr "Fitxers _recents" #: gnunit/src/nunit-gtk.glade:92 msgid "_Clear recent" msgstr "_Buida recents" #: gnunit/src/nunit-gtk.glade:165 msgid "Enable/disable by category" msgstr "" #: gnunit/src/nunit-gtk.glade:166 msgid "_Categories" msgstr "" #: gnunit/src/nunit-gtk.glade:219 msgid "Open assembly" msgstr "Obre un assembly" #: gnunit/src/nunit-gtk.glade:220 msgid "Open" msgstr "Obre" #: gnunit/src/nunit-gtk.glade:234 msgid "Save results to a XML file" msgstr "Desa els resultats a un fitxer XML" #: gnunit/src/nunit-gtk.glade:235 msgid "Save As" msgstr "Anomena i desa" #: gnunit/src/nunit-gtk.glade:249 msgid "Run selected test fixture(s)" msgstr "Executa els tests seleccionats" #: gnunit/src/nunit-gtk.glade:250 gnunit/src/nunit-gtk.glade:516 msgid "Run" msgstr "Executa" #: gnunit/src/nunit-gtk.glade:265 docbrowser/browser.glade:1538 #: docbrowser/browser.glade:1917 docbrowser/browser.glade:2208 #: docbrowser/browser.glade:2557 msgid "Cancel" msgstr "Cancel·la" #: gnunit/src/nunit-gtk.glade:266 msgid "Stop" msgstr "Atura" #: gnunit/src/nunit-gtk.glade:280 msgid "Exit program" msgstr "Surt del programa" #: gnunit/src/nunit-gtk.glade:281 docbrowser/browser.glade:138 msgid "Quit" msgstr "Surt" #: gnunit/src/nunit-gtk.glade:390 msgid "Test: " msgstr "Test: " #: gnunit/src/nunit-gtk.glade:588 msgid "Errors and failures" msgstr "Errors i fallides" #: gnunit/src/nunit-gtk.glade:641 msgid "Tests not run" msgstr "Tests no executats" #: gnunit/src/nunit-gtk.glade:699 msgid "Standard error" msgstr "Sortida d'error" #: gnunit/src/nunit-gtk.glade:757 msgid "Standard out" msgstr "Sortida estàndard" #: gnunit/src/nunit-gtk.glade:815 gnunit/src/main.cs:686 msgid "Error" msgstr "Error" #: gnunit/src/nunit-gtk.glade:904 msgid "label" msgstr "etiqueta" #: gnunit/src/nunit-gtk.glade:936 gnunit/src/main.cs:104 msgid "Show details >>" msgstr "Mostra els detalls >>" #: gnunit/src/nunit-gtk.glade:1009 msgid "Error details" msgstr "Detalls de l'error" #: gnunit/src/nunit-gtk.glade:1056 msgid "File exists. Overwrite?" msgstr "El fitxer ja existeix. Voleu sobreescriure'l?" #: gnunit/src/nunit-gtk.glade:1084 msgid "Don't save results" msgstr "No desis els resultats" #: gnunit/src/nunit-gtk.glade:1098 msgid "Save results" msgstr "Desa els resultats" #: gnunit/src/main.cs:37 #, csharp-format msgid "File {0} exists." msgstr "" #: gnunit/src/main.cs:38 msgid "Do you want to overwrite it?" msgstr "Voleu sobreescriure'l?" #: gnunit/src/main.cs:107 msgid "Hide details <<" msgstr "Ocultar els detalls <<" #: gnunit/src/main.cs:200 msgid "Uncategorized" msgstr "" #: gnunit/src/main.cs:408 msgid "No assembly loaded." msgstr "No hi ha cap assembly carregat." #: gnunit/src/main.cs:434 #, csharp-format msgid "Loading {0}..." msgstr "S'està carregant {0}..." #: gnunit/src/main.cs:546 #, csharp-format msgid "Loading test {0} of {1}" msgstr "S'està carregant test {0} de {1}" #: gnunit/src/main.cs:557 msgid "Error loading assembly" msgstr "Error carregant l'assembly" #: gnunit/src/main.cs:558 #, csharp-format msgid "Error loading '{0}'" msgstr "Error carregant '{0}'" #: gnunit/src/main.cs:608 msgid "translator_credits" msgstr "" #: gnunit/src/main.cs:630 msgid "You have to select a test to run." msgstr "Heu d'escollir un test per executar" #: gnunit/src/main.cs:660 msgid "No test results available" msgstr "No hi ha resultats dels tests disponibles" #: gnunit/src/main.cs:661 msgid "You must run some tests in order to get results to save." msgstr "Heu d'exectuar alguns tests per obtenir resultats per desar" #: gnunit/src/main.cs:667 msgid "Save results to..." msgstr "Desa els resultats com a..." #: gnunit/src/main.cs:676 msgid "Results not saved." msgstr "No s'han desat els resultats" #: gnunit/src/main.cs:687 msgid "There has been an error saving the results.\n" msgstr "Hi ha hagut un error desant els resultats\n" #: gnunit/src/main.cs:688 msgid "Do you have correct permissions to write to that file?" msgstr "Teniu els permisos adequats per escriure en aquest fitxer?" #: gnunit/src/main.cs:696 #, csharp-format msgid "Results saved to {0}" msgstr "Els resultats s'han desat a {0}" #: gnunit/src/main.cs:774 #, fuzzy, csharp-format msgid "Tests (assertions): {0} ({3}) Ignored: {1} Failures: {2}" msgstr "Tests: {0} ignorats: {1} fallades: {2}" #: gnunit/src/main.cs:952 msgid "Running tests..." msgstr "S'està executant els test..." #: gnunit/src/main.cs:995 msgid "Cancelled on user request." msgstr "Cancel·lat per petició de l'usuari" #: gnunit/src/main.cs:1033 #, csharp-format msgid "{0} tests loaded." msgstr "{0} tests carregats." #: gnunit/src/main.cs:1051 #, csharp-format msgid "Elapsed time: {0}" msgstr "Temps transcorregut: {0}" #: gnunit/src/main.cs:1061 msgid "Unhandled Exception" msgstr "Excepció no gestionada" #: gnunit/src/main.cs:1061 msgid "There has been an unhandled exception.\n" msgstr "Ha succeït una excepció no gestionada.\n" #: gnunit/src/main.cs:1062 msgid "The program will terminate now." msgstr "El programa es finalitzarà ara." #: docbrowser/browser.glade:8 msgid "Mono Documentation Library" msgstr "Documentació de les biblioteques del Mono" #: docbrowser/browser.glade:35 msgid "_File" msgstr "_Fitxer" #: docbrowser/browser.glade:44 msgid "New _Tab" msgstr "" #: docbrowser/browser.glade:66 #, fuzzy msgid "_Lookup URL..." msgstr "_Cerca URL" #: docbrowser/browser.glade:88 msgid "_Print..." msgstr "" #: docbrowser/browser.glade:116 msgid "_Close Tab" msgstr "" #: docbrowser/browser.glade:164 msgid "_Edit" msgstr "_Edita" #: docbrowser/browser.glade:172 msgid "_Cut" msgstr "" #: docbrowser/browser.glade:194 msgid "_Copy" msgstr "_Còpia" #: docbrowser/browser.glade:216 msgid "_Paste" msgstr "" #: docbrowser/browser.glade:244 msgid "Select All" msgstr "Selecciona-ho tot" #: docbrowser/browser.glade:258 msgid "_View" msgstr "_Visualització" #: docbrowser/browser.glade:267 msgid "Collapse All" msgstr "Contrau tots" #: docbrowser/browser.glade:276 msgid "Show Inherited Members" msgstr "Mostra els membres heredats" #: docbrowser/browser.glade:286 msgid "Show Comments" msgstr "Mostra comentaris" #: docbrowser/browser.glade:300 msgid "_Bookmarks" msgstr "_Adreçes d'interès" #: docbrowser/browser.glade:315 #, fuzzy msgid "_Contributing" msgstr "_Puja les contribucions" #: docbrowser/browser.glade:323 #, fuzzy msgid "_Upload Contributions..." msgstr "_Puja les contribucions" #: docbrowser/browser.glade:345 msgid "_View Contribution Statistics..." msgstr "" #: docbrowser/browser.glade:372 msgid "Edit Mode" msgstr "" #: docbrowser/browser.glade:386 msgid "_Help" msgstr "Aj_uda" #: docbrowser/browser.glade:395 #, fuzzy msgid "About..." msgstr "Quant a " #: docbrowser/browser.glade:548 msgid "n/a" msgstr "n/d" #: docbrowser/browser.glade:657 msgid "_Contents" msgstr "_Continguts" #: docbrowser/browser.glade:721 msgid "_Index" msgstr "_Índex" #: docbrowser/browser.glade:784 msgid "_Search" msgstr "_Cerca" #: docbrowser/browser.glade:856 msgid "About monodoc" msgstr "" #: docbrowser/browser.glade:907 msgid "" "monodoc: The Mono Documentation Library viewer" msgstr "" "monodoc: Visualitzador de la documentació de " "les biblioteques del Mono" #: docbrowser/browser.glade:928 msgid "Version " msgstr "" #: docbrowser/browser.glade:970 msgid "" "Authors:\n" " Miguel de Icaza (miguel@ximian.com)\n" " Duncan Mak (duncan@ximian.com)\n" " Joshua Tauberer (tauberer@for.net)\n" " Lee Malabone\n" " Philip Van Hoof\n" " Johannes Roith (johannes@jroith.de)\n" " Alp Toker (alp@atoker.com)\n" " Piers Haken\n" " John Luke (jluke@cfl.rr.com)\n" " Ben Maurer\n" " Mario Sopena Novales (mario.sopena@gmail.com)\n" " Rafael Ferreira (raf@ophion.org)\n" "\t " msgstr "" #: docbrowser/browser.glade:1005 msgid "" "Plugins:\n" " ECMA Documentation.\n" " Mono XML Documentation.\n" " Mono Handbook.\n" " Manual Pages.\n" " Compiler Errors.\n" " ECMA C# Specification." msgstr "" #: docbrowser/browser.glade:1080 #, fuzzy msgid "Lookup URL" msgstr "_Cerca URL" #: docbrowser/browser.glade:1103 msgid "_URL to lookup:" msgstr "" #: docbrowser/browser.glade:1132 docbrowser/browser.glade:1360 #: docbrowser/browser.glade:1746 docbrowser/browser.glade:2726 #: docbrowser/browser.glade:2749 docbrowser/browser.glade:2798 msgid "*" msgstr "*" #: docbrowser/browser.glade:1135 msgid "lookup_entry" msgstr "" #: docbrowser/browser.glade:1183 msgid "Login configuration" msgstr "" #: docbrowser/browser.glade:1215 msgid "" "You can edit the contents of the API documentation in MonoDoc and " "contribute\n" "those back. To do this you must agree to relicense your updates under the " "terms\n" "of the MIT X11 Open Source License and register your email address with the\n" "documentation service.\n" "\n" "If you agree, click Continue" msgstr "" #: docbrowser/browser.glade:1271 docbrowser/browser.glade:1432 #: docbrowser/browser.glade:1807 msgid "Continue" msgstr "" #: docbrowser/browser.glade:1300 msgid "0" msgstr "" #: docbrowser/browser.glade:1331 msgid "_Email:" msgstr "" #: docbrowser/browser.glade:1374 msgid "xx" msgstr "" #: docbrowser/browser.glade:1461 msgid "1" msgstr "" #: docbrowser/browser.glade:1486 msgid "Monodoc is requesting an account for you." msgstr "" #: docbrowser/browser.glade:1567 msgid "2" msgstr "" #: docbrowser/browser.glade:1592 msgid "" "Error: Monodoc encountered a failure when requesting\n" "a password for your e-mail address. Try again later." msgstr "" #: docbrowser/browser.glade:1628 docbrowser/browser.glade:2013 #: docbrowser/browser.glade:2102 docbrowser/browser.glade:2297 #: docbrowser/browser.glade:2387 docbrowser/browser.glade:2477 msgid "Ok" msgstr "D'acord" #: docbrowser/browser.glade:1658 msgid "3" msgstr "" #: docbrowser/browser.glade:1689 msgid "" "Once you receive your password on the mail, please enter it\n" "here:\n" msgstr "" #: docbrowser/browser.glade:1718 msgid "Password:" msgstr "" #: docbrowser/browser.glade:1837 msgid "4" msgstr "" #: docbrowser/browser.glade:1862 msgid "MonoDoc is logging into the server." msgstr "" #: docbrowser/browser.glade:1953 msgid "5" msgstr "" #: docbrowser/browser.glade:1978 msgid "" "Congratulations! \n" "\n" "You can now contribute your changes to MonoDoc by using \n" "the File/Upload menu option." msgstr "" #: docbrowser/browser.glade:2043 msgid "6" msgstr "" #: docbrowser/browser.glade:2068 msgid "" "Terminated \n" "\n" "The request to the Monodoc server has been cancelled." msgstr "" #: docbrowser/browser.glade:2132 msgid "7" msgstr "" #: docbrowser/browser.glade:2157 msgid "" "Please wait\n" "\n" "MonoDoc is checking the server version." msgstr "" #: docbrowser/browser.glade:2237 msgid "8" msgstr "" #: docbrowser/browser.glade:2262 msgid "" "Communications Problem \n" "\n" "There was a communications problem when communicating\n" "with the Mono Documentation Server." msgstr "" #: docbrowser/browser.glade:2327 msgid "9" msgstr "" #: docbrowser/browser.glade:2352 msgid "" "Version missmatch \n" "\n" "This version of MonoDoc is not compatible with the current Monodoc\n" "server, please upgrade your MonoDoc installation." msgstr "" #: docbrowser/browser.glade:2417 msgid "10" msgstr "" #: docbrowser/browser.glade:2442 msgid "" "Password Problem \n" "\n" "The passkey entered is incorrect. \n" "Please try again." msgstr "" #: docbrowser/browser.glade:2507 msgid "11" msgstr "" #: docbrowser/browser.glade:2528 msgid "Uploading Documentation Updates - MonoDoc" msgstr "" #: docbrowser/browser.glade:2583 msgid "Monodoc Documentation Updates Uploader. " msgstr "" #: docbrowser/browser.glade:2610 msgid "Status: " msgstr "" #: docbrowser/browser.glade:2668 msgid "New Comment" msgstr "" #: docbrowser/browser.glade:2690 msgid "TODO: Some advise on posting here." msgstr "" #: docbrowser/browser.glade:2766 msgid "Title:" msgstr "" #: docbrowser/browser.glade:2815 msgid "Comment" msgstr "" #: docbrowser/browser.glade:2841 msgid "E-Mail:" msgstr "" #: docbrowser/browser.glade:2867 docbrowser/browser.glade:3169 msgid "Name:" msgstr "" #: docbrowser/browser.glade:2987 #, fuzzy msgid "Manage Bookmarks" msgstr "_Adreçes d'interès" #: docbrowser/browser.glade:3071 msgid "New Folder" msgstr "" #: docbrowser/browser.glade:3136 #, fuzzy msgid "Add Bookmark" msgstr "_Afegeix adreçes d'interès" #: docbrowser/browser.glade:3227 msgid "Create in:" msgstr "" #~ msgid "Editing" #~ msgstr "Editant" #~ msgid "_Edit bookmarks..." #~ msgstr "_Edita adreçes d'interès " #~ msgid "_Look for:" #~ msgstr "C_erca:" #, fuzzy #~ msgid "_Search for:" #~ msgstr "_Cerca" mono-tools-4.2/po/mono-tools.pot0000664000175000017500000001777112642235741021002 0ustar00directhexdirecthex00000000000000# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?" "product=glib&keywords=I18N+L10N&component=general\n" "POT-Creation-Date: 2016-01-03 15:18+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: ../docbrowser/browser.glade:8 msgid "Mono Documentation Library" msgstr "" #: ../docbrowser/browser.glade:35 msgid "_File" msgstr "" #: ../docbrowser/browser.glade:44 msgid "New _Tab" msgstr "" #: ../docbrowser/browser.glade:66 msgid "_Lookup URL..." msgstr "" #: ../docbrowser/browser.glade:88 msgid "_Print..." msgstr "" #: ../docbrowser/browser.glade:116 msgid "_Close Tab" msgstr "" #: ../docbrowser/browser.glade:138 msgid "Quit" msgstr "" #: ../docbrowser/browser.glade:164 msgid "_Edit" msgstr "" #: ../docbrowser/browser.glade:172 msgid "_Cut" msgstr "" #: ../docbrowser/browser.glade:194 msgid "_Copy" msgstr "" #: ../docbrowser/browser.glade:216 msgid "_Paste" msgstr "" #: ../docbrowser/browser.glade:244 msgid "Select All" msgstr "" #: ../docbrowser/browser.glade:258 msgid "_View" msgstr "" #: ../docbrowser/browser.glade:267 msgid "Collapse All" msgstr "" #: ../docbrowser/browser.glade:276 msgid "Show Inherited Members" msgstr "" #: ../docbrowser/browser.glade:286 msgid "Show Comments" msgstr "" #: ../docbrowser/browser.glade:300 msgid "_Bookmarks" msgstr "" #: ../docbrowser/browser.glade:315 msgid "_Contributing" msgstr "" #: ../docbrowser/browser.glade:323 msgid "_Upload Contributions..." msgstr "" #: ../docbrowser/browser.glade:345 msgid "_View Contribution Statistics..." msgstr "" #: ../docbrowser/browser.glade:372 msgid "Edit Mode" msgstr "" #: ../docbrowser/browser.glade:386 msgid "_Help" msgstr "" #: ../docbrowser/browser.glade:395 msgid "About..." msgstr "" #: ../docbrowser/browser.glade:548 msgid "n/a" msgstr "" #: ../docbrowser/browser.glade:657 msgid "_Contents" msgstr "" #: ../docbrowser/browser.glade:721 msgid "_Index" msgstr "" #: ../docbrowser/browser.glade:784 msgid "_Search" msgstr "" #: ../docbrowser/browser.glade:856 msgid "About monodoc" msgstr "" #: ../docbrowser/browser.glade:907 msgid "" "monodoc: The Mono Documentation Library viewer" msgstr "" #: ../docbrowser/browser.glade:928 msgid "Version " msgstr "" #: ../docbrowser/browser.glade:970 msgid "" "Authors:\n" " Miguel de Icaza (miguel@ximian.com)\n" " Duncan Mak (duncan@ximian.com)\n" " Joshua Tauberer (tauberer@for.net)\n" " Lee Malabone\n" " Philip Van Hoof\n" " Johannes Roith (johannes@jroith.de)\n" " Alp Toker (alp@atoker.com)\n" " Piers Haken\n" " John Luke (jluke@cfl.rr.com)\n" " Ben Maurer\n" " Mario Sopena Novales (mario.sopena@gmail.com)\n" " Rafael Ferreira (raf@ophion.org)\n" "\t " msgstr "" #: ../docbrowser/browser.glade:1005 msgid "" "Plugins:\n" " ECMA Documentation.\n" " Mono XML Documentation.\n" " Mono Handbook.\n" " Manual Pages.\n" " Compiler Errors.\n" " ECMA C# Specification." msgstr "" #: ../docbrowser/browser.glade:1080 msgid "Lookup URL" msgstr "" #: ../docbrowser/browser.glade:1103 msgid "_URL to lookup:" msgstr "" #: ../docbrowser/browser.glade:1132 ../docbrowser/browser.glade:1360 #: ../docbrowser/browser.glade:1746 ../docbrowser/browser.glade:2726 #: ../docbrowser/browser.glade:2749 ../docbrowser/browser.glade:2798 msgid "*" msgstr "" #: ../docbrowser/browser.glade:1135 msgid "lookup_entry" msgstr "" #: ../docbrowser/browser.glade:1183 msgid "Login configuration" msgstr "" #: ../docbrowser/browser.glade:1215 msgid "" "You can edit the contents of the API documentation in MonoDoc and " "contribute\n" "those back. To do this you must agree to relicense your updates under the " "terms\n" "of the MIT X11 Open Source License and register your email address with the\n" "documentation service.\n" "\n" "If you agree, click Continue" msgstr "" #: ../docbrowser/browser.glade:1271 ../docbrowser/browser.glade:1432 #: ../docbrowser/browser.glade:1807 msgid "Continue" msgstr "" #: ../docbrowser/browser.glade:1300 msgid "0" msgstr "" #: ../docbrowser/browser.glade:1331 msgid "_Email:" msgstr "" #: ../docbrowser/browser.glade:1374 msgid "xx" msgstr "" #: ../docbrowser/browser.glade:1461 msgid "1" msgstr "" #: ../docbrowser/browser.glade:1486 msgid "Monodoc is requesting an account for you." msgstr "" #: ../docbrowser/browser.glade:1538 ../docbrowser/browser.glade:1917 #: ../docbrowser/browser.glade:2208 ../docbrowser/browser.glade:2557 msgid "Cancel" msgstr "" #: ../docbrowser/browser.glade:1567 msgid "2" msgstr "" #: ../docbrowser/browser.glade:1592 msgid "" "Error: Monodoc encountered a failure when requesting\n" "a password for your e-mail address. Try again later." msgstr "" #: ../docbrowser/browser.glade:1628 ../docbrowser/browser.glade:2013 #: ../docbrowser/browser.glade:2102 ../docbrowser/browser.glade:2297 #: ../docbrowser/browser.glade:2387 ../docbrowser/browser.glade:2477 msgid "Ok" msgstr "" #: ../docbrowser/browser.glade:1658 msgid "3" msgstr "" #: ../docbrowser/browser.glade:1689 msgid "" "Once you receive your password on the mail, please enter it\n" "here:\n" msgstr "" #: ../docbrowser/browser.glade:1718 msgid "Password:" msgstr "" #: ../docbrowser/browser.glade:1837 msgid "4" msgstr "" #: ../docbrowser/browser.glade:1862 msgid "MonoDoc is logging into the server." msgstr "" #: ../docbrowser/browser.glade:1953 msgid "5" msgstr "" #: ../docbrowser/browser.glade:1978 msgid "" "Congratulations! \n" "\n" "You can now contribute your changes to MonoDoc by using \n" "the File/Upload menu option." msgstr "" #: ../docbrowser/browser.glade:2043 msgid "6" msgstr "" #: ../docbrowser/browser.glade:2068 msgid "" "Terminated \n" "\n" "The request to the Monodoc server has been cancelled." msgstr "" #: ../docbrowser/browser.glade:2132 msgid "7" msgstr "" #: ../docbrowser/browser.glade:2157 msgid "" "Please wait\n" "\n" "MonoDoc is checking the server version." msgstr "" #: ../docbrowser/browser.glade:2237 msgid "8" msgstr "" #: ../docbrowser/browser.glade:2262 msgid "" "Communications Problem \n" "\n" "There was a communications problem when communicating\n" "with the Mono Documentation Server." msgstr "" #: ../docbrowser/browser.glade:2327 msgid "9" msgstr "" #: ../docbrowser/browser.glade:2352 msgid "" "Version missmatch \n" "\n" "This version of MonoDoc is not compatible with the current Monodoc\n" "server, please upgrade your MonoDoc installation." msgstr "" #: ../docbrowser/browser.glade:2417 msgid "10" msgstr "" #: ../docbrowser/browser.glade:2442 msgid "" "Password Problem \n" "\n" "The passkey entered is incorrect. \n" "Please try again." msgstr "" #: ../docbrowser/browser.glade:2507 msgid "11" msgstr "" #: ../docbrowser/browser.glade:2528 msgid "Uploading Documentation Updates - MonoDoc" msgstr "" #: ../docbrowser/browser.glade:2583 msgid "Monodoc Documentation Updates Uploader. " msgstr "" #: ../docbrowser/browser.glade:2610 msgid "Status: " msgstr "" #: ../docbrowser/browser.glade:2668 msgid "New Comment" msgstr "" #: ../docbrowser/browser.glade:2690 msgid "TODO: Some advise on posting here." msgstr "" #: ../docbrowser/browser.glade:2766 msgid "Title:" msgstr "" #: ../docbrowser/browser.glade:2815 msgid "Comment" msgstr "" #: ../docbrowser/browser.glade:2841 msgid "E-Mail:" msgstr "" #: ../docbrowser/browser.glade:2867 ../docbrowser/browser.glade:3169 msgid "Name:" msgstr "" #: ../docbrowser/browser.glade:2987 msgid "Manage Bookmarks" msgstr "" #: ../docbrowser/browser.glade:3071 msgid "New Folder" msgstr "" #: ../docbrowser/browser.glade:3136 msgid "Add Bookmark" msgstr "" #: ../docbrowser/browser.glade:3227 msgid "Create in:" msgstr "" mono-tools-4.2/po/es.po0000664000175000017500000003172412413742070017103 0ustar00directhexdirecthex00000000000000# GNUnit # Copyright (C) 2003, 2004 Gonzalo Paniagua Javier # This file is distributed under the same license as the GNUnit package. # Gonzalo Paniagua Javier , 2003, 2004. # msgid "" msgstr "" "Project-Id-Version: GNUnit\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-01-22 17:13-0500\n" "PO-Revision-Date: 2004-08-05 11:14+0200\n" "Last-Translator: Gonzalo Paniagua Javier \n" "Language-Team: Gonzalo Paniagua Javier \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: gnunit/src/AssemblyStore.cs:304 msgid "Already running some test(s)." msgstr "Ya se están ejecutando tests." #: gnunit/src/AssemblyStore.cs:587 msgid "Warning: unexpected combination." msgstr "Aviso: combinación no esperada." #: gnunit/src/AssemblyStore.cs:596 #, csharp-format msgid "Don't know anything about {0}" msgstr "" #: gnunit/src/FileDialog.cs:26 msgid "Select an assembly to load" msgstr "Elija un assembly para cargar" #: gnunit/src/nunit-gtk.glade:10 msgid "Mono NUnit2 GUI" msgstr "" #: gnunit/src/nunit-gtk.glade:72 msgid "_Recent assemblies" msgstr "Ficheros _recientes" #: gnunit/src/nunit-gtk.glade:92 msgid "_Clear recent" msgstr "_Borra recientes" #: gnunit/src/nunit-gtk.glade:165 msgid "Enable/disable by category" msgstr "" #: gnunit/src/nunit-gtk.glade:166 msgid "_Categories" msgstr "" #: gnunit/src/nunit-gtk.glade:219 msgid "Open assembly" msgstr "Carga un ensamblado" #: gnunit/src/nunit-gtk.glade:220 msgid "Open" msgstr "Abrir" #: gnunit/src/nunit-gtk.glade:234 msgid "Save results to a XML file" msgstr "Guardar resultados a un fichero XML" #: gnunit/src/nunit-gtk.glade:235 msgid "Save As" msgstr "Guardar como" #: gnunit/src/nunit-gtk.glade:249 msgid "Run selected test fixture(s)" msgstr "Ejecutar los tests seleccionados" #: gnunit/src/nunit-gtk.glade:250 gnunit/src/nunit-gtk.glade:516 msgid "Run" msgstr "Ejecutar" #: gnunit/src/nunit-gtk.glade:265 docbrowser/browser.glade:1538 #: docbrowser/browser.glade:1917 docbrowser/browser.glade:2208 #: docbrowser/browser.glade:2557 msgid "Cancel" msgstr "Cancelar" #: gnunit/src/nunit-gtk.glade:266 msgid "Stop" msgstr "Detener" #: gnunit/src/nunit-gtk.glade:280 msgid "Exit program" msgstr "Salir del programa" #: gnunit/src/nunit-gtk.glade:281 docbrowser/browser.glade:138 msgid "Quit" msgstr "Salir" #: gnunit/src/nunit-gtk.glade:390 msgid "Test: " msgstr "Test: " #: gnunit/src/nunit-gtk.glade:588 msgid "Errors and failures" msgstr "Errores y fallos" #: gnunit/src/nunit-gtk.glade:641 msgid "Tests not run" msgstr "Tests no ejecutados" #: gnunit/src/nunit-gtk.glade:699 msgid "Standard error" msgstr "Salida de error" #: gnunit/src/nunit-gtk.glade:757 msgid "Standard out" msgstr "Salida estándar" #: gnunit/src/nunit-gtk.glade:815 gnunit/src/main.cs:686 msgid "Error" msgstr "Error" #: gnunit/src/nunit-gtk.glade:904 msgid "label" msgstr "etiqueta" #: gnunit/src/nunit-gtk.glade:936 gnunit/src/main.cs:104 msgid "Show details >>" msgstr "Mostrar detalles >>" #: gnunit/src/nunit-gtk.glade:1009 msgid "Error details" msgstr "Detalles del error" #: gnunit/src/nunit-gtk.glade:1056 msgid "File exists. Overwrite?" msgstr "El fichero existe. ¿Sobreescribir?" #: gnunit/src/nunit-gtk.glade:1084 msgid "Don't save results" msgstr "No guardar resultados" #: gnunit/src/nunit-gtk.glade:1098 msgid "Save results" msgstr "Guardar resultados" #: gnunit/src/main.cs:37 #, csharp-format msgid "File {0} exists." msgstr "El fichero {0} existe." #: gnunit/src/main.cs:38 msgid "Do you want to overwrite it?" msgstr "¿Lo quiere sobreescribir?" #: gnunit/src/main.cs:107 msgid "Hide details <<" msgstr "Ocultar detalles <<" #: gnunit/src/main.cs:200 msgid "Uncategorized" msgstr "" #: gnunit/src/main.cs:408 msgid "No assembly loaded." msgstr "No hay ningún assembly cargado." #: gnunit/src/main.cs:434 #, csharp-format msgid "Loading {0}..." msgstr "Cargando {0}..." #: gnunit/src/main.cs:546 #, csharp-format msgid "Loading test {0} of {1}" msgstr "Cargando test {0} de {1}" #: gnunit/src/main.cs:557 msgid "Error loading assembly" msgstr "Error cargando assembly" #: gnunit/src/main.cs:558 #, csharp-format msgid "Error loading '{0}'" msgstr "Error cargando '{0}'" #: gnunit/src/main.cs:608 msgid "translator_credits" msgstr "Gonzalo Paniagua Javier " #: gnunit/src/main.cs:630 msgid "You have to select a test to run." msgstr "Debe seleccionar un test para ejecutar" #: gnunit/src/main.cs:660 msgid "No test results available" msgstr "No hay resultados de tests disponibles" #: gnunit/src/main.cs:661 msgid "You must run some tests in order to get results to save." msgstr "Debe ejecutar algún test para tener resultados que guardar." #: gnunit/src/main.cs:667 msgid "Save results to..." msgstr "Guardar resultados como..." #: gnunit/src/main.cs:676 msgid "Results not saved." msgstr "No se han guardado los resultados." #: gnunit/src/main.cs:687 msgid "There has been an error saving the results.\n" msgstr "Ocurrió un error guardando los resultados.\n" #: gnunit/src/main.cs:688 msgid "Do you have correct permissions to write to that file?" msgstr "¿Tiene permiso de escritura sobre ese fichero?" #: gnunit/src/main.cs:696 #, csharp-format msgid "Results saved to {0}" msgstr "Resultados guardados en {0}" #: gnunit/src/main.cs:774 #, fuzzy, csharp-format msgid "Tests (assertions): {0} ({3}) Ignored: {1} Failures: {2}" msgstr "Tests: {0} Ignorados: {1} Fallos: {2}" #: gnunit/src/main.cs:952 msgid "Running tests..." msgstr "Ejecutando tests..." #: gnunit/src/main.cs:995 msgid "Cancelled on user request." msgstr "Cancelado a petición del usuario" #: gnunit/src/main.cs:1033 #, csharp-format msgid "{0} tests loaded." msgstr "{0} tests cargados." #: gnunit/src/main.cs:1051 #, csharp-format msgid "Elapsed time: {0}" msgstr "Tiempo transcurrido: {0}" #: gnunit/src/main.cs:1061 msgid "Unhandled Exception" msgstr "Excepción no controlada" #: gnunit/src/main.cs:1061 msgid "There has been an unhandled exception.\n" msgstr "Ha ocurrido una excepción no controlada\n" #: gnunit/src/main.cs:1062 msgid "The program will terminate now." msgstr "El programa terminará ahora." #: docbrowser/browser.glade:8 msgid "Mono Documentation Library" msgstr "" #: docbrowser/browser.glade:35 msgid "_File" msgstr "" #: docbrowser/browser.glade:44 msgid "New _Tab" msgstr "" #: docbrowser/browser.glade:66 msgid "_Lookup URL..." msgstr "" #: docbrowser/browser.glade:88 msgid "_Print..." msgstr "" #: docbrowser/browser.glade:116 msgid "_Close Tab" msgstr "" #: docbrowser/browser.glade:164 msgid "_Edit" msgstr "" #: docbrowser/browser.glade:172 msgid "_Cut" msgstr "" #: docbrowser/browser.glade:194 msgid "_Copy" msgstr "" #: docbrowser/browser.glade:216 msgid "_Paste" msgstr "" #: docbrowser/browser.glade:244 msgid "Select All" msgstr "" #: docbrowser/browser.glade:258 msgid "_View" msgstr "" #: docbrowser/browser.glade:267 msgid "Collapse All" msgstr "" #: docbrowser/browser.glade:276 msgid "Show Inherited Members" msgstr "" #: docbrowser/browser.glade:286 msgid "Show Comments" msgstr "" #: docbrowser/browser.glade:300 msgid "_Bookmarks" msgstr "" #: docbrowser/browser.glade:315 msgid "_Contributing" msgstr "" #: docbrowser/browser.glade:323 msgid "_Upload Contributions..." msgstr "" #: docbrowser/browser.glade:345 msgid "_View Contribution Statistics..." msgstr "" #: docbrowser/browser.glade:372 msgid "Edit Mode" msgstr "" #: docbrowser/browser.glade:386 msgid "_Help" msgstr "" #: docbrowser/browser.glade:395 msgid "About..." msgstr "" #: docbrowser/browser.glade:548 msgid "n/a" msgstr "" #: docbrowser/browser.glade:657 msgid "_Contents" msgstr "" #: docbrowser/browser.glade:721 msgid "_Index" msgstr "" #: docbrowser/browser.glade:784 msgid "_Search" msgstr "" #: docbrowser/browser.glade:856 msgid "About monodoc" msgstr "" #: docbrowser/browser.glade:907 msgid "" "monodoc: The Mono Documentation Library viewer" msgstr "" #: docbrowser/browser.glade:928 msgid "Version " msgstr "" #: docbrowser/browser.glade:970 msgid "" "Authors:\n" " Miguel de Icaza (miguel@ximian.com)\n" " Duncan Mak (duncan@ximian.com)\n" " Joshua Tauberer (tauberer@for.net)\n" " Lee Malabone\n" " Philip Van Hoof\n" " Johannes Roith (johannes@jroith.de)\n" " Alp Toker (alp@atoker.com)\n" " Piers Haken\n" " John Luke (jluke@cfl.rr.com)\n" " Ben Maurer\n" " Mario Sopena Novales (mario.sopena@gmail.com)\n" " Rafael Ferreira (raf@ophion.org)\n" "\t " msgstr "" #: docbrowser/browser.glade:1005 msgid "" "Plugins:\n" " ECMA Documentation.\n" " Mono XML Documentation.\n" " Mono Handbook.\n" " Manual Pages.\n" " Compiler Errors.\n" " ECMA C# Specification." msgstr "" #: docbrowser/browser.glade:1080 msgid "Lookup URL" msgstr "" #: docbrowser/browser.glade:1103 msgid "_URL to lookup:" msgstr "" #: docbrowser/browser.glade:1132 docbrowser/browser.glade:1360 #: docbrowser/browser.glade:1746 docbrowser/browser.glade:2726 #: docbrowser/browser.glade:2749 docbrowser/browser.glade:2798 msgid "*" msgstr "" #: docbrowser/browser.glade:1135 msgid "lookup_entry" msgstr "" #: docbrowser/browser.glade:1183 msgid "Login configuration" msgstr "" #: docbrowser/browser.glade:1215 msgid "" "You can edit the contents of the API documentation in MonoDoc and " "contribute\n" "those back. To do this you must agree to relicense your updates under the " "terms\n" "of the MIT X11 Open Source License and register your email address with the\n" "documentation service.\n" "\n" "If you agree, click Continue" msgstr "" #: docbrowser/browser.glade:1271 docbrowser/browser.glade:1432 #: docbrowser/browser.glade:1807 msgid "Continue" msgstr "" #: docbrowser/browser.glade:1300 msgid "0" msgstr "" #: docbrowser/browser.glade:1331 msgid "_Email:" msgstr "" #: docbrowser/browser.glade:1374 msgid "xx" msgstr "" #: docbrowser/browser.glade:1461 msgid "1" msgstr "" #: docbrowser/browser.glade:1486 msgid "Monodoc is requesting an account for you." msgstr "" #: docbrowser/browser.glade:1567 msgid "2" msgstr "" #: docbrowser/browser.glade:1592 msgid "" "Error: Monodoc encountered a failure when requesting\n" "a password for your e-mail address. Try again later." msgstr "" #: docbrowser/browser.glade:1628 docbrowser/browser.glade:2013 #: docbrowser/browser.glade:2102 docbrowser/browser.glade:2297 #: docbrowser/browser.glade:2387 docbrowser/browser.glade:2477 msgid "Ok" msgstr "" #: docbrowser/browser.glade:1658 msgid "3" msgstr "" #: docbrowser/browser.glade:1689 msgid "" "Once you receive your password on the mail, please enter it\n" "here:\n" msgstr "" #: docbrowser/browser.glade:1718 msgid "Password:" msgstr "" #: docbrowser/browser.glade:1837 msgid "4" msgstr "" #: docbrowser/browser.glade:1862 msgid "MonoDoc is logging into the server." msgstr "" #: docbrowser/browser.glade:1953 msgid "5" msgstr "" #: docbrowser/browser.glade:1978 msgid "" "Congratulations! \n" "\n" "You can now contribute your changes to MonoDoc by using \n" "the File/Upload menu option." msgstr "" #: docbrowser/browser.glade:2043 msgid "6" msgstr "" #: docbrowser/browser.glade:2068 msgid "" "Terminated \n" "\n" "The request to the Monodoc server has been cancelled." msgstr "" #: docbrowser/browser.glade:2132 msgid "7" msgstr "" #: docbrowser/browser.glade:2157 msgid "" "Please wait\n" "\n" "MonoDoc is checking the server version." msgstr "" #: docbrowser/browser.glade:2237 msgid "8" msgstr "" #: docbrowser/browser.glade:2262 msgid "" "Communications Problem \n" "\n" "There was a communications problem when communicating\n" "with the Mono Documentation Server." msgstr "" #: docbrowser/browser.glade:2327 msgid "9" msgstr "" #: docbrowser/browser.glade:2352 msgid "" "Version missmatch \n" "\n" "This version of MonoDoc is not compatible with the current Monodoc\n" "server, please upgrade your MonoDoc installation." msgstr "" #: docbrowser/browser.glade:2417 msgid "10" msgstr "" #: docbrowser/browser.glade:2442 msgid "" "Password Problem \n" "\n" "The passkey entered is incorrect. \n" "Please try again." msgstr "" #: docbrowser/browser.glade:2507 msgid "11" msgstr "" #: docbrowser/browser.glade:2528 msgid "Uploading Documentation Updates - MonoDoc" msgstr "" #: docbrowser/browser.glade:2583 msgid "Monodoc Documentation Updates Uploader. " msgstr "" #: docbrowser/browser.glade:2610 msgid "Status: " msgstr "" #: docbrowser/browser.glade:2668 msgid "New Comment" msgstr "" #: docbrowser/browser.glade:2690 msgid "TODO: Some advise on posting here." msgstr "" #: docbrowser/browser.glade:2766 msgid "Title:" msgstr "" #: docbrowser/browser.glade:2815 msgid "Comment" msgstr "" #: docbrowser/browser.glade:2841 msgid "E-Mail:" msgstr "" #: docbrowser/browser.glade:2867 docbrowser/browser.glade:3169 msgid "Name:" msgstr "" #: docbrowser/browser.glade:2987 msgid "Manage Bookmarks" msgstr "" #: docbrowser/browser.glade:3071 msgid "New Folder" msgstr "" #: docbrowser/browser.glade:3136 msgid "Add Bookmark" msgstr "" #: docbrowser/browser.glade:3227 msgid "Create in:" msgstr "" mono-tools-4.2/po/POTFILES.in0000664000175000017500000000003112413742070017674 0ustar00directhexdirecthex00000000000000docbrowser/browser.glade mono-tools-4.2/po/da.po0000664000175000017500000003162312413742070017056 0ustar00directhexdirecthex00000000000000# Dansk oversættelse af GNUnit. # Copyright (C) 2003 2004 Martin Willemoes Hansen # This file is distributed under the same license as the GNUnit package. # Martin Willemoes Hansen , 2003, 2004. # msgid "" msgstr "" "Project-Id-Version: GNUnit\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-01-22 17:13-0500\n" "PO-Revision-Date: 2004-08-05 11:11+0200\n" "Last-Translator: Martin Willemoes Hansen \n" "Language-Team: Martin Willemoes Hansen \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: gnunit/src/AssemblyStore.cs:304 msgid "Already running some test(s)." msgstr "Udfører allerede nogle test(s)." #: gnunit/src/AssemblyStore.cs:587 msgid "Warning: unexpected combination." msgstr "Advarsel: uventet kombination." #: gnunit/src/AssemblyStore.cs:596 #, csharp-format msgid "Don't know anything about {0}" msgstr "Ved intet om {0}" #: gnunit/src/FileDialog.cs:26 msgid "Select an assembly to load" msgstr "Vælg en assembly til indlæsning" #: gnunit/src/nunit-gtk.glade:10 msgid "Mono NUnit2 GUI" msgstr "Mono grafiskbrugerflade for NUnit2" #: gnunit/src/nunit-gtk.glade:72 msgid "_Recent assemblies" msgstr "_Seneste assemblies" #: gnunit/src/nunit-gtk.glade:92 msgid "_Clear recent" msgstr "_Ryd seneste" #: gnunit/src/nunit-gtk.glade:165 msgid "Enable/disable by category" msgstr "" #: gnunit/src/nunit-gtk.glade:166 msgid "_Categories" msgstr "" #: gnunit/src/nunit-gtk.glade:219 msgid "Open assembly" msgstr "Åbn assembly" #: gnunit/src/nunit-gtk.glade:220 msgid "Open" msgstr "Åbn" #: gnunit/src/nunit-gtk.glade:234 msgid "Save results to a XML file" msgstr "Gem resultater til en XML fil" #: gnunit/src/nunit-gtk.glade:235 msgid "Save As" msgstr "Gem som" #: gnunit/src/nunit-gtk.glade:249 msgid "Run selected test fixture(s)" msgstr "Kør udvalgte testfiksering(er)" #: gnunit/src/nunit-gtk.glade:250 gnunit/src/nunit-gtk.glade:516 msgid "Run" msgstr "Kør" #: gnunit/src/nunit-gtk.glade:265 docbrowser/browser.glade:1538 #: docbrowser/browser.glade:1917 docbrowser/browser.glade:2208 #: docbrowser/browser.glade:2557 msgid "Cancel" msgstr "Afbryd" #: gnunit/src/nunit-gtk.glade:266 msgid "Stop" msgstr "Stop" #: gnunit/src/nunit-gtk.glade:280 msgid "Exit program" msgstr "Afslut program" #: gnunit/src/nunit-gtk.glade:281 docbrowser/browser.glade:138 msgid "Quit" msgstr "Afslut" #: gnunit/src/nunit-gtk.glade:390 msgid "Test: " msgstr "Test: " #: gnunit/src/nunit-gtk.glade:588 msgid "Errors and failures" msgstr "Fejl og mislykninger" #: gnunit/src/nunit-gtk.glade:641 msgid "Tests not run" msgstr "Ikke kørte tests" #: gnunit/src/nunit-gtk.glade:699 msgid "Standard error" msgstr "Standard fejl" #: gnunit/src/nunit-gtk.glade:757 msgid "Standard out" msgstr "Standard ud" #: gnunit/src/nunit-gtk.glade:815 gnunit/src/main.cs:686 msgid "Error" msgstr "Fejl" #: gnunit/src/nunit-gtk.glade:904 msgid "label" msgstr "etiket" #: gnunit/src/nunit-gtk.glade:936 gnunit/src/main.cs:104 msgid "Show details >>" msgstr "Vis detaljer >>" #: gnunit/src/nunit-gtk.glade:1009 msgid "Error details" msgstr "Fejl deltaljer" #: gnunit/src/nunit-gtk.glade:1056 msgid "File exists. Overwrite?" msgstr "Fil eksistere. Overskriv?" #: gnunit/src/nunit-gtk.glade:1084 msgid "Don't save results" msgstr "Gem ikke resultater" #: gnunit/src/nunit-gtk.glade:1098 msgid "Save results" msgstr "Gem resultater" #: gnunit/src/main.cs:37 #, csharp-format msgid "File {0} exists." msgstr "Fil {0} eksistere." #: gnunit/src/main.cs:38 msgid "Do you want to overwrite it?" msgstr "Vil du overskrive den?" #: gnunit/src/main.cs:107 msgid "Hide details <<" msgstr "Skjul detaljer" #: gnunit/src/main.cs:200 msgid "Uncategorized" msgstr "" #: gnunit/src/main.cs:408 msgid "No assembly loaded." msgstr "Ingen assembly indlæst." #: gnunit/src/main.cs:434 #, csharp-format msgid "Loading {0}..." msgstr "Indlæser {0}..." #: gnunit/src/main.cs:546 #, csharp-format msgid "Loading test {0} of {1}" msgstr "Indlæser test {0} af {1}" #: gnunit/src/main.cs:557 msgid "Error loading assembly" msgstr "Fejl ved indlæsning af assembly" #: gnunit/src/main.cs:558 #, csharp-format msgid "Error loading '{0}'" msgstr "Fejl ved indlæsning af '{0}'" #: gnunit/src/main.cs:608 msgid "translator_credits" msgstr "Martin Willemoes Hansen " #: gnunit/src/main.cs:630 msgid "You have to select a test to run." msgstr "Du mangler at vælge en test til udførsel" #: gnunit/src/main.cs:660 msgid "No test results available" msgstr "Ingen test resultater tilgængelig" #: gnunit/src/main.cs:661 msgid "You must run some tests in order to get results to save." msgstr "Du mangler at udfører nogle tests, for at kunne gemme resultatet." #: gnunit/src/main.cs:667 msgid "Save results to..." msgstr "Gem resultatet i..." #: gnunit/src/main.cs:676 msgid "Results not saved." msgstr "Resultatet ikke gemt." #: gnunit/src/main.cs:687 msgid "There has been an error saving the results.\n" msgstr "Der opstod en fejl, med at gemme resultatet.\n" #: gnunit/src/main.cs:688 msgid "Do you have correct permissions to write to that file?" msgstr "Har du skrive rettigheder til filen?" #: gnunit/src/main.cs:696 #, csharp-format msgid "Results saved to {0}" msgstr "Resultat gemt til {0}" #: gnunit/src/main.cs:774 #, fuzzy, csharp-format msgid "Tests (assertions): {0} ({3}) Ignored: {1} Failures: {2}" msgstr "Tests: {0} Ignorerede: {1} Mislykket: {2}" #: gnunit/src/main.cs:952 msgid "Running tests..." msgstr "Udfører tests..." #: gnunit/src/main.cs:995 msgid "Cancelled on user request." msgstr "Brugeren valgte at afbryde." #: gnunit/src/main.cs:1033 #, csharp-format msgid "{0} tests loaded." msgstr "{0} tests indlæst." #: gnunit/src/main.cs:1051 #, csharp-format msgid "Elapsed time: {0}" msgstr "Tid gået: {0}" #: gnunit/src/main.cs:1061 msgid "Unhandled Exception" msgstr "Uhåndteret undtagelse" #: gnunit/src/main.cs:1061 msgid "There has been an unhandled exception.\n" msgstr "Der har været en uhåndteret undtagelse.\n" #: gnunit/src/main.cs:1062 msgid "The program will terminate now." msgstr "Programmet afslutter nu." #: docbrowser/browser.glade:8 msgid "Mono Documentation Library" msgstr "" #: docbrowser/browser.glade:35 msgid "_File" msgstr "" #: docbrowser/browser.glade:44 msgid "New _Tab" msgstr "" #: docbrowser/browser.glade:66 msgid "_Lookup URL..." msgstr "" #: docbrowser/browser.glade:88 msgid "_Print..." msgstr "" #: docbrowser/browser.glade:116 msgid "_Close Tab" msgstr "" #: docbrowser/browser.glade:164 msgid "_Edit" msgstr "" #: docbrowser/browser.glade:172 msgid "_Cut" msgstr "" #: docbrowser/browser.glade:194 msgid "_Copy" msgstr "" #: docbrowser/browser.glade:216 msgid "_Paste" msgstr "" #: docbrowser/browser.glade:244 msgid "Select All" msgstr "" #: docbrowser/browser.glade:258 msgid "_View" msgstr "" #: docbrowser/browser.glade:267 msgid "Collapse All" msgstr "" #: docbrowser/browser.glade:276 msgid "Show Inherited Members" msgstr "" #: docbrowser/browser.glade:286 msgid "Show Comments" msgstr "" #: docbrowser/browser.glade:300 msgid "_Bookmarks" msgstr "" #: docbrowser/browser.glade:315 msgid "_Contributing" msgstr "" #: docbrowser/browser.glade:323 msgid "_Upload Contributions..." msgstr "" #: docbrowser/browser.glade:345 msgid "_View Contribution Statistics..." msgstr "" #: docbrowser/browser.glade:372 msgid "Edit Mode" msgstr "" #: docbrowser/browser.glade:386 msgid "_Help" msgstr "" #: docbrowser/browser.glade:395 msgid "About..." msgstr "" #: docbrowser/browser.glade:548 msgid "n/a" msgstr "" #: docbrowser/browser.glade:657 msgid "_Contents" msgstr "" #: docbrowser/browser.glade:721 msgid "_Index" msgstr "" #: docbrowser/browser.glade:784 msgid "_Search" msgstr "" #: docbrowser/browser.glade:856 msgid "About monodoc" msgstr "" #: docbrowser/browser.glade:907 msgid "" "monodoc: The Mono Documentation Library viewer" msgstr "" #: docbrowser/browser.glade:928 msgid "Version " msgstr "" #: docbrowser/browser.glade:970 msgid "" "Authors:\n" " Miguel de Icaza (miguel@ximian.com)\n" " Duncan Mak (duncan@ximian.com)\n" " Joshua Tauberer (tauberer@for.net)\n" " Lee Malabone\n" " Philip Van Hoof\n" " Johannes Roith (johannes@jroith.de)\n" " Alp Toker (alp@atoker.com)\n" " Piers Haken\n" " John Luke (jluke@cfl.rr.com)\n" " Ben Maurer\n" " Mario Sopena Novales (mario.sopena@gmail.com)\n" " Rafael Ferreira (raf@ophion.org)\n" "\t " msgstr "" #: docbrowser/browser.glade:1005 msgid "" "Plugins:\n" " ECMA Documentation.\n" " Mono XML Documentation.\n" " Mono Handbook.\n" " Manual Pages.\n" " Compiler Errors.\n" " ECMA C# Specification." msgstr "" #: docbrowser/browser.glade:1080 msgid "Lookup URL" msgstr "" #: docbrowser/browser.glade:1103 msgid "_URL to lookup:" msgstr "" #: docbrowser/browser.glade:1132 docbrowser/browser.glade:1360 #: docbrowser/browser.glade:1746 docbrowser/browser.glade:2726 #: docbrowser/browser.glade:2749 docbrowser/browser.glade:2798 msgid "*" msgstr "" #: docbrowser/browser.glade:1135 msgid "lookup_entry" msgstr "" #: docbrowser/browser.glade:1183 msgid "Login configuration" msgstr "" #: docbrowser/browser.glade:1215 msgid "" "You can edit the contents of the API documentation in MonoDoc and " "contribute\n" "those back. To do this you must agree to relicense your updates under the " "terms\n" "of the MIT X11 Open Source License and register your email address with the\n" "documentation service.\n" "\n" "If you agree, click Continue" msgstr "" #: docbrowser/browser.glade:1271 docbrowser/browser.glade:1432 #: docbrowser/browser.glade:1807 msgid "Continue" msgstr "" #: docbrowser/browser.glade:1300 msgid "0" msgstr "" #: docbrowser/browser.glade:1331 msgid "_Email:" msgstr "" #: docbrowser/browser.glade:1374 msgid "xx" msgstr "" #: docbrowser/browser.glade:1461 msgid "1" msgstr "" #: docbrowser/browser.glade:1486 msgid "Monodoc is requesting an account for you." msgstr "" #: docbrowser/browser.glade:1567 msgid "2" msgstr "" #: docbrowser/browser.glade:1592 msgid "" "Error: Monodoc encountered a failure when requesting\n" "a password for your e-mail address. Try again later." msgstr "" #: docbrowser/browser.glade:1628 docbrowser/browser.glade:2013 #: docbrowser/browser.glade:2102 docbrowser/browser.glade:2297 #: docbrowser/browser.glade:2387 docbrowser/browser.glade:2477 msgid "Ok" msgstr "" #: docbrowser/browser.glade:1658 msgid "3" msgstr "" #: docbrowser/browser.glade:1689 msgid "" "Once you receive your password on the mail, please enter it\n" "here:\n" msgstr "" #: docbrowser/browser.glade:1718 msgid "Password:" msgstr "" #: docbrowser/browser.glade:1837 msgid "4" msgstr "" #: docbrowser/browser.glade:1862 msgid "MonoDoc is logging into the server." msgstr "" #: docbrowser/browser.glade:1953 msgid "5" msgstr "" #: docbrowser/browser.glade:1978 msgid "" "Congratulations! \n" "\n" "You can now contribute your changes to MonoDoc by using \n" "the File/Upload menu option." msgstr "" #: docbrowser/browser.glade:2043 msgid "6" msgstr "" #: docbrowser/browser.glade:2068 msgid "" "Terminated \n" "\n" "The request to the Monodoc server has been cancelled." msgstr "" #: docbrowser/browser.glade:2132 msgid "7" msgstr "" #: docbrowser/browser.glade:2157 msgid "" "Please wait\n" "\n" "MonoDoc is checking the server version." msgstr "" #: docbrowser/browser.glade:2237 msgid "8" msgstr "" #: docbrowser/browser.glade:2262 msgid "" "Communications Problem \n" "\n" "There was a communications problem when communicating\n" "with the Mono Documentation Server." msgstr "" #: docbrowser/browser.glade:2327 msgid "9" msgstr "" #: docbrowser/browser.glade:2352 msgid "" "Version missmatch \n" "\n" "This version of MonoDoc is not compatible with the current Monodoc\n" "server, please upgrade your MonoDoc installation." msgstr "" #: docbrowser/browser.glade:2417 msgid "10" msgstr "" #: docbrowser/browser.glade:2442 msgid "" "Password Problem \n" "\n" "The passkey entered is incorrect. \n" "Please try again." msgstr "" #: docbrowser/browser.glade:2507 msgid "11" msgstr "" #: docbrowser/browser.glade:2528 msgid "Uploading Documentation Updates - MonoDoc" msgstr "" #: docbrowser/browser.glade:2583 msgid "Monodoc Documentation Updates Uploader. " msgstr "" #: docbrowser/browser.glade:2610 msgid "Status: " msgstr "" #: docbrowser/browser.glade:2668 msgid "New Comment" msgstr "" #: docbrowser/browser.glade:2690 msgid "TODO: Some advise on posting here." msgstr "" #: docbrowser/browser.glade:2766 msgid "Title:" msgstr "" #: docbrowser/browser.glade:2815 msgid "Comment" msgstr "" #: docbrowser/browser.glade:2841 msgid "E-Mail:" msgstr "" #: docbrowser/browser.glade:2867 docbrowser/browser.glade:3169 msgid "Name:" msgstr "" #: docbrowser/browser.glade:2987 msgid "Manage Bookmarks" msgstr "" #: docbrowser/browser.glade:3071 msgid "New Folder" msgstr "" #: docbrowser/browser.glade:3136 msgid "Add Bookmark" msgstr "" #: docbrowser/browser.glade:3227 msgid "Create in:" msgstr "" mono-tools-4.2/po/fr.po0000664000175000017500000003132212413742070017075 0ustar00directhexdirecthex00000000000000# GNUnit. # Copyright (C) 2003, 2004 Sebastien Pouliot # This file is distributed under the same license as the GNUnit package. # Sebastien Pouliot , 2003, 2004. # msgid "" msgstr "" "Project-Id-Version: GNUnit\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-01-22 17:13-0500\n" "PO-Revision-Date: 2004-08-05 11:14+0200\n" "Last-Translator: Sebastien Pouliot \n" "Language-Team: Sebastien Pouliot \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: gnunit/src/AssemblyStore.cs:304 msgid "Already running some test(s)." msgstr "Test(s) en cours d'exécution." #: gnunit/src/AssemblyStore.cs:587 msgid "Warning: unexpected combination." msgstr "Avertissement: combinaison innattendue." #: gnunit/src/AssemblyStore.cs:596 #, csharp-format msgid "Don't know anything about {0}" msgstr "Aucune information n'est disponible sur {0}" #: gnunit/src/FileDialog.cs:26 msgid "Select an assembly to load" msgstr "Choisir un assembly à charger" #: gnunit/src/nunit-gtk.glade:10 msgid "Mono NUnit2 GUI" msgstr "" #: gnunit/src/nunit-gtk.glade:72 msgid "_Recent assemblies" msgstr "" #: gnunit/src/nunit-gtk.glade:92 msgid "_Clear recent" msgstr "" #: gnunit/src/nunit-gtk.glade:165 msgid "Enable/disable by category" msgstr "" #: gnunit/src/nunit-gtk.glade:166 msgid "_Categories" msgstr "" #: gnunit/src/nunit-gtk.glade:219 msgid "Open assembly" msgstr "" #: gnunit/src/nunit-gtk.glade:220 msgid "Open" msgstr "" #: gnunit/src/nunit-gtk.glade:234 msgid "Save results to a XML file" msgstr "" #: gnunit/src/nunit-gtk.glade:235 msgid "Save As" msgstr "" #: gnunit/src/nunit-gtk.glade:249 msgid "Run selected test fixture(s)" msgstr "" #: gnunit/src/nunit-gtk.glade:250 gnunit/src/nunit-gtk.glade:516 msgid "Run" msgstr "" #: gnunit/src/nunit-gtk.glade:265 docbrowser/browser.glade:1538 #: docbrowser/browser.glade:1917 docbrowser/browser.glade:2208 #: docbrowser/browser.glade:2557 msgid "Cancel" msgstr "" #: gnunit/src/nunit-gtk.glade:266 msgid "Stop" msgstr "" #: gnunit/src/nunit-gtk.glade:280 msgid "Exit program" msgstr "" #: gnunit/src/nunit-gtk.glade:281 docbrowser/browser.glade:138 msgid "Quit" msgstr "" #: gnunit/src/nunit-gtk.glade:390 msgid "Test: " msgstr "" #: gnunit/src/nunit-gtk.glade:588 msgid "Errors and failures" msgstr "" #: gnunit/src/nunit-gtk.glade:641 msgid "Tests not run" msgstr "" #: gnunit/src/nunit-gtk.glade:699 msgid "Standard error" msgstr "" #: gnunit/src/nunit-gtk.glade:757 msgid "Standard out" msgstr "" #: gnunit/src/nunit-gtk.glade:815 gnunit/src/main.cs:686 msgid "Error" msgstr "" #: gnunit/src/nunit-gtk.glade:904 msgid "label" msgstr "" #: gnunit/src/nunit-gtk.glade:936 gnunit/src/main.cs:104 msgid "Show details >>" msgstr "" #: gnunit/src/nunit-gtk.glade:1009 msgid "Error details" msgstr "" #: gnunit/src/nunit-gtk.glade:1056 msgid "File exists. Overwrite?" msgstr "" #: gnunit/src/nunit-gtk.glade:1084 msgid "Don't save results" msgstr "" #: gnunit/src/nunit-gtk.glade:1098 msgid "Save results" msgstr "" #: gnunit/src/main.cs:37 #, csharp-format msgid "File {0} exists." msgstr "Le fichier {0} existe." #: gnunit/src/main.cs:38 msgid "Do you want to overwrite it?" msgstr "Voulez-vous le ré-écrire?" #: gnunit/src/main.cs:107 msgid "Hide details <<" msgstr "Moins de détails <<" #: gnunit/src/main.cs:200 msgid "Uncategorized" msgstr "" #: gnunit/src/main.cs:408 msgid "No assembly loaded." msgstr "Aucun assembly n'est chargé." #: gnunit/src/main.cs:434 #, csharp-format msgid "Loading {0}..." msgstr "Chargement de {0}..." #: gnunit/src/main.cs:546 #, csharp-format msgid "Loading test {0} of {1}" msgstr "Chargement du test {0} de {1}" #: gnunit/src/main.cs:557 msgid "Error loading assembly" msgstr "Erreur lors du chargement de l'assembly" #: gnunit/src/main.cs:558 #, csharp-format msgid "Error loading '{0}'" msgstr "Erreur lors du chargement de '{0}'" #: gnunit/src/main.cs:608 msgid "translator_credits" msgstr "Sebastien Pouliot " #: gnunit/src/main.cs:630 msgid "You have to select a test to run." msgstr "Un test doit être choisi pour s'exécuter." #: gnunit/src/main.cs:660 msgid "No test results available" msgstr "Aucun résultat des tests n'est disponible" #: gnunit/src/main.cs:661 msgid "You must run some tests in order to get results to save." msgstr "Des tests doivent être exécutés avant de conserver les résultats." #: gnunit/src/main.cs:667 msgid "Save results to..." msgstr "Résultats conservés dans..." #: gnunit/src/main.cs:676 msgid "Results not saved." msgstr "Résultats non conservés." #: gnunit/src/main.cs:687 msgid "There has been an error saving the results.\n" msgstr "Une erreur est survenue lors de la conservation des résultats.\n" #: gnunit/src/main.cs:688 msgid "Do you have correct permissions to write to that file?" msgstr "Avez-vous les permissions requises pour écrire dans ce fichier?" #: gnunit/src/main.cs:696 #, csharp-format msgid "Results saved to {0}" msgstr "Résultats conservés dans {0}" #: gnunit/src/main.cs:774 #, fuzzy, csharp-format msgid "Tests (assertions): {0} ({3}) Ignored: {1} Failures: {2}" msgstr "Testés: {0} Ignorés: {1} Echecs: {2}" #: gnunit/src/main.cs:952 msgid "Running tests..." msgstr "Tests en cours d'exécution..." #: gnunit/src/main.cs:995 msgid "Cancelled on user request." msgstr "Opération interrompue sur demande de l'utilisateur." #: gnunit/src/main.cs:1033 #, csharp-format msgid "{0} tests loaded." msgstr "{0} tests chargés." #: gnunit/src/main.cs:1051 #, csharp-format msgid "Elapsed time: {0}" msgstr "Temps d'éxécution: {0}" #: gnunit/src/main.cs:1061 msgid "Unhandled Exception" msgstr "Exception non traitée" #: gnunit/src/main.cs:1061 msgid "There has been an unhandled exception.\n" msgstr "" #: gnunit/src/main.cs:1062 msgid "The program will terminate now." msgstr "Le logiciel va se terminer maintenant." #: docbrowser/browser.glade:8 msgid "Mono Documentation Library" msgstr "" #: docbrowser/browser.glade:35 msgid "_File" msgstr "" #: docbrowser/browser.glade:44 msgid "New _Tab" msgstr "" #: docbrowser/browser.glade:66 msgid "_Lookup URL..." msgstr "" #: docbrowser/browser.glade:88 msgid "_Print..." msgstr "" #: docbrowser/browser.glade:116 msgid "_Close Tab" msgstr "" #: docbrowser/browser.glade:164 msgid "_Edit" msgstr "" #: docbrowser/browser.glade:172 msgid "_Cut" msgstr "" #: docbrowser/browser.glade:194 msgid "_Copy" msgstr "" #: docbrowser/browser.glade:216 msgid "_Paste" msgstr "" #: docbrowser/browser.glade:244 msgid "Select All" msgstr "" #: docbrowser/browser.glade:258 msgid "_View" msgstr "" #: docbrowser/browser.glade:267 msgid "Collapse All" msgstr "" #: docbrowser/browser.glade:276 msgid "Show Inherited Members" msgstr "" #: docbrowser/browser.glade:286 msgid "Show Comments" msgstr "" #: docbrowser/browser.glade:300 msgid "_Bookmarks" msgstr "" #: docbrowser/browser.glade:315 msgid "_Contributing" msgstr "" #: docbrowser/browser.glade:323 msgid "_Upload Contributions..." msgstr "" #: docbrowser/browser.glade:345 msgid "_View Contribution Statistics..." msgstr "" #: docbrowser/browser.glade:372 msgid "Edit Mode" msgstr "" #: docbrowser/browser.glade:386 msgid "_Help" msgstr "" #: docbrowser/browser.glade:395 msgid "About..." msgstr "" #: docbrowser/browser.glade:548 msgid "n/a" msgstr "" #: docbrowser/browser.glade:657 msgid "_Contents" msgstr "" #: docbrowser/browser.glade:721 msgid "_Index" msgstr "" #: docbrowser/browser.glade:784 msgid "_Search" msgstr "" #: docbrowser/browser.glade:856 msgid "About monodoc" msgstr "" #: docbrowser/browser.glade:907 msgid "" "monodoc: The Mono Documentation Library viewer" msgstr "" #: docbrowser/browser.glade:928 msgid "Version " msgstr "" #: docbrowser/browser.glade:970 msgid "" "Authors:\n" " Miguel de Icaza (miguel@ximian.com)\n" " Duncan Mak (duncan@ximian.com)\n" " Joshua Tauberer (tauberer@for.net)\n" " Lee Malabone\n" " Philip Van Hoof\n" " Johannes Roith (johannes@jroith.de)\n" " Alp Toker (alp@atoker.com)\n" " Piers Haken\n" " John Luke (jluke@cfl.rr.com)\n" " Ben Maurer\n" " Mario Sopena Novales (mario.sopena@gmail.com)\n" " Rafael Ferreira (raf@ophion.org)\n" "\t " msgstr "" #: docbrowser/browser.glade:1005 msgid "" "Plugins:\n" " ECMA Documentation.\n" " Mono XML Documentation.\n" " Mono Handbook.\n" " Manual Pages.\n" " Compiler Errors.\n" " ECMA C# Specification." msgstr "" #: docbrowser/browser.glade:1080 msgid "Lookup URL" msgstr "" #: docbrowser/browser.glade:1103 msgid "_URL to lookup:" msgstr "" #: docbrowser/browser.glade:1132 docbrowser/browser.glade:1360 #: docbrowser/browser.glade:1746 docbrowser/browser.glade:2726 #: docbrowser/browser.glade:2749 docbrowser/browser.glade:2798 msgid "*" msgstr "" #: docbrowser/browser.glade:1135 msgid "lookup_entry" msgstr "" #: docbrowser/browser.glade:1183 msgid "Login configuration" msgstr "" #: docbrowser/browser.glade:1215 msgid "" "You can edit the contents of the API documentation in MonoDoc and " "contribute\n" "those back. To do this you must agree to relicense your updates under the " "terms\n" "of the MIT X11 Open Source License and register your email address with the\n" "documentation service.\n" "\n" "If you agree, click Continue" msgstr "" #: docbrowser/browser.glade:1271 docbrowser/browser.glade:1432 #: docbrowser/browser.glade:1807 msgid "Continue" msgstr "" #: docbrowser/browser.glade:1300 msgid "0" msgstr "" #: docbrowser/browser.glade:1331 msgid "_Email:" msgstr "" #: docbrowser/browser.glade:1374 msgid "xx" msgstr "" #: docbrowser/browser.glade:1461 msgid "1" msgstr "" #: docbrowser/browser.glade:1486 msgid "Monodoc is requesting an account for you." msgstr "" #: docbrowser/browser.glade:1567 msgid "2" msgstr "" #: docbrowser/browser.glade:1592 msgid "" "Error: Monodoc encountered a failure when requesting\n" "a password for your e-mail address. Try again later." msgstr "" #: docbrowser/browser.glade:1628 docbrowser/browser.glade:2013 #: docbrowser/browser.glade:2102 docbrowser/browser.glade:2297 #: docbrowser/browser.glade:2387 docbrowser/browser.glade:2477 msgid "Ok" msgstr "" #: docbrowser/browser.glade:1658 msgid "3" msgstr "" #: docbrowser/browser.glade:1689 msgid "" "Once you receive your password on the mail, please enter it\n" "here:\n" msgstr "" #: docbrowser/browser.glade:1718 msgid "Password:" msgstr "" #: docbrowser/browser.glade:1837 msgid "4" msgstr "" #: docbrowser/browser.glade:1862 msgid "MonoDoc is logging into the server." msgstr "" #: docbrowser/browser.glade:1953 msgid "5" msgstr "" #: docbrowser/browser.glade:1978 msgid "" "Congratulations! \n" "\n" "You can now contribute your changes to MonoDoc by using \n" "the File/Upload menu option." msgstr "" #: docbrowser/browser.glade:2043 msgid "6" msgstr "" #: docbrowser/browser.glade:2068 msgid "" "Terminated \n" "\n" "The request to the Monodoc server has been cancelled." msgstr "" #: docbrowser/browser.glade:2132 msgid "7" msgstr "" #: docbrowser/browser.glade:2157 msgid "" "Please wait\n" "\n" "MonoDoc is checking the server version." msgstr "" #: docbrowser/browser.glade:2237 msgid "8" msgstr "" #: docbrowser/browser.glade:2262 msgid "" "Communications Problem \n" "\n" "There was a communications problem when communicating\n" "with the Mono Documentation Server." msgstr "" #: docbrowser/browser.glade:2327 msgid "9" msgstr "" #: docbrowser/browser.glade:2352 msgid "" "Version missmatch \n" "\n" "This version of MonoDoc is not compatible with the current Monodoc\n" "server, please upgrade your MonoDoc installation." msgstr "" #: docbrowser/browser.glade:2417 msgid "10" msgstr "" #: docbrowser/browser.glade:2442 msgid "" "Password Problem \n" "\n" "The passkey entered is incorrect. \n" "Please try again." msgstr "" #: docbrowser/browser.glade:2507 msgid "11" msgstr "" #: docbrowser/browser.glade:2528 msgid "Uploading Documentation Updates - MonoDoc" msgstr "" #: docbrowser/browser.glade:2583 msgid "Monodoc Documentation Updates Uploader. " msgstr "" #: docbrowser/browser.glade:2610 msgid "Status: " msgstr "" #: docbrowser/browser.glade:2668 msgid "New Comment" msgstr "" #: docbrowser/browser.glade:2690 msgid "TODO: Some advise on posting here." msgstr "" #: docbrowser/browser.glade:2766 msgid "Title:" msgstr "" #: docbrowser/browser.glade:2815 msgid "Comment" msgstr "" #: docbrowser/browser.glade:2841 msgid "E-Mail:" msgstr "" #: docbrowser/browser.glade:2867 docbrowser/browser.glade:3169 msgid "Name:" msgstr "" #: docbrowser/browser.glade:2987 msgid "Manage Bookmarks" msgstr "" #: docbrowser/browser.glade:3071 msgid "New Folder" msgstr "" #: docbrowser/browser.glade:3136 msgid "Add Bookmark" msgstr "" #: docbrowser/browser.glade:3227 msgid "Create in:" msgstr "" mono-tools-4.2/po/fr.gmo0000664000175000017500000000515612642235741017255 0ustar00directhexdirecthex00000000000000%pq64FZq"=,] !8-Q?4@D+`"'#8*V& @>  ' + E )0 Z      File {0} exists.Already running some test(s).Cancelled on user request.Do you have correct permissions to write to that file?Do you want to overwrite it?Don't know anything about {0}Elapsed time: {0}Error loading '{0}'Error loading assemblyHide details <<Loading test {0} of {1}Loading {0}...No assembly loaded.No test results availableResults not saved.Results saved to {0}Running tests...Save results to...Select an assembly to loadThe program will terminate now.There has been an error saving the results. Unhandled ExceptionWarning: unexpected combination.You have to select a test to run.You must run some tests in order to get results to save.translator_credits{0} tests loaded.Project-Id-Version: GNUnit Report-Msgid-Bugs-To: POT-Creation-Date: 2008-01-22 17:13-0500 PO-Revision-Date: 2004-08-05 11:14+0200 Last-Translator: Sebastien Pouliot Language-Team: Sebastien Pouliot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le fichier {0} existe.Test(s) en cours d'exécution.Opération interrompue sur demande de l'utilisateur.Avez-vous les permissions requises pour écrire dans ce fichier?Voulez-vous le ré-écrire?Aucune information n'est disponible sur {0}Temps d'éxécution: {0}Erreur lors du chargement de '{0}'Erreur lors du chargement de l'assemblyMoins de détails <<Chargement du test {0} de {1}Chargement de {0}...Aucun assembly n'est chargé.Aucun résultat des tests n'est disponibleRésultats non conservés.Résultats conservés dans {0}Tests en cours d'exécution...Résultats conservés dans...Choisir un assembly à chargerLe logiciel va se terminer maintenant.Une erreur est survenue lors de la conservation des résultats. Exception non traitéeAvertissement: combinaison innattendue.Un test doit être choisi pour s'exécuter.Des tests doivent être exécutés avant de conserver les résultats.Sebastien Pouliot {0} tests chargés.mono-tools-4.2/mperfmon/0000775000175000017500000000000012642235743017342 5ustar00directhexdirecthex00000000000000mono-tools-4.2/mperfmon/ChangeLog0000664000175000017500000000142612413742070021107 0ustar00directhexdirecthex00000000000000 Fri Sep 26 17:20:04 CEST 2008 Paolo Molaro * Makefile.am, mperfmon.1: added man page. Tue Sep 23 18:50:04 CEST 2008 Paolo Molaro * Added some simple configuration file support. * Added the ability to define performance counter sets (no GUI to edit them yet) and load a set, instead of loading all the counters individually. * Use shorter numeric labels on the graphs. * Added also console usage, try: mperfmon --report=MonoSummary pid_of_mono_process. Fri Sep 19 20:56:13 CEST 2008 Paolo Molaro * Preferences.cs: added preferences dialog to change the update interval. Thu Sep 18 18:43:23 CEST 2008 Paolo Molaro * Initial drop of mperfmon: utility to browse and display performance counters. mono-tools-4.2/mperfmon/Config.cs0000664000175000017500000000526512413742070021076 0ustar00directhexdirecthex00000000000000// Config.cs created with MonoDevelop // User: lupus at 12:03 PM 9/20/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using System.Xml; using System.Collections.Generic; namespace mperfmon { public class CounterSet { string name; List counters; bool is_system; // add an id to each counter: counters with the same id are put // in the same graph public CounterSet (string name, List counters, bool is_system) { this.name = name; this.is_system = is_system; this.counters = new List (counters); } public bool IsSystem { get {return is_system;} } public string Name { get {return name;} set {name = value;} } public List Counters { get {return counters;} } } public class Config { string filename; uint timeout = 1000; public List sets = new List (); public Config(string filename, bool system) { Load (filename, system); } public void Load (string file, bool system) { XmlTextReader reader = new XmlTextReader (file); string set_name = null; List counters = new List (); while (reader.Read ()) { if (reader.NodeType == XmlNodeType.Element) { string name = reader.Name; if (name == "mperfmon") continue; if (name == "update") { for (int i = 0; i < reader.AttributeCount; ++i) { reader.MoveToAttribute (i); if (reader.Name == "interval") { timeout = uint.Parse (reader.Value); } } continue; } if (name == "set") { for (int i = 0; i < reader.AttributeCount; ++i) { reader.MoveToAttribute (i); if (reader.Name == "name") { set_name = reader.Value; } } continue; } if (name == "counter") { string cat = null, counter = null; for (int i = 0; i < reader.AttributeCount; ++i) { reader.MoveToAttribute (i); if (reader.Name == "cat") { cat = reader.Value; } else if (reader.Name == "name") { counter = reader.Value; } } if (cat != null && counter != null) { counters.Add (cat); counters.Add (counter); } continue; } } else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.Name == "set") { sets.Add (new CounterSet (set_name, counters, system)); set_name = null; counters.Clear (); } } } } public uint Timeout { get {return timeout;} set {timeout = value;} } public CounterSet this [string name] { get { foreach (CounterSet c in sets) { if (c.Name == name) return c; } return null; } } } } mono-tools-4.2/mperfmon/Main.cs0000664000175000017500000000562212413742070020552 0ustar00directhexdirecthex00000000000000// Main.cs created with MonoDevelop // User: lupus at 12:08 PM 9/18/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using System.IO; using System.Reflection; using System.Diagnostics; using System.Collections.Generic; using Gtk; namespace mperfmon { class MainClass { static void Report (Config cfg, string name, string[] args, int start, int count) { List instances = new List (); for (; start < args.Length; ++start) instances.Add (args [start]); if (instances.Count == 0) { Console.WriteLine ("Need to provide instance names."); return; } CounterSet cset = cfg [name]; if (cset == null) { Console.WriteLine ("Unknown counter set: {0}.", name); return; } List counters = ReportList (cset, instances); for (int i = 0; i < count; ++i) { Report (counters); System.Threading.Thread.Sleep ((int)cfg.Timeout); } } static void Report (List counters) { string last_instance = null; foreach (PerformanceCounter c in counters) { string instance = c.InstanceName; if (last_instance != instance) { Console.WriteLine ("Report for: {0}", instance); last_instance = instance; } Console.Write ("\t{0}/{1}: ", c.CategoryName, c.CounterName); try { Console.WriteLine (c.NextValue ()); } catch (Exception e) { Console.WriteLine (e.Message); } } } static List ReportList (CounterSet cset, List instances) { List counters = cset.Counters; List pcounters = new List (); foreach (string instance in instances) { for (int i = 0; i < counters.Count; i += 2) { try { PerformanceCounter counter = new PerformanceCounter (counters [i], counters [i + 1], instance); pcounters.Add (counter); } catch (Exception e) { //Console.WriteLine (e.Message); } } } return pcounters; } public static void Main (string[] args) { string report_name = null; int report_args = args.Length; int count = 2; Config cfg; string cfg_file = Path.Combine (Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location), "config"); for (int i = 0; i < args.Length; ++i) { if (args [i].StartsWith ("--report=")) { report_name = args [i].Substring (9); continue; } else if (args [i].StartsWith ("--count=")) { count = int.Parse (args [i].Substring (8)); continue; } else if (args [i].StartsWith ("--config=")) { cfg_file = args [i].Substring (9); continue; } report_args = i; break; } cfg = new Config (cfg_file, true); if (report_name != null) { Report (cfg, report_name, args, report_args, count); return; } Application.Init (); MainWindow win = new MainWindow (cfg); win.Show (); Application.Run (); } } }mono-tools-4.2/mperfmon/Makefile.in0000664000175000017500000004657512642235732021426 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = mperfmon ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mperfmon 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)$(mperfmondir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(mperfmon_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/mperfmon.in \ ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ mperfmondir = $(prefix)/lib/mperfmon bin_SCRIPTS = mperfmon mperfmon_DATA = mperfmon.exe config man_MANS = mperfmon.1 CLEANFILES = mperfmon.exe mperfmon.exe.mdb mperfmon mperfmon_sources = \ $(srcdir)/Main.cs \ $(srcdir)/AssemblyInfo.cs \ $(srcdir)/MainWindow.cs \ $(srcdir)/NewCounter.cs \ $(srcdir)/Preferences.cs \ $(srcdir)/Config.cs \ $(srcdir)/AddSet.cs \ $(srcdir)/gtk-gui/generated.cs \ $(srcdir)/gtk-gui/MainWindow.cs \ $(srcdir)/gtk-gui/mperfmon.AddSet.cs \ $(srcdir)/gtk-gui/mperfmon.Preferences.cs \ $(srcdir)/gtk-gui/mperfmon.NewCounter.cs mperfmon_resources = \ $(srcdir)/gtk-gui/gui.stetic EXTRA_DIST = $(mperfmon_sources) $(mperfmon_resources) mperfmon.in config $(man_MANS) packages = -pkg:gtk-sharp-2.0 assemblies = -r:System -r:System.Xml -r:Mono.Cairo -r:Mono.Posix ress = $(foreach res,$(mperfmon_resources), $(addprefix -resource:,$(res)),$(notdir $(res))) 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) --gnu mperfmon/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu mperfmon/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): mperfmon: $(top_builddir)/config.status $(srcdir)/mperfmon.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-mperfmonDATA: $(mperfmon_DATA) @$(NORMAL_INSTALL) @list='$(mperfmon_DATA)'; test -n "$(mperfmondir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(mperfmondir)'"; \ $(MKDIR_P) "$(DESTDIR)$(mperfmondir)" || 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)$(mperfmondir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(mperfmondir)" || exit $$?; \ done uninstall-mperfmonDATA: @$(NORMAL_UNINSTALL) @list='$(mperfmon_DATA)'; test -n "$(mperfmondir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(mperfmondir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(mperfmondir)"; 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) 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-man install-mperfmonDATA 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-mperfmonDATA uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-mperfmonDATA 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 tags-am \ uninstall uninstall-am uninstall-binSCRIPTS uninstall-man \ uninstall-man1 uninstall-mperfmonDATA .PRECIOUS: Makefile mperfmon.exe: $(mperfmon_sources) $(mperfmon_resources) $(MCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG -target:exe -out:mperfmon.exe $(mperfmon_sources) $(ress) $(packages) $(assemblies) # 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-tools-4.2/mperfmon/AssemblyInfo.cs0000664000175000017500000000205512413742070022256 0ustar00directhexdirecthex00000000000000// AssemblyInfo.cs created with MonoDevelop // User: lupus at 12:08 PM 9/18/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // 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("mperfmon")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // If the build and revision are set to '*' they will be updated automatically. [assembly: AssemblyVersion("1.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-tools-4.2/mperfmon/config0000664000175000017500000000115212413742070020521 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/mperfmon/AddSet.cs0000664000175000017500000000301312413742070021022 0ustar00directhexdirecthex00000000000000// Author: lupus 9/23/2008 // // using System; using System.Diagnostics; using Gtk; namespace mperfmon { public partial class AddSet : Gtk.Dialog { string csetn; string instance; TreeStore instances_store; Config cfg; public AddSet(Config cfg) { this.cfg = cfg; this.Build(); CellRendererText renderer = new CellRendererText (); instances.AppendColumn ("Instance", renderer, "text", 0); instances_store = new TreeStore (typeof (string)); instances.Model = instances_store; for (int i = 0; i < cfg.sets.Count; ++i) { counterset.AppendText (cfg.sets [i].Name); } instances.Selection.Changed += delegate { TreeSelection ts = instances.Selection; TreeIter iter; TreeModel mod; if (ts.GetSelected (out mod, out iter)) { instance = mod.GetValue (iter, 0) as string; } }; if (cfg.sets.Count > 0) { counterset.Active = 0; } } protected virtual void OnSetSelected (object sender, System.EventArgs e) { instances_store.Clear (); CounterSet cset = cfg.sets [counterset.Active]; csetn = cset.Name; try { // we take just the first counter category into consideration // to retrieve an instance PerformanceCounterCategory cat = new PerformanceCounterCategory (cset.Counters [0]); foreach (string s in cat.GetInstanceNames ()) { instances_store.AppendValues (s); } } catch { } } public string CounterSet { get { return csetn; } } public string Instance { get { return instance; } } } } mono-tools-4.2/mperfmon/NewCounter.cs0000664000175000017500000000456312413742070021762 0ustar00directhexdirecthex00000000000000// NewCounter.cs created with MonoDevelop // User: lupus at 12:15 PM 9/18/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using System.Diagnostics; using Gtk; namespace mperfmon { public partial class NewCounter : Gtk.Dialog { PerformanceCounterCategory[] cats; TreeStore counters_store; TreeStore instances_store; string category; string counter; string instance; public string Category { get {return category;} } public string Counter { get {return counter;} } public string Instance { get {return instance;} } public NewCounter() { this.Build(); cats = PerformanceCounterCategory.GetCategories (); for (int i = 0; i < cats.Length; ++i) { categories.AppendText (cats [i].CategoryName); } CellRendererText renderer = new CellRendererText (); counters.AppendColumn ("Name", renderer, "text", 0); CellRendererText renderer2 = new CellRendererText (); instances.AppendColumn ("Instance", renderer2, "text", 0); counters_store = new TreeStore (typeof (string)); instances_store = new TreeStore (typeof (string)); counters.Model = counters_store; instances.Model = instances_store; counters.Selection.Changed += delegate { TreeSelection ts = counters.Selection; TreeIter iter; TreeModel mod; if (ts.GetSelected (out mod, out iter)) { counter = mod.GetValue (iter, 0) as string; } }; instances.Selection.Changed += delegate { TreeSelection ts = instances.Selection; TreeIter iter; TreeModel mod; if (ts.GetSelected (out mod, out iter)) { instance = mod.GetValue (iter, 0) as string; } }; if (cats.Length > 0) categories.Active = 0; } protected virtual void OnCategorySelected (object sender, System.EventArgs e) { PerformanceCounterCategory cat = cats [categories.Active]; category = cat.CategoryName; counters_store.Clear (); instances_store.Clear (); try { foreach (PerformanceCounter c in cat.GetCounters ()) { counters_store.AppendValues (c.CounterName); //Console.WriteLine (c.CounterName); } } catch {} try { foreach (string s in cat.GetInstanceNames ()) { instances_store.AppendValues (s); //Console.WriteLine (c.CounterName); } } catch {} } protected virtual void OnCounterRow (object o, Gtk.RowActivatedArgs args) { } } } mono-tools-4.2/mperfmon/Preferences.cs0000664000175000017500000000071512413742070022125 0ustar00directhexdirecthex00000000000000// Preferences.cs created with MonoDevelop // User: lupus at 7:44 PM 9/19/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; namespace mperfmon { public partial class Preferences : Gtk.Dialog { public Preferences() { this.Build(); } public uint Timeout { get { return (uint)(update_interval.Value * 1000); } set { update_interval.Value = value/1000.0; } } } } mono-tools-4.2/mperfmon/MainWindow.cs0000664000175000017500000001605312413742070021742 0ustar00directhexdirecthex00000000000000// MainWindow.cs created with MonoDevelop // User: lupus at 12:08 PM 9/18/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using System.Threading; using System.Diagnostics; using System.Collections; using Gtk; using Cairo; using System.Collections.Generic; using mperfmon; public partial class MainWindow: Gtk.Window { bool timeout_active = false; uint timeout_ms = 1000; uint timeout_id; ArrayList clist = new ArrayList (); Config cfg; public MainWindow (Config config): base (Gtk.WindowType.Toplevel) { cfg = config; timeout_ms = cfg.Timeout; Build (); } void AddCounter (string cat, string counter, string instance) { CounterDisplay d = new CounterDisplay (this, cat, counter, instance); graph_vbox.PackStart (d, false, false, 6); clist.Add (d); //Console.WriteLine ("Added: {0}/{1}", cat, counter); if (!timeout_active) { timeout_id = GLib.Timeout.Add (timeout_ms, OnTimeout); timeout_active = true; } } public void RemoveCounter (CounterDisplay d) { clist.Remove (d); graph_vbox.Remove (d); if (clist.Count == 0 && timeout_active) { timeout_active = false; GLib.Source.Remove (timeout_id); } } bool OnTimeout () { foreach (CounterDisplay d in clist) { d.Update (); } return true; } protected void OnDeleteEvent (object sender, DeleteEventArgs a) { Application.Quit (); a.RetVal = true; } protected virtual void AddCounter (object sender, System.EventArgs e) { NewCounter cdialog = new NewCounter (); int res = cdialog.Run (); if (res == (int)ResponseType.Ok) { AddCounter (cdialog.Category, cdialog.Counter, cdialog.Instance); } else { } cdialog.Destroy (); } protected virtual void OnQuit (object sender, System.EventArgs e) { Application.Quit (); } protected virtual void OnPreferences (object sender, System.EventArgs e) { Preferences prefs = new Preferences (); prefs.Timeout = timeout_ms; int res = prefs.Run (); if (res == (int)ResponseType.Ok) { timeout_ms = prefs.Timeout; if (timeout_active) { GLib.Source.Remove (timeout_id); timeout_id = GLib.Timeout.Add (timeout_ms, OnTimeout); } } prefs.Destroy (); } protected virtual void OnPause (object sender, System.EventArgs e) { if (timeout_active) { GLib.Source.Remove (timeout_id); timeout_active = false; } } protected virtual void OnPlay (object sender, System.EventArgs e) { if (!timeout_active) { timeout_active = true; timeout_id = GLib.Timeout.Add (timeout_ms, OnTimeout); } } protected virtual void OnClear (object sender, System.EventArgs e) { while (clist.Count > 0) { RemoveCounter (clist [clist.Count -1] as CounterDisplay); } } protected virtual void OnSaveAs (object sender, System.EventArgs e) { // save the counters data } protected virtual void OnAddSet (object sender, System.EventArgs e) { AddSet cdialog = new AddSet (cfg); int res = cdialog.Run (); if (res == (int)ResponseType.Ok) { CounterSet cset = cfg [cdialog.CounterSet]; string instance = cdialog.Instance; List csetcounters = cset.Counters; for (int i =0; i < csetcounters.Count; i += 2) { AddCounter (csetcounters [i], csetcounters [i + 1], instance); } } else { } cdialog.Destroy (); } } public class CounterDisplay : Frame { Label rawval, error, type; PerformanceCounter countero; CounterDrawing draw; MainWindow w; public CounterDisplay (MainWindow win, string cat, string counter, string instance): base (string.Format ("{0}/{1}", cat, counter)) { w = win; HBox hbox = new HBox (false, 6); VBox vbox = new VBox (false, 6); hbox.PackStart (vbox, false, false, 4); Label l = new Label (string.Format ("Instance: {0}", instance)); l.Xalign = 0; vbox.PackStart (l, false, false, 0); rawval = new Label (""); rawval.Xalign = 0; vbox.PackStart (rawval, false, false, 0); error = new Label (""); error.Xalign = 0; vbox.PackStart (error, false, false, 0); type = new Label (""); type.Xalign = 0; vbox.PackStart (type, false, false, 0); draw = new CounterDrawing (); hbox.PackEnd (draw, true, true, 4); Add (hbox); Button rem = new Button ("Remove"); vbox.PackStart (rem, false, false, 0); rem.Clicked += delegate { w.RemoveCounter (this); }; ShowAll (); try { if (instance == null) countero = new PerformanceCounter (cat, counter); else countero = new PerformanceCounter (cat, counter, instance); type.Text = countero.CounterType.ToString (); Update (); //Console.WriteLine ("{0}", countero.RawValue); //Console.WriteLine ("'{0}' '{1}' '{3}': {2}", cat, counter, countero.RawValue, instance); } catch (Exception e) { error.Text = e.Message; Console.WriteLine (e.StackTrace); } } public void Update () { try { //Console.WriteLine (countero.RawValue); float v = countero.NextValue(); draw.Add (v); //rawval.Text = string.Format ("Value: {0} (raw: {1})", v, countero.RawValue); rawval.Text = string.Format ("Value: {0:.00}", v); } catch (Exception e) { error.Text = e.Message; Console.WriteLine (e.StackTrace); } } } class CounterDrawing : DrawingArea { List values = new List (); double scale_y = 1; double max_y = 0; int first_value = 0; public void Add (float val) { max_y = Math.Max (max_y, val); values.Add (val); QueueDraw(); } static string GetLabel (double val) { if (val >= 1000000000) return string.Format ("{0} G", val/1000000000); if (val >= 1000000) return string.Format ("{0} M", val/1000000); if (val >= 1000) return string.Format ("{0} K", val/1000); return string.Format ("{0}", val); } void draw_grid (Cairo.Context gr, int w, int h) { double y_interval, y_spacing; double pixels = 80; double num_ticks = h/pixels; double interval = max_y/num_ticks; double min_size = 1; while (true) { double new_size = min_size * 10; if (new_size < interval) { min_size = new_size; continue; } break; } y_spacing = pixels * min_size/interval; y_interval = min_size; gr.Color = new Color (0.4, 0.4, 0.4, 1); gr.LineWidth = .5; double y_label = 0; for (double i = h; i >= 0; i -= y_spacing) { gr.MoveTo (0, i); gr.LineTo (w, i); gr.Stroke (); gr.LineTo (5, i); gr.ShowText (GetLabel (y_label)); y_label += y_interval; } } void draw (Cairo.Context gr) { if (values.Count < 2) return; gr.Color = new Color (1, 0.1, 0.1, 1); gr.LineWidth = 1; gr.MoveTo (0, (max_y - values [first_value + 0]) * scale_y); for (int i = 1; first_value + i < values.Count; ++i) { gr.LineTo (i, (max_y - values [first_value + i]) * scale_y); } gr.Stroke (); } protected override bool OnExposeEvent (Gdk.EventExpose args) { Gdk.Window win = args.Window; using (Cairo.Context gr = Gdk.CairoHelper.Create (win)) { int x, y, w, h, d; win.GetGeometry (out x, out y, out w, out h, out d); scale_y = h/max_y; gr.Rectangle (0, 0, w, h); gr.SetSourceRGB (0.2, 0.2, 0.2); gr.Fill (); draw_grid (gr, w, h); if (w < values.Count) first_value = values.Count - w; draw (gr); } return true; } } mono-tools-4.2/mperfmon/gtk-gui/0000775000175000017500000000000012642235743020711 5ustar00directhexdirecthex00000000000000mono-tools-4.2/mperfmon/gtk-gui/mperfmon.Preferences.cs0000664000175000017500000001155312413742070025320 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // Mono Runtime Version: 2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ namespace mperfmon { public partial class Preferences { private Gtk.Table table1; private Gtk.Label label1; private Gtk.SpinButton update_interval; private Gtk.Button buttonCancel; private Gtk.Button buttonOk; protected virtual void Build() { Stetic.Gui.Initialize(this); // Widget mperfmon.Preferences this.Name = "mperfmon.Preferences"; this.Title = Mono.Unix.Catalog.GetString("Mono Perf Monitor preferences"); this.TypeHint = ((Gdk.WindowTypeHint)(1)); this.WindowPosition = ((Gtk.WindowPosition)(4)); this.HasSeparator = false; // Internal child mperfmon.Preferences.VBox Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.table1 = new Gtk.Table(((uint)(3)), ((uint)(2)), false); this.table1.Name = "table1"; this.table1.RowSpacing = ((uint)(6)); this.table1.ColumnSpacing = ((uint)(6)); this.table1.BorderWidth = ((uint)(6)); // Container child table1.Gtk.Table+TableChild this.label1 = new Gtk.Label(); this.label1.Name = "label1"; this.label1.LabelProp = Mono.Unix.Catalog.GetString("Update interval (seconds):"); this.table1.Add(this.label1); Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.label1])); w2.XOptions = ((Gtk.AttachOptions)(4)); w2.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.update_interval = new Gtk.SpinButton(0.2, 60, 0.2); this.update_interval.CanFocus = true; this.update_interval.Name = "update_interval"; this.update_interval.Adjustment.PageIncrement = 1; this.update_interval.Adjustment.PageSize = 1; this.update_interval.ClimbRate = 1; this.update_interval.Digits = ((uint)(1)); this.update_interval.Numeric = true; this.update_interval.SnapToTicks = true; this.update_interval.Value = 1; this.table1.Add(this.update_interval); Gtk.Table.TableChild w3 = ((Gtk.Table.TableChild)(this.table1[this.update_interval])); w3.LeftAttach = ((uint)(1)); w3.RightAttach = ((uint)(2)); w3.XOptions = ((Gtk.AttachOptions)(4)); w3.YOptions = ((Gtk.AttachOptions)(4)); w1.Add(this.table1); Gtk.Box.BoxChild w4 = ((Gtk.Box.BoxChild)(w1[this.table1])); w4.Position = 0; // Internal child mperfmon.Preferences.ActionArea Gtk.HButtonBox w5 = this.ActionArea; w5.Name = "dialog1_ActionArea"; w5.Spacing = 6; w5.BorderWidth = ((uint)(5)); w5.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new 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); Gtk.ButtonBox.ButtonBoxChild w6 = ((Gtk.ButtonBox.ButtonBoxChild)(w5[this.buttonCancel])); w6.Expand = false; w6.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new 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"; this.AddActionWidget(this.buttonOk, -5); Gtk.ButtonBox.ButtonBoxChild w7 = ((Gtk.ButtonBox.ButtonBoxChild)(w5[this.buttonOk])); w7.Position = 1; w7.Expand = false; w7.Fill = false; if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 290; this.DefaultHeight = 248; this.Show(); } } } mono-tools-4.2/mperfmon/gtk-gui/generated.cs0000664000175000017500000000202112413742070023161 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // Mono Runtime Version: 2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ 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 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-tools-4.2/mperfmon/gtk-gui/gui.stetic0000664000175000017500000007540212413742070022712 0ustar00directhexdirecthex00000000000000 .. 2.12.0 Action File File Action _Add counter _Add performance counter gtk-add Action _Quit _Quit gtk-quit Action Help Help Action _Help _Help gtk-help Action gtk-quit Action gtk-add Add a new counter Action gtk-preferences Preferences Action gtk-stop Action _Clear _Clear gtk-clear Remove all the counters Action gtk-media-pause Stop ccollecting samples Action gtk-media-play Start collecting samples Action Save _As Save _As gtk-save-as Action Add counter set Add counter set gtk-add Mono Perf Monitor CenterOnParent 3 3 6 6 3 False Fill True True False False True False True In None 6 2 3 3 True Fill False True False True True False False Icons 1 2 3 False Fill True True False False True False Add performance counter Dialog CenterOnParent 2 False False 2 2 2 6 6 None 0 0 12 In True True True <b>Counters:</b> True label_item 1 2 False True True False True True False None 0 0 12 In True True True <b>Instances:</b> True label_item 1 2 1 2 False True True False True True False 6 Category 0 True False False True 0 1 True False False 2 True 0 Fill False False False False True False 0 False 6 6 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 Mono Perf Monitor preferences Dialog CenterOnParent 2 False False 2 3 2 6 6 6 Update interval (seconds): True Fill Fill False True False False True False True 0.2 60 1 1 0.2 1 1 True True 1 1 2 True Fill Fill False True False False True False 0 True 6 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 Add a counter set CenterOnParent 2 False False 2 2 2 6 6 True 1 2 True Fill Fill False True False False True False In True True True 1 2 2 False True True False True True False Counter set: True Fill Fill False True False False True False 0 False 6 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 mono-tools-4.2/mperfmon/gtk-gui/MainWindow.cs0000664000175000017500000002123512413742070023307 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // Mono Runtime Version: 2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ public partial class MainWindow { private Gtk.UIManager UIManager; private Gtk.Action FileAction; private Gtk.Action AddCounterAction; private Gtk.Action QuitAction; private Gtk.Action HelpAction; private Gtk.Action HelpAction1; private Gtk.Action quitAction; private Gtk.Action addAction; private Gtk.Action preferencesAction; private Gtk.Action stopAction; private Gtk.Action ClearAction; private Gtk.Action mediaPauseAction; private Gtk.Action mediaPlayAction; private Gtk.Action SaveAsAction; private Gtk.Action AddCounterSetAction; private Gtk.Table table1; private Gtk.MenuBar menubar1; private Gtk.ScrolledWindow scrolledwindow1; private Gtk.VBox graph_vbox; private Gtk.Toolbar toolbar1; protected virtual void Build() { Stetic.Gui.Initialize(this); // Widget MainWindow this.UIManager = new Gtk.UIManager(); Gtk.ActionGroup w1 = new Gtk.ActionGroup("Default"); this.FileAction = new Gtk.Action("FileAction", Mono.Unix.Catalog.GetString("File"), null, null); this.FileAction.ShortLabel = Mono.Unix.Catalog.GetString("File"); w1.Add(this.FileAction, null); this.AddCounterAction = new Gtk.Action("AddCounterAction", Mono.Unix.Catalog.GetString("_Add counter"), null, "gtk-add"); this.AddCounterAction.ShortLabel = Mono.Unix.Catalog.GetString("_Add performance counter"); w1.Add(this.AddCounterAction, null); this.QuitAction = new Gtk.Action("QuitAction", Mono.Unix.Catalog.GetString("_Quit"), null, "gtk-quit"); this.QuitAction.ShortLabel = Mono.Unix.Catalog.GetString("_Quit"); w1.Add(this.QuitAction, null); this.HelpAction = new Gtk.Action("HelpAction", Mono.Unix.Catalog.GetString("Help"), null, null); this.HelpAction.ShortLabel = Mono.Unix.Catalog.GetString("Help"); w1.Add(this.HelpAction, null); this.HelpAction1 = new Gtk.Action("HelpAction1", Mono.Unix.Catalog.GetString("_Help"), null, "gtk-help"); this.HelpAction1.ShortLabel = Mono.Unix.Catalog.GetString("_Help"); w1.Add(this.HelpAction1, null); this.quitAction = new Gtk.Action("quitAction", null, null, "gtk-quit"); w1.Add(this.quitAction, null); this.addAction = new Gtk.Action("addAction", null, Mono.Unix.Catalog.GetString("Add a new counter"), "gtk-add"); w1.Add(this.addAction, null); this.preferencesAction = new Gtk.Action("preferencesAction", null, Mono.Unix.Catalog.GetString("Preferences"), "gtk-preferences"); w1.Add(this.preferencesAction, null); this.stopAction = new Gtk.Action("stopAction", null, null, "gtk-stop"); w1.Add(this.stopAction, null); this.ClearAction = new Gtk.Action("ClearAction", Mono.Unix.Catalog.GetString("_Clear"), Mono.Unix.Catalog.GetString("Remove all the counters"), "gtk-clear"); this.ClearAction.ShortLabel = Mono.Unix.Catalog.GetString("_Clear"); w1.Add(this.ClearAction, null); this.mediaPauseAction = new Gtk.Action("mediaPauseAction", null, Mono.Unix.Catalog.GetString("Stop ccollecting samples"), "gtk-media-pause"); w1.Add(this.mediaPauseAction, null); this.mediaPlayAction = new Gtk.Action("mediaPlayAction", null, Mono.Unix.Catalog.GetString("Start collecting samples"), "gtk-media-play"); w1.Add(this.mediaPlayAction, null); this.SaveAsAction = new Gtk.Action("SaveAsAction", Mono.Unix.Catalog.GetString("Save _As"), null, "gtk-save-as"); this.SaveAsAction.ShortLabel = Mono.Unix.Catalog.GetString("Save _As"); w1.Add(this.SaveAsAction, null); this.AddCounterSetAction = new Gtk.Action("AddCounterSetAction", Mono.Unix.Catalog.GetString("Add counter set"), null, "gtk-add"); this.AddCounterSetAction.ShortLabel = Mono.Unix.Catalog.GetString("Add counter set"); w1.Add(this.AddCounterSetAction, null); this.UIManager.InsertActionGroup(w1, 0); this.AddAccelGroup(this.UIManager.AccelGroup); this.Name = "MainWindow"; this.Title = Mono.Unix.Catalog.GetString("Mono Perf Monitor"); this.WindowPosition = ((Gtk.WindowPosition)(4)); // Container child MainWindow.Gtk.Container+ContainerChild this.table1 = new Gtk.Table(((uint)(3)), ((uint)(3)), false); this.table1.Name = "table1"; this.table1.RowSpacing = ((uint)(6)); this.table1.ColumnSpacing = ((uint)(6)); // Container child table1.Gtk.Table+TableChild this.UIManager.AddUiFromString(""); this.menubar1 = ((Gtk.MenuBar)(this.UIManager.GetWidget("/menubar1"))); this.menubar1.Name = "menubar1"; this.table1.Add(this.menubar1); Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.menubar1])); w2.RightAttach = ((uint)(3)); w2.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.scrolledwindow1 = new Gtk.ScrolledWindow(); this.scrolledwindow1.CanFocus = true; this.scrolledwindow1.Name = "scrolledwindow1"; this.scrolledwindow1.ShadowType = ((Gtk.ShadowType)(1)); // Container child scrolledwindow1.Gtk.Container+ContainerChild Gtk.Viewport w3 = new Gtk.Viewport(); w3.ShadowType = ((Gtk.ShadowType)(0)); // Container child GtkViewport.Gtk.Container+ContainerChild this.graph_vbox = new Gtk.VBox(); this.graph_vbox.Name = "graph_vbox"; this.graph_vbox.Spacing = 6; w3.Add(this.graph_vbox); this.scrolledwindow1.Add(w3); this.table1.Add(this.scrolledwindow1); Gtk.Table.TableChild w6 = ((Gtk.Table.TableChild)(this.table1[this.scrolledwindow1])); w6.TopAttach = ((uint)(2)); w6.BottomAttach = ((uint)(3)); w6.RightAttach = ((uint)(3)); w6.XOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.UIManager.AddUiFromString(""); this.toolbar1 = ((Gtk.Toolbar)(this.UIManager.GetWidget("/toolbar1"))); this.toolbar1.Name = "toolbar1"; this.toolbar1.ShowArrow = false; this.toolbar1.ToolbarStyle = ((Gtk.ToolbarStyle)(0)); this.table1.Add(this.toolbar1); Gtk.Table.TableChild w7 = ((Gtk.Table.TableChild)(this.table1[this.toolbar1])); w7.TopAttach = ((uint)(1)); w7.BottomAttach = ((uint)(2)); w7.RightAttach = ((uint)(3)); w7.YOptions = ((Gtk.AttachOptions)(4)); this.Add(this.table1); if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 533; this.DefaultHeight = 436; this.Show(); this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent); this.AddCounterAction.Activated += new System.EventHandler(this.AddCounter); this.QuitAction.Activated += new System.EventHandler(this.OnQuit); this.quitAction.Activated += new System.EventHandler(this.OnQuit); this.preferencesAction.Activated += new System.EventHandler(this.OnPreferences); this.ClearAction.Activated += new System.EventHandler(this.OnClear); this.mediaPauseAction.Activated += new System.EventHandler(this.OnPause); this.mediaPlayAction.Activated += new System.EventHandler(this.OnPlay); this.SaveAsAction.Activated += new System.EventHandler(this.OnSaveAs); this.AddCounterSetAction.Activated += new System.EventHandler(this.OnAddSet); } } mono-tools-4.2/mperfmon/gtk-gui/mperfmon.NewCounter.cs0000664000175000017500000002140512413742070025145 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // Mono Runtime Version: 2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ namespace mperfmon { public partial class NewCounter { private Gtk.Table table2; private Gtk.Frame frame1; private Gtk.Alignment GtkAlignment3; private Gtk.ScrolledWindow GtkScrolledWindow; private Gtk.TreeView counters; private Gtk.Label GtkLabel3; private Gtk.Frame frame2; private Gtk.Alignment GtkAlignment2; private Gtk.ScrolledWindow GtkScrolledWindow1; private Gtk.TreeView instances; private Gtk.Label GtkLabel2; private Gtk.HBox hbox1; private Gtk.Label label1; private Gtk.ComboBox categories; private Gtk.Button buttonCancel; private Gtk.Button buttonOk; protected virtual void Build() { Stetic.Gui.Initialize(this); // Widget mperfmon.NewCounter this.Name = "mperfmon.NewCounter"; this.Title = Mono.Unix.Catalog.GetString("Add performance counter"); this.TypeHint = ((Gdk.WindowTypeHint)(1)); this.WindowPosition = ((Gtk.WindowPosition)(4)); this.HasSeparator = false; // Internal child mperfmon.NewCounter.VBox Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.table2 = new Gtk.Table(((uint)(2)), ((uint)(2)), false); this.table2.Name = "table2"; this.table2.RowSpacing = ((uint)(6)); this.table2.ColumnSpacing = ((uint)(6)); // Container child table2.Gtk.Table+TableChild this.frame1 = new Gtk.Frame(); this.frame1.Name = "frame1"; this.frame1.ShadowType = ((Gtk.ShadowType)(0)); // Container child frame1.Gtk.Container+ContainerChild this.GtkAlignment3 = new Gtk.Alignment(0F, 0F, 1F, 1F); this.GtkAlignment3.Name = "GtkAlignment3"; this.GtkAlignment3.LeftPadding = ((uint)(12)); // Container child GtkAlignment3.Gtk.Container+ContainerChild this.GtkScrolledWindow = new Gtk.ScrolledWindow(); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this.counters = new Gtk.TreeView(); this.counters.CanFocus = true; this.counters.Name = "counters"; this.counters.HeadersClickable = true; this.GtkScrolledWindow.Add(this.counters); this.GtkAlignment3.Add(this.GtkScrolledWindow); this.frame1.Add(this.GtkAlignment3); this.GtkLabel3 = new Gtk.Label(); this.GtkLabel3.Name = "GtkLabel3"; this.GtkLabel3.LabelProp = Mono.Unix.Catalog.GetString("Counters:"); this.GtkLabel3.UseMarkup = true; this.frame1.LabelWidget = this.GtkLabel3; this.table2.Add(this.frame1); Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table2[this.frame1])); w5.TopAttach = ((uint)(1)); w5.BottomAttach = ((uint)(2)); // Container child table2.Gtk.Table+TableChild this.frame2 = new Gtk.Frame(); this.frame2.Name = "frame2"; this.frame2.ShadowType = ((Gtk.ShadowType)(0)); // Container child frame2.Gtk.Container+ContainerChild this.GtkAlignment2 = new Gtk.Alignment(0F, 0F, 1F, 1F); this.GtkAlignment2.Name = "GtkAlignment2"; this.GtkAlignment2.LeftPadding = ((uint)(12)); // Container child GtkAlignment2.Gtk.Container+ContainerChild this.GtkScrolledWindow1 = new Gtk.ScrolledWindow(); this.GtkScrolledWindow1.Name = "GtkScrolledWindow1"; this.GtkScrolledWindow1.ShadowType = ((Gtk.ShadowType)(1)); // Container child GtkScrolledWindow1.Gtk.Container+ContainerChild this.instances = new Gtk.TreeView(); this.instances.CanFocus = true; this.instances.Name = "instances"; this.instances.HeadersClickable = true; this.GtkScrolledWindow1.Add(this.instances); this.GtkAlignment2.Add(this.GtkScrolledWindow1); this.frame2.Add(this.GtkAlignment2); this.GtkLabel2 = new Gtk.Label(); this.GtkLabel2.Name = "GtkLabel2"; this.GtkLabel2.LabelProp = Mono.Unix.Catalog.GetString("Instances:"); this.GtkLabel2.UseMarkup = true; this.frame2.LabelWidget = this.GtkLabel2; this.table2.Add(this.frame2); Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table2[this.frame2])); w9.TopAttach = ((uint)(1)); w9.BottomAttach = ((uint)(2)); w9.LeftAttach = ((uint)(1)); w9.RightAttach = ((uint)(2)); // Container child table2.Gtk.Table+TableChild this.hbox1 = new Gtk.HBox(); this.hbox1.Name = "hbox1"; this.hbox1.Spacing = 6; // Container child hbox1.Gtk.Box+BoxChild this.label1 = new Gtk.Label(); this.label1.Name = "label1"; this.label1.LabelProp = Mono.Unix.Catalog.GetString("Category"); this.hbox1.Add(this.label1); Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.hbox1[this.label1])); w10.Position = 0; w10.Expand = false; w10.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.categories = Gtk.ComboBox.NewText(); this.categories.Name = "categories"; this.categories.Active = 0; this.hbox1.Add(this.categories); Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.hbox1[this.categories])); w11.Position = 1; w11.Expand = false; w11.Fill = false; this.table2.Add(this.hbox1); Gtk.Table.TableChild w12 = ((Gtk.Table.TableChild)(this.table2[this.hbox1])); w12.RightAttach = ((uint)(2)); w12.XOptions = ((Gtk.AttachOptions)(0)); w12.YOptions = ((Gtk.AttachOptions)(4)); w1.Add(this.table2); Gtk.Box.BoxChild w13 = ((Gtk.Box.BoxChild)(w1[this.table2])); w13.Position = 0; w13.Padding = ((uint)(6)); // Internal child mperfmon.NewCounter.ActionArea Gtk.HButtonBox w14 = this.ActionArea; w14.Name = "dialog1_ActionArea"; w14.Spacing = 6; w14.BorderWidth = ((uint)(5)); w14.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new 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); Gtk.ButtonBox.ButtonBoxChild w15 = ((Gtk.ButtonBox.ButtonBoxChild)(w14[this.buttonCancel])); w15.Expand = false; w15.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new 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"; this.AddActionWidget(this.buttonOk, -5); Gtk.ButtonBox.ButtonBoxChild w16 = ((Gtk.ButtonBox.ButtonBoxChild)(w14[this.buttonOk])); w16.Position = 1; w16.Expand = false; w16.Fill = false; if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 565; this.DefaultHeight = 359; this.Show(); this.categories.Changed += new System.EventHandler(this.OnCategorySelected); this.counters.RowActivated += new Gtk.RowActivatedHandler(this.OnCounterRow); } } } mono-tools-4.2/mperfmon/gtk-gui/mperfmon.AddSet.cs0000664000175000017500000001244112413742070024220 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // Mono Runtime Version: 2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ namespace mperfmon { public partial class AddSet { private Gtk.Table table1; private Gtk.ComboBox counterset; private Gtk.ScrolledWindow GtkScrolledWindow; private Gtk.TreeView instances; private Gtk.Label label1; private Gtk.Button buttonCancel; private Gtk.Button buttonOk; protected virtual void Build() { Stetic.Gui.Initialize(this); // Widget mperfmon.AddSet this.Name = "mperfmon.AddSet"; this.Title = Mono.Unix.Catalog.GetString("Add a counter set"); this.WindowPosition = ((Gtk.WindowPosition)(4)); this.HasSeparator = false; // Internal child mperfmon.AddSet.VBox Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.table1 = new Gtk.Table(((uint)(2)), ((uint)(2)), false); this.table1.Name = "table1"; this.table1.RowSpacing = ((uint)(6)); this.table1.ColumnSpacing = ((uint)(6)); // Container child table1.Gtk.Table+TableChild this.counterset = Gtk.ComboBox.NewText(); this.counterset.Name = "counterset"; this.table1.Add(this.counterset); Gtk.Table.TableChild w2 = ((Gtk.Table.TableChild)(this.table1[this.counterset])); w2.LeftAttach = ((uint)(1)); w2.RightAttach = ((uint)(2)); w2.XOptions = ((Gtk.AttachOptions)(4)); w2.YOptions = ((Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.GtkScrolledWindow = new Gtk.ScrolledWindow(); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this.instances = new Gtk.TreeView(); this.instances.CanFocus = true; this.instances.Name = "instances"; this.instances.HeadersClickable = true; this.GtkScrolledWindow.Add(this.instances); this.table1.Add(this.GtkScrolledWindow); Gtk.Table.TableChild w4 = ((Gtk.Table.TableChild)(this.table1[this.GtkScrolledWindow])); w4.TopAttach = ((uint)(1)); w4.BottomAttach = ((uint)(2)); w4.RightAttach = ((uint)(2)); // Container child table1.Gtk.Table+TableChild this.label1 = new Gtk.Label(); this.label1.Name = "label1"; this.label1.LabelProp = Mono.Unix.Catalog.GetString("Counter set:"); this.table1.Add(this.label1); Gtk.Table.TableChild w5 = ((Gtk.Table.TableChild)(this.table1[this.label1])); w5.XOptions = ((Gtk.AttachOptions)(4)); w5.YOptions = ((Gtk.AttachOptions)(4)); w1.Add(this.table1); Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(w1[this.table1])); w6.Position = 0; // Internal child mperfmon.AddSet.ActionArea Gtk.HButtonBox w7 = this.ActionArea; w7.Name = "dialog1_ActionArea"; w7.Spacing = 6; w7.BorderWidth = ((uint)(5)); w7.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new 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); Gtk.ButtonBox.ButtonBoxChild w8 = ((Gtk.ButtonBox.ButtonBoxChild)(w7[this.buttonCancel])); w8.Expand = false; w8.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new 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"; this.AddActionWidget(this.buttonOk, -5); Gtk.ButtonBox.ButtonBoxChild w9 = ((Gtk.ButtonBox.ButtonBoxChild)(w7[this.buttonOk])); w9.Position = 1; w9.Expand = false; w9.Fill = false; if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 400; this.DefaultHeight = 300; this.Show(); this.counterset.Changed += new System.EventHandler(this.OnSetSelected); } } } mono-tools-4.2/mperfmon/Makefile.am0000664000175000017500000000216112642235713021373 0ustar00directhexdirecthex00000000000000mperfmondir=$(prefix)/lib/mperfmon bin_SCRIPTS = mperfmon mperfmon_DATA = mperfmon.exe config man_MANS=mperfmon.1 CLEANFILES = mperfmon.exe mperfmon.exe.mdb mperfmon mperfmon_sources = \ $(srcdir)/Main.cs \ $(srcdir)/AssemblyInfo.cs \ $(srcdir)/MainWindow.cs \ $(srcdir)/NewCounter.cs \ $(srcdir)/Preferences.cs \ $(srcdir)/Config.cs \ $(srcdir)/AddSet.cs \ $(srcdir)/gtk-gui/generated.cs \ $(srcdir)/gtk-gui/MainWindow.cs \ $(srcdir)/gtk-gui/mperfmon.AddSet.cs \ $(srcdir)/gtk-gui/mperfmon.Preferences.cs \ $(srcdir)/gtk-gui/mperfmon.NewCounter.cs mperfmon_resources = \ $(srcdir)/gtk-gui/gui.stetic EXTRA_DIST = $(mperfmon_sources) $(mperfmon_resources) mperfmon.in config $(man_MANS) packages = -pkg:gtk-sharp-2.0 assemblies = -r:System -r:System.Xml -r:Mono.Cairo -r:Mono.Posix ress= $(foreach res,$(mperfmon_resources), $(addprefix -resource:,$(res)),$(notdir $(res))) mperfmon.exe: $(mperfmon_sources) $(mperfmon_resources) $(MCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG -target:exe -out:mperfmon.exe $(mperfmon_sources) $(ress) $(packages) $(assemblies) mono-tools-4.2/mperfmon/mperfmon.in0000664000175000017500000000007712413742070021511 0ustar00directhexdirecthex00000000000000#!/bin/sh exec mono "@prefix@/lib/mperfmon/mperfmon.exe" "$@" mono-tools-4.2/mperfmon/mperfmon.10000664000175000017500000000246212413742070021243 0ustar00directhexdirecthex00000000000000.TH "mperfmon" 1 .SH NAME mperfmon \- Mono Performance Counter Monitor .SH SYNOPSIS .B mperfmon [--config=FILE] [--report=REPORT_NAME] [--count=NUM] [pid] .SH OPTIONS .TP .I \-\-config=FILE Specifies the configuration file to load instead of the default one installed in the same directory as the app. .TP .I \-\-report=REPORT_NAME Instead of showing the GUI, run in console mode and print a report of the set of counters specified by REPORT_NAME and described in the config file. The report is printed for up to the number of times specified with the --count option. The \fIpid\fP argument is used as the instance name in the performance counters, it is typically the pid of a mono process. .TP .I \-\-count=NUM Sets the number of times a report is printed in console mode. The default is 2. .PP .SH DESCRIPTION mperfmon is a tool that allows you to monitor performance counters exposed by Mono processes or by the operating system. With the --report option it can be used on the console, otherwise a GUI is started. In GUI mode each counter added is monitored at user-specified time intervals (the default is 1 second) and it is shown in a graph as it changes over time. .PP .SH MAILING LISTS Visit http://lists.ximian.com/mailman/listinfo/mono-devel-list for details. .SH WEB SITE Visit http://www.mono-project.com for details mono-tools-4.2/aclocal.m40000664000175000017500000017742612642235730017374 0ustar00directhexdirecthex00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 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_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) 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'.])]) # Copyright (C) 1995-2002 Free Software Foundation, Inc. # Copyright (C) 2001-2003,2004 Red Hat, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General # Public License, this file may be distributed as part of a program # that contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License # but which still want to provide support for the GNU gettext functionality. # # Macro to add for using GNU gettext. # Ulrich Drepper , 1995, 1996 # # Modified to never use included libintl. # Owen Taylor , 12/15/1998 # # Major rework to remove unused code # Owen Taylor , 12/11/2002 # # Added better handling of ALL_LINGUAS from GNU gettext version # written by Bruno Haible, Owen Taylor 5/30/3002 # # Modified to require ngettext # Matthias Clasen 08/06/2004 # # We need this here as well, since someone might use autoconf-2.5x # to configure GLib then an older version to configure a package # using AM_GLIB_GNU_GETTEXT AC_PREREQ(2.53) dnl dnl We go to great lengths to make sure that aclocal won't dnl try to pull in the installed version of these macros dnl when running aclocal in the glib directory. dnl m4_copy([AC_DEFUN],[glib_DEFUN]) m4_copy([AC_REQUIRE],[glib_REQUIRE]) dnl dnl At the end, if we're not within glib, we'll define the public dnl definitions in terms of our private definitions. dnl # GLIB_LC_MESSAGES #-------------------- glib_DEFUN([GLIB_LC_MESSAGES], [AC_CHECK_HEADERS([locale.h]) if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi fi]) # GLIB_PATH_PROG_WITH_TEST #---------------------------- dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) glib_DEFUN([GLIB_PATH_PROG_WITH_TEST], [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) # GLIB_WITH_NLS #----------------- glib_DEFUN([GLIB_WITH_NLS], dnl NLS is obligatory [USE_NLS=yes AC_SUBST(USE_NLS) gt_cv_have_gettext=no CATOBJEXT=NONE XGETTEXT=: INTLLIBS= AC_CHECK_HEADER(libintl.h, [gt_cv_func_dgettext_libintl="no" libintl_extra_libs="" # # First check in libc # AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc, [AC_TRY_LINK([ #include ], [return !ngettext ("","", 1)], gt_cv_func_ngettext_libc=yes, gt_cv_func_ngettext_libc=no) ]) if test "$gt_cv_func_ngettext_libc" = "yes" ; then AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, [AC_TRY_LINK([ #include ], [return !dgettext ("","")], gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no) ]) fi if test "$gt_cv_func_ngettext_libc" = "yes" ; then AC_CHECK_FUNCS(bind_textdomain_codeset) fi # # If we don't have everything we want, check in libintl # if test "$gt_cv_func_dgettext_libc" != "yes" \ || test "$gt_cv_func_ngettext_libc" != "yes" \ || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then AC_CHECK_LIB(intl, bindtextdomain, [AC_CHECK_LIB(intl, ngettext, [AC_CHECK_LIB(intl, dgettext, gt_cv_func_dgettext_libintl=yes)])]) if test "$gt_cv_func_dgettext_libintl" != "yes" ; then AC_MSG_CHECKING([if -liconv is needed to use gettext]) AC_MSG_RESULT([]) AC_CHECK_LIB(intl, ngettext, [AC_CHECK_LIB(intl, dcgettext, [gt_cv_func_dgettext_libintl=yes libintl_extra_libs=-liconv], :,-liconv)], :,-liconv) fi # # If we found libintl, then check in it for bind_textdomain_codeset(); # we'll prefer libc if neither have bind_textdomain_codeset(), # and both have dgettext and ngettext # if test "$gt_cv_func_dgettext_libintl" = "yes" ; then glib_save_LIBS="$LIBS" LIBS="$LIBS -lintl $libintl_extra_libs" unset ac_cv_func_bind_textdomain_codeset AC_CHECK_FUNCS(bind_textdomain_codeset) LIBS="$glib_save_LIBS" if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then gt_cv_func_dgettext_libc=no else if test "$gt_cv_func_dgettext_libc" = "yes" \ && test "$gt_cv_func_ngettext_libc" = "yes"; then gt_cv_func_dgettext_libintl=no fi fi fi fi if test "$gt_cv_func_dgettext_libc" = "yes" \ || test "$gt_cv_func_dgettext_libintl" = "yes"; then gt_cv_have_gettext=yes fi if test "$gt_cv_func_dgettext_libintl" = "yes"; then INTLLIBS="-lintl $libintl_extra_libs" fi if test "$gt_cv_have_gettext" = "yes"; then AC_DEFINE(HAVE_GETTEXT,1, [Define if the GNU gettext() function is already present or preinstalled.]) GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl if test "$MSGFMT" != "no"; then glib_save_LIBS="$LIBS" LIBS="$LIBS $INTLLIBS" AC_CHECK_FUNCS(dcgettext) MSGFMT_OPTS= AC_MSG_CHECKING([if msgfmt accepts -c]) GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[ msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: test 1.0\n" "PO-Revision-Date: 2007-02-15 12:01+0100\n" "Last-Translator: test \n" "Language-Team: C \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" ], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_SUBST(MSGFMT_OPTS) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr], [CATOBJEXT=.gmo DATADIRNAME=share], [case $host in *-*-solaris*) dnl On Solaris, if bind_textdomain_codeset is in libc, dnl GNU format message catalog is always supported, dnl since both are added to the libc all together. dnl Hence, we'd like to go with DATADIRNAME=share and dnl and CATOBJEXT=.gmo in this case. AC_CHECK_FUNC(bind_textdomain_codeset, [CATOBJEXT=.gmo DATADIRNAME=share], [CATOBJEXT=.mo DATADIRNAME=lib]) ;; *-*-openbsd*) CATOBJEXT=.mo DATADIRNAME=share ;; *) CATOBJEXT=.mo DATADIRNAME=lib ;; esac]) LIBS="$glib_save_LIBS" INSTOBJEXT=.mo else gt_cv_have_gettext=no fi fi ]) if test "$gt_cv_have_gettext" = "yes" ; then AC_DEFINE(ENABLE_NLS, 1, [always defined to indicate that i18n is enabled]) fi dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is not GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else AC_MSG_RESULT( [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi # We need to process the po/ directory. POSUB=po AC_OUTPUT_COMMANDS( [case "$CONFIG_FILES" in *po/Makefile.in*) sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile esac]) dnl These rules are solely for the distribution goal. While doing this dnl we only have to keep exactly one list of the available catalogs dnl in configure.ac. for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" done dnl Make all variables we use known to autoconf. AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) AC_SUBST(DATADIRNAME) AC_SUBST(GMOFILES) AC_SUBST(INSTOBJEXT) AC_SUBST(INTLLIBS) AC_SUBST(PO_IN_DATADIR_TRUE) AC_SUBST(PO_IN_DATADIR_FALSE) AC_SUBST(POFILES) AC_SUBST(POSUB) ]) # AM_GLIB_GNU_GETTEXT # ------------------- # Do checks necessary for use of gettext. If a suitable implementation # of gettext is found in either in libintl or in the C library, # it will set INTLLIBS to the libraries needed for use of gettext # and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable # gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST() # on various variables needed by the Makefile.in.in installed by # glib-gettextize. dnl glib_DEFUN([GLIB_GNU_GETTEXT], [AC_REQUIRE([AC_PROG_CC])dnl GLIB_LC_MESSAGES GLIB_WITH_NLS if test "$gt_cv_have_gettext" = "yes"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) NEW_LINGUAS= for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then NEW_LINGUAS="$NEW_LINGUAS $presentlang" fi done LINGUAS=$NEW_LINGUAS AC_MSG_RESULT($LINGUAS) fi dnl Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly dnl find the mkinstalldirs script in another subdir but ($top_srcdir). dnl Try to locate is. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) dnl Generate list of files to be processed by xgettext which will dnl be included in po/Makefile. test -d po || mkdir po if test "x$srcdir" != "x."; then if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then posrcprefix="$srcdir/" else posrcprefix="../$srcdir/" fi else posrcprefix="../" fi rm -f po/POTFILES sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ < $srcdir/po/POTFILES.in > po/POTFILES ]) # AM_GLIB_DEFINE_LOCALEDIR(VARIABLE) # ------------------------------- # Define VARIABLE to the location where catalog files will # be installed by po/Makefile. glib_DEFUN([GLIB_DEFINE_LOCALEDIR], [glib_REQUIRE([GLIB_GNU_GETTEXT])dnl glib_save_prefix="$prefix" glib_save_exec_prefix="$exec_prefix" glib_save_datarootdir="$datarootdir" test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix=$prefix datarootdir=`eval echo "${datarootdir}"` if test "x$CATOBJEXT" = "x.mo" ; then localedir=`eval echo "${libdir}/locale"` else localedir=`eval echo "${datadir}/locale"` fi prefix="$glib_save_prefix" exec_prefix="$glib_save_exec_prefix" datarootdir="$glib_save_datarootdir" AC_DEFINE_UNQUOTED($1, "$localedir", [Define the location where the catalogs will be installed]) ]) dnl dnl Now the definitions that aclocal will find dnl ifdef(glib_configure_ac,[],[ AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)]) AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)]) ])dnl # GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL]) # # Create a temporary file with TEST-FILE as its contents and pass the # file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with # 0 and perform ACTION-IF-FAIL for any other exit status. AC_DEFUN([GLIB_RUN_PROG], [cat >conftest.foo <<_ACEOF $2 _ACEOF if AC_RUN_LOG([$1 conftest.foo]); then m4_ifval([$3], [$3], [:]) m4_ifvaln([$4], [else $4])dnl echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD fi]) # 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 # PKG_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable pkgconfigdir as the location where a module # should install pkg-config .pc files. By default the directory is # $libdir/pkgconfig, but the default can be changed by passing # DIRECTORY. The user can override through the --with-pkgconfigdir # parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_INSTALLDIR # PKG_NOARCH_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable noarch_pkgconfigdir as the location where a # module should install arch-independent pkg-config .pc files. By # default the directory is $datadir/pkgconfig, but the default can be # changed by passing DIRECTORY. The user can override through the # --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_NOARCH_INSTALLDIR # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------- # Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])# PKG_CHECK_VAR # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' 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.15], [], [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.15])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-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$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])]) # Copyright (C) 1999-2014 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. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2014 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 macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # 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.65])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], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) 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], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [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([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). 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])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro 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 # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) 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-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != 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-2014 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. # 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-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_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], [AS_HELP_STRING([--]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 ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_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 is modern enough. # If it is, 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 --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_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) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_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-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_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}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} 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-tools-4.2/AUTHORS0000664000175000017500000000014712413742070016561 0ustar00directhexdirecthex00000000000000Jonathan Pryor (jonpryor@vt.edu) Martin Baulig Miguel de Icaza mono-tools-4.2/Makefile.in0000664000175000017500000006254712642235730017576 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mono-tools.spec CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/mono-tools.spec.in \ AUTHORS COPYING COPYING.LIB ChangeLog INSTALL NEWS README \ compile config.guess config.sub install-sh missing 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__post_remove_distdir = $(am__remove_distdir) 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 DIST_TARGETS = dist-gzip 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = po docbrowser asn1view create-native-map ilcontrast gui-compare \ gendarme mperfmon gsharp webdoc minvoke Mono.Profiler #capture aclocal flags for autoreconf ACLOCAL_AMFLAGS = $(ACLOCAL_FLAGS) 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) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu 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-tools.spec: $(top_builddir)/config.status $(srcdir)/mono-tools.spec.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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files 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__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_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.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 $(distdir)/_build/sub $(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/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(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__post_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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip 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-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/compile0000755000175000017500000001624512550553153017077 0ustar00directhexdirecthex00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # 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-tools-4.2/config.sub0000755000175000017500000010577512405615464017516 0ustar00directhexdirecthex00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-09-11' # This file 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 3 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, 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mono-tools-4.2/mono-tools.spec.in0000664000175000017500000000553212413742070021103 0ustar00directhexdirecthex00000000000000Name: mono-tools Version: @VERSION@ Release: 0 License: GPL v2 only ; LGPL v2.0 only ; MIT License (or similar) BuildArch: noarch Url: http://go-mono.org/ Source0: %{name}-%{version}.tar.bz2 Summary: Collection of Tools and Utilities for Mono Group: Development/Tools/Other BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: mono-devel mono-nunit monodoc-core BuildRequires: update-desktop-files BuildRequires: webkit-sharp BuildRequires: glade-sharp2 %description Mono Tools is a collection of development and testing programs and utilities for use with Mono. %files -f %{name}.lang %defattr(-, root, root) %_bindir/create-native-map %_bindir/emveepee %_bindir/gendarme %_bindir/gendarme-wizard %_bindir/gd2i %_bindir/gsharp %_bindir/gui-compare %_bindir/ilcontrast %_bindir/minvoke %_bindir/monodoc %_bindir/mperfmon %_bindir/mprof-decoder %_bindir/mprof-heap-viewer %_datadir/applications/gendarme-wizard.desktop %_datadir/applications/gsharp.desktop %_datadir/applications/ilcontrast.desktop %_datadir/applications/monodoc.desktop %_datadir/create-native-map %_datadir/icons/hicolor/*/apps/monodoc.png %_datadir/pixmaps/gendarme.svg %_datadir/pixmaps/ilcontrast.png %_datadir/pixmaps/monodoc.png %_datadir/pkgconfig/create-native-map.pc %_datadir/pkgconfig/gendarme-framework.pc %_mandir/man1/create-native-map* %_mandir/man1/gd2i* %_mandir/man1/gendarme* %_mandir/man1/mperfmon* %_mandir/man1/mprof-decoder* %_mandir/man1/mprof-heap-viewer* %_mandir/man5/gendarme* %_prefix/lib/create-native-map %_prefix/lib/gendarme %_prefix/lib/gsharp %_prefix/lib/gui-compare %_prefix/lib/ilcontrast %_prefix/lib/minvoke %_prefix/lib/mono-tools %_prefix/lib/monodoc/*.dll* %_prefix/lib/monodoc/*.exe* %_prefix/lib/monodoc/sources %_prefix/lib/mperfmon %package -n monodoc-http License: X11/MIT Summary: ASP.NET front-end for displaying Monodoc documentation Group: Development/Tools/Other %description -n monodoc-http Monodoc-http provides an ASP.NET front-end for displaying installed Monodoc documentation. %files -n monodoc-http %defattr(-, root, root) %_prefix/lib/monodoc/web %prep %setup -q %build ./configure --prefix=%{_prefix} --libdir=%{_prefix}/lib --sysconfdir=%{_sysconfdir} --mandir=%{_mandir} %install make install DESTDIR=%{buildroot} %suse_update_desktop_file monodoc %suse_update_desktop_file ilcontrast %suse_update_desktop_file gendarme-wizard %suse_update_desktop_file gsharp # Move create-native-map stuff out of lib into share mkdir $RPM_BUILD_ROOT/%_prefix/share/create-native-map mv $RPM_BUILD_ROOT/%_prefix/lib/create-native-map/MapAttribute.cs $RPM_BUILD_ROOT/%_prefix/share/create-native-map mv $RPM_BUILD_ROOT/%_prefix/lib/pkgconfig $RPM_BUILD_ROOT/%_prefix/share %find_lang %{name} %clean rm -Rf %{buildroot} %post %{_bindir}/monodoc --make-index %changelog mono-tools-4.2/configure.in0000664000175000017500000002265712642235713020041 0ustar00directhexdirecthex00000000000000AC_INIT([mono-tools], [4.2]) AC_CONFIG_SRCDIR([README]) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE([tar-ustar -Wno-portability]) AM_MAINTAINER_MODE AC_PROG_INSTALL #capture aclocal flags for autoreconf AC_SUBST(ACLOCAL_FLAGS) dnl C# compiler AC_PATH_PROG(MCS, mcs, no) AC_PATH_PROG(GMCS, gmcs, no) AC_PATH_PROG(DMCS, dmcs, no) AC_PATH_PROG(RUNTIME, mono, no) AC_PATH_PROG(GACUTIL, gacutil, no) CS="C#" if test "x$MCS" = "xno" ; then dnl AC_MSG_ERROR([You need to install a C# compiler]) AC_MSG_ERROR([No $CS compiler found]) fi AM_CONDITIONAL(DMCS_PRESENT, test ! "x$DMCS" = "xno") if test "x$RUNTIME" = "xno" ; then AC_MSG_ERROR([No runtime found]) fi dnl resgen AC_PATH_PROG(RESGEN, resgen, no) if test "x$RESGEN" = "xno" ; then AC_MSG_ERROR([resgen not found in $PATH]) fi AC_SUBST(MCS) AC_SUBST(GMCS) AC_SUBST(DMCS) AC_SUBST(RUNTIME) AC_SUBST(RESGEN) AC_SUBST(GACUTIL) PKG_CHECK_MODULES(NUNIT, mono-nunit) AC_SUBST(NUNIT_LIBS) PKG_CHECK_MODULES(MONODOC, monodoc) AC_SUBST(MONODOC_LIBS) AC_PATH_PROG(MDOC, mdoc, no) AC_SUBST(MDOC) PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0 glade-sharp-2.0) AC_SUBST(GTK_SHARP_LIBS) CSHARP_FLAGS="" PKG_CHECK_MODULES(GNOME_SHARP, gnome-sharp-2.0 gconf-sharp-2.0, enable_gnome=yes, enable_gnome=no) if test "x$enable_gnome" = "xyes"; then CSHARP_FLAGS="-d:GNOME" fi AC_SUBST(GNOME_SHARP_LIBS) AM_CONDITIONAL(ENABLE_GNOME, test "x$enable_gnome" = "xyes") PKG_CHECK_MODULES(GTKHTML_SHARP, gtkhtml-sharp-3.14, enable_gtkhtml=yes, enable_gtkhtml=no) if test "x$enable_gtkhtml" = "xyes"; then CSHARP_FLAGS="-d:GTKHTML_SHARP_3_14 $CSHARP_FLAGS" else PKG_CHECK_MODULES(GTKHTML_SHARP, gtkhtml-sharp-2.0, enable_gtkhtml=yes, enable_gtkhtml=no) fi AC_SUBST(GTKHTML_SHARP_LIBS) AM_CONDITIONAL(ENABLE_GTKHTML, test "x$enable_gtkhtml" = "xyes") AC_SUBST(CSHARP_FLAGS) PKG_CHECK_MODULES(GECKO_SHARP, gecko-sharp-2.0, enable_gecko=yes, enable_gecko=no) AC_SUBST(GECKO_SHARP_LIBS) AM_CONDITIONAL(ENABLE_GECKO, test "x$enable_gecko" = "xyes") if test "x$enable_gecko" = "xyes"; then # get the mozilla home directory MOZILLA_HOME="`$PKG_CONFIG --variable=libdir mozilla-gtkmozembed`" AC_SUBST(MOZILLA_HOME) fi PKG_CHECK_MODULES(WEBKIT_SHARP, webkit-sharp-1.0, enable_webkit=yes, enable_webkit=no) AC_SUBST(WEBKIT_SHARP_LIBS) AM_CONDITIONAL(ENABLE_WEBKIT, test "x$enable_webkit" = "xyes") # PKG_CHECK_MODULES(MONOWEBBROWSER, mono-webbrowser, enable_monowebbrowser=yes, enable_monowebbrowser=no) # AC_SUBST(MONOWEBBROWSER_LIBS) AC_MSG_CHECKING([for Mono.WebBrowser]) if test "x$GACUTIL" = "xno" then AC_MSG_RESULT([no]) if test "x$enable_monowebbrowser" = "x" ; then enable_monowebbrowser=no ; fi else if $GACUTIL -l Mono.WebBrowser | grep -q "Mono.WebBrowser" then AC_MSG_RESULT([yes]) enable_monowebbrowser=yes else AC_MSG_RESULT([no]) enable_monowebbrowser=no fi fi MONOWEBBROWSER_LIBS=-r:Mono.WebBrowser AM_CONDITIONAL(ENABLE_MONOWEBBROWSER, test "x$enable_monowebbrowser" = "xyes") if test "x$enable_gtkhtml$enable_gecko$enable_monowebbrowser$enable_webkit" = "xnononono" ; then AC_MSG_ERROR([no HTML display found. You need either gtkhtml, gecko, WebKit or Mono.WebBrowser]) fi AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Use 'DEBUG' Configuration [default=YES]]), enable_debug=yes, enable_debug=no) AM_CONDITIONAL(ENABLE_DEBUG, test x$enable_debug = xyes) if test "x$enable_debug" = "xyes" ; then CONFIG_REQUESTED="yes" fi AC_ARG_ENABLE(release, AC_HELP_STRING([--enable-release], [Use 'RELEASE' Configuration [default=NO]]), enable_release=yes, enable_release=no) AM_CONDITIONAL(ENABLE_RELEASE, test x$enable_release = xyes) if test "x$enable_release" = "xyes" ; then CONFIG_REQUESTED="yes" fi if test -z "$CONFIG_REQUESTED" ; then AM_CONDITIONAL(ENABLE_DEBUG, true) enable_debug=yes fi if test `uname -s` = "Darwin"; then LIB_PREFIX= LIB_SUFFIX=.dylib else LIB_PREFIX=.so LIB_SUFFIX= fi AC_SUBST(LIB_PREFIX) AC_SUBST(LIB_SUFFIX) dnl dnl I hate PKG_CONFIG_MODULES, that is for the weak dnl if pkg-config --modversion cecil>/dev/null; then AC_MSG_RESULT("Found cecil.pc") else AC_MSG_ERROR([You are missing Cecil (cecil.pc for packageconfig) required for gui-compare and minvoke]) fi CECIL_ASM=`pkg-config --variable=Libraries cecil` AC_SUBST(CECIL_ASM) dnl Intl GETTEXT_PACKAGE=mono-tools AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package]) ALL_LINGUAS="da es fr ca pt_BR" AM_GLIB_GNU_GETTEXT GNUNIT_VERSION=0.5 AC_SUBST(GNUNIT_VERSION) AC_PROG_AWK export VERSION [TOOLS_VERSION=$($AWK 'BEGIN { split (ENVIRON["VERSION"] ".0.0.0", vsplit, ".") if(length(vsplit [1]) > 4) { split (substr(ENVIRON["VERSION"], 0, 4) "." substr(ENVIRON["VERSION"], 5) ".0.0", vsplit, ".") } print vsplit [1] "." vsplit [2] "." vsplit [3] "." vsplit [4] }')] AC_SUBST(TOOLS_VERSION) GENDARME_VERSION=$TOOLS_VERSION AC_SUBST(GENDARME_VERSION) AC_OUTPUT([ mono-tools.spec Makefile gsharp/Makefile gsharp/gsharp gsharp/gsharp.exe.config gui-compare/Makefile gui-compare/gui-compare minvoke/Makefile minvoke/minvoke mperfmon/Makefile mperfmon/mperfmon docbrowser/Makefile docbrowser/theme-icons/Makefile docbrowser/monodoc docbrowser/AssemblyInfo.cs po/Makefile.in asn1view/Makefile asn1view/art/Makefile asn1view/gtk/Makefile asn1view/common/Makefile ilcontrast/Makefile ilcontrast/ilcontrast create-native-map/Makefile create-native-map/bin/Makefile create-native-map/lib/Makefile create-native-map/lib/create-native-map/Makefile create-native-map/lib/pkgconfig/Makefile create-native-map/lib/pkgconfig/create-native-map.pc create-native-map/man/Makefile create-native-map/src/Makefile gendarme/Makefile gendarme/AssemblyInfo.cs gendarme/gendarme gendarme/gendarme-wizard gendarme/gd2i gendarme/man/Makefile gendarme/man/gendarme.1 gendarme/man/gendarme.5 gendarme/man/gd2i.1 gendarme/console/Makefile gendarme/console/gendarme.exe.config gendarme/framework/Makefile gendarme/framework/gendarme-framework.pc gendarme/framework/Test/Makefile gendarme/rules/Makefile gendarme/rules/Test.Rules/Makefile gendarme/rules/Gendarme.Rules.Security/Makefile gendarme/rules/Gendarme.Rules.Security/Test/Makefile gendarme/rules/Gendarme.Rules.Security.Cas/Makefile gendarme/rules/Gendarme.Rules.Security.Cas/Test/Makefile gendarme/rules/Gendarme.Rules.Performance/Makefile gendarme/rules/Gendarme.Rules.Performance/Test/Makefile gendarme/rules/Gendarme.Rules.Concurrency/Makefile gendarme/rules/Gendarme.Rules.Concurrency/Test/Makefile gendarme/rules/Gendarme.Rules.Correctness/Makefile gendarme/rules/Gendarme.Rules.Correctness/Test/Makefile gendarme/rules/Gendarme.Rules.Portability/Makefile gendarme/rules/Gendarme.Rules.Portability/Test/Makefile gendarme/rules/Gendarme.Rules.Exceptions/Makefile gendarme/rules/Gendarme.Rules.Exceptions/Test/Makefile gendarme/rules/Gendarme.Rules.Ui/Makefile gendarme/rules/Gendarme.Rules.Ui/Test/Makefile gendarme/rules/Gendarme.Rules.Naming/Makefile gendarme/rules/Gendarme.Rules.Naming/Test/Makefile gendarme/rules/Gendarme.Rules.Smells/Makefile gendarme/rules/Gendarme.Rules.Smells/Test/Makefile gendarme/rules/Gendarme.Rules.BadPractice/Makefile gendarme/rules/Gendarme.Rules.BadPractice/Test/Makefile gendarme/rules/Gendarme.Rules.Design/Makefile gendarme/rules/Gendarme.Rules.Design/Test/Makefile gendarme/rules/Gendarme.Rules.Design.Generic/Makefile gendarme/rules/Gendarme.Rules.Design.Generic/Test/Makefile gendarme/rules/Gendarme.Rules.Design.Linq/Makefile gendarme/rules/Gendarme.Rules.Design.Linq/Test/Makefile gendarme/rules/Gendarme.Rules.Interoperability/Makefile gendarme/rules/Gendarme.Rules.Interoperability/Test/Makefile gendarme/rules/Gendarme.Rules.Interoperability.Com/Makefile gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/Makefile gendarme/rules/Gendarme.Rules.NUnit/Makefile gendarme/rules/Gendarme.Rules.NUnit/Test/Makefile gendarme/rules/Gendarme.Rules.Serialization/Makefile gendarme/rules/Gendarme.Rules.Serialization/Test/Makefile gendarme/rules/Gendarme.Rules.Maintainability/Makefile gendarme/rules/Gendarme.Rules.Maintainability/Test/Makefile gendarme/rules/Gendarme.Rules.Globalization/Makefile gendarme/rules/Gendarme.Rules.Globalization/Test/Makefile gendarme/rules/Gendarme.Rules.Gendarme/Makefile gendarme/rules/Gendarme.Rules.Gendarme/Test/Makefile gendarme/swf-wizard-runner/Makefile gendarme/tools/Makefile gendarme/tools/supported/Makefile gendarme/tools/supported/gd2i/Makefile gendarme/tools/supported/templates/Makefile gendarme/tools/unsupported/Makefile gendarme/tools/unsupported/mapper/Makefile gendarme/tools/unsupported/typeref/Makefile gendarme/tools/unsupported/xmldoc2wiki/Makefile gendarme/wix/Makefile Mono.Profiler/profiler-file-decoder/Makefile Mono.Profiler/Makefile Mono.Profiler/heap-snapshot-viewer/mprof-heap-viewer Mono.Profiler/heap-snapshot-viewer/Makefile Mono.Profiler/profiler-decoder-library/Makefile Mono.Profiler/profiler-file-decoder/mprof-decoder Mono.Profiler/heap-snapshot-explorer/Makefile Mono.Profiler/Mono.Profiler.Widgets/Makefile Mono.Profiler/mprof-gui/Makefile Mono.Profiler/mprof-gui/emveepee webdoc/Makefile ]) echo "---" echo "Configuration summary" echo "" echo " * Installation prefix = $prefix" echo " * Using Gecko = $enable_gecko" echo " * Using GtkHtml = $enable_gtkhtml" echo " * Using Mono.WebBrowser = $enable_monowebbrowser" echo " * Using WebKit = $enable_webkit" echo " * Using Gnome = $enable_gnome" echo "" echo " NOTE: if any of the above say 'no' you may install the" echo " corresponding development packages for them, rerun" echo " autogen.sh to include them in the build." echo "" mono-tools-4.2/COPYING0000775000175000017500000004311012413742070016544 0ustar00directhexdirecthex00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. mono-tools-4.2/README0000664000175000017500000000156712413742070016400 0ustar00directhexdirecthex00000000000000Mono Tools: ---------- Mono Tools is a collection of development and testing programs and utilities for use with Mono. Building: -------- Building from a source tarball should be as simple as: ./configure [typical configure flags, such as --prefix=PREFIX] make make install Building from git is almost identical, except that you need to execute autogen.sh to create the configure script (which will be automatically executed): git clone https://github.com/mono/mono-tools.git ./autogen.sh [typical configure flags, such as --prefix=PREFIX] make make install Building on OSX with homebrew: ------------------------------ Have the following packages installed: autoconf pkg-config readline automake gettext glib intltool libtool Run autogen like this: PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/ ./autogen.sh mono-tools-4.2/Mono.Profiler/0000775000175000017500000000000012642235744020211 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/mprof-gui/0000775000175000017500000000000012642235744022116 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/mprof-gui/ChangeLog0000664000175000017500000000475112413742070023666 0ustar00directhexdirecthex000000000000002009-09-03 Mike Kestner * MainWindow.cs : add RepeatSessions menu to the Profile menu. 2009-09-03 Mike Kestner * MainWindow.cs : hook into Repeat events from the StartPage. 2009-09-03 Mike Kestner * MainWindow.cs : refactor for ProfileConfiguration. Add recent configs to history. 2009-08-28 Mike Kestner * MainWindow.cs : add RecentLogs menu to Profile menu. 2009-08-28 Mike Kestner * MainWindow.cs : load and save History class. add LogInfo items to history when new profiles are created and loaded. 2009-08-27 Mike Kestner * MainWindow.cs : use new StartPage widget. Some refactoring for tabbed MDI that I decided not to utilize, but left in the event we do in the future. Refactoring for Opening recent documents which the StartPage and menu don't support yet. Add toolbar with new/open/save items. 2009-08-19 Mike Kestner * MainWindow.cs : fix crash with StartEnabled handling. 2009-08-19 Mike Kestner * MainWindow.cs : add logging status ui to enable/disable logging in the profiler process. 2009-08-04 Mike Kestner * MainWindow.cs : update sensitivity of the Show System Nodes action to indicate if the option is supported in the current view. 2009-07-15 Mike Kestner * MainWindow.cs : support file open and save operations. 2009-06-19 Mike Kestner * MainWindow.cs : add menu item to show/hide system nodes, hidden by default. Use new ProfileView.LoadProfile method. 2009-06-17 Mike Kestner * MainWindow.cs : Use new ProfileSetupDialog to configure profile type and assembly target. Use temp files for the log file to avoid sharing errors on subsequent executions. 2009-06-17 Mike Kestner * MainWindow.cs : Save is ctrl-s not c. 2009-06-17 Mike Kestner * MainWindow.cs : add accelerators for stock menu items. 2009-06-11 Mike Kestner * gtk-gui/* : kill stetic stuff. project is simple enough to avoid it. * Main.cs : add license. * MainWindow.cs : refactor to non-stetic class. Move profile loading to Widgets.ProfileView. add license. 2009-05-21 Mike Kestner * *: initial checkin. beginnings of a visual profiling application to drive the mono logging profiler and display/navigate its output. mono-tools-4.2/Mono.Profiler/mprof-gui/emveepee.in0000664000175000017500000000010012413742070024217 0ustar00directhexdirecthex00000000000000#!/bin/sh exec mono "@prefix@/lib/@PACKAGE@/emveepee.exe" "$@" mono-tools-4.2/Mono.Profiler/mprof-gui/Main.cs0000664000175000017500000000253612413742070023326 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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; namespace Mono.Profiler.Gui { class MainClass { public static void Main (string[] args) { Gtk.Application.Init (); MainWindow win = new MainWindow (); win.Show (); Gtk.Application.Run (); } } } mono-tools-4.2/Mono.Profiler/mprof-gui/Makefile.in0000664000175000017500000004343612642235730024170 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = Mono.Profiler/mprof-gui ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = emveepee 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)$(programfilesdir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(programfiles_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/emveepee.in \ ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ASSEMBLY = $(top_builddir)/Mono.Profiler/lib/emveepee.exe @ENABLE_DEBUG_FALSE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 @ENABLE_DEBUG_TRUE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -debug "-define:DEBUG" @ENABLE_DEBUG_FALSE@ASSEMBLY_MDB = @ENABLE_DEBUG_TRUE@ASSEMBLY_MDB = $(ASSEMBLY).mdb programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) bin_SCRIPTS = emveepee CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AssemblyInfo.cs \ Main.cs \ MainWindow.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_args = $(addprefix -resource:, $(build_resources)) REFERENCES = \ -pkg:gtk-sharp-2.0 \ -r:Mono.Posix \ -r:System DLL_REFERENCES = PROJECT_REFERENCES = \ ../lib/Mono.Profiler.Widgets.dll \ ../lib/mprof-decoder-library.dll build_references = $(addprefix -r:, $(PROJECT_REFERENCES)) $(REFERENCES) EXTRA_DIST = mprof-gui.csproj $(FILES) $(RESOURCES) 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) --gnu Mono.Profiler/mprof-gui/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Mono.Profiler/mprof-gui/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): emveepee: $(top_builddir)/config.status $(srcdir)/emveepee.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-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: ctags CTAGS: cscope cscopelist: 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)$(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) 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-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-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-programfilesDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-pdf \ install-pdf-am 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 tags-am \ uninstall uninstall-am uninstall-binSCRIPTS \ uninstall-programfilesDATA .PRECIOUS: Makefile $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(PROJECT_REFERENCES) mkdir -p $(shell dirname $(ASSEMBLY)) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:exe $(build_sources) $(build_resources_args) $(build_references) # 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-tools-4.2/Mono.Profiler/mprof-gui/AssemblyInfo.cs0000664000175000017500000000170412413742070025031 0ustar00directhexdirecthex00000000000000using 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("gui")] [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.*")] // 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-tools-4.2/Mono.Profiler/mprof-gui/MainWindow.cs0000664000175000017500000003034612413742070024516 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 Mono.Profiler; using Mono.Profiler.Widgets; using Mono.Unix; namespace Mono.Profiler.Gui { public class MainWindow : Gtk.Window { int max_history_count = 5; Gtk.Action save_action; Gtk.Action show_system_nodes_action; Gtk.ActionGroup group; Gtk.ToggleAction logging_enabled_action; Gtk.Box content_area; Gtk.Widget view; History history; LogInfo log_info; ProfilerProcess proc; public MainWindow () : base (Catalog.GetString ("Mono Visual Profiler")) { history = History.Load (); history.LogFiles.Changed += UpdateRecentLogs; history.Configs.Changed += UpdateRepeatSessions; DefaultSize = new Gdk.Size (800, 600); Gtk.Box box = new Gtk.VBox (false, 0); Gtk.UIManager uim = BuildUIManager (); box.PackStart (uim.GetWidget ("/Menubar"), false, false, 0); box.PackStart (uim.GetWidget ("/Toolbar"), false, false, 0); UpdateRecentLogs (null, null); UpdateRepeatSessions (null, null); content_area = new Gtk.VBox (false, 0); content_area.Show (); box.PackStart (content_area, true, true, 0); StartPage start_page = new StartPage (history); start_page.Activated += OnStartPageActivated; start_page.Show (); View = start_page; box.ShowAll (); Add (box); } Gtk.Widget View { get { return view; } set { if (view != null) content_area.Remove (view); view = value; content_area.PackStart (view, true, true, 0); } } protected override bool OnDeleteEvent (Gdk.Event ev) { Shutdown (); return true; } protected override void OnShown () { base.OnShown (); View.GrabFocus (); } void UpdateRecentLogs (object o, EventArgs args) { for (int i = 0; i < max_history_count; i++) { Gtk.Action action = group.GetAction ("RecentLogs" + i); if (i < history.LogFiles.Count) { LogInfo info = history.LogFiles [i]; action.Label = "_" + i + ": " + info.Caption; action.Tooltip = info.Filename; action.Visible = true; } else action.Visible = false; } } void UpdateRepeatSessions (object o, EventArgs args) { for (int i = 0; i < max_history_count; i++) { Gtk.Action action = group.GetAction ("RepeatSession" + i); if (i < history.Configs.Count) { ProfileConfiguration config = history.Configs [i]; action.Label = "_" + i + ": " + config.ToString (); action.Visible = true; } else action.Visible = false; } } void Refresh (ProfileView contents) { Gtk.Application.Invoke (delegate { if (contents.LoadProfile (proc.LogFile)) { if (log_info == null || log_info.Filename != proc.LogFile) { log_info = new LogInfo (proc.LogFile, log_info == null ? null : log_info.Detail); history.LogFiles.Add (log_info); } save_action.Sensitive = true; show_system_nodes_action.Sensitive = contents.SupportsFiltering; } }); } void StartProfile (ProfileConfiguration config) { ProfileView view = new ProfileView (); view.Show (); View = view; logging_enabled_action.Visible = true; logging_enabled_action.Active = config.StartEnabled; proc = new ProfilerProcess (config); proc.Paused += delegate { Refresh (view); }; proc.Exited += delegate { Refresh (view); logging_enabled_action.Visible = false; }; proc.Start (); log_info = new LogInfo (proc.LogFile, config.ToString ()); history.LogFiles.Prepend (log_info); history.Configs.Prepend (config); } void Shutdown () { history.Save (); Gtk.Application.Quit (); } void OnNewActivated (object sender, System.EventArgs e) { ProfileSetupDialog d = new ProfileSetupDialog (this); if (d.Run () == (int) Gtk.ResponseType.Accept) StartProfile (d.Config); d.Destroy (); } static object[] chooser_button_params = new object[] { Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, Gtk.Stock.Open, Gtk.ResponseType.Accept }; void OpenProfile (string filename) { ProfileView view = new ProfileView (); if (view.LoadProfile (filename)) { view.Show (); View = view; logging_enabled_action.Visible = false; save_action.Sensitive = true; show_system_nodes_action.Sensitive = view.SupportsFiltering; log_info = null; foreach (LogInfo info in history.LogFiles) { if (info.Filename == filename) { log_info = info; break; } } if (log_info == null) log_info = new LogInfo (filename, null); history.LogFiles.Prepend (log_info); } } void OnOpenActivated (object sender, System.EventArgs e) { Gtk.FileChooserDialog d = new Gtk.FileChooserDialog ("Open Profile Log", this, Gtk.FileChooserAction.Open, chooser_button_params); if (d.Run () == (int) Gtk.ResponseType.Accept) OpenProfile (d.Filename); d.Destroy (); } void OnQuitActivated (object sender, System.EventArgs e) { Shutdown (); } void OnRecentLogsActivated (object o, EventArgs args) { Gtk.Action action = o as Gtk.Action; OpenProfile (action.Tooltip); } void OnRepeatSessionActivated (object o, EventArgs args) { Gtk.Action action = o as Gtk.Action; int idx = Int32.Parse (action.Name.Substring (13)); ProfileConfiguration config = history.Configs [idx]; StartProfile (config); } void OnSaveAsActivated (object sender, System.EventArgs e) { Gtk.FileChooserDialog d = new Gtk.FileChooserDialog ("Save Profile Log", this, Gtk.FileChooserAction.Save, chooser_button_params); if (d.Run () == (int) Gtk.ResponseType.Accept) { System.IO.File.Copy (log_info.Filename, d.Filename); log_info.Filename = d.Filename; save_action.Sensitive = false; } d.Destroy (); } void OnStartPageActivated (object o, StartEventArgs args) { switch (args.Type) { case StartEventType.Create: OnNewActivated (null, null); break; case StartEventType.Open: if (args.Detail == null) OnOpenActivated (null, null); else OpenProfile (args.Detail); break; case StartEventType.Repeat: StartProfile (args.Config); break; default: throw new NotSupportedException (); } } void OnLoggingActivated (object sender, System.EventArgs e) { if (proc == null) return; Gtk.ToggleAction ta = sender as Gtk.ToggleAction; if (ta.Active) proc.Resume (); else proc.Pause (); } void OnShowSystemNodesActivated (object sender, System.EventArgs e) { Gtk.ToggleAction ta = sender as Gtk.ToggleAction; (View as ProfileView).Options.ShowSystemNodes = ta.Active; } const string ui_info = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; Gtk.UIManager BuildUIManager () { Gtk.ActionEntry[] actions = new Gtk.ActionEntry[] { new Gtk.ActionEntry ("ProfileMenu", null, Catalog.GetString ("_Profile"), null, null, null), new Gtk.ActionEntry ("NewAction", Gtk.Stock.New, null, "N", Catalog.GetString ("Create New Profile"), new EventHandler (OnNewActivated)), new Gtk.ActionEntry ("OpenAction", Gtk.Stock.Open, null, "O", Catalog.GetString ("Open Existing Profile Log"), new EventHandler (OnOpenActivated)), new Gtk.ActionEntry ("SaveAsAction", Gtk.Stock.SaveAs, null, "S", Catalog.GetString ("Save Profile Data"), new EventHandler (OnSaveAsActivated)), new Gtk.ActionEntry ("RecentLogsMenu", null, Catalog.GetString ("Recent _Logs"), null, null, null), new Gtk.ActionEntry ("RecentLogs0", null, "_0", null, null, new EventHandler (OnRecentLogsActivated)), new Gtk.ActionEntry ("RecentLogs1", null, "_1", null, null, new EventHandler (OnRecentLogsActivated)), new Gtk.ActionEntry ("RecentLogs2", null, "_2", null, null, new EventHandler (OnRecentLogsActivated)), new Gtk.ActionEntry ("RecentLogs3", null, "_3", null, null, new EventHandler (OnRecentLogsActivated)), new Gtk.ActionEntry ("RecentLogs4", null, "_4", null, null, new EventHandler (OnRecentLogsActivated)), new Gtk.ActionEntry ("RepeatSessionsMenu", null, Catalog.GetString ("Re_peat Sessions"), null, null, null), new Gtk.ActionEntry ("RepeatSession0", null, "_0", null, null, new EventHandler (OnRepeatSessionActivated)), new Gtk.ActionEntry ("RepeatSession1", null, "_1", null, null, new EventHandler (OnRepeatSessionActivated)), new Gtk.ActionEntry ("RepeatSession2", null, "_2", null, null, new EventHandler (OnRepeatSessionActivated)), new Gtk.ActionEntry ("RepeatSession3", null, "_3", null, null, new EventHandler (OnRepeatSessionActivated)), new Gtk.ActionEntry ("RepeatSession4", null, "_4", null, null, new EventHandler (OnRepeatSessionActivated)), new Gtk.ActionEntry ("QuitAction", Gtk.Stock.Quit, null, "Q", Catalog.GetString ("Quit Profiler"), new EventHandler (OnQuitActivated)), new Gtk.ActionEntry ("RunMenu", null, Catalog.GetString ("_Run"), null, null, null), new Gtk.ActionEntry ("ViewMenu", null, Catalog.GetString ("_View"), null, null, null), }; Gtk.ToggleActionEntry[] toggle_actions = new Gtk.ToggleActionEntry[] { new Gtk.ToggleActionEntry ("ShowSystemNodesAction", null, Catalog.GetString ("_Show system nodes"), null, Catalog.GetString ("Shows internal nodes of system library method invocations"), new EventHandler (OnShowSystemNodesActivated), false), new Gtk.ToggleActionEntry ("LogEnabledAction", null, Catalog.GetString ("_Logging enabled"), null, Catalog.GetString ("Profile logging enabled"), new EventHandler (OnLoggingActivated), true), }; group = new Gtk.ActionGroup ("group"); group.Add (actions); group.Add (toggle_actions); Gtk.UIManager uim = new Gtk.UIManager (); uim.InsertActionGroup (group, (int) uim.NewMergeId ()); uim.AddUiFromString (ui_info); AddAccelGroup (uim.AccelGroup); logging_enabled_action = group.GetAction ("LogEnabledAction") as Gtk.ToggleAction; logging_enabled_action.Visible = false; save_action = group.GetAction ("SaveAsAction"); save_action.Sensitive = false; show_system_nodes_action = group.GetAction ("ShowSystemNodesAction"); return uim; } } } mono-tools-4.2/Mono.Profiler/mprof-gui/Makefile.am0000664000175000017500000000223412642235713024147 0ustar00directhexdirecthex00000000000000ASSEMBLY = $(top_builddir)/Mono.Profiler/lib/emveepee.exe if ENABLE_DEBUG CSFLAGS = -noconfig -codepage:utf8 -warn:4 -debug "-define:DEBUG" ASSEMBLY_MDB = $(ASSEMBLY).mdb else CSFLAGS = -noconfig -codepage:utf8 -warn:4 ASSEMBLY_MDB = endif programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) bin_SCRIPTS = emveepee CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AssemblyInfo.cs \ Main.cs \ MainWindow.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_args = $(addprefix -resource:, $(build_resources)) REFERENCES = \ -pkg:gtk-sharp-2.0 \ -r:Mono.Posix \ -r:System DLL_REFERENCES = PROJECT_REFERENCES = \ ../lib/Mono.Profiler.Widgets.dll \ ../lib/mprof-decoder-library.dll build_references = $(addprefix -r:, $(PROJECT_REFERENCES)) $(REFERENCES) $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(PROJECT_REFERENCES) mkdir -p $(shell dirname $(ASSEMBLY)) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:exe $(build_sources) $(build_resources_args) $(build_references) EXTRA_DIST = mprof-gui.csproj $(FILES) $(RESOURCES) mono-tools-4.2/Mono.Profiler/mprof-gui/mprof-gui.csproj0000664000175000017500000000631412413742070025240 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 2.0 {17E3AC3C-F4F1-4686-9770-E72C30A74457} Exe emveepee Mono.Profiler.Gui v2.0 65001 true full false ..\lib DEBUG prompt 4 none false bin\Release prompt 4 {986423AE-B771-4EB2-8952-AA4C2CBF1313} Mono.Profiler.Widgets {3C7942A8-2A4D-4C70-A670-65984F738EBB} profiler-decoder-library mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/0000775000175000017500000000000012642235744024307 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/ChangeLog0000664000175000017500000001074512413742070026057 0ustar00directhexdirecthex000000000000002009-10-08 Mike Kestner * ProfileConfiguration.cs: fix screwup in args construction that was causing multi-mode profile setups. 2009-09-03 Mike Kestner * StartPage.cs: add Quick Sessions section to repeat configs from the history. 2009-09-03 Mike Kestner * History.cs: add recent config support. * ProfileConfiguration.cs: new encapsulation for profile params. * ProfilerProcess.cs: construct from ProfileConfiguation. * ProfileSetupDialog.cs: expose Config prop. Manage the Execute response button sensitivity proactively. 2009-08-28 Mike Kestner * StartPage.cs: a little banner gradient tweaking. 2009-08-28 Mike Kestner * History.cs: basic history tracking xml serialized class. * StartPage.cs: display recent logs using new history. 2009-08-27 Mike Kestner * StartPage.cs: beginnings of a startup page similar to MD. 2009-08-19 Mike Kestner * ProfilerProcess.cs: new class to manage creation of and comm with the profiler. Initial suspend/resume capability. * ProfileSetupDialog.cs: add StartEnabled feature to control logging status on startup. * ProfileView.cs: use new reader iteration paradigm. 2009-08-04 Mike Kestner * ProfileView.cs: add SupportsFiltering prop to support action sensitivity in menu. 2009-07-30 Mike Kestner * Node.cs: add a DescendingValue comparison. 2009-07-15 Mike Kestner * AllocationsView.cs: make it a ScrolledWindow subclass. * CallsView.cs: make it a ScrolledWindow subclass. * DisplayOptions.cs: file rename * ProfileSetupDialog.cs: add support for stat profiling. default to stat profiling. * ProfileView.cs: not scrollable, the child views manage their own scrolling now. Load profiles by data content instead of explicitly. Close the reader when done loading to avoid access sharing problems. * StatDetail.cs: notebook to display calls and callers info for statistical hit items. * StatList.cs: ordered list widget for statistical hit items. * StatStore.cs: list store for statistical profile data. * StatView.cs: paned view to hold stat list and detail views and managed selection changes. 2009-06-19 Mike Kestner * CallsStore.cs: add child node compression for filtered libraries. Retrieves a list of filtered libraries from the DisplayOptions and "flattens" library calls within the set to hide internal implementation nodes. Prunes the tree to better visualize user code. * DisplayOptions.cs: initial pass at a filtering options class. Adds ShowSystemNodes option and first pass at a Filters array for filtered libraries which will be user configurable eventually. * ProfileView.cs: replace Type prop and set_LogFile with a LoadProfile method to make the operation atomic. * *.cs : hooks to enable DisplayOptions. 2009-06-17 Mike Kestner * ProfileSetupDialog.cs: add dialog to begin to add configurability to the profiler invocation. Supports alloc and calls switches as well as selecting assembly to execute. * ProfileView.cs: add ProfileType prop to support explicit view setup. Conditionally construct child view type when LogFile is set. 2009-06-17 Mike Kestner * CallsView.cs: Reorder columns to put cost first. 2009-06-17 Mike Kestner * AllocationsStore.cs: Allocations subclass of the new ProfileStore. * AllocationsView.cs: new Allocations tree view. * CallsStore.cs: refactor as ProfileStore subclass with CallsNode subclass. * Node.cs: super class for Calls and Allocations tree nodes. * ProfileStore.cs: super class for Calls and Allocations stores. 2009-06-12 Massimiliano Mantione * CallsStore.cs: Get the root frames from the event handler now. 2009-06-11 Mike Kestner * CallsStore.cs: add license. * CallsView.cs: new internal treeview subclass for calls data. * ProfileView.cs: new scrolled window class to load profile logs and manage different profile view types. 2009-06-09 Mike Kestner * CallsStore.cs: use StackTrace objects to navigate the call tree and obtain context appropriate clicks info. Fix a bug in the GetIter path traversal logic for trees deeper than 2 levels. 2009-05-21 Mike Kestner * *: initial checkin. beginnings of a widget library for profiler output display and navigation. mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/ProfileStore.cs0000664000175000017500000001130712413742070027244 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; using System.Runtime.InteropServices; using Gtk; using Mono.Profiler; namespace Mono.Profiler.Widgets { internal abstract class ProfileStore : GLib.Object, TreeModelImplementor { ProfilerEventHandler data; DisplayOptions options; protected List nodes; protected ProfileStore (ProfilerEventHandler data, DisplayOptions options) { this.data = data; this.options = options; } public override void Dispose () { foreach (Node n in nodes) n.Dispose (); base.Dispose (); } public DisplayOptions Options { get { return options; } } public ProfilerEventHandler ProfileData { get { return data; } } public TreeModelFlags Flags { get { return TreeModelFlags.ItersPersist; } } public int NColumns { get { return 2; } } public GLib.GType GetColumnType (int idx) { if (idx > 1) return GLib.GType.Invalid; else return GLib.GType.String; } public bool GetIter (out TreeIter iter, TreePath path) { iter = TreeIter.Zero; if (path.Indices.Length == 0 || nodes.Count <= path.Indices [0]) return false; Node node = nodes [path.Indices [0]]; for (int i = 1; i < path.Indices.Length; i++) { if (node.Children.Count <= path.Indices [i]) return false; node = node.Children [path.Indices [i]]; } iter = (TreeIter) node; return true; } public TreePath GetPath (TreeIter iter) { Node node = (Node) iter; TreePath result = new TreePath (); if (node == null) return result; while (node.Parent != null) { result.PrependIndex (node.Parent.Children.IndexOf (node)); node = node.Parent; } result.PrependIndex (nodes.IndexOf (node)); return result; } public abstract void GetValue (TreeIter iter, int column, ref GLib.Value val); public bool IterChildren (out TreeIter iter, TreeIter parent) { iter = TreeIter.Zero; Node parent_node = (Node) parent; if (parent_node == null) { if (nodes.Count == 0) return false; iter = (TreeIter) nodes [0]; } else { if (parent_node.Children.Count == 0) return false; iter = (TreeIter) parent_node.Children [0]; } return true; } public bool IterHasChild (TreeIter iter) { Node node = (Node) iter; if (node == null) return nodes.Count > 0; else return node.Children.Count > 0; } public int IterNChildren (TreeIter iter) { Node node = (Node) iter; if (node == null) return nodes.Count; else return node.Children.Count; } public bool IterNext (ref TreeIter iter) { Node node = (Node) iter; iter = TreeIter.Zero; if (node == null) return false; List siblings = node.Parent == null ? nodes : node.Parent.Children; int idx = siblings.IndexOf (node); if (idx < 0 || ++idx >= siblings.Count) return false; iter = (TreeIter) siblings [idx]; return true; } public bool IterNthChild (out TreeIter iter, TreeIter parent, int n) { Node parent_node = (Node) parent; List siblings = parent_node == null ? nodes : parent_node.Children; if (siblings.Count == 0 || siblings.Count <= n) { iter = TreeIter.Zero; return false; } else { iter = (TreeIter) siblings [n]; return true; } } public bool IterParent (out TreeIter parent, TreeIter iter) { Node node = (Node) iter; if (node == null) { parent = TreeIter.Zero; return false; } else { parent = (TreeIter) node.Parent; return true; } } public void RefNode (TreeIter iter) { } public void UnrefNode (TreeIter iter) { } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/CallsStore.cs0000664000175000017500000000631412413742070026704 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; using Mono.Profiler; namespace Mono.Profiler.Widgets { internal class CallsStore : ProfileStore { class CallsNode : Node { List children; StackTrace frame; public CallsNode (ProfileStore store, Node parent, StackTrace frame) : base (store, parent) { this.frame = frame; } public override List Children { get { if (children == null) { children = new List (); bool filter = Store.Options.Filters.Contains (frame.TopMethod.Class.Assembly.BaseName); foreach (StackTrace child in frame.CalledFrames) { if (filter) RecursiveAddFilteredChildren (child); else children.Add (new CallsNode (Store, this, child)); } } return children; } } void RecursiveAddFilteredChildren (StackTrace trace) { if (Store.Options.Filters.Contains (trace.TopMethod.Class.Assembly.BaseName)) foreach (StackTrace child in trace.CalledFrames) RecursiveAddFilteredChildren (child); else children.Add (new CallsNode (Store, this, trace)); } public override string Name { get { return frame.TopMethod.Class.Name + "." + frame.TopMethod.Name; } } public override ulong Value { get { return frame.Clicks; } } } ulong total_clicks; public CallsStore (ProfilerEventHandler data, DisplayOptions options) : base (data, options) { if (data == null || (data.Flags & ProfilerFlags.METHOD_EVENTS) == 0) return; nodes = new List (); foreach (StackTrace frame in data.RootFrames) { total_clicks += frame.TopMethod.Clicks; nodes.Add (new CallsNode (this, null, frame)); } } public override void GetValue (Gtk.TreeIter iter, int column, ref GLib.Value val) { Node node = (Node) iter; if (column == 0) val = new GLib.Value (node.Name); else if (column == 1) { double percent = (double) node.Value / (double) total_clicks * 100.0; val = new GLib.Value (String.Format ("{0,5:F2}% ({1:F6}s)", percent, ProfileData.ClicksToSeconds (node.Value))); } } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/StatStore.cs0000664000175000017500000000552712413742070026566 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; using Mono.Profiler; namespace Mono.Profiler.Widgets { internal class StatStore : ProfileStore { class StatNode : Node { static List children = new List (); IStatisticalHitItem item; public static Comparison CompareByHits = delegate (Node a, Node b) { return (b as StatNode).item.StatisticalHits.CompareTo ((a as StatNode).item.StatisticalHits); }; public StatNode (ProfileStore store, Node parent, IStatisticalHitItem item) : base (store, parent) { this.item = item; } public override List Children { get { return children; } } public IStatisticalHitItem HitItem { get { return item; } } public override string Name { get { return item.Name; } } public override ulong Value { get { return item.StatisticalHits; } } } ulong total_hits; public StatStore (ProfilerEventHandler data, DisplayOptions options) : base (data, options) { nodes = new List (); foreach (IStatisticalHitItem item in data.StatisticalHitItems) { if (item.StatisticalHits <= 0) continue; total_hits += item.StatisticalHits; nodes.Add (new StatNode (this, null, item)); } nodes.Sort (StatNode.CompareByHits); } public IStatisticalHitItem this [int index] { get { return (nodes [index] as StatNode).HitItem; } } public override void GetValue (Gtk.TreeIter iter, int column, ref GLib.Value val) { Node node = (Node) iter; if (column == 0) val = new GLib.Value (node.Name); else if (column == 1) { double percent = (double) node.Value / (double) total_hits * 100.0; val = new GLib.Value (String.Format ("{0,5:F2}%", percent)); } } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/DisplayOptions.cs0000664000175000017500000000405312413742070027610 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; namespace Mono.Profiler.Widgets { public class DisplayOptions { static string[] system_libs = new string[] { "mscorlib", "System", "System.Xml", "glib-sharp", "pango-sharp", "atk-sharp", "gdk-sharp", "gtk-sharp", "glade-sharp", "gtk-dotnet" }; List filters = new List (); internal List Filters { get { List result = new List (); result.AddRange ((string[])filters.ToArray ()); if (!show_system_nodes) result.AddRange (system_libs); return result; } } bool show_system_nodes; public bool ShowSystemNodes { get { return show_system_nodes; } set { if (show_system_nodes == value) return; show_system_nodes = value; OnChanged (); } } public event EventHandler Changed; void OnChanged () { if (Changed == null) return; Changed (this, EventArgs.Empty); } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/Mono.Profiler.Widgets.csproj0000664000175000017500000000667012413742070031627 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 2.0 {986423AE-B771-4EB2-8952-AA4C2CBF1313} Library Mono.Profiler.Widgets v2.0 65001 true full false ..\lib DEBUG prompt 4 false none false bin\Release prompt 4 false {3C7942A8-2A4D-4C70-A670-65984F738EBB} profiler-decoder-library mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/Makefile.in0000664000175000017500000004062612642235730026357 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = Mono.Profiler/Mono.Profiler.Widgets ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 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)$(programfilesdir)" DATA = $(programfiles_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ BUILDDIR = $(top_builddir)/Mono.Profiler/lib ASSEMBLY = $(BUILDDIR)/Mono.Profiler.Widgets.dll @ENABLE_DEBUG_FALSE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 @ENABLE_DEBUG_TRUE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -debug -define:DEBUG @ENABLE_DEBUG_FALSE@ASSEMBLY_MDB = @ENABLE_DEBUG_TRUE@ASSEMBLY_MDB = $(ASSEMBLY).mdb programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AllocationsStore.cs \ AllocationsView.cs \ AssemblyInfo.cs \ CallsStore.cs \ CallsView.cs \ DisplayOptions.cs \ History.cs \ Node.cs \ ProfileConfiguration.cs \ ProfileSetupDialog.cs \ ProfileStore.cs \ ProfileView.cs \ ProfilerProcess.cs \ StartPage.cs \ StatDetail.cs \ StatList.cs \ StatStore.cs \ StatView.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = \ Monodevelop-logo.png build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_args = $(addprefix -resource:, $(build_resources)) REFERENCES = \ -pkg:glib-sharp-2.0 \ -pkg:gtk-sharp-2.0 \ -r:Mono.Cairo \ -r:Mono.Posix \ -r:System \ -r:System.Xml PROJECT_REFERENCES = ../lib/mprof-decoder-library.dll build_references = $(addprefix /r:, $(PROJECT_REFERENCES)) $(REFERENCES) EXTRA_DIST = Mono.Profiler.Widgets.csproj $(FILES) $(RESOURCES) 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) --gnu Mono.Profiler/Mono.Profiler.Widgets/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Mono.Profiler/Mono.Profiler.Widgets/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): 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: ctags CTAGS: cscope cscopelist: 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 $(DATA) installdirs: for dir in "$(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) 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-programfilesDATA 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: uninstall-programfilesDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-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 tags-am uninstall \ uninstall-am uninstall-programfilesDATA .PRECIOUS: Makefile $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) mkdir -p $(BUILDDIR) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:library $(build_sources) $(build_resources_args) $(build_references) # 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-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/StatDetail.cs0000664000175000017500000001020112413742070026655 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; using Gdk; using Gtk; namespace Mono.Profiler.Widgets { [System.ComponentModel.ToolboxItem (true)] internal class StatDetail : Notebook { class PageView : ScrolledWindow { TreeView view; public PageView () : base () { view = new TreeView (); view.AppendColumn ("Count", new CellRendererText (), "text", 1); TreeViewColumn col = new TreeViewColumn ("Method", new CellRendererText (), "text", 0); view.AppendColumn (col); view.ExpanderColumn = col; view.Show (); Add (view); } public Store Store { set { view.Model = value == null ? null : new TreeModelAdapter (value); } } } class Store : ProfileStore { class CallInfoNode : Node { static List children = new List (); public static Comparison CompareByCalls = delegate (Node a, Node b) { return b.Value.CompareTo (a.Value); }; StatisticalHitItemCallInformation info; public CallInfoNode (ProfileStore store, Node parent, StatisticalHitItemCallInformation info) : base (store, parent) { this.info = info; } public override List Children { get { return children; } } public override string Name { get { return info.Item.Name; } } public override ulong Value { get { return info.Calls; } } } public Store (ProfilerEventHandler data, DisplayOptions options, StatisticalHitItemCallInformation[] infos) : base (data, options) { nodes = new List (); foreach (StatisticalHitItemCallInformation info in infos) nodes.Add (new CallInfoNode (this, null, info)); nodes.Sort (CallInfoNode.CompareByCalls); } public override void GetValue (Gtk.TreeIter iter, int column, ref GLib.Value val) { Node node = (Node) iter; if (column == 0) val = new GLib.Value (node.Name); else if (column == 1) val = new GLib.Value (node.Value.ToString ()); } } DisplayOptions options; PageView callers; PageView calls; ProfilerEventHandler data; public StatDetail (ProfilerEventHandler data, DisplayOptions options) { this.data = data; this.options = options; options.Changed += delegate { Refresh (); }; Label callers_lbl = new Label (Mono.Unix.Catalog.GetString ("Callers")); callers_lbl.Show (); Label calls_lbl = new Label (Mono.Unix.Catalog.GetString ("Calls")); calls_lbl.Show (); callers = new PageView (); callers.Show (); calls = new PageView (); calls.Show (); AppendPage (calls, calls_lbl); AppendPage (callers, callers_lbl); } void Refresh () { if (item.HasCallCounts) { calls.Store = new Store (data, options, item.CallCounts.Callees); callers.Store = new Store (data, options, item.CallCounts.Callers); } else { calls.Store = null; callers.Store = null; } } IStatisticalHitItem item; public IStatisticalHitItem CurrentItem { get { return item; } set { if (item == value) return; item = value; Refresh (); } } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/StatView.cs0000664000175000017500000000332512413742070026376 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; using Gdk; using Gtk; namespace Mono.Profiler.Widgets { public class StatView : VPaned { StatList list; StatDetail detail; public StatView (ProfilerEventHandler data, DisplayOptions options) { list = new StatList (data, options); ScrolledWindow sw = new ScrolledWindow (); sw.Add (list); sw.ShowAll (); detail = new StatDetail (data, options); detail.CurrentItem = list.SelectedItem; list.Selection.Changed += delegate { detail.CurrentItem = list.SelectedItem; }; Add1 (sw); Add2 (detail); Position = 200; } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/History.cs0000664000175000017500000001234012413742070026266 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections; using System.Collections.Generic; using System.IO; using System.Xml; using System.Xml.Serialization; namespace Mono.Profiler.Widgets { public class LogInfo { string detail; string filename; public LogInfo () {} public LogInfo (string filename, string detail) { this.filename = filename; this.detail = detail; } public string Caption { get { return Path.GetFileName (Filename); } } [XmlAttribute] public string Detail { get { return detail; } set { detail = value; OnChanged (); } } [XmlAttribute] public string Filename { get { return filename; } set { filename = value; OnChanged (); } } public event EventHandler Changed; void OnChanged () { if (Changed != null) Changed (this, EventArgs.Empty); } } public class LogInfoList : IEnumerable { int max_items = 5; List list = new List (); public int Count { get { return list.Count; } } public LogInfo this [int index] { get { return list [index]; } } public IEnumerator GetEnumerator () { return list.GetEnumerator (); } public event EventHandler Changed; void OnChanged () { if (Changed != null) Changed (this, EventArgs.Empty); } // Used by XmlSerializer public void Add (object obj) { LogInfo info = obj as LogInfo; if (info != null && File.Exists (info.Filename)) { list.Add (obj as LogInfo); OnChanged (); } } public void Prepend (LogInfo info) { list.Remove (info); list.Insert (0, info); while (list.Count > max_items) list.RemoveAt (max_items); OnChanged (); } } public class ProfileConfigList : IEnumerable { int max_items = 5; List list = new List (); public int Count { get { return list.Count; } } public ProfileConfiguration this [int index] { get { return list [index]; } } public IEnumerator GetEnumerator () { return list.GetEnumerator (); } public event EventHandler Changed; void OnChanged () { if (Changed != null) Changed (this, EventArgs.Empty); } // Used by XmlSerializer public void Add (object obj) { ProfileConfiguration config = obj as ProfileConfiguration; if (config != null) { list.Add (config); OnChanged (); } } public void Prepend (ProfileConfiguration config) { list.Remove (config); list.Insert (0, config); while (list.Count > max_items) list.RemoveAt (max_items); OnChanged (); } } public class History { [XmlArray] [XmlArrayItem (ElementName="ProfileConfiguration", Type=typeof (ProfileConfiguration))] public ProfileConfigList Configs; [XmlArray] [XmlArrayItem (ElementName="LogInfo", Type=typeof (LogInfo))] public LogInfoList LogFiles; public History () { LogFiles = new LogInfoList (); LogFiles.Changed += delegate { OnChanged (); }; Configs = new ProfileConfigList (); Configs.Changed += delegate { OnChanged (); }; } public event EventHandler Changed; void OnChanged () { if (Changed != null) Changed (this, EventArgs.Empty); } public static History Load () { string path = Filename; if (!File.Exists (path)) return new History (); History result; try { XmlSerializer serializer = new XmlSerializer (typeof (History)); XmlTextReader rdr = new XmlTextReader (path); result = (History) serializer.Deserialize (rdr); rdr.Close (); } catch (Exception) { result = new History (); } return result; } public void Save () { try { XmlSerializer serializer = new XmlSerializer (typeof (History)); using (FileStream fs = File.Create (Filename)) serializer.Serialize (fs, this); } catch (Exception e) { Console.WriteLine (e); } } static string filename; static string Filename { get { if (filename == null) { string dir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "emveepee"); if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); filename = Path.Combine (dir, "history.xml"); } return filename; } } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/AssemblyInfo.cs0000664000175000017500000000172612413742070027226 0ustar00directhexdirecthex00000000000000using 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.Profiler.Widgets")] [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.*")] // 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-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/Node.cs0000664000175000017500000000456712413742070025526 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; using System.Runtime.InteropServices; namespace Mono.Profiler.Widgets { internal abstract class Node { public static Comparison DescendingValue = delegate (Node a, Node b) { return b.Value.CompareTo (a.Value); }; ProfileStore store; Node parent; GCHandle gch; public Node (ProfileStore store, Node parent) { this.store = store; this.parent = parent; gch = GCHandle.Alloc (this, GCHandleType.Weak); } public abstract List Children { get; } public abstract string Name { get; } public abstract ulong Value { get; } public Node Parent { get { return parent; } } protected ProfileStore Store { get { return store; } } public void Dispose () { foreach (Node n in Children) n.Dispose (); gch.Free (); } public static explicit operator Node (Gtk.TreeIter iter) { if (iter.UserData == IntPtr.Zero) return null; GCHandle gch = (GCHandle) iter.UserData; return gch.Target as Node; } public static explicit operator Gtk.TreeIter (Node node) { if (node == null) return Gtk.TreeIter.Zero; Gtk.TreeIter result = Gtk.TreeIter.Zero; result.UserData = (IntPtr) node.gch; return result; } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/StatList.cs0000664000175000017500000000401012413742070026367 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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; using Mono.Profiler; namespace Mono.Profiler.Widgets { internal class StatList : TreeView { StatStore store; public StatList (ProfilerEventHandler data, DisplayOptions options) : base () { store = new StatStore (data, options); Model = new TreeModelAdapter (store); Selection.SelectPath (new TreePath ("0")); AppendColumn ("Percent", new CellRendererText (), "text", 1); TreeViewColumn col = new TreeViewColumn ("Method", new CellRendererText (), "text", 0); AppendColumn (col); ExpanderColumn = col; options.Changed += delegate { Model = new TreeModelAdapter (new StatStore (data, options)); }; } public IStatisticalHitItem SelectedItem { get { TreeModel model; TreePath[] paths = Selection.GetSelectedRows (out model); return store [paths [0].Indices [0]]; } set { throw new NotImplementedException (); } } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/ProfileConfiguration.cs0000664000175000017500000000561312413742070030762 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Text; using System.Xml.Serialization; namespace Mono.Profiler.Widgets { [Flags] public enum ProfileMode { None = 0, Allocations = 1 << 0, Instrumented = 1 << 1, Statistical = 1 << 2, HeapSummary = 1 << 3, HeapSnaphot = 1 << 4, } public class ProfileConfiguration { public ProfileConfiguration () {} string assembly_path; [XmlAttribute] public string AssemblyPath { get { return assembly_path; } set { assembly_path = value; } } ProfileMode mode = ProfileMode.Statistical; [XmlAttribute] public ProfileMode Mode { get { return mode; } set { mode = value; } } bool start_enabled = true; [XmlAttribute] public bool StartEnabled { get { return start_enabled; } set { start_enabled = value; } } public string ToArgs () { StringBuilder sb = new StringBuilder (); if ((Mode & ProfileMode.Allocations) != 0) sb.Append ("alloc"); if ((Mode & ProfileMode.Instrumented) != 0) { if (sb.Length > 0) sb.Append (","); sb.Append ("calls"); } if ((Mode & ProfileMode.Statistical) != 0) { if (sb.Length > 0) sb.Append (","); sb.Append ("s=128"); } if (!StartEnabled) sb.Append (",sd"); return sb.ToString (); } public override string ToString () { return System.IO.Path.GetFileName (AssemblyPath) + ":" + Mode + ", StartEnabled=" + StartEnabled; } public override bool Equals (object o) { if (o is ProfileConfiguration) { ProfileConfiguration c = o as ProfileConfiguration; return AssemblyPath == c.AssemblyPath && Mode == c.Mode && StartEnabled == c.StartEnabled; } else return false; } public override int GetHashCode () { return AssemblyPath.GetHashCode () ^ Mode.GetHashCode () ^ StartEnabled.GetHashCode (); } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/ProfileSetupDialog.cs0000664000175000017500000000612712413742070030374 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Text; using Gtk; namespace Mono.Profiler.Widgets { public class ProfileSetupDialog : Dialog { ProfileConfiguration config; public ProfileSetupDialog (Gtk.Window parent) : base ("Profile Options", parent, DialogFlags.DestroyWithParent, Stock.Cancel, ResponseType.Cancel, Stock.Execute, ResponseType.Accept) { config = new ProfileConfiguration (); HBox box = new HBox (false, 6); box.PackStart (new Label ("Assembly:"), false, false, 0); FileChooserButton assembly_button = new FileChooserButton ("Select Assembly", FileChooserAction.Open); FileFilter filter = new FileFilter (); filter.AddPattern ("*.exe"); assembly_button.Filter = filter; assembly_button.SelectionChanged += delegate { config.AssemblyPath = assembly_button.Filename; SetResponseSensitive (ResponseType.Accept, !String.IsNullOrEmpty (assembly_button.Filename)); }; box.PackStart (assembly_button, true, true, 0); box.ShowAll (); VBox.PackStart (box, false, false, 3); box = new HBox (false, 6); box.PackStart (new Label ("Type:"), false, false, 0); ComboBox type_combo = ComboBox.NewText (); type_combo.AppendText ("Allocations"); type_combo.AppendText ("Calls/Instrumented"); type_combo.AppendText ("Statistical"); type_combo.Active = 2; type_combo.Changed += delegate { config.Mode = (ProfileMode) (1 << type_combo.Active); }; box.PackStart (type_combo, false, false, 0); box.ShowAll (); VBox.PackStart (box, false, false, 3); box = new HBox (false, 6); CheckButton start_enabled_chkbtn = new CheckButton ("Enabled at Startup"); start_enabled_chkbtn.Active = true; start_enabled_chkbtn.Toggled += delegate { config.StartEnabled = start_enabled_chkbtn.Active; }; box.PackStart (start_enabled_chkbtn, false, false, 0); box.ShowAll (); VBox.PackStart (box, false, false, 3); SetResponseSensitive (ResponseType.Accept, false); } public ProfileConfiguration Config { get { return config; } } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/ProfilerProcess.cs0000664000175000017500000000657412413742070027762 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Diagnostics; using System.Net; using System.Net.Sockets; using Mono.Profiler; namespace Mono.Profiler.Widgets { public class ProfilerProcess { Process proc; string log_file; public ProfilerProcess (ProfileConfiguration config) { log_file = System.IO.Path.GetTempFileName (); proc = new Process (); proc.StartInfo.FileName = "mono"; proc.StartInfo.Arguments = "--profile=logging:" + config.ToArgs () + ",o=" + log_file + ",cp=" + Port.ToString () + " " + config.AssemblyPath; proc.EnableRaisingEvents = true; proc.Exited += delegate { OnExited (); }; } int port; int Port { get { if (port == 0) { IPEndPoint ep = new IPEndPoint (IPAddress.Any, 0); using (Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { socket.Bind (ep); port = ((IPEndPoint) socket.LocalEndPoint).Port; } } return port; } } NetworkStream stream; NetworkStream Stream { get { if (stream == null) { IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, Port); TcpClient client = new TcpClient (); client.Connect (ep); stream = client.GetStream (); } return stream; } } public event EventHandler Exited; void OnExited () { if (Exited == null) return; Exited (this, EventArgs.Empty); } public event EventHandler Paused; void OnPaused () { if (Paused == null) return; Paused (this, EventArgs.Empty); } public string LogFile { get { return log_file; } } string SendCommand (string cmd) { byte[] buffer = System.Text.Encoding.ASCII.GetBytes (cmd); NetworkStream stream = Stream; stream.Write (buffer, 0, buffer.Length); buffer = new byte [1024]; int cnt = stream.Read (buffer, 0, buffer.Length); return System.Text.Encoding.ASCII.GetString (buffer, 0, cnt); } public void Pause () { string resp = SendCommand ("disable\n"); if (resp == "DONE\n") OnPaused (); else throw new Exception ("'disable' command produced error"); } public void Resume () { string resp = SendCommand ("enable\n"); if (resp != "DONE\n") throw new Exception ("'enable' command produced error"); } public void Start () { proc.Start (); } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/Monodevelop-logo.png0000664000175000017500000001010712413742070030230 0ustar00directhexdirecthex00000000000000PNG  IHDR@@iqIDATx^ PT'm41yFE5|.>MLH"A hPQEQdEٚYA@8j꽙=sp9޽[E3SSEW}T;sw| jPԠ5hɑndw`p%{/TwjXi'ο|nlϗ<&GZ7g".J )1  j@x@xXv`㧺g[˧pْc{TS,?XxLX{8㡡I0/ډBkcBj1 $_־*\) <)iU52='̎x<'WL[ָ\#@5=ԡQT'R[j[6VC|M/པS `#/bp>WݛgORDa4X':FHE}fxukXx`5\UBG]VE3G!'~#x؜SB8BwCzEvVLo<|S#xP)m=j ZXx2=8Y E-Th~CXu CQC .kzjl6+޿D8Xnt~5X7w7="| UT{qpLgtt3m" A%(Mw~wէ(E.RHR6CYmfKJk;pk$Q'8Kz"0Ƥ[Ю.Xx.o3xb3Dx qƏ!f\Z31C>T].$,ccu^0?-v5 8zO_dcMej?qUKL-I?\+ꐛp( ,O+q7yU qyMcPf| ;lЉUʇ;Ż`F/? ^zl&p V3~L_Lkc1 0󓞂m}F9Ž)mK6؁+ psѼ#|/!%Ecl{53_ԲV)p| AA㓍 u'?ᡩ_bɐZ& -XEX6rhϟxHѹŎ&w,B2[Gt})%3a'0Qx,,@ kOu%ɨ5u 6Fb9`gl)ӛYBsc1s![Fe|&,ܺ}P NuNŒB9(lÓEOmd;JN7{\fbpMz82Eo]?#xZ `P^ 4is8BFV<;Y~xxъvʄVdױ 0ZƂ|&b.b Vδ|~x]0n}w/ALubrY[]8gG'hW& a>8 /F 14տҿ?oeϨZ OuI4F~x^~` ?W>.G/ :>1lRL9$UR?2L^u&֯ԗٌ.Hvt0'.*4I5g~ITM|x6>4:  |_s/WJ pG3s.\}x] ? ? 5DsZ-쐹t -“[y`7Z1zzIv!>ÜXծ7 5Fk靿J0G%)[d PXƇܽEn77%1}[a6EdMOVKbn\4G go _Y;!dkZ ~o_+]M<ǯ`x\**.e!BӪ+OS,H w Z\Ga/ESW" ➮\[, /$B9 pR$㻡Ç޸Vq! f=f-em4jvϼSDSFЭ.\`o?:dTjb8>&=49i;$bRXx W:dgsfa>7?_\s۠t,`:g:*A$e^5SrySlzd5Y2`%zR78g0r$W?[q䚅Hk"ǃI1T~M[>#V:֎no GZ4a_o{6_d~e?䚁5IFcz[=y¤W5sAh>%>!1WK7V^F;s_l)N&!]W(i6p /٤LJSBFxj|$?2?|5̦yI`-%=}VMsrM A =LΏV܂kk- 3bz'"C͏]62iA{ Lks,QgȰA*ۀkԘ jo(ۙi]?;>GM_ Q|G:dz MzX{8ƾQz/hM_{< <,&nv7"c֟E31O!j!Y$na*hˡNi nlwY̓ 6Lf,SMqs \͡lSO?@L2Zى`3>%=bǗ5; ceR+;c.><98WH:/:;O)-e~ʀ,na<)rAsuhԥ;vN5gk- ./ hv/t&^Y]ƃJ?y|]No}6g?~ -τw}+NP_ODMx6m/Rxl </׍ouR3|iseM_P\/v:ga#^]LF/h5>kwQ_|9ӾuhEc([ O8N7+73^yFx.|r ۰I 6n坈!t2 4JA8ZY8s.3LZ/ 0DuT9TH#9~wѪd8m։/=5Cj󙴊DPʝ JzSS 3xN&KAE^>'щnxݠG -*L7wwc }Q;ddm>ct h( 鉻kPԠ5}_%.IENDB`mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/AllocationsStore.cs0000664000175000017500000000663512413742070030124 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; using Mono.Profiler; namespace Mono.Profiler.Widgets { internal class AllocationsStore : ProfileStore { ulong total_bytes; class ClassNode : Node { List children; LoadedClass instance; public ClassNode (ProfileStore store, Node parent, LoadedClass instance) : base (store, parent) { this.instance = instance; } public override List Children { get { if (children == null) { children = new List (); foreach (LoadedClass.AllocationsPerMethod child in instance.Methods) children.Add (new MethodNode (Store, this, child)); } return children; } } public override string Name { get { return instance.Name; } } public override ulong Value { get { return instance.AllocatedBytes; } } } class MethodNode : Node { List children = new List (); LoadedClass.AllocationsPerMethod instance; public MethodNode (ProfileStore store, Node parent, LoadedClass.AllocationsPerMethod instance) : base (store, parent) { this.instance = instance; } public override List Children { get { return children; } } public override string Name { get { return instance.Method.Class.Name + "." + instance.Method.Name; } } public override ulong Value { get { return instance.AllocatedBytes; } } } public AllocationsStore (ProfilerEventHandler data, DisplayOptions options) : base (data, options) { if (data == null || (data.Flags & ProfilerFlags.CLASS_EVENTS) == 0) return; nodes = new List (); LoadedClass[] classes = data.LoadedElements.Classes; Array.Sort (classes, LoadedClass.CompareByAllocatedBytes); Array.Reverse (classes); foreach (LoadedClass c in classes) { if (c.AllocatedBytes > 0) { total_bytes += c.AllocatedBytes; nodes.Add (new ClassNode (this, null, c)); } } } public override void GetValue (Gtk.TreeIter iter, int column, ref GLib.Value val) { Node node = (Node) iter; if (column == 0) val = new GLib.Value (node.Name); else { double percent = (double) node.Value / (double) total_bytes * 100.0; val = new GLib.Value (String.Format ("{0,5:F2}% ({1} bytes)", percent, node.Value)); } } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/StartPage.cs0000664000175000017500000003165212413742070026526 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 System.Collections.Generic; using Mono.Profiler; namespace Mono.Profiler.Widgets { public delegate void StartEventHandler (object o, StartEventArgs args); public enum StartEventType { Create, Open, Repeat, } public class StartEventArgs : EventArgs { ProfileConfiguration config; StartEventType type; string detail; public StartEventArgs (StartEventType type, string detail) { this.type = type; this.detail = detail; } public StartEventArgs (ProfileConfiguration config) { this.type = StartEventType.Repeat; this.config = config; } public ProfileConfiguration Config { get { return config; } } public string Detail { get { return detail; } } public StartEventType Type { get { return type; } } } public class StartPage : Gtk.DrawingArea { const int padding = 8; const int text_padding = 3; bool pressed; BannerItem banner; History history; LinkItem prelight_item; LinkItem selected_item; List items = new List (); Pango.Layout layout; public StartPage (History history) { this.history = history; history.Changed += delegate { Refresh (); }; CanFocus = true; Events = Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.ExposureMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.PointerMotionMask; layout = CreatePangoLayout (String.Empty); } public event StartEventHandler Activated; protected override bool OnButtonPressEvent (Gdk.EventButton ev) { if (ev.Button != 1) return base.OnButtonPressEvent (ev); Gdk.Point pt = new Gdk.Point ((int)ev.X, (int)ev.Y); foreach (Item item in items) { if (item is LinkItem && item.Bounds.Contains (pt)) { // button press animation pressed = true; SelectItem (item as LinkItem); break; } } GrabFocus (); return base.OnButtonPressEvent (ev); } protected override bool OnButtonReleaseEvent (Gdk.EventButton ev) { pressed = false; if (selected_item == null) return base.OnButtonReleaseEvent (ev); Gdk.Point pt = new Gdk.Point ((int)ev.X, (int)ev.Y); if (selected_item.Bounds.Contains (pt)) selected_item.OnActivated (); return base.OnButtonReleaseEvent (ev); } protected override bool OnExposeEvent (Gdk.EventExpose ev) { base.OnExposeEvent (ev); Paint (ev); return true; } protected override bool OnKeyPressEvent (Gdk.EventKey ev) { switch (ev.Key) { case Gdk.Key.Left: SelectPreviousItem (); break; case Gdk.Key.Right: SelectNextItem (); break; case Gdk.Key.Up: SelectPreviousItem (); break; case Gdk.Key.Down: SelectNextItem (); break; case Gdk.Key.KP_Enter: case Gdk.Key.ISO_Enter: case Gdk.Key.Return: if (selected_item != null) selected_item.OnActivated (); break; default: return false; } return true; } protected override bool OnMotionNotifyEvent (Gdk.EventMotion ev) { SelectItem (null); Gdk.Point pt = new Gdk.Point ((int)ev.X, (int)ev.Y); if (prelight_item != null) { if (prelight_item.Bounds.Contains (pt)) return true; else { LinkItem item = prelight_item; prelight_item = null; QueueDrawArea (item.Bounds.X, item.Bounds.Y, item.Bounds.Width, item.Bounds.Height); } } foreach (Item item in items) { if (item is LinkItem && item.Bounds.Contains (pt)) { prelight_item = item as LinkItem; QueueDrawArea (item.Bounds.X, item.Bounds.Y, item.Bounds.Width, item.Bounds.Height); break; } } return true; } protected override void OnSizeAllocated (Gdk.Rectangle allocation) { base.OnSizeAllocated (allocation); Layout (); } protected override void OnSizeRequested (ref Gtk.Requisition requisition) { requisition.Width = 350; requisition.Height = 340; } abstract class Item { protected StartPage owner; public Gdk.Rectangle Bounds; protected Item (StartPage owner) { this.owner = owner; } public abstract void Draw (Gdk.Rectangle clip); public virtual void OnActivated () { } } class BannerItem : Item { public BannerItem (StartPage owner) : base (owner) { Bounds = new Gdk.Rectangle (0, 0, owner.Allocation.Width, 65); } public override void Draw (Gdk.Rectangle clip) { using (Cairo.Context ctx = Gdk.CairoHelper.Create (owner.GdkWindow)) { ctx.MoveTo (new Cairo.PointD (0, 0)); ctx.LineTo (new Cairo.PointD (Bounds.Width, 0)); ctx.LineTo (new Cairo.PointD (Bounds.Width, Bounds.Height)); ctx.LineTo (new Cairo.PointD (0, Bounds.Height)); ctx.ClosePath (); ctx.Save (); Cairo.Gradient grad = new Cairo.LinearGradient (Bounds.Width / 4, 0, Bounds.Width * 3 / 4, Bounds.Height); grad.AddColorStop (0, new Cairo.Color (0.0, 0.0, 0.5, 1.0)); grad.AddColorStop (1, new Cairo.Color (0.0, 0.0, 1.0, 1.0)); ctx.Pattern = grad; ctx.FillPreserve (); ctx.Restore (); } Gdk.Pixbuf pixbuf = new Gdk.Pixbuf (null, "Monodevelop-logo.png"); owner.GdkWindow.DrawPixbuf (null, pixbuf, 0, 0, padding, 0, -1, -1, Gdk.RgbDither.None, 0, 0); owner.layout.SetMarkup ("Mono Visual Profiler"); Pango.Rectangle ink, log; owner.layout.GetPixelExtents (out ink, out log); owner.GdkWindow.DrawLayout (owner.Style.TextGC (Gtk.StateType.Normal), pixbuf.Width + 2 * padding - ink.X, (65 - ink.Height) / 2 - ink.Y, owner.layout); } } class LabelItem : Item { string markup; Gdk.Point text_offset; public LabelItem (StartPage owner, string label, int x, int y) : base (owner) { markup = "" + label + ""; owner.layout.SetMarkup (markup); Pango.Rectangle ink, log; owner.layout.GetPixelExtents (out ink, out log); Bounds = new Gdk.Rectangle (x + 30, y, ink.Width, ink.Height); text_offset = new Gdk.Point (ink.X, ink.Y); } public override void Draw (Gdk.Rectangle clip) { owner.layout.SetMarkup (markup); owner.GdkWindow.DrawLayout (owner.Style.TextGC (Gtk.StateType.Normal), Bounds.X - text_offset.X, Bounds.Y - text_offset.Y, owner.layout); } } class LinkItem : Item { public StartEventType Type; public string Detail; string markup; string description; Gdk.Point text_offset; Gdk.Point description_offset; protected LinkItem (StartPage owner, string caption, string description, int x, int y) : base (owner) { markup = "" + caption + ""; this.description = description; owner.layout.SetMarkup (markup); Pango.Rectangle ink, log; owner.layout.GetPixelExtents (out ink, out log); text_offset = new Gdk.Point (padding - ink.X, padding - ink.Y); if (String.IsNullOrEmpty (description)) Bounds = new Gdk.Rectangle (x + 40, y, ink.Width + 2 * padding, ink.Height + 2 * padding); else { int height = ink.Height + padding; int width = ink.Width; owner.layout.SetMarkup ("" + description + ""); owner.layout.GetPixelExtents (out ink, out log); description_offset = new Gdk.Point (padding - ink.X, height + text_padding - ink.Y); Bounds = new Gdk.Rectangle (x + 40, y, width > ink.Width ? width + 2 * padding : ink.Width + 2 * padding, height + ink.Height + padding + text_padding); } } public LinkItem (StartPage owner, string caption, StartEventType type, string detail, int x, int y) : this (owner, caption, null, type, detail, x, y) {} public LinkItem (StartPage owner, string caption, string description, StartEventType type, string detail, int x, int y) : this (owner, caption, description, x, y) { Type = type; Detail = detail; } public override void Draw (Gdk.Rectangle clip) { if (owner.selected_item == this || owner.prelight_item == this) Gtk.Style.PaintBox (owner.Style, owner.GdkWindow, Gtk.StateType.Prelight, owner.pressed ? Gtk.ShadowType.Out : Gtk.ShadowType.In, clip, owner, "GtkButton", Bounds.X, Bounds.Y, Bounds.Width, Bounds.Height); owner.layout.SetMarkup (markup); owner.GdkWindow.DrawLayout (owner.Style.TextGC (Gtk.StateType.Normal), Bounds.X + text_offset.X, Bounds.Y + text_offset.Y, owner.layout); if (description != null) { owner.layout.SetMarkup ("" + description + ""); owner.GdkWindow.DrawLayout (owner.Style.TextGC (Gtk.StateType.Normal), Bounds.X + description_offset.X, Bounds.Y + description_offset.Y, owner.layout); } } public override void OnActivated () { owner.OnActivated (new StartEventArgs (Type, Detail)); } } class QuickStartItem : LinkItem { ProfileConfiguration config; public QuickStartItem (StartPage owner, ProfileConfiguration config, string caption, string description, int x, int y) : base (owner, caption, description, x, y) { this.config = config; } public override void OnActivated () { owner.OnActivated (new StartEventArgs (config)); } } void Layout () { if (banner == null) banner = new BannerItem (this); items.Clear (); items.Add (banner); Item item = new LabelItem (this, "Common Actions:", 0, banner.Bounds.Bottom + 3 * padding); items.Add (item); item = new LinkItem (this, "Create New Profile", StartEventType.Create, null, 0, item.Bounds.Bottom + text_padding); items.Add (item); item = new LinkItem (this, "Open Profile Log File", StartEventType.Open, null, 0, item.Bounds.Bottom); items.Add (item); int y = item.Bounds.Bottom + 3 * padding; if (history.LogFiles.Count > 0) { item = new LabelItem (this, "Recent Logs:", 0, y); y = item.Bounds.Bottom + text_padding; items.Add (item); foreach (LogInfo info in history.LogFiles) { item = new LinkItem (this, info.Caption, info.Detail, StartEventType.Open, info.Filename, 0, y); items.Add (item); y = item.Bounds.Bottom; } } int x = Allocation.Width / 2; if (history.Configs.Count > 0) { item = new LabelItem (this, "Quick Sessions:", x, banner.Bounds.Bottom + 3 * padding); items.Add (item); y = item.Bounds.Bottom + text_padding; foreach (ProfileConfiguration config in history.Configs) { string text = config.ToString (); int idx = text.IndexOf (":"); item = new QuickStartItem (this, config, text.Substring (0, idx), text.Substring (idx + 1), x, y); items.Add (item); y = item.Bounds.Bottom; } } } void OnActivated (StartEventArgs args) { if (Activated != null) Activated (this, args); } void Paint (Gdk.EventExpose ev) { Gtk.Style.PaintBox (Style, GdkWindow, Gtk.StateType.Normal, Gtk.ShadowType.In, ev.Area, this, null, 0, 0, Allocation.Width, Allocation.Height); foreach (Item item in items) if (item.Bounds.IntersectsWith (ev.Area)) item.Draw (ev.Area); } void Refresh () { Layout (); QueueDraw (); } void SelectItem (LinkItem item) { if (selected_item != null) QueueDrawArea (selected_item.Bounds.X, selected_item.Bounds.Y, selected_item.Bounds.Width, selected_item.Bounds.Height); selected_item = item; if (selected_item != null) QueueDrawArea (selected_item.Bounds.X, selected_item.Bounds.Y, selected_item.Bounds.Width, selected_item.Bounds.Height); } void SelectNextItem () { if (selected_item == null) { SelectItem (items [2] as LinkItem); // skips Banner and Common Actions label return; } int idx = items.IndexOf (selected_item); while (++idx < items.Count && !(items[idx] is LinkItem)); if (idx < items.Count) SelectItem (items[idx] as LinkItem); } void SelectPreviousItem () { if (selected_item == null) { SelectItem (items [2] as LinkItem); // skips Banner and Common Actions label return; } int idx = items.IndexOf (selected_item); while (--idx >= 2 && !(items[idx] is LinkItem)); if (idx >= 2) SelectItem (items[idx] as LinkItem); } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/Makefile.am0000664000175000017500000000270212642235713026340 0ustar00directhexdirecthex00000000000000BUILDDIR= $(top_builddir)/Mono.Profiler/lib ASSEMBLY = $(BUILDDIR)/Mono.Profiler.Widgets.dll if ENABLE_DEBUG CSFLAGS = -noconfig -codepage:utf8 -warn:4 -debug -define:DEBUG ASSEMBLY_MDB = $(ASSEMBLY).mdb else CSFLAGS = -noconfig -codepage:utf8 -warn:4 ASSEMBLY_MDB = endif programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AllocationsStore.cs \ AllocationsView.cs \ AssemblyInfo.cs \ CallsStore.cs \ CallsView.cs \ DisplayOptions.cs \ History.cs \ Node.cs \ ProfileConfiguration.cs \ ProfileSetupDialog.cs \ ProfileStore.cs \ ProfileView.cs \ ProfilerProcess.cs \ StartPage.cs \ StatDetail.cs \ StatList.cs \ StatStore.cs \ StatView.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = \ Monodevelop-logo.png build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_args = $(addprefix -resource:, $(build_resources)) REFERENCES = \ -pkg:glib-sharp-2.0 \ -pkg:gtk-sharp-2.0 \ -r:Mono.Cairo \ -r:Mono.Posix \ -r:System \ -r:System.Xml PROJECT_REFERENCES = ../lib/mprof-decoder-library.dll build_references = $(addprefix /r:, $(PROJECT_REFERENCES)) $(REFERENCES) $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) mkdir -p $(BUILDDIR) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:library $(build_sources) $(build_resources_args) $(build_references) EXTRA_DIST = Mono.Profiler.Widgets.csproj $(FILES) $(RESOURCES) mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/CallsView.cs0000664000175000017500000000342112413742070026516 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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; using Mono.Profiler; namespace Mono.Profiler.Widgets { internal class CallsView : ScrolledWindow { public CallsView (ProfilerEventHandler data, DisplayOptions options) : base () { TreeView view = new TreeView (new TreeModelAdapter (new CallsStore (data, options))); view.AppendColumn ("Cost", new CellRendererText (), "text", 1); TreeViewColumn col = new TreeViewColumn ("Method", new CellRendererText (), "text", 0); view.AppendColumn (col); view.ExpanderColumn = col; view.Show (); options.Changed += delegate { view.Model = new TreeModelAdapter (new CallsStore (data, options)); }; Add (view); } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/ProfileView.cs0000664000175000017500000000550212413742070027062 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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 Mono.Profiler; namespace Mono.Profiler.Widgets { [System.ComponentModel.ToolboxItem (true)] public class ProfileView : Gtk.EventBox { bool supports_filtering = false; DisplayOptions options; string path; public string LogFile { get { return path; } } public bool LoadProfile (string path) { this.path = path; SyncLogFileReader rdr = new SyncLogFileReader (path); ProfilerEventHandler data = new ProfilerEventHandler (); data.LoadedElements.RecordHeapSnapshots = false; for (BlockData current = rdr.ReadBlock (); current != null; current = rdr.ReadBlock ()) { try { current.Decode (data, rdr); } catch (DecodingException e) { Console.Error.WriteLine ("Stopping decoding after a DecodingException in block of code {0}, length {1}, file offset {2}, block offset {3}: {4}", e.FailingData.Code, e.FailingData.Length, e.FailingData.FileOffset, e.OffsetInBlock, e.Message); rdr.Close (); return false; } } rdr.Close (); Gtk.Widget view; supports_filtering = false; if (data.HasStatisticalData) view = new StatView (data, Options); else if (data.HasAllocationData) view = new AllocationsView (data, Options); else { view = new CallsView (data, Options); supports_filtering = true; } view.ShowAll (); View = view; return true; } public DisplayOptions Options { get { if (options == null) options = new DisplayOptions (); return options; } } public bool SupportsFiltering { get { return supports_filtering; } } Gtk.Widget View { get { return Child; } set { if (Child != null) Remove (Child); if (value != null) Add (value); } } } } mono-tools-4.2/Mono.Profiler/Mono.Profiler.Widgets/AllocationsView.cs0000664000175000017500000000330412413742070027730 0ustar00directhexdirecthex00000000000000// Copyright (c) 2009 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; using Mono.Profiler; namespace Mono.Profiler.Widgets { internal class AllocationsView : ScrolledWindow { public AllocationsView (ProfilerEventHandler data, DisplayOptions options) : base () { TreeView view = new TreeView (new TreeModelAdapter (new AllocationsStore (data, options))); view.AppendColumn ("Cost", new CellRendererText (), "text", 1); TreeViewColumn col = new TreeViewColumn ("Class/Allocator", new CellRendererText (), "text", 0); view.AppendColumn (col); view.ExpanderColumn = col; view.Show (); Add (view); } } } mono-tools-4.2/Mono.Profiler/Makefile.in0000664000175000017500000004565012642235730022263 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = Mono.Profiler ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in compile 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = profiler-decoder-library profiler-file-decoder heap-snapshot-explorer heap-snapshot-viewer Mono.Profiler.Widgets mprof-gui EXTRA_DIST = Mono.Profiler.sln 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) --gnu Mono.Profiler/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Mono.Profiler/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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ 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-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/Mono.Profiler/profiler-file-decoder/0000775000175000017500000000000012642235744024353 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/profiler-file-decoder/ChangeLog0000664000175000017500000000620012413742070026112 0ustar00directhexdirecthex000000000000002009-06-12 Massimiliano Mantione * Main.cs: Get the root frames from the event handler now. 2009-06-12 Massimiliano Mantione * Main.cs: Also show method execution time grouped by individual stack frames in the call tree 2009-06-09 Mike Kestner * Main.cs: commit Massi's new calls profile formatting code. 2009-05-21 Mike Kestner * *: replace MD 1.0 solution files with 2.0 msbuild files, and turn on makefile synchronization instead of generated makefiles. 2009-04-06 Massimiliano Mantione * Main.cs: Added support for monitor profiling. 2008-11-03 Massimiliano Mantione * Main.cs: Changed clicksToSeconds to ClicksToSeconds after refactoring. 2008-10-10 Massimiliano Mantione * Main.cs: - Added support for handling the stack trace of each allocation event. - Transferred handling of decoder bugs to the DebugProfilerEventHandler. 2008-08-21 Massimiliano Mantione * Main.cs: Added support for correct accounting of allocations which happened at JIT time. 2008-08-20 Massimiliano Mantione * Main.cs: Ignore decoding exceptions but print the stack trace. 2008-08-12 Massimiliano Mantione * mprof-decoder.in: Fixed for integration into mono-tools; 2008-08-12 Massimiliano Mantione * Makefile.am: Fixed for integration into mono-tools; 2008-08-04 Massimiliano Mantione * Main.cs: Ignore (but print) decoding exceptions and process the available data anyway. 2008-08-04 Massimiliano Mantione Added man page. 2008-08-01 Massimiliano Mantione * Makefile.am, profiler-file-decoder.mdp: renamed output assembly. * profiler-file-decoder.in: renamed to mprof-decoder.in * profiler-file-decoder: deleted (it is autogenerated). 2008-08-01 Massimiliano Mantione Makefile.am, profiler-file-decoder: Regenerated from MonoDevelop. 2008-06-18 Massimiliano Mantione * Main.cs: Initial implementation of allocation summaries. 2008-05-23 Massimiliano Mantione * Main.cs: Handle statistical profiler call chains. 2008-05-13 Massimiliano Mantione * Main.cs: Cleaned up and optimized "heap-desc" functionality. 2008-05-12 Massimiliano Mantione * Main.cs: Added support for garbage collection statistics. 2008-04-11 Massimiliano Mantione * Main.cs: Made HeapSnapshot non generic. 2008-04-10 Massimiliano Mantione * Main.cs: Added desc-heap like reporting. 2008-03-19 Massimiliano Mantione * Main.cs: More printing adjustments. 2008-03-11 Massimiliano Mantione * Main.cs: Minor adjustments in printing. 2008-03-04 Massimiliano Mantione * Main.cs: Also print allocation and calls caller attribution. 2008-01-11 Massimiliano Mantione * Main.cs: Added (first code dump). * profiler-file-decoder.mdp: Added (first code dump). * ChangeLog: Added (first code dump). mono-tools-4.2/Mono.Profiler/profiler-file-decoder/Main.cs0000664000175000017500000004061012413742070025556 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.IO; namespace Mono.Profiler { public class ConsoleDecoder { static void PrintSeparator (TextWriter writer) { writer.WriteLine ("\n\n------------------------------------------------"); } static void PrintMethodAllocationsPerClass (TextWriter writer, LoadedClass.AllocationsPerMethod allocationsPerMethod, bool JitTime, bool printStackTraces, double stackTraceTreshold) { if (! JitTime) { writer.WriteLine (" {0} bytes ({1} instances) from {2}.{3}", allocationsPerMethod.AllocatedBytes, allocationsPerMethod.AllocatedInstances, allocationsPerMethod.Method.Class.Name, allocationsPerMethod.Method.Name); } else { writer.WriteLine (" {0} bytes ({1} instances) at JIT time in {2}.{3}", allocationsPerMethod.AllocatedBytes, allocationsPerMethod.AllocatedInstances, allocationsPerMethod.Method.Class.Name, allocationsPerMethod.Method.Name); } if (printStackTraces) { LoadedClass.AllocationsPerStackTrace [] stackTraces = allocationsPerMethod.StackTraces; Array.Sort (stackTraces, LoadedClass.AllocationsPerStackTrace.CompareByAllocatedBytes); Array.Reverse (stackTraces); double cumulativeAllocatedBytesPerStackTrace = 0; foreach (LoadedClass.AllocationsPerStackTrace trace in stackTraces) { if (cumulativeAllocatedBytesPerStackTrace / allocationsPerMethod.AllocatedBytes < stackTraceTreshold) { writer.WriteLine (" {0} bytes ({1} instances) inside", trace.AllocatedBytes, trace.AllocatedInstances); for (StackTrace frame = trace.Trace; frame != null; frame = frame.Caller) { writer.Write (" "); if (frame.MethodIsBeingJitted) { writer.Write ("[JIT time]:"); } writer.WriteLine ("{0}.{1}", frame.TopMethod.Class.Name, frame.TopMethod.Name); } } else { break; } cumulativeAllocatedBytesPerStackTrace += (double)trace.AllocatedBytes; } } } static void PrintClassAllocationData (TextWriter writer, ProfilerEventHandler data, LoadedClass c, ulong totalAllocatedBytes) { double allocatedBytesPerClass = (double)c.AllocatedBytes; writer.WriteLine ("{0,5:F2}% ({1} bytes) {2}", ((allocatedBytesPerClass / totalAllocatedBytes) * 100), c.AllocatedBytes, c.Name); if (data.Directives.AllocationsHaveStackTrace) { LoadedClass.AllocationsPerMethod[] allocationsPerMethodArray = c.Methods; double cumulativeAllocatedBytesPerMethod = 0; if (c.MethodsAtJitTimeCount > 0) { LoadedClass.AllocationsPerMethod[] allocationsPerMethodAtJitTime = c.MethodsAtJitTime; LoadedClass.AllocationsPerMethod[] totalAllocationsPerMethod = new LoadedClass.AllocationsPerMethod [allocationsPerMethodArray.Length + allocationsPerMethodAtJitTime.Length]; Array.Copy (allocationsPerMethodArray, totalAllocationsPerMethod, allocationsPerMethodArray.Length); Array.Copy (allocationsPerMethodAtJitTime, 0, totalAllocationsPerMethod, allocationsPerMethodArray.Length, allocationsPerMethodAtJitTime.Length); allocationsPerMethodArray = totalAllocationsPerMethod; } if (allocationsPerMethodArray.Length != 0) { Array.Sort (allocationsPerMethodArray, LoadedClass.AllocationsPerMethod.CompareByAllocatedBytes); Array.Reverse (allocationsPerMethodArray); foreach (LoadedClass.AllocationsPerMethod allocationsPerMethod in allocationsPerMethodArray) { PrintMethodAllocationsPerClass (writer, allocationsPerMethod, false, cumulativeAllocatedBytesPerMethod < allocatedBytesPerClass * 0.7, 0.7); cumulativeAllocatedBytesPerMethod += (double)allocationsPerMethod.AllocatedBytes; } } } else { LoadedClass.AllocationsPerMethod[] allocationsPerMethodArray = c.Methods; if (allocationsPerMethodArray.Length != 0) { Array.Sort (allocationsPerMethodArray, LoadedClass.AllocationsPerMethod.CompareByAllocatedBytes); Array.Reverse (allocationsPerMethodArray); foreach (LoadedClass.AllocationsPerMethod allocationsPerMethod in allocationsPerMethodArray) { PrintMethodAllocationsPerClass (writer, allocationsPerMethod, false, false, 0); } } if (c.MethodsAtJitTimeCount > 0) { allocationsPerMethodArray = c.MethodsAtJitTime; Array.Sort (allocationsPerMethodArray, LoadedClass.AllocationsPerMethod.CompareByAllocatedBytes); Array.Reverse (allocationsPerMethodArray); foreach (LoadedClass.AllocationsPerMethod allocationsPerMethod in allocationsPerMethodArray) { PrintMethodAllocationsPerClass (writer, allocationsPerMethod, true, false, 0); } } } } static void PrintExecutionTimeByCallStack (TextWriter writer, ProfilerEventHandler data, StackTrace stackFrame, double callerSeconds, int indentationLevel) { for (int i = 0; i < indentationLevel; i++) { writer.Write (" "); } LoadedMethod currentMethod = stackFrame.TopMethod; double currentSeconds = data.ClicksToSeconds (stackFrame.Clicks); writer.WriteLine ("{0,5:F2}% ({1:F6}s, {2} calls) {3}.{4}", ((currentSeconds / callerSeconds) * 100), currentSeconds, stackFrame.Calls, currentMethod.Class.Name, currentMethod.Name); foreach (StackTrace calledFrame in stackFrame.CalledFrames) { PrintExecutionTimeByCallStack (writer, data, calledFrame, currentSeconds, indentationLevel + 1); } } static void PrintData (TextWriter writer, ProfilerEventHandler data) { LoadedClass[] classes = data.LoadedElements.Classes; LoadedMethod[] methods = data.LoadedElements.Methods; IStatisticalHitItem[] statisticalHitItems = data.StatisticalHitItems; if ((data.Flags & ProfilerFlags.CLASS_EVENTS) != 0) { Array.Sort (classes, LoadedClass.CompareByAllocatedBytes); Array.Reverse (classes); ulong totalAllocatedBytes = 0; foreach (LoadedClass c in classes) { totalAllocatedBytes += c.AllocatedBytes; } if (totalAllocatedBytes > 0) { PrintSeparator (writer); writer.WriteLine ("Reporting allocations (on {0} classes)", classes.Length); foreach (LoadedClass c in classes) { if (c.AllocatedBytes > 0) { PrintClassAllocationData (writer, data, c, totalAllocatedBytes); } } } else { writer.WriteLine ("No allocations reported (on {0} classes)", classes.Length); } } if ((data.Flags & ProfilerFlags.METHOD_EVENTS) != 0) { Array.Sort (methods, LoadedMethod.CompareByTotalClicks); Array.Reverse (methods); ulong totalExecutionClicks = 0; foreach (LoadedMethod m in methods) { totalExecutionClicks += m.Clicks; } if (totalExecutionClicks > 0) { PrintSeparator (writer); writer.WriteLine ("Reporting execution time (on {0} methods)", methods.Length); foreach (LoadedMethod m in methods) { if (m.Clicks > 0) { writer.WriteLine ("{0,5:F2}% ({1:F6}s) {2}.{3}", ((((double)m.Clicks) / totalExecutionClicks) * 100), data.ClicksToSeconds (m.Clicks), m.Class.Name, m.Name); LoadedMethod.CallsPerCallerMethod[] callsPerCallerMethodArray = m.Callers; if (callsPerCallerMethodArray.Length > 0) { Array.Sort (callsPerCallerMethodArray, LoadedMethod.CallsPerCallerMethod.CompareByCalls); Array.Reverse (callsPerCallerMethodArray); foreach (LoadedMethod.CallsPerCallerMethod callsPerCallerMethod in callsPerCallerMethodArray) { writer.WriteLine (" {0} calls from {1}.{2}", callsPerCallerMethod.Calls, callsPerCallerMethod.Callees.Class.Name, callsPerCallerMethod.Callees.Name); } } } } PrintSeparator (writer); writer.WriteLine ("Reporting execution time by stack frame"); foreach (StackTrace rootFrame in data.RootFrames) { PrintExecutionTimeByCallStack (writer, data, rootFrame, data.ClicksToSeconds (totalExecutionClicks), 0); } } else { writer.WriteLine ("No execution time reported (on {0} methods)", methods.Length); } } if ((data.Flags & ProfilerFlags.JIT_COMPILATION) != 0) { Array.Sort (methods, LoadedMethod.CompareByJitClicks); Array.Reverse (methods); ulong totalJitClicks = 0; foreach (LoadedMethod m in methods) { totalJitClicks += m.JitClicks; } if (totalJitClicks > 0) { PrintSeparator (writer); writer.WriteLine ("Reporting jit time (on {0} methods)", methods.Length); foreach (LoadedMethod m in methods) { if (m.JitClicks > 0) { writer.WriteLine ("{0,5:F2}% ({1:F3}ms) {2}.{3}", ((((double)m.JitClicks) / totalJitClicks) * 100), data.ClicksToSeconds (m.JitClicks) * 1000, m.Class.Name, m.Name); } } } else { writer.WriteLine ("No jit time reported (on {0} methods)", methods.Length); } } if ((data.Flags & ProfilerFlags.STATISTICAL) != 0) { Array.Sort (statisticalHitItems, StatisticalHitItemCallCounts.CompareByStatisticalHits); Array.Reverse (statisticalHitItems); ulong totalHits = 0; foreach (IStatisticalHitItem s in statisticalHitItems) { totalHits += s.StatisticalHits; } if (totalHits > 0) { PrintSeparator (writer); writer.WriteLine ("Reporting statistical hits ({0} hits recorded)", totalHits); foreach (IStatisticalHitItem s in statisticalHitItems) { if ((s.StatisticalHits > 0) || s.HasCallCounts) { writer.WriteLine ("{0,5:F2}% ({1}) {2}", ((((double)s.StatisticalHits) / totalHits) * 100), s.StatisticalHits, s.Name); if (s.HasCallCounts) { StatisticalHitItemCallCounts callCounts = s.CallCounts; if (callCounts.CallersCount > 0) { StatisticalHitItemCallInformation[] calls = callCounts.Callers; foreach (StatisticalHitItemCallInformation call in calls) { writer.WriteLine (" {0} calls from {1}", call.Calls, call.Item.Name); } } if (callCounts.CalleesCount > 0) { StatisticalHitItemCallInformation[] calls = callCounts.Callees; foreach (StatisticalHitItemCallInformation call in calls) { writer.WriteLine (" {0} calls to {1}", call.Calls, call.Item.Name); } } } } } } else { writer.WriteLine ("No statistical hits reported (on {0} items)", statisticalHitItems.Length); } } if (data.GlobalMonitorStatistics.ContainsData) { PrintSeparator (writer); writer.WriteLine ("Reporting monitor statistics."); data.GlobalMonitorStatistics.WriteStatistics (writer, data); } ProfilerEventHandler.GcStatistics[] gcStatistics = data.GarbageCollectioncStatistics; if (gcStatistics.Length > 0) { double totalTime = data.ClicksToSeconds (data.EndCounter - data.StartCounter); double gcTime = 0; double gcMarkTime = 0; double gcSweepTime = 0; int collections = 0; foreach (ProfilerEventHandler.GcStatistics gcs in gcStatistics) { if (gcs.NewHeapSize == null) { collections ++; gcTime += gcs.Duration; gcMarkTime += gcs.MarkDuration; gcSweepTime += gcs.SweepDuration; } } PrintSeparator (writer); writer.WriteLine ("Reporting GC statistics for {0} collections (total {1:F3}ms, {2,5:F2}% of total time, mark {3,5:F2}%, sweep {4,5:F2}%)", collections, gcTime * 1000, (gcTime / totalTime) * 100, (gcMarkTime / gcTime) * 100, (gcSweepTime / gcTime) * 100); foreach (ProfilerEventHandler.GcStatistics gcs in gcStatistics) { if (gcs.NewHeapSize == null) { ulong gcStartClicks = gcs.StartCounter - data.StartCounter; writer.WriteLine ("[{0}] Collection starting at {1:F3}s (generation {2}): duration {3:F3}ms, mark {4:F3}ms, sweep {5:F3}ms", gcs.Collection, data.ClicksToSeconds (gcStartClicks), gcs.Generation, gcs.Duration * 1000, gcs.MarkDuration * 1000, gcs.SweepDuration * 1000); } else { writer.WriteLine ("[{0}] Heap resized to {1} bytes", gcs.Collection, gcs.NewHeapSize); } } } AllocationSummary [] allocationSummaries = data.AllocationSummaries; if (allocationSummaries.Length > 0) { PrintSeparator (writer); writer.WriteLine ("Reporting allocation summaries for {0} collections", allocationSummaries.Length); foreach (AllocationSummary allocationSummary in allocationSummaries) { writer.WriteLine ("Data for collection {0} written {1:F3}s since the application started", allocationSummary.Collection, ((double) (allocationSummary.StartTime - data.StartTime).Milliseconds) / 1000); AllocationClassData[] classData = allocationSummary.Data; foreach (AllocationClassData cData in classData) { writer.WriteLine (" Class {0}: {1} bytes in {2} instances (freed: {3} bytes in {4} instances)", cData.Class.Name, cData.ReachableBytes, cData.ReachableInstances, cData.UnreachableBytes, cData.UnreachableInstances); } } } HeapSnapshot[] heapSnapshots = data.LoadedElements.HeapSnapshots; if (heapSnapshots.Length > 0) { PrintSeparator (writer); writer.WriteLine ("Reporting heap data for {0} collections", heapSnapshots.Length); foreach (HeapSnapshot heapSnapshot in heapSnapshots) { HeapSnapshot.AllocationStatisticsPerClass [] allocationStatistics = heapSnapshot.AllocationStatistics; writer.WriteLine ("Heap data collection {0} started at {1} (duration {2:F3}ms)", heapSnapshot.Collection, data.CounterToDateTime (heapSnapshot.StartCounter), data.ClicksToSeconds (heapSnapshot.EndCounter - heapSnapshot.StartCounter) * 1000); if (allocationStatistics.Length > 0) { Array.Sort (allocationStatistics, HeapSnapshot.AllocationStatisticsPerClass.CompareByAllocatedBytes); Array.Reverse (allocationStatistics); uint totalAllocatedBytes = 0; foreach (HeapSnapshot.AllocationStatisticsPerClass s in allocationStatistics) { totalAllocatedBytes += s.AllocatedBytes; } foreach (HeapSnapshot.AllocationStatisticsPerClass s in allocationStatistics) { if (s.AllocatedBytes > 0) { writer.WriteLine (" {0,5:F2}% {1} {2} bytes ({3} freed)", ((((double)s.AllocatedBytes) / totalAllocatedBytes) * 100), s.Class.Name, s.AllocatedBytes, s.FreedBytes); } } } else { writer.WriteLine ("No allocation statistics for this collection)", statisticalHitItems.Length); } } } } static void Main (string[] argv) { BlockData.DebugLog = Console.Out; if (argv.Length != 1) { Console.WriteLine ("Please specify one input file"); return; } SyncLogFileReader reader = new SyncLogFileReader (argv [0]); ProfilerEventHandler data = new ProfilerEventHandler (); data.LoadedElements.RecordHeapSnapshots = false; while (! reader.HasEnded) { BlockData currentBlock = null; try { currentBlock = reader.ReadBlock (); currentBlock.Decode (data, reader); } catch (DecodingException e) { Console.WriteLine ("Stopping decoding after a DecodingException in block of code {0}, length {1}, file offset {2}, block offset {3}: {4}", e.FailingData.Code, e.FailingData.Length, e.FailingData.FileOffset, e.OffsetInBlock, e.Message); break; } } PrintData (Console.Out, data); } } } mono-tools-4.2/Mono.Profiler/profiler-file-decoder/mprof-decoder.in0000664000175000017500000000010512413742070027414 0ustar00directhexdirecthex00000000000000#!/bin/sh exec mono "@prefix@/lib/@PACKAGE@/mprof-decoder.exe" "$@" mono-tools-4.2/Mono.Profiler/profiler-file-decoder/Makefile.in0000664000175000017500000004671412642235731026430 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = Mono.Profiler/profiler-file-decoder ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mprof-decoder 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)$(programfilesdir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(programfiles_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/mprof-decoder.in \ ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ BUILDDIR = $(top_builddir)/Mono.Profiler/lib ASSEMBLY = $(BUILDDIR)/mprof-decoder.exe @ENABLE_DEBUG_FALSE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ @ENABLE_DEBUG_TRUE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG @ENABLE_DEBUG_FALSE@ASSEMBLY_MDB = @ENABLE_DEBUG_TRUE@ASSEMBLY_MDB = $(ASSEMBLY).mdb programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) bin_SCRIPTS = mprof-decoder man_MANS = man/man1/mprof-decoder.1 CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = Main.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = REFERENCES = DLL_REFERENCES = PROJECT_REFERENCES = ../lib/mprof-decoder-library.dll build_references = $(addprefix /r:, $(PROJECT_REFERENCES)) EXTRA_DIST = profiler-file-decoder.csproj $(FILES) $(RESOURCES) $(man_MANS) 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) --gnu Mono.Profiler/profiler-file-decoder/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Mono.Profiler/profiler-file-decoder/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): mprof-decoder: $(top_builddir)/config.status $(srcdir)/mprof-decoder.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-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: ctags CTAGS: cscope cscopelist: 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) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(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) 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-man 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-programfilesDATA uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-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 tags-am \ uninstall uninstall-am uninstall-binSCRIPTS uninstall-man \ uninstall-man1 uninstall-programfilesDATA .PRECIOUS: Makefile $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(DLL_REFERENCES) $(PROJECT_REFERENCES) mkdir -p $(shell dirname $(ASSEMBLY)) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:exe $(build_sources) $(build_references) # 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-tools-4.2/Mono.Profiler/profiler-file-decoder/profiler-file-decoder.csproj0000664000175000017500000000535512413742070031736 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.21022 2.0 {8659A379-FB47-4379-AFD0-53ADB7DA9CED} Exe mprof-decoder v2.0 65001 true full true ..\lib prompt 4 true DEBUG none true bin\Release prompt 4 true {3C7942A8-2A4D-4C70-A670-65984F738EBB} profiler-decoder-library mono-tools-4.2/Mono.Profiler/profiler-file-decoder/Makefile.am0000664000175000017500000000174612642235713026413 0ustar00directhexdirecthex00000000000000BUILDDIR = $(top_builddir)/Mono.Profiler/lib ASSEMBLY = $(BUILDDIR)/mprof-decoder.exe if ENABLE_DEBUG CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG ASSEMBLY_MDB = $(ASSEMBLY).mdb else CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ ASSEMBLY_MDB = endif programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) bin_SCRIPTS = mprof-decoder man_MANS = man/man1/mprof-decoder.1 CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = Main.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = REFERENCES = DLL_REFERENCES = PROJECT_REFERENCES = ../lib/mprof-decoder-library.dll build_references = $(addprefix /r:, $(PROJECT_REFERENCES)) $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(DLL_REFERENCES) $(PROJECT_REFERENCES) mkdir -p $(shell dirname $(ASSEMBLY)) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:exe $(build_sources) $(build_references) EXTRA_DIST = profiler-file-decoder.csproj $(FILES) $(RESOURCES) $(man_MANS) mono-tools-4.2/Mono.Profiler/profiler-file-decoder/man/0000775000175000017500000000000012642235744025126 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/profiler-file-decoder/man/man1/0000775000175000017500000000000012642235744025762 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/profiler-file-decoder/man/man1/mprof-decoder.10000664000175000017500000000073112413742070030562 0ustar00directhexdirecthex00000000000000.TH "mprof-decoder" 1 .SH NAME mprof-decoder \- Console decoder for the logging profiler output files .SH SYNOPSIS .B mprof-decoder file .SH DESCRIPTION .B mprof-decoder Console decoder for the logging profiler output files .PP Decodes the contents of a logging profiler output file and prints the data on standard output. .SH Options .PP None .SH ENVIRONMENT VARIABLES .PP None .SH SEE ALSO mono(1) .BR .SH COPYRIGHT Copyright (C) 2008 Novell, Inc (http://www.novell.com) mono-tools-4.2/Mono.Profiler/compile0000775000175000017500000000013712413742070021557 0ustar00directhexdirecthex00000000000000gmcs -debug -out:profiler-decoder.exe profiler-decoder-library/*.cs profiler-file-decoder/*.cs mono-tools-4.2/Mono.Profiler/Mono.Profiler.sln0000664000175000017500000000770612413742070023421 0ustar00directhexdirecthex00000000000000 Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "profiler-file-decoder", "profiler-file-decoder\profiler-file-decoder.csproj", "{8659A379-FB47-4379-AFD0-53ADB7DA9CED}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "heap-snapshot-viewer", "heap-snapshot-viewer\heap-snapshot-viewer.csproj", "{C7CC60B3-F642-4C60-9B6D-14C1F5EEA1F3}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "heap-snapshot-explorer", "heap-snapshot-explorer\heap-snapshot-explorer.csproj", "{CF955735-EE08-4307-B898-494A3A6391C9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mprof-runtime", "mprof-runtime\mprof-runtime.csproj", "{ED16B262-EC68-42FE-9839-E430E61B61CD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Profiler.Widgets", "Mono.Profiler.Widgets\Mono.Profiler.Widgets.csproj", "{986423AE-B771-4EB2-8952-AA4C2CBF1313}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mprof-gui", "mprof-gui\mprof-gui.csproj", "{17E3AC3C-F4F1-4686-9770-E72C30A74457}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "profiler-decoder-library", "profiler-decoder-library\profiler-decoder-library.csproj", "{3C7942A8-2A4D-4C70-A670-65984F738EBB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {17E3AC3C-F4F1-4686-9770-E72C30A74457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {17E3AC3C-F4F1-4686-9770-E72C30A74457}.Debug|Any CPU.Build.0 = Debug|Any CPU {17E3AC3C-F4F1-4686-9770-E72C30A74457}.Release|Any CPU.ActiveCfg = Release|Any CPU {17E3AC3C-F4F1-4686-9770-E72C30A74457}.Release|Any CPU.Build.0 = Release|Any CPU {3C7942A8-2A4D-4C70-A670-65984F738EBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3C7942A8-2A4D-4C70-A670-65984F738EBB}.Release|Any CPU.ActiveCfg = Release|Any CPU {8659A379-FB47-4379-AFD0-53ADB7DA9CED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8659A379-FB47-4379-AFD0-53ADB7DA9CED}.Debug|Any CPU.Build.0 = Debug|Any CPU {8659A379-FB47-4379-AFD0-53ADB7DA9CED}.Release|Any CPU.ActiveCfg = Release|Any CPU {8659A379-FB47-4379-AFD0-53ADB7DA9CED}.Release|Any CPU.Build.0 = Release|Any CPU {986423AE-B771-4EB2-8952-AA4C2CBF1313}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {986423AE-B771-4EB2-8952-AA4C2CBF1313}.Debug|Any CPU.Build.0 = Debug|Any CPU {986423AE-B771-4EB2-8952-AA4C2CBF1313}.Release|Any CPU.ActiveCfg = Release|Any CPU {986423AE-B771-4EB2-8952-AA4C2CBF1313}.Release|Any CPU.Build.0 = Release|Any CPU {C7CC60B3-F642-4C60-9B6D-14C1F5EEA1F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C7CC60B3-F642-4C60-9B6D-14C1F5EEA1F3}.Debug|Any CPU.Build.0 = Debug|Any CPU {C7CC60B3-F642-4C60-9B6D-14C1F5EEA1F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {C7CC60B3-F642-4C60-9B6D-14C1F5EEA1F3}.Release|Any CPU.Build.0 = Release|Any CPU {CF955735-EE08-4307-B898-494A3A6391C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CF955735-EE08-4307-B898-494A3A6391C9}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF955735-EE08-4307-B898-494A3A6391C9}.Release|Any CPU.ActiveCfg = Release|Any CPU {CF955735-EE08-4307-B898-494A3A6391C9}.Release|Any CPU.Build.0 = Release|Any CPU {ED16B262-EC68-42FE-9839-E430E61B61CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ED16B262-EC68-42FE-9839-E430E61B61CD}.Debug|Any CPU.Build.0 = Debug|Any CPU {ED16B262-EC68-42FE-9839-E430E61B61CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {ED16B262-EC68-42FE-9839-E430E61B61CD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution version = 0.1 outputpath = build\bin\ StartupItem = profiler-file-decoder\profiler-file-decoder.csproj MonoDevelop.ChangeLogAddIn.ChangeLogInfo = $0 $0.policy = UpdateNearestChangeLog name = Mono.Profiler EndGlobalSection EndGlobal mono-tools-4.2/Mono.Profiler/profiler-decoder-library/0000775000175000017500000000000012642235744025100 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/profiler-decoder-library/ChangeLog0000664000175000017500000003121712413742070026645 0ustar00directhexdirecthex000000000000002009-08-19 Massimiliano Mantione * Reader.cs: Return null when file ends without an EndBlock, instead of throwing an exception. This supports intermediate parsing of log files during suspend/resume operations. 2009-07-15 Mike Kestner * Reader.cs: add a Close method to explicitly close the stream. 2009-06-30 Massimiliano Mantione * BaseTypes.cs, Decoder.cs: Added flags that state what kind of profile data has been processed. 2009-06-24 Massimiliano Mantione * ObjectModel.cs, EventProcessor.cs: Build direct and reverse call trees for statistical events. 2009-06-18 Massimiliano Mantione * BaseTypes.cs, Decoder.cs, ObjectModel.cs, EventProcessor.cs: Added assembly information to classes and wrapper flag to methods. 2009-06-12 Massimiliano Mantione * EventProcessor.cs, ObjectModel.cs (StackTrace): Got rid of static fields when handling call stack creation, and introduced a proper factory instead. 2009-06-12 Massimiliano Mantione * ObjectModel.cs (CallStack.MethodExit and CallStack.PopMethod): properly merged the fix for call stack execution time attribution. 2009-06-12 Massimiliano Mantione * ObjectModel.cs: added method execution time accounting on individual stack frames in the call tree. 2009-06-09 Mike Kestner * ObjectModel.cs: commit Massi's calls StackTrace logging. 2009-05-21 Mike Kestner * *: replace MD 1.0 solution files with 2.0 msbuild files, and turn on makefile synchronization instead of generated makefiles. 2009-04-06 Massimiliano Mantione * BaseTypes.cs, Decoder.cs, ObjectModel.cs, EventProcessor.cs: Added support for monitor profiling. 2009-03-17 Massimiliano Mantione * ObjectModel.cs: In "IHeapItemSetStatisticsSubject.Description" implementations return the full method name. 2009-03-16 Massimiliano Mantione * ObjectModel.cs: fixed description string of "referenced by" subset. 2009-01-17 Massimiliano Mantione * BaseTypes.cs: Added "Region" property to IExecutableMemoryRegion, so that it is possible to set the region when we load the elf file, and use it in "BaseExecutableMemoryRegion.NewFunction". * Decoder.cs, ObjectModel.cs, NativeLibraryReader.cs: Likewise. 2008-12-29 Massimiliano Mantione * ObjectModel.cs: fixed call stack array resize condition. 2008-12-01 Massimiliano Mantione * ObjectModel.cs: - Added interface IHeapItemSetStatisticsSubject to represents criteria by which heap item sets can be examined, implemented by LoadedClass, StackTrace and LoadedMethod. - Added methods to IHeapItem (and implementations) to get the item allocator method and call stack. - Added filter classes (FilterHeapItemByAllocatorMethod, HeapItemWasAllocatedByMethod, FilterHeapItemByAllocationCallStack...) to filter by those criteria. - Added abstract class HeapItemSetStatisticsBySubject to factor the building of statistics (implemented by HeapItemSetClassStatistics, HeapItemSetMethodStatistics and HeapItemSetCallStackStatistics). - Inside HeapItemSet added the BuildStatistics generic method (which works with the previous classes). - Inside HeapItemSet added the FindObjectAllocations functionality. 2008-11-03 Massimiliano Mantione * BaseTypes.cs: Added "header start time" property to the event handler, so that there is always a "context" of when the event block happened diring the execution. Added also this time as a parameter to the heap snapshot factory and constructor. * Decoder.cs: Likewise. * Reader.cs: Likewise. * EventProcessor.cs: Likewise. Moreover, fixed case of public properties and added ability to record each allocation individually (up to now the data was only aggregated, see "AllocatedObject"). * ObjectModel.cs: Massive refactory of "HeapObjectSet", making it generic so that it can be a set of IHeapItem (which in turn can be a HeapObject or an AllocatedObject). This enables exploring heap snapshots and relating each objectg to its allocation event. Also added filtering based on "references objects in another set". 2008-10-13 Massimiliano Mantione * BaseTypes.cs: Turn HeapObject class into generic BaseHeapObject class, and add a new IAllocatedObject interface (this will give more freedom when implementing HeapObject and AllocatedObject separately). * ObjectModel.cs: Derive HeapObject from BaseHeapObject. * EventProcessor.cs: Likewise. 2008-10-12 Massimiliano Mantione * BaseTypes.cs: Added support for object ids in allocation events. * ObjectModel.cs: Likewise. * EventProcessor.cs: Likewise. 2008-10-10 Massimiliano Mantione * BaseTypes.cs: - Added support for handling the stack trace of each allocation event. - Added a DebugProfilerEventHandler which helps detecting decoder bugs. * ObjectModel.cs: Likewise. * EventProcessor.cs: Likewise. * Decoder.cs: Likewise. 2008-09-17 Massimiliano Mantione * ObjectModel.cs: Add "jit time support" to the call stack. * EventProcessor.cs: Likewise. 2008-08-21 Massimiliano Mantione * BaseTypes.cs: Added support for correct accounting of allocations which happened at JIT time. * ObjectModel.cs: Likewise. * Decoder.cs: Likewise. * EventProcessor.cs: Likewise. 2008-08-20 Massimiliano Mantione * BaseTypes.cs: Added support for directives in the log file. * Decoder.cs: Likewise. * EventProcessor.cs: Likewise. 2008-08-12 Massimiliano Mantione * Makefile.am: Fixed for integration into mono-tools; 2008-08-05 Massimiliano Mantione * Reader.cs: If the file is truncated "cleanly" do not throw exceptions. 2008-08-04 Massimiliano Mantione Removed .pc file generation. 2008-08-01 Massimiliano Mantione * Makefile.am, profiler-decoder-library.mdp: renamed output assembly. 2008-08-01 Massimiliano Mantione Makefile.am, profiler-decoder-library.pc.in: Regenerated from MonoDevelop. 2008-07-28 Massimiliano Mantione * Decoder.cs: Fixed decoding for the "allocation summaries" feature. 2008-06-18 Massimiliano Mantione * ObjectModel.cs (StackFrame, CallStack): Keep track of stack depth. 2008-06-18 Massimiliano Mantione * ObjectModel.cs (CallStack): Added explicit thread id. * EventProcessor.cs: likewise. 2008-06-18 Massimiliano Mantione * BaseTypes.cs: Initial implementation of allocation summaries. * Decoder.cs: likewise. * ObjectModel.cs: likewise. * EventProcessor.cs: likewise. 2008-05-23 Massimiliano Mantione * BaseTypes.cs (IProfilerEventHandler): Added StatisticalCallChainStart method to handle call chains. * Decoder.cs (StatisticalCode): Added CALL_CHAIN. (Decode): Decode call chains (calling StatisticalCallChainStart). * ObjectModel.cs: Added caller and callee data to IStatisticalHitItem. * EventProcessor.cs: Use all of the above to handle call chains. 2008-05-12 Massimiliano Mantione * BaseTypes.cs: Added a flag to ILoadedElementFactory and IHeapSnapshot to specify if the snapshot objects must be created in memory or not, so that memory is not wasted if the user is only interested in the other profiling info. * Decoder.cs: Likewise. * ObjectModel.cs: Likewise, and cleaned up "heap-desc" functionality. * EventProcessor.cs: Likewise. 2008-05-12 Massimiliano Mantione * BaseTypes.cs: Added support for garbage collection counter. * Decoder.cs: Likewise. * ObjectModel.cs: Likewise. * EventProcessor.cs: Likewise, and added support for garbage collection statistics in general (GcStatistics class and gc events). 2008-05-05 Massimiliano Mantione * Decoder.cs: Fixed stupid decoding bug. * BaseTypes.cs: Changed FIXME comment. 2008-05-02 Massimiliano Mantione * Decoder.cs: Modified the Decode method to recognize the new way in which the unmanaged symbols are emitted. * EventProcessor.cs: Likewise, and added accounting of unrecognized symbols (statistical hits not found on symbol tables). * ObjectModel.cs: Similar changes to handle unmanaged symbols. * BaseTypes.cs: Likewise. 2008-04-16 Massimiliano Mantione * ObjectModel.cs: Added heap object set comparison operation. 2008-04-16 Massimiliano Mantione * BaseTypes.cs (InitializeBackReferences): temporary workaround for snapshot issue (it seems we get "false" references). 2008-04-16 Massimiliano Mantione * EventProcessor.cs: removed commented code. 2008-04-16 Massimiliano Mantione * Reader (SeekableLogFileReader): Add block timestamps. 2008-04-16 Massimiliano Mantione * Decoder.cs (BlockData): Cope with new timestamp in header. 2008-04-16 Massimiliano Mantione * BaseTypes.cs: Fix spelling of "backReferencesInitialized". 2008-04-15 Massimiliano Mantione * ObjectModel.cs (HeapObjectSet): Added "AllocatedBytes" property. 2008-04-13 Massimiliano Mantione * Reader.cs (SeekableLogFileReader): Implemented a new kind of reader that simply scans the file and builds a summary of all the blocks and their file offsets, but reads no data (each block can be read later). 2008-04-13 Massimiliano Mantione * Decoder.cs (BlockData): Added methods to decode the block header. * Reader.cs (ReadBlock): Use the new methods to decode the block header. 2008-04-13 Massimiliano Mantione * ObjectModel.cs: Completed heap object sets and basic filters. 2008-04-13 Massimiliano Mantione * BaseTypes.cs: Made start and end times proper "DateTime" values. instead of ambiguous "ulong" counters. * ObjectModel.cs: likewise. * EventProcessor.cs: likewise. * Decoder.cs: likewise. 2008-04-13 Massimiliano Mantione * ObjectModel.cs: Initial implementation of heap object sets. 2008-04-11 Massimiliano Mantione * ObjectModel.cs: Made HeapSnapshot non generic (since it is in the specific object model keeping it generic was pointless). * EventProcessor.cs: Likewise. 2008-04-11 Massimiliano Mantione * BaseTypes.cs (ObjextModel.ctor): Added explicit assignments. 2008-04-11 Massimiliano Mantione * BaseTypes.cs: Added back references tracking to HeapObject, and code to build them to BaseHeapSnapshot. * EventProcessor.cs (HeapReportEnd): Do back references initialization. 2008-04-10 Massimiliano Mantione * BaseTypes.cs: Renamed HeapSnapshot to BaseHeapSnapshot because this should be extended, and added a "initialAllocations" argument to the NewHeapSnapshot factory method to allow the initialization of heap summary data. * Decoder.cs: pass "initialAllocations" to the new snapshot. * EventProcessor.cs: Added new HeapSnapshot class which provides desc-heap like reporting facilities. 2008-03-19 Massimiliano Mantione NativeLibraryReader.cs: Redirect stderr to hide it. 2008-03-19 Massimiliano Mantione EventProcessor.cs: Added ProfilerEventHandler.clicksToSeconds method. 2008-03-19 Massimiliano Mantione * Decoder.cs: Uncommented LogLine method but made it public to avoid warnings. 2008-03-11 Massimiliano Mantione BaseTypes.cs, Decoder.cs, EventProcessor.cs, NativeLibraryReader.cs, ObjectModel.cs: Added heap profiling decoding, and changed statistical information format to allow further extensibility. 2008-03-04 Massimiliano Mantione * Decoder.cs: changed out parameters into return values, and commented out tracing code for performance. * Reader.cs: Support recycling byte[] buffers. 2008-02-28 Massimiliano Mantione * BaseTypes.cs: LoadedElementHandler: changed loadedClasses and loadedMethods hash tables into arrays. 2008-02-28 Massimiliano Mantione * BaseTypes.cs: added support for gc start-stop world events. * Decode.cs: likewise. 2008-01-11 Massimiliano Mantione * AssemblyInfo.cs: Added (first code dump). * NativeLibraryReader.cs: Added (first code dump). * BaseTypes.cs: Added (first code dump). * EventProcessor.cs: Added (first code dump). * Reader.cs: Added (first code dump). * Decoder.cs: Added (first code dump). * ObjectModel.cs: Added (first code dump). * profiler-decoder-library.mdp: Added (first code dump). * ChangeLog: Added (first code dump). mono-tools-4.2/Mono.Profiler/profiler-decoder-library/BaseTypes.cs0000664000175000017500000014226612413742070027330 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.IO; using System.Collections.Generic; namespace Mono.Profiler { public enum MonitorEvent { CONTENTION = 1, DONE = 2, FAIL = 3 } public class LoadedAssembly { uint id; public uint ID { get { return id; } } string name; public string Name { get { return name; } } string baseName; public string BaseName { get { return baseName; } } uint major; public uint Major { get { return major; } } uint minor; public uint Minor { get { return minor; } } uint build; public uint Build { get { return build; } } uint revision; public uint Revision { get { return revision; } } string culture; public string Culture { get { return culture; } } string publicKeyToken; public string PublicKeyToken { get { return publicKeyToken; } } bool retargetable; public bool Retargetable { get { return retargetable; } } public static readonly LoadedAssembly Unavailable = new LoadedAssembly (0, "UNAVAILABLE", "UNAVAILABLE", 0, 0, 0, 0, "neutral", "null", false); public LoadedAssembly (uint id, string name, string baseName, uint major, uint minor, uint build, uint revision, string culture, string publicKeyToken, bool retargetable) { this.id = id; this.name = name; this.baseName = baseName; this.major = major; this.minor = minor; this.build = build; this.revision = revision; this.culture = culture; this.publicKeyToken = publicKeyToken; this.retargetable = retargetable; } } public interface ILoadedElement { uint ID {get;} string Name {get;} } public interface ILoadedClass : ILoadedElement { uint Size {get;} LoadedAssembly Assembly {get;} } public interface ILoadedMethod : ILoadedElement where LC : ILoadedClass { LC Class {get;} bool IsWrapper {get;} } public interface IUnmanagedFunctionFromID : ILoadedElement where UFR : IUnmanagedFunctionFromRegion where MR : IExecutableMemoryRegion { MR Region {get;} } public interface IUnmanagedFunctionFromRegion where UFR : IUnmanagedFunctionFromRegion { IExecutableMemoryRegion Region {get; set;} string Name {get; set;} uint StartOffset {get; set;} uint EndOffset {get; set;} } public struct StackSectionElement where LC : ILoadedClass where LM : ILoadedMethod { LM method; public LM Method { get { return method; } set { method = value; } } bool isBeingJitted; public bool IsBeingJitted { get { return isBeingJitted; } set { isBeingJitted = value; } } } public interface IExecutableMemoryRegion : ILoadedElement where UFR : IUnmanagedFunctionFromRegion { ulong StartAddress {get;} ulong EndAddress {get;} uint FileOffset {get;} UFR NewFunction (string name, uint offset); UFR GetFunction (uint offset); UFR[] Functions {get;} void SortFunctions (); } public interface IAllocatedObject where LC : ILoadedClass { ulong ID {get;} LC Class {get;} uint Size {get;} } public interface IHeapObject : IAllocatedObject where HO: IHeapObject where LC : ILoadedClass { HO[] References {get;} HO[] BackReferences {get;} } public delegate HO HeapObjectFactory (ulong ID) where HO : IHeapObject where LC : ILoadedClass; public interface IHeapSnapshot where HO: IHeapObject where LC : ILoadedClass { uint Collection {get;} ulong StartCounter {get;} DateTime StartTime {get;} ulong EndCounter {get;} DateTime EndTime {get;} TimeSpan HeaderStartTime {get;} HO NewHeapObject (ulong id, LC c, uint size, ulong[] referenceIds, int referencesCount); HO GetHeapObject (ulong id); HO[] HeapObjects {get;} bool RecordSnapshot {get;} } public interface ILoadedElementFactory where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where HO: IHeapObject where HS: IHeapSnapshot { LoadedAssembly NewAssembly (uint id, string name, string baseName, uint major, uint minor, uint build, uint revision, string culture, string publicKeyToken, bool retargetable); LC NewClass (uint id, LoadedAssembly assembly, string name, uint size); LM NewMethod (uint id, LC c, bool isWrapper, string name); MR NewExecutableMemoryRegion (uint id, string fileName, uint fileOffset, ulong startAddress, ulong endAddress); UFI NewUnmanagedFunction (uint id, string name, MR region); HS NewHeapSnapshot (uint collection, ulong startCounter, DateTime startTime, ulong endCounter, DateTime endTime, TimeSpan headerStartTime, LC[] initialAllocations, bool recordSnapshot); bool RecordHeapSnapshots {get; set;} } public interface ILoadedElementHandler : ILoadedElementFactory where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where HO: IHeapObject where HS: IHeapSnapshot { LoadedAssembly[] Assemblies {get;} LoadedAssembly GetAssembly (uint id); LC[] Classes {get;} LC GetClass (uint id); LM[] Methods {get;} LM GetMethod (uint id); MR[] ExecutableMemoryRegions {get;} MR GetExecutableMemoryRegion (uint id); MR GetExecutableMemoryRegion (ulong address); void InvalidateExecutableMemoryRegion (uint id); void SortExecutableMemoryRegions (); UFI[] UnmanagedFunctionsByID {get;} UFI GetUnmanagedFunctionByID (uint id); HS[] HeapSnapshots {get;} } public interface IProfilerEventHandler where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where EH : ILoadedElementHandler where HO: IHeapObject where HS: IHeapSnapshot { DirectivesHandler Directives {get;} EH LoadedElements {get;} Double TicksPerCounterUnit {get;} TimeSpan ClicksToTimeSpan (ulong clicks); /* Properties that state what kind of data has been processed */ bool HasAllocationData {get;} void AllocationDataProcessed (); bool HasCallData {get;} void CallDataProcessed (); bool HasStatisticalData {get;} void StatisticalDataProcessed (); bool HasHeapSnapshotData {get;} void HeapSnapshotDataProcessed (); bool HasJitTimeData {get;} void JitTimeDataProcessed (); bool HasGcTimeData {get;} void GcTimeDataProcessed (); bool HasHeapSummaryData {get;} void HeapSummaryDataProcessed (); bool HasLockContentionData {get;} void LockContentionDataProcessed (); void Start (uint version, string runtimeFile, ProfilerFlags flags, ulong startCounter, DateTime startTime); void End (uint version, ulong endCounter, DateTime endTime); void StartBlock (ulong startCounter, DateTime startTime, ulong threadId); void EndBlock (ulong endCounter, DateTime endTime, ulong threadId); void ModuleLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success); void ModuleUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name); void AssemblyLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success); void AssemblyUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name); void ApplicationDomainLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success); void ApplicationDomainUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name); void SetCurrentThread (ulong threadId); void ClassStartLoad (LC c, ulong counter); void ClassEndLoad (LC c, ulong counter, bool success); void ClassStartUnload (LC c, ulong counter); void ClassEndUnload (LC c, ulong counter); void Allocation (LC c, uint size, LM caller, bool jitTime, ulong objectId, ulong counter); void Exception (LC c, ulong counter); void MethodEnter (LM m, ulong counter); void MethodExit (LM m, ulong counter); void MethodJitStart (LM m, ulong counter); void MethodJitEnd (LM m, ulong counter, bool success); void MethodFreed (LM m, ulong counter); void AdjustStack (uint lastValidFrame, uint topSectionSize, StackSectionElement[] topSection); void MethodStatisticalHit (LM m); void UnknownMethodStatisticalHit (); void UnmanagedFunctionStatisticalHit (UFR f); void UnmanagedFunctionStatisticalHit (UFI f); void UnknownUnmanagedFunctionStatisticalHit (MR region, uint offset); void UnknownUnmanagedFunctionStatisticalHit (ulong address); void StatisticalCallChainStart (uint chainDepth); void ThreadStart (ulong threadId, ulong counter); void ThreadEnd (ulong threadId, ulong counter); void GarbageCollectionStart (uint collection, uint generation, ulong counter); void GarbageCollectionEnd (uint collection, uint generation, ulong counter); void GarbageCollectionMarkStart (uint collection, uint generation, ulong counter); void GarbageCollectionMarkEnd (uint collection, uint generation, ulong counter); void GarbageCollectionSweepStart (uint collection, uint generation, ulong counter); void GarbageCollectionSweepEnd (uint collection, uint generation, ulong counter); void GarbageCollectionResize (uint collection, ulong newSize); void GarbageCollectionStopWorldStart (uint collection, uint generation, ulong counter); void GarbageCollectionStopWorldEnd (uint collection, uint generation, ulong counter); void GarbageCollectionStartWorldStart (uint collection, uint generation, ulong counter); void GarbageCollectionStartWorldEnd (uint collection, uint generation, ulong counter); void HeapReportStart (HS snapshot); void HeapObjectUnreachable (LC c, uint size); void HeapObjectReachable (HO o); void HeapReportEnd (HS snapshot); void AllocationSummaryStart (uint collection, ulong startCounter, DateTime startTime); void ClassAllocationSummary (LC c, uint reachableInstances, uint reachableBytes, uint unreachableInstances, uint unreachableBytes); void AllocationSummaryEnd (uint collection, ulong endCounter, DateTime endTime); void MonitorEvent (MonitorEvent eventCode, LC loadedClass, ulong objectId, ulong counter); void InitializeData (byte[] data, uint currentOffset); void DataProcessed (uint offset); } public class BaseLoadedElement : ILoadedElement { uint id; public uint ID { get { return id; } } string name; public string Name { get { return name; } } public BaseLoadedElement (uint id, string name) { this.id = id; this.name = name; } } public class BaseLoadedClass : BaseLoadedElement, ILoadedClass { LoadedAssembly assembly; public LoadedAssembly Assembly { get { return assembly; } } uint size; public uint Size { get { return size; } } public BaseLoadedClass (uint id, LoadedAssembly assembly, string name, uint size) : base (id, name) { this.assembly = assembly; this.size = size; } } public class BaseLoadedMethod : BaseLoadedElement, ILoadedMethod where LC : ILoadedClass { LC c; public LC Class { get { return c; } } bool isWrapper; public bool IsWrapper { get { return isWrapper; } } public BaseLoadedMethod (uint id, LC c, bool isWrapper, string name) : base (id, name) { this.c = c; this.isWrapper = isWrapper; } } public class BaseUnmanagedFunctionFromRegion : IUnmanagedFunctionFromRegion where UFR : IUnmanagedFunctionFromRegion { IExecutableMemoryRegion region; public IExecutableMemoryRegion Region { get { return region; } set { region = value; } } string name; public string Name { get { return name; } set { name = value; } } uint startOffset; public uint StartOffset { get { return startOffset; } set { startOffset = value; } } uint endOffset; public uint EndOffset { get { return endOffset; } set { endOffset = value; } } public BaseUnmanagedFunctionFromRegion () { this.region = null; this.name = null; this.startOffset = 0; this.endOffset = 0; } public BaseUnmanagedFunctionFromRegion (IExecutableMemoryRegion region, string name, uint startOffset, uint endOffset) { this.region = region; this.name = name; this.startOffset = startOffset; this.endOffset = endOffset; } } public class BaseUnmanagedFunctionFromID: BaseLoadedElement, IUnmanagedFunctionFromID where UFR : IUnmanagedFunctionFromRegion where MR : IExecutableMemoryRegion { MR region; public MR Region { get { return region; } } public BaseUnmanagedFunctionFromID (uint id, string name, MR region) : base (id, name) { this.region = region; } } public class BaseHeapObject : IHeapObject where LC : ILoadedClass where HO : BaseHeapObject { ulong id; public ulong ID { get { return id; } } LC c; public LC Class { get { return c; } internal set { c = value; } } uint size; public uint Size { get { return size; } internal set { size = value; } } static HO[] emptyReferences = new HO [0]; public static HO[] EmptyReferences { get { return emptyReferences; } } HO[] references; public HO[] References { get { return references; } internal set { references = value; } } HO[] backReferences; public HO[] BackReferences { get { return backReferences; } internal set { backReferences = value; } } int backReferencesCounter; internal void IncrementBackReferences () { backReferencesCounter ++; } internal void AllocateBackReferences () { if (references != null) { int referencesCount = 0; foreach (HO reference in references) { if (reference != null) { referencesCount ++; } } if (referencesCount != references.Length) { if (referencesCount > 0) { HO[] newReferences = new HO [referencesCount]; referencesCount = 0; foreach (HO reference in references) { if (reference != null) { newReferences [referencesCount] = reference; referencesCount ++; } } references = newReferences; } else { references = emptyReferences; } } } else { references = emptyReferences; } if (backReferencesCounter > 0) { backReferences = new HO [backReferencesCounter]; backReferencesCounter = 0; } else { backReferences = emptyReferences; } } internal void AddBackReference (HO heapObject) { backReferences [backReferencesCounter] = heapObject; backReferencesCounter ++; } public BaseHeapObject (ulong id) { this.id = id; this.c = default(LC); this.size = 0; this.references = null; this.backReferences = null; this.backReferencesCounter = 0; } } public abstract class BaseHeapSnapshot : IHeapSnapshot where LC : ILoadedClass where HO : BaseHeapObject { Dictionary heap; bool backReferencesInitialized; HeapObjectFactory heapObjectFactory; uint collection; public uint Collection { get { return collection; } } ulong startCounter; public ulong StartCounter { get { return startCounter; } } DateTime startTime; public DateTime StartTime { get { return startTime; } } ulong endCounter; public ulong EndCounter { get { return endCounter; } } DateTime endTime; public DateTime EndTime { get { return endTime; } } TimeSpan headerStartTime; public TimeSpan HeaderStartTime { get { return headerStartTime; } } public HO NewHeapObject (ulong id, LC c, uint size, ulong[] referenceIds, int referencesCount) { if (backReferencesInitialized) { throw new Exception ("Cannot create heap objects after backReferencesInitialized is true"); } if (recordSnapshot) { HO[] references = new HO [referencesCount]; HO result = GetOrCreateHeapObject (id); for (int i = 0; i < references.Length; i++) { references [i] = GetOrCreateHeapObject (referenceIds [i]); references [i].IncrementBackReferences (); } result.References = references; result.Size = size; result.Class = c; return result; } else { return null; } } public void InitializeBackReferences () { if (backReferencesInitialized) { throw new Exception ("Cannot call InitializeBackReferences twice"); } //FIXME: Bad objects should not happen anymore... Dictionary badObjects = new Dictionary (); foreach (HO heapObject in heap.Values) { if (heapObject.Class != null) { heapObject.AllocateBackReferences (); } else { badObjects.Add (heapObject.ID, heapObject); } } foreach (ulong id in badObjects.Keys) { heap.Remove (id); } foreach (HO heapObject in heap.Values) { foreach (HO reference in heapObject.References) { reference.AddBackReference (heapObject); } } backReferencesInitialized = true; } HO GetOrCreateHeapObject (ulong id) { if (recordSnapshot) { if (heap.ContainsKey (id)) { return heap [id]; } else { HO result = heapObjectFactory (id); heap [id] = result; return result; } } else { return null; } } public HO GetHeapObject (ulong id) { return heap [id]; } public HO[] HeapObjects { get { HO[] result = new HO [heap.Values.Count]; heap.Values.CopyTo (result, 0); return result; } } bool recordSnapshot; public bool RecordSnapshot { get { return recordSnapshot; } } public BaseHeapSnapshot (HeapObjectFactory heapObjectFactory, uint collection, ulong startCounter, DateTime startTime, ulong endCounter, DateTime endTime, TimeSpan headerStartTime, bool recordSnapshot) { this.heapObjectFactory = heapObjectFactory; this.collection = collection; this.startCounter = startCounter; this.startTime = startTime; this.endCounter = endCounter; this.endTime = endTime; this.headerStartTime = headerStartTime; this.recordSnapshot = recordSnapshot; heap = new Dictionary (); backReferencesInitialized = false; } } public struct AllocationClassData where LC : ILoadedClass { LC c; public LC Class { get { return c; } } uint reachableInstances; public uint ReachableInstances { get { return reachableInstances; } } uint reachableBytes; public uint ReachableBytes { get { return reachableBytes; } } uint unreachableInstances; public uint UnreachableInstances { get { return unreachableInstances; } } uint unreachableBytes; public uint UnreachableBytes { get { return unreachableBytes; } } public static Comparison> CompareByReachableBytes = delegate (AllocationClassData a, AllocationClassData b) { return a.ReachableBytes.CompareTo (b.ReachableBytes); }; public static Comparison> CompareByReachableInstances = delegate (AllocationClassData a, AllocationClassData b) { return a.ReachableInstances.CompareTo (b.ReachableInstances); }; public AllocationClassData (LC c, uint reachableInstances, uint reachableBytes, uint unreachableInstances, uint unreachableBytes) { this.c = c; this.reachableInstances = reachableInstances; this.reachableBytes = reachableBytes; this.unreachableInstances = unreachableInstances; this.unreachableBytes = unreachableBytes; } } public class BaseAllocationSummary where LC : ILoadedClass { uint collection; public uint Collection { get { return collection; } } List> data; public AllocationClassData[] Data { get { AllocationClassData[] result = data.ToArray (); Array.Sort (result, AllocationClassData.CompareByReachableBytes); Array.Reverse (result); return result; } } internal void RecordData (LC c, uint reachableInstances, uint reachableBytes, uint unreachableInstances, uint unreachableBytes) { data.Add (new AllocationClassData (c, reachableInstances, reachableBytes, unreachableInstances, unreachableBytes)); } ulong startCounter; public ulong StartCounter { get { return startCounter; } } DateTime startTime; public DateTime StartTime { get { return startTime; } } ulong endCounter; public ulong EndCounter { get { return endCounter; } internal set { endCounter = value; } } DateTime endTime; public DateTime EndTime { get { return endTime; } internal set { endTime = value; } } public BaseAllocationSummary (uint collection, ulong startCounter, DateTime startTime) { this.collection = collection; this.startCounter = startCounter; this.startTime = startTime; this.endCounter = startCounter; this.endTime = startTime; data = new List> (); } } public enum DirectiveCodes { END = 0, ALLOCATIONS_CARRY_CALLER = 1, ALLOCATIONS_HAVE_STACK = 2, ALLOCATIONS_CARRY_ID = 3, LOADED_ELEMENTS_CARRY_ID = 4, CLASSES_CARRY_ASSEMBLY_ID = 5, METHODS_CARRY_WRAPPER_FLAG = 6, LAST } public class DirectivesHandler { bool allocationsCarryCallerMethod; public bool AllocationsCarryCallerMethod { get { return allocationsCarryCallerMethod; } } public void AllocationsCarryCallerMethodReceived () { allocationsCarryCallerMethod = true; } bool allocationsHaveStackTrace; public bool AllocationsHaveStackTrace { get { return allocationsHaveStackTrace; } } public void AllocationsHaveStackTraceReceived () { allocationsHaveStackTrace = true; } bool allocationsCarryId; public bool AllocationsCarryId { get { return allocationsCarryId; } } public void AllocationsCarryIdReceived () { allocationsCarryId = true; } bool loadedElementsCarryId; public bool LoadedElementsCarryId { get { return loadedElementsCarryId; } } public void LoadedElementsCarryIdReceived () { loadedElementsCarryId = true; } bool classesCarryAssemblyId; public bool ClassesCarryAssemblyId { get { return classesCarryAssemblyId; } } public void ClassesCarryAssemblyIdReceived () { classesCarryAssemblyId = true; } bool methodsCarryWrapperFlag; public bool MethodsCarryWrapperFlag { get { return methodsCarryWrapperFlag; } } public void MethodsCarryWrapperFlagReceived () { methodsCarryWrapperFlag = true; } public DirectivesHandler () { allocationsCarryCallerMethod = false; allocationsHaveStackTrace = false; allocationsCarryId = false; } } public class BaseProfilerEventHandler : IProfilerEventHandler where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where EH : ILoadedElementHandler where HO: IHeapObject where HS: IHeapSnapshot { DirectivesHandler directives; public DirectivesHandler Directives { get { return directives; } } EH loadedElements; public EH LoadedElements { get { return loadedElements; } } public virtual Double TicksPerCounterUnit { get { return 0; } } public virtual TimeSpan ClicksToTimeSpan (ulong clicks) { return TimeSpan.FromTicks (0); } public BaseProfilerEventHandler (EH loadedElements) { this.loadedElements = loadedElements; this.directives = new DirectivesHandler (); } protected BaseProfilerEventHandler (IProfilerEventHandler baseHandler) { this.loadedElements = baseHandler.LoadedElements; this.directives = baseHandler.Directives; } bool hasAllocationData; public bool HasAllocationData { get { return hasAllocationData; } } public void AllocationDataProcessed () { hasAllocationData = true; } bool hasCallData; public bool HasCallData { get { return hasCallData; } } public void CallDataProcessed () { hasCallData = true; } bool hasStatisticalData; public bool HasStatisticalData { get { return hasStatisticalData; } } public void StatisticalDataProcessed () { hasStatisticalData = true; } bool hasHeapSnapshotData; public bool HasHeapSnapshotData { get { return hasHeapSnapshotData; } } public void HeapSnapshotDataProcessed () { hasHeapSnapshotData = true; } bool hasJitTimeData; public bool HasJitTimeData { get { return hasJitTimeData; } } public void JitTimeDataProcessed () { hasJitTimeData = true; } bool hasGcTimeData; public bool HasGcTimeData { get { return hasGcTimeData; } } public void GcTimeDataProcessed () { hasGcTimeData = true; } bool hasHeapSummaryData; public bool HasHeapSummaryData { get { return hasHeapSummaryData; } } public void HeapSummaryDataProcessed () { hasHeapSummaryData = true; } bool hasLockContentionData; public bool HasLockContentionData { get { return hasLockContentionData; } } public void LockContentionDataProcessed () { hasLockContentionData = true; } public virtual void Start (uint version, string runtimeFile, ProfilerFlags flags, ulong startCounter, DateTime startTime) {} public virtual void End (uint version, ulong endCounter, DateTime endTime) {} public virtual void StartBlock (ulong startCounter, DateTime startTime, ulong threadId) {} public virtual void EndBlock (ulong endCounter, DateTime endTime, ulong threadId) {} public virtual void ModuleLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) {} public virtual void ModuleUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name) {} public virtual void AssemblyLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) {} public virtual void AssemblyUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name) {} public virtual void ApplicationDomainLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) {} public virtual void ApplicationDomainUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name) {} public virtual void SetCurrentThread (ulong threadId) {} public virtual void ClassStartLoad (LC c, ulong counter) {} public virtual void ClassEndLoad (LC c, ulong counter, bool success) {} public virtual void ClassStartUnload (LC c, ulong counter) {} public virtual void ClassEndUnload (LC c, ulong counter) {} public virtual void Allocation (LC c, uint size, LM caller, bool jitTime, ulong objectId, ulong counter) {} public virtual void Exception (LC c, ulong counter) {} public virtual void MethodEnter (LM m, ulong counter) {} public virtual void MethodExit (LM m, ulong counter) {} public virtual void MethodJitStart (LM m, ulong counter) {} public virtual void MethodJitEnd (LM m, ulong counter, bool success) {} public virtual void MethodFreed (LM m, ulong counter) {} public virtual void AdjustStack (uint lastValidFrame, uint topSectionSize, StackSectionElement[] topSection) {} public virtual void MethodStatisticalHit (LM m) {} public virtual void UnknownMethodStatisticalHit () {} public virtual void UnmanagedFunctionStatisticalHit (UFR f) {} public virtual void UnmanagedFunctionStatisticalHit (UFI f) {} public virtual void UnknownUnmanagedFunctionStatisticalHit (MR region, uint offset) {} public virtual void UnknownUnmanagedFunctionStatisticalHit (ulong address) {} public virtual void StatisticalCallChainStart (uint chainDepth) {} public virtual void ThreadStart (ulong threadId, ulong counter) {} public virtual void ThreadEnd (ulong threadId, ulong counter) {} public virtual void GarbageCollectionStart (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionEnd (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionMarkStart (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionMarkEnd (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionSweepStart (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionSweepEnd (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionResize (uint collection, ulong newSize) {} public virtual void GarbageCollectionStopWorldStart (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionStopWorldEnd (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionStartWorldStart (uint collection, uint generation, ulong counter) {} public virtual void GarbageCollectionStartWorldEnd (uint collection, uint generation, ulong counter) {} public virtual void HeapReportStart (HS snapshot) {} public virtual void HeapObjectUnreachable (LC c, uint size) {} public virtual void HeapObjectReachable (HO o) {} public virtual void HeapReportEnd (HS snapshot) {} public virtual void AllocationSummaryStart (uint collection, ulong startCounter, DateTime startTime) {} public virtual void ClassAllocationSummary (LC c, uint reachableInstances, uint reachableBytes, uint unreachableInstances, uint unreachableBytes) {} public virtual void AllocationSummaryEnd (uint collection, ulong endCounter, DateTime endTime) {} public virtual void MonitorEvent (MonitorEvent eventCode, LC loadedClass, ulong objectId, ulong counter) {} public virtual void InitializeData (byte[] data, uint currentOffset) {} public virtual void DataProcessed (uint offset) {} } public class DebugProfilerEventHandler : BaseProfilerEventHandler where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where EH : ILoadedElementHandler where HO: IHeapObject where HS: IHeapSnapshot { uint currentOffset; public uint CurrentOffset { get { return currentOffset; } } byte[] data; TextWriter output; public DebugProfilerEventHandler (IProfilerEventHandler baseHandler, TextWriter output) : base (baseHandler) { this.output = output; this.data = null; this.currentOffset = 0; } public override void Start (uint version, string runtimeFile, ProfilerFlags flags, ulong startCounter, DateTime startTime) { output.WriteLine (""); } public override void End (uint version, ulong endCounter, DateTime endTime) { output.WriteLine (""); } public override void StartBlock (ulong startCounter, DateTime startTime, ulong threadId) { output.WriteLine ("StartBlock: startCounter {0}, startTime {1}, threadId {2}", startCounter, startTime, threadId); } public override void EndBlock (ulong endCounter, DateTime endTime, ulong threadId) { output.WriteLine ("StartBlock: endCounter {0}, endTime {1}, threadId {2}", endCounter, endTime, threadId); } public override void ModuleLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) { output.WriteLine ("ModuleLoaded"); } public override void ModuleUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name) { output.WriteLine ("ModuleUnloaded"); } public override void AssemblyLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) { output.WriteLine ("AssemblyLoaded"); } public override void AssemblyUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name) { output.WriteLine ("AssemblyUnloaded"); } public override void ApplicationDomainLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) { output.WriteLine ("ApplicationDomainLoaded"); } public override void ApplicationDomainUnloaded (ulong threadId,uint id, ulong startCounter, ulong endCounter, string name) { output.WriteLine ("ApplicationDomainUnloaded"); } public override void SetCurrentThread (ulong threadId) { output.WriteLine ("SetCurrentThread"); } public override void ClassStartLoad (LC c, ulong counter) { output.WriteLine ("ClassStartLoad"); } public override void ClassEndLoad (LC c, ulong counter, bool success) { output.WriteLine ("ClassEndLoad"); } public override void ClassStartUnload (LC c, ulong counter) { output.WriteLine ("ClassStartUnload"); } public override void ClassEndUnload (LC c, ulong counter) { output.WriteLine ("ClassEndUnload"); } public override void Allocation (LC c, uint size, LM caller, bool jitTime, ulong objectId, ulong counter) { output.WriteLine ("Allocation [classId {0}({1}), size {2}, callerId {3}), jitTime {4}, counter {5}]", c.ID, c.Name, size, caller != null ? caller.ID : 0, jitTime, counter); } public override void Exception (LC c, ulong counter) { output.WriteLine ("Exception"); } public override void MethodEnter (LM m, ulong counter) { output.WriteLine ("MethodEnter"); } public override void MethodExit (LM m, ulong counter) { output.WriteLine ("MethodExit"); } public override void MethodJitStart (LM m, ulong counter) { output.WriteLine ("MethodJitStart"); } public override void MethodJitEnd (LM m, ulong counter, bool success) { output.WriteLine ("MethodJitEnd"); } public override void MethodFreed (LM m, ulong counter) { output.WriteLine ("MethodFreed"); } public override void AdjustStack (uint lastValidFrame, uint topSectionSize, StackSectionElement[] topSection) { output.WriteLine ("AdjustStack"); } public override void MethodStatisticalHit (LM m) { output.WriteLine ("MethodStatisticalHit"); } public override void UnknownMethodStatisticalHit () { output.WriteLine ("UnknownMethodStatisticalHit"); } public override void UnmanagedFunctionStatisticalHit (UFR f) { output.WriteLine ("UnmanagedFunctionStatisticalHit"); } public override void UnmanagedFunctionStatisticalHit (UFI f) { output.WriteLine ("UnmanagedFunctionStatisticalHit"); } public override void UnknownUnmanagedFunctionStatisticalHit (MR region, uint offset) { output.WriteLine ("UnknownUnmanagedFunctionStatisticalHit"); } public override void UnknownUnmanagedFunctionStatisticalHit (ulong address) { output.WriteLine ("UnknownUnmanagedFunctionStatisticalHit"); } public override void StatisticalCallChainStart (uint chainDepth) { output.WriteLine ("StatisticalCallChainStart"); } public override void ThreadStart (ulong threadId, ulong counter) { output.WriteLine ("ThreadStart"); } public override void ThreadEnd (ulong threadId, ulong counter) { output.WriteLine ("ThreadEnd"); } public override void GarbageCollectionStart (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionStart"); } public override void GarbageCollectionEnd (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionEnd"); } public override void GarbageCollectionMarkStart (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionMarkStart"); } public override void GarbageCollectionMarkEnd (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionMarkEnd"); } public override void GarbageCollectionSweepStart (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionSweepStart"); } public override void GarbageCollectionSweepEnd (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionSweepEnd"); } public override void GarbageCollectionResize (uint collection, ulong newSize) { output.WriteLine ("GarbageCollectionResize"); } public override void GarbageCollectionStopWorldStart (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionStopWorldStart"); } public override void GarbageCollectionStopWorldEnd (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionStopWorldEnd"); } public override void GarbageCollectionStartWorldStart (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionStartWorldStart"); } public override void GarbageCollectionStartWorldEnd (uint collection, uint generation, ulong counter) { output.WriteLine ("GarbageCollectionStartWorldEnd"); } public override void HeapReportStart (HS snapshot) { output.WriteLine ("HeapReportStart"); } public override void HeapObjectUnreachable (LC c, uint size) { output.WriteLine ("HeapObjectUnreachable"); } public override void HeapObjectReachable (HO o) { output.WriteLine ("HeapObjectReachable"); } public override void HeapReportEnd (HS snapshot) { output.WriteLine ("HeapReportEnd"); } public override void AllocationSummaryStart (uint collection, ulong startCounter, DateTime startTime) { output.WriteLine ("AllocationSummaryStart"); } public override void ClassAllocationSummary (LC c, uint reachableInstances, uint reachableBytes, uint unreachableInstances, uint unreachableBytes) { output.WriteLine ("ClassAllocationSummary"); } public override void AllocationSummaryEnd (uint collection, ulong endCounter, DateTime endTime) { output.WriteLine ("AllocationSummaryEnd"); } public override void InitializeData (byte[] data, uint currentOffset) { this.data = data; this.currentOffset = currentOffset; } public override void DataProcessed (uint offset) { BlockData.DumpData (data, output, currentOffset, offset); currentOffset = offset; } } public class BaseExecutableMemoryRegion : BaseLoadedElement, IExecutableMemoryRegion where UFR : IUnmanagedFunctionFromRegion, new() { uint fileOffset; public uint FileOffset { get { return fileOffset; } } ulong startAddress; public ulong StartAddress { get { return startAddress; } } ulong endAddress; public ulong EndAddress { get { return endAddress; } } List functions; public UFR NewFunction (string name, uint offset) { UFR result = new UFR (); result.Name = name; result.StartOffset = offset; result.EndOffset = offset; result.Region = this; functions.Add (result); return result; } public UFR GetFunction (uint offset) { int lowIndex = 0; int highIndex = functions.Count; int middleIndex = lowIndex + ((highIndex - lowIndex) / 2); UFR middleFunction = (middleIndex < functions.Count) ? functions [middleIndex] : default (UFR); while (lowIndex != highIndex) { if (middleFunction.StartOffset > offset) { if (middleIndex > 0) { highIndex = middleIndex; } else { return default (UFR); } } else if (middleFunction.EndOffset < offset) { if (middleIndex < functions.Count - 1) { lowIndex = middleIndex; } else { return default (UFR); } } else { return middleFunction; } middleIndex = lowIndex + ((highIndex - lowIndex) / 2); middleFunction = functions [middleIndex]; } if ((middleFunction == null) || (middleFunction.StartOffset > offset) || (middleFunction.EndOffset < offset)) { return default (UFR); } else { return middleFunction; } } public UFR[] Functions { get { UFR[] result = new UFR [functions.Count]; functions.CopyTo (result); return result; } } public static Comparison CompareByStartOffset = delegate (UFR a, UFR b) { return a.StartOffset.CompareTo (b.StartOffset); }; public void SortFunctions () { functions.Sort (CompareByStartOffset); if (functions.Count > 0) { UFR previousFunction = functions [0]; for (int i = 1; i < functions.Count; i++) { UFR currentFunction = functions [i]; previousFunction.EndOffset = currentFunction.StartOffset - 1; previousFunction = currentFunction; } previousFunction.EndOffset = (uint) (EndAddress - StartAddress); } } public BaseExecutableMemoryRegion (uint id, string name, uint fileOffset, ulong startAddress, ulong endAddress) : base (id, name) { this.fileOffset = fileOffset; this.startAddress = startAddress; this.endAddress = endAddress; functions = new List (); NativeLibraryReader.FillFunctions,UFR> (this); } } public class LoadedElementHandler : ILoadedElementHandler where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where HO: IHeapObject where HS: IHeapSnapshot { ILoadedElementFactory factory; int loadedAssembliesCount; LoadedAssembly[] loadedAssemblies; public LoadedAssembly[] Assemblies { get { LoadedAssembly[] result = new LoadedAssembly [loadedAssembliesCount]; int resultIndex = 0; for (int i = 0; i < loadedAssemblies.Length; i++) { LoadedAssembly c = loadedAssemblies [i]; if (c != null) { result [resultIndex] = c; resultIndex ++; } } return result; } } public LoadedAssembly GetAssembly (uint id) { LoadedAssembly result = loadedAssemblies [(int) id]; return (result != null) ? result : LoadedAssembly.Unavailable; } int loadedClassesCount; LC[] loadedClasses; public LC[] Classes { get { LC[] result = new LC [loadedClassesCount]; int resultIndex = 0; for (int i = 0; i < loadedClasses.Length; i++) { LC c = loadedClasses [i]; if (c != null) { result [resultIndex] = c; resultIndex ++; } } return result; } } public LC GetClass (uint id) { return loadedClasses [(int) id]; } int loadedMethodsCount; LM[] loadedMethods; public LM[] Methods { get { LM[] result = new LM [loadedMethodsCount]; int resultIndex = 0; for (int i = 0; i < loadedMethods.Length; i++) { LM m = loadedMethods [i]; if (m != null) { result [resultIndex] = m; resultIndex ++; } } return result; } } public LM GetMethod (uint id) { return loadedMethods [(int) id]; } Dictionary memoryRegions; List sortedMemoryRegions; public MR[] ExecutableMemoryRegions { get { MR[] result = new MR [memoryRegions.Count]; memoryRegions.Values.CopyTo (result, 0); return result; } } public MR GetExecutableMemoryRegion (uint id) { return memoryRegions [id]; } public MR GetExecutableMemoryRegion (ulong address) { int lowIndex = 0; int highIndex = sortedMemoryRegions.Count; int middleIndex = lowIndex + ((highIndex - lowIndex) / 2); MR middleRegion = (middleIndex < sortedMemoryRegions.Count) ? sortedMemoryRegions [middleIndex] : default (MR); while (lowIndex != highIndex) { if (middleRegion.StartAddress > address) { if (middleIndex > 0) { highIndex = middleIndex; } else { return default (MR); } } else if (middleRegion.EndAddress < address) { if (middleIndex < sortedMemoryRegions.Count - 1) { lowIndex = middleIndex; } else { return default (MR); } } else { return middleRegion; } middleIndex = lowIndex + ((highIndex - lowIndex) / 2); middleRegion = sortedMemoryRegions [middleIndex]; } if ((middleRegion == null) || (middleRegion.StartAddress > address) || (middleRegion.EndAddress < address)) { return default (MR); } else { return middleRegion; } } public void InvalidateExecutableMemoryRegion (uint id) { MR region = GetExecutableMemoryRegion (id); if (region != null) { sortedMemoryRegions.Remove (region); } } static Comparison CompareByStartAddress = delegate (MR a, MR b) { return a.StartAddress.CompareTo (b.StartAddress); }; public void SortExecutableMemoryRegions () { sortedMemoryRegions.Sort (CompareByStartAddress); } public LoadedAssembly NewAssembly (uint id, string name, string baseName, uint major, uint minor, uint build, uint revision, string culture, string publicKeyToken, bool retargetable) { LoadedAssembly result = factory.NewAssembly (id, name, baseName, major, minor, build, revision, culture, publicKeyToken, retargetable); if (loadedAssemblies.Length <= id) { LoadedAssembly[] newLoadedAssemblies = new LoadedAssembly [((int) id + 1) * 2]; loadedAssemblies.CopyTo (newLoadedAssemblies, 0); loadedAssemblies = newLoadedAssemblies; } loadedAssemblies [(int) id] = result; loadedAssembliesCount ++; return result; } public LC NewClass (uint id, LoadedAssembly assembly, string name, uint size) { LC result = factory.NewClass (id, assembly, name, size); if (loadedClasses.Length <= id) { LC[] newLoadedClasses = new LC [((int) id + 1) * 2]; loadedClasses.CopyTo (newLoadedClasses, 0); loadedClasses = newLoadedClasses; } loadedClasses [(int) id] = result; loadedClassesCount ++; return result; } public LM NewMethod (uint id, LC c, bool isWrapper, string name) { LM result = factory.NewMethod (id, c, isWrapper, name); if (loadedMethods.Length <= id) { LM[] newLoadedMethods = new LM [((int) id + 1) * 2]; loadedMethods.CopyTo (newLoadedMethods, 0); loadedMethods = newLoadedMethods; } loadedMethods [(int) id] = result; loadedMethodsCount ++; return result; } public MR NewExecutableMemoryRegion (uint id, string fileName, uint fileOffset, ulong startAddress, ulong endAddress) { MR result = factory.NewExecutableMemoryRegion (id, fileName, fileOffset, startAddress, endAddress); memoryRegions.Add (id, result); sortedMemoryRegions.Add (result); return result; } List heapSnapshots; public HS NewHeapSnapshot (uint collection, ulong startCounter, DateTime startTime, ulong endCounter, DateTime endTime, TimeSpan headerStartTime, LC[] initialAllocations, bool recordSnapshot) { HS result = factory.NewHeapSnapshot (collection, startCounter, startTime, endCounter, endTime, headerStartTime, initialAllocations, recordSnapshot); heapSnapshots.Add (result); return result; } public HS[] HeapSnapshots { get { HS[] result = new HS [heapSnapshots.Count]; heapSnapshots.CopyTo (result); return result; } } int unmanagedFunctionsByIDCount; UFI[] unmanagedFunctionsByID; public UFI[] UnmanagedFunctionsByID { get { UFI[] result = new UFI [unmanagedFunctionsByIDCount]; int resultIndex = 0; for (int i = 0; i < unmanagedFunctionsByID.Length; i++) { UFI f = unmanagedFunctionsByID [i]; if (f != null) { result [resultIndex] = f; resultIndex ++; } } return result; } } public UFI GetUnmanagedFunctionByID (uint id) { return unmanagedFunctionsByID [(int) id]; } public UFI NewUnmanagedFunction (uint id, string name, MR region) { UFI result = factory.NewUnmanagedFunction (id, name, region); if (unmanagedFunctionsByID.Length <= id) { UFI[] newUnmanagedFunctionsByID = new UFI [((int) id + 1) * 2]; unmanagedFunctionsByID.CopyTo (newUnmanagedFunctionsByID, 0); unmanagedFunctionsByID = newUnmanagedFunctionsByID; } unmanagedFunctionsByID [(int) id] = result; unmanagedFunctionsByIDCount ++; return result; } public bool RecordHeapSnapshots { get { return factory.RecordHeapSnapshots; } set { factory.RecordHeapSnapshots = value; } } public LoadedElementHandler (ILoadedElementFactory factory) { this.factory = factory; loadedAssemblies = new LoadedAssembly [10]; loadedClasses = new LC [1000]; loadedClassesCount = 0; loadedMethods = new LM [5000]; loadedMethodsCount = 0; memoryRegions = new Dictionary (); sortedMemoryRegions = new List (); heapSnapshots = new List (); unmanagedFunctionsByID = new UFI [1000]; unmanagedFunctionsByIDCount = 0; } } } mono-tools-4.2/Mono.Profiler/profiler-decoder-library/ObjectModel.cs0000664000175000017500000022624212413742070027615 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.IO; using System.Collections.Generic; namespace Mono.Profiler { public class LoadedClass : BaseLoadedClass, IHeapItemSetStatisticsSubject { uint allocatedBytes; public uint AllocatedBytes { get { return allocatedBytes; } } uint currentlyAllocatedBytes; public uint CurrentlyAllocatedBytes { get { return currentlyAllocatedBytes; } } public static Comparison CompareByAllocatedBytes = delegate (LoadedClass a, LoadedClass b) { return a.AllocatedBytes.CompareTo (b.AllocatedBytes); }; string IHeapItemSetStatisticsSubject.Description { get { return Name; } } internal void InstanceCreated (uint size, LoadedMethod method, bool jitTime, StackTrace stackTrace) { allocatedBytes += size; currentlyAllocatedBytes += size; if (method != null) { Dictionary methods; if (! jitTime) { if (allocationsPerMethod == null) { allocationsPerMethod = new Dictionary (); } methods = allocationsPerMethod; } else { if (allocationsPerMethodAtJitTime == null) { allocationsPerMethodAtJitTime = new Dictionary (); } methods = allocationsPerMethodAtJitTime; } AllocationsPerMethod callerMethod; if (methods.ContainsKey (method.ID)) { callerMethod = methods [method.ID]; } else { callerMethod = new AllocationsPerMethod (method); methods.Add (method.ID, callerMethod); } callerMethod.Allocation (size, stackTrace); } } internal void InstanceFreed (uint size) { currentlyAllocatedBytes -= size; } public abstract class AllocationsPerItem { protected T item; uint allocatedBytes; public uint AllocatedBytes { get { return allocatedBytes; } } uint allocatedInstances; public uint AllocatedInstances { get { return allocatedInstances; } } protected void InternalAllocation (uint allocatedBytes) { this.allocatedBytes += allocatedBytes; this.allocatedInstances ++; } public static Comparison> CompareByAllocatedBytes = delegate (AllocationsPerItem a, AllocationsPerItem b) { return a.AllocatedBytes.CompareTo (b.AllocatedBytes); }; public static Comparison> CompareByAllocatedInstances = delegate (AllocationsPerItem a, AllocationsPerItem b) { return a.AllocatedInstances.CompareTo (b.AllocatedInstances); }; protected AllocationsPerItem (T item) { this.item = item; allocatedInstances = 0; allocatedBytes = 0; } } public class AllocationsPerMethod : AllocationsPerItem { public LoadedMethod Method { get { return item; } } Dictionary stackTraces; public AllocationsPerStackTrace[] StackTraces { get { if (stackTraces != null) { AllocationsPerStackTrace[] result = new AllocationsPerStackTrace [stackTraces.Count]; stackTraces.Values.CopyTo (result, 0); return result; } else { return new AllocationsPerStackTrace [0]; } } } public int StackTracesCount { get { if (stackTraces != null) { return stackTraces.Count; } else { return 0; } } } internal void Allocation (uint allocatedBytes, StackTrace stackTrace) { InternalAllocation (allocatedBytes); if (stackTrace != null) { if (stackTraces == null) { stackTraces = new Dictionary (); } AllocationsPerStackTrace allocationsPerStackTrace; if (stackTraces.ContainsKey (stackTrace.ID)) { allocationsPerStackTrace = stackTraces [stackTrace.ID]; } else { allocationsPerStackTrace = new AllocationsPerStackTrace (stackTrace); stackTraces [stackTrace.ID] = allocationsPerStackTrace; } allocationsPerStackTrace.Allocation (allocatedBytes); } } public AllocationsPerMethod (LoadedMethod method) : base (method) { } } public class AllocationsPerStackTrace : AllocationsPerItem { public StackTrace Trace { get { return item; } } internal void Allocation (uint allocatedBytes) { InternalAllocation (allocatedBytes); } public AllocationsPerStackTrace (StackTrace trace) : base (trace) { } } Dictionary allocationsPerMethod; public AllocationsPerMethod[] Methods { get { if (allocationsPerMethod != null) { AllocationsPerMethod[] result = new AllocationsPerMethod [allocationsPerMethod.Count]; allocationsPerMethod.Values.CopyTo (result, 0); return result; } else { return new AllocationsPerMethod [0]; } } } Dictionary allocationsPerMethodAtJitTime; public AllocationsPerMethod[] MethodsAtJitTime { get { if (allocationsPerMethodAtJitTime != null) { AllocationsPerMethod[] result = new AllocationsPerMethod [allocationsPerMethodAtJitTime.Count]; allocationsPerMethodAtJitTime.Values.CopyTo (result, 0); return result; } else { return new AllocationsPerMethod [0]; } } } public int MethodsAtJitTimeCount { get { if (allocationsPerMethodAtJitTime != null) { return allocationsPerMethodAtJitTime.Values.Count; } else { return 0; } } } public static readonly LoadedClass LoadedClassUnavailable = new LoadedClass (0, LoadedAssembly.Unavailable, "(CLASS UNAVAILABLE)", 0); public LoadedClass (uint id, LoadedAssembly assembly, string name, uint size): base (id, assembly, name, size) { allocatedBytes = 0; currentlyAllocatedBytes = 0; allocationsPerMethod = null; } } public class StackTrace : IHeapItemSetStatisticsSubject { LoadedMethod topMethod; public LoadedMethod TopMethod { get { return topMethod; } } StackTrace caller; public StackTrace Caller { get { return caller; } } bool methodIsBeingJitted; public bool MethodIsBeingJitted { get { return methodIsBeingJitted; } } uint level; public uint Level { get { return level; } } uint id; public uint ID { get { return id; } } ulong clicks; public ulong Clicks { get { return clicks; } } uint calls; public ulong Calls { get { return calls; } } public void ResetCalls () { calls = 0; clicks = 0; } public void RegisterCall (ulong clicks) { this.clicks += clicks; calls ++; } static StackTrace[] EmptyCalledFrames = new StackTrace [0]; List calledFrames; public StackTrace[] CalledFrames { get { if (calledFrames != null) { StackTrace[] result = calledFrames.ToArray (); Array.Sort (result, CompareByClicks); Array.Reverse (result); return result; } else { return EmptyCalledFrames; } } } void AddCalledFrame (StackTrace calledFrame) { if (calledFrames == null) { calledFrames = new List (); } calledFrames.Add (calledFrame); } public static Comparison CompareByClicks = delegate (StackTrace a, StackTrace b) { return a.Clicks.CompareTo (b.Clicks); }; public static Comparison CompareByCalls = delegate (StackTrace a, StackTrace b) { return a.Calls.CompareTo (b.Calls); }; public void Write (TextWriter writer, int depth, string indentationString) { writer.Write ("CallStack of id "); writer.Write (id); writer.Write ('\n'); StackTrace currentFrame = this; while (currentFrame != null) { StackTrace nextFrame = currentFrame.Caller; for (int i = 0; i < depth; i++) { writer.Write (indentationString); } writer.Write (currentFrame.TopMethod.Name); if (nextFrame != null) { writer.Write ('\n'); } currentFrame = nextFrame; } } public string FullDescription { get { System.Text.StringBuilder sb = new System.Text.StringBuilder (); sb.Append ("CallStack of id "); sb.Append (id); sb.Append ('\n'); StackTrace currentFrame = this; while (currentFrame != null) { StackTrace nextFrame = currentFrame.Caller; sb.Append (" "); sb.Append (currentFrame.TopMethod.Class.Name); sb.Append ("."); sb.Append (currentFrame.TopMethod.Name); if (nextFrame != null) { sb.Append ('\n'); } currentFrame = nextFrame; } return sb.ToString (); } } string IHeapItemSetStatisticsSubject.Description { get { return FullDescription; } } public static readonly StackTrace StackTraceUnavailable = new StackTrace (CallStack.StackFrame.StackFrameUnavailable.Method, null, false, 0); StackTrace (LoadedMethod topMethod, StackTrace caller, bool methodIsBeingJitted, uint id) { this.clicks = 0; this.calls = 0; this.calledFrames = null; this.topMethod = topMethod; this.caller = caller; if (caller != null) { caller.AddCalledFrame (this); } this.methodIsBeingJitted = methodIsBeingJitted; this.level = caller != null ? caller.level + 1 : 1; this.id = id; } bool MatchesCallStack (CallStack.StackFrame stack) { StackTrace currentTrace = this; while ((currentTrace != null) && (stack != null)) { if (currentTrace.TopMethod != stack.Method) { return false; } if (currentTrace.methodIsBeingJitted != stack.IsBeingJitted) { return false; } currentTrace = currentTrace.Caller; stack = stack.Caller; } if ((currentTrace == null) && (stack == null)) { return true; } else { return false; } } internal class Factory { List rootFrames; public StackTrace[] RootFrames { get { StackTrace[] result = rootFrames.ToArray (); Array.Sort (result, StackTrace.CompareByClicks); Array.Reverse (result); return result; } } uint nextFreeId; Dictionary> [] tracesByLevel; public Factory () { rootFrames = new List (); // Important: StackTrace.StackTraceUnavailable gets id 0, which must be unique nextFreeId = 1; tracesByLevel = new Dictionary> [64]; } public StackTrace NewStackTrace (CallStack.StackFrame frame) { if (frame == null) { return null; } if (frame.Level >= (uint) tracesByLevel.Length) { Dictionary> [] newTracesByLevel = new Dictionary> [frame.Level * 2]; Array.Copy (tracesByLevel, newTracesByLevel, tracesByLevel.Length); tracesByLevel = newTracesByLevel; } Dictionary> tracesByMethod = tracesByLevel [frame.Level]; if (tracesByLevel [frame.Level] == null) { tracesByMethod = new Dictionary> (); tracesByLevel [frame.Level] = tracesByMethod; } List traces; if (tracesByMethod.ContainsKey (frame.Method.ID)) { traces = tracesByMethod [frame.Method.ID]; } else { traces = new List (); tracesByMethod [frame.Method.ID] = traces; } foreach (StackTrace trace in traces) { if (trace.MatchesCallStack (frame)) { return trace; } } StackTrace callerTrace = NewStackTrace (frame.Caller); StackTrace result = new StackTrace (frame.Method, callerTrace, frame.IsBeingJitted, nextFreeId); nextFreeId ++; traces.Add (result); if (callerTrace == null) { rootFrames.Add (result); } return result; } public StackTrace NewStackTrace (CallStack stack) { return NewStackTrace (stack.StackTop); } } } class CallStack { public class StackFrame { LoadedMethod method; public LoadedMethod Method { get { return method; } internal set { method = value; } } ulong startCounter; public ulong StartCounter { get { return startCounter; } internal set { startCounter = value; } } bool isBeingJitted; public bool IsBeingJitted { get { return isBeingJitted; } internal set { isBeingJitted = value; } } StackFrame caller; public StackFrame Caller { get { return caller; } internal set { caller = value; } } uint level; public uint Level { get { return level; } } public void SetLevel () { level = (caller != null) ? (caller.Level + 1) : 1; } public static readonly StackFrame StackFrameUnavailable = new StackFrame (LoadedMethod.LoadedMethodForStackTraceUnavailable, 0, false, null); internal StackFrame (LoadedMethod method, ulong startCounter, bool isBeingJitted, StackFrame caller) { this.method = method; this.startCounter = startCounter; this.isBeingJitted = isBeingJitted; this.caller = caller; SetLevel (); } static StackFrame freeFrames = null; internal static StackFrame FrameFactory (LoadedMethod method, ulong startCounter, bool isBeingJitted, StackFrame caller) { if (freeFrames != null) { StackFrame result = freeFrames; freeFrames = result.Caller; result.Method = method; result.startCounter = startCounter; result.isBeingJitted = isBeingJitted; result.Caller = caller; result.SetLevel (); return result; } else { return new StackFrame (method, startCounter, isBeingJitted, caller); } } internal static void FreeFrame (StackFrame frame) { frame.Caller = freeFrames; freeFrames = frame; } } ulong threadId; public ulong ThreadId { get { return threadId; } } StackFrame stackTop; internal StackFrame StackTop { get { return stackTop; } } public uint Depth { get { return (stackTop != null) ? stackTop.Level : 0; } } void PopMethod (StackTrace.Factory stackTraceFactory, LoadedMethod method, ulong counter, bool isBeingJitted) { while (stackTop != null) { LoadedMethod topMethod = stackTop.Method; bool topMethodIsBeingJitted = stackTop.IsBeingJitted; StackFrame callerFrame = stackTop.Caller; LoadedMethod callerMethod = (callerFrame != null)? callerFrame.Method : null; if (! topMethodIsBeingJitted) { ulong delta = counter - stackTop.StartCounter; topMethod.MethodCalled (delta, callerMethod); StackTrace trace = stackTraceFactory.NewStackTrace (this); if (trace != null) { trace.RegisterCall (delta); } } StackFrame.FreeFrame (stackTop); stackTop = callerFrame; if ((topMethod == method) && (topMethodIsBeingJitted == isBeingJitted)) { return; } } } internal void MethodEnter (LoadedMethod method, ulong counter) { stackTop = StackFrame.FrameFactory (method, counter, false, stackTop); } internal void MethodExit (StackTrace.Factory stackTraceFactory, LoadedMethod method, ulong counter) { PopMethod (stackTraceFactory, method, counter, false); } internal void TopMethodExit (StackTrace.Factory stackTraceFactory, ulong counter) { MethodExit (stackTraceFactory, stackTop.Method, counter); } internal void MethodJitStart (LoadedMethod method, ulong counter) { stackTop = StackFrame.FrameFactory (method, counter, true, stackTop); } internal void MethodJitEnd (StackTrace.Factory stackTraceFactory, LoadedMethod method, ulong counter) { PopMethod (stackTraceFactory, method, counter, true); } internal void AdjustStack (uint lastValidFrame, uint topSectionSize, StackSectionElement[] topSection) { if (Depth >= lastValidFrame) { while (Depth > lastValidFrame) { StackFrame lastTop = stackTop; stackTop = stackTop.Caller; StackFrame.FreeFrame (lastTop); } for (int i = (int) topSectionSize - 1; i >= 0; i--) { stackTop = StackFrame.FrameFactory (topSection [i].Method, 0, topSection [i].IsBeingJitted, stackTop); } } else { throw new Exception (String.Format ("Depth is {0} but lastValidFrame is {1}", Depth, lastValidFrame)); } } internal CallStack (ulong threadId) { this.threadId = threadId; stackTop = null; } } public class StatisticalHitItemCallInformation { IStatisticalHitItem item; public IStatisticalHitItem Item { get { return item; } } uint calls; public uint Calls { get { return calls; } internal set { calls = value; } } internal void AddCall () { calls ++; } public StatisticalHitItemCallInformation (IStatisticalHitItem item) { this.item = item; this.calls = 0; } } public class StatisticalHitItemCallCounts { public static Comparison CompareByStatisticalHits = delegate (IStatisticalHitItem a, IStatisticalHitItem b) { int result = a.StatisticalHits.CompareTo (b.StatisticalHits); if ((result == 0) && a.HasCallCounts && b.HasCallCounts) { StatisticalHitItemCallCounts aCounts = a.CallCounts; StatisticalHitItemCallCounts bCounts = b.CallCounts; result = aCounts.CallersCount.CompareTo (bCounts.CallersCount); if (result == 0) { result = aCounts.CalleesCount.CompareTo (bCounts.CalleesCount); } } return result; }; List callers; List callees; static StatisticalHitItemCallInformation[] GetSortedInfo (List list) { StatisticalHitItemCallInformation[] result = list.ToArray (); Array.Sort (result, delegate (StatisticalHitItemCallInformation a, StatisticalHitItemCallInformation b) { return a.Calls.CompareTo (b.Calls); }); Array.Reverse (result); return result; } public StatisticalHitItemCallInformation[] Callers { get { return GetSortedInfo (callers); } } public StatisticalHitItemCallInformation[] Callees { get { return GetSortedInfo (callees); } } public int CallersCount { get { return callers.Count; } } public int CalleesCount { get { return callees.Count; } } void AddCall (List list, IStatisticalHitItem item) { foreach (StatisticalHitItemCallInformation info in list) { if (info.Item == item) { info.AddCall (); return; } } StatisticalHitItemCallInformation newInfo = new StatisticalHitItemCallInformation (item); newInfo.AddCall (); list.Add (newInfo); } internal void AddCaller (IStatisticalHitItem caller) { AddCall (callers, caller); } internal void AddCallee (IStatisticalHitItem callee) { AddCall (callees, callee); } public StatisticalHitItemCallCounts () { callers = new List (); callees = new List (); } } public interface IStatisticalHitItem { string Name {get;} uint StatisticalHits {get;} bool HasCallCounts {get;} StatisticalHitItemCallCounts CallCounts {get;} } public class StatisticalHitItemTreeNode { IStatisticalHitItem item; public IStatisticalHitItem Item { get { return item; } } public string Name { get { return item.Name; } } uint hitCount; void IncrementHitCount () { hitCount ++; } public uint HitCount { get { return hitCount; } } public static Comparison CompareByHitCount = delegate (StatisticalHitItemTreeNode a, StatisticalHitItemTreeNode b) { int result = b.HitCount.CompareTo (a.HitCount); if (result == 0) { result = a.Name.CompareTo (b.Name); } return result; }; Dictionary children; static StatisticalHitItemTreeNode[] emptyChildren = new StatisticalHitItemTreeNode [0]; public int ChildrenCount { get { return (children != null) ? children.Count : 0; } } public StatisticalHitItemTreeNode[] Children { get { if (children != null) { StatisticalHitItemTreeNode[] result = new StatisticalHitItemTreeNode [children.Count]; int resultIndex = 0; foreach (StatisticalHitItemTreeNode child in children.Values) { result [resultIndex] = child; resultIndex ++; } Array.Sort (result, CompareByHitCount); return result; } else { return emptyChildren; } } } public StatisticalHitItemTreeNode AddChild (IStatisticalHitItem childItem) { if (children == null) { children = new Dictionary (); } StatisticalHitItemTreeNode child; if (children.ContainsKey (childItem.Name)) { child = children [childItem.Name]; } else { child = new StatisticalHitItemTreeNode (childItem); children [childItem.Name] = child; } child.IncrementHitCount (); return child; } public void PrintTree (TextWriter writer, uint fatherHits, int level) { for (int i = 0; i < level; i++) { writer.Write (" "); } writer.WriteLine ("{0,5:F2}% ({1}) {2}", ((((double) HitCount) / fatherHits) * 100), HitCount, Name); foreach (StatisticalHitItemTreeNode child in Children) { child.PrintTree (writer, HitCount, level + 1); } } public StatisticalHitItemTreeNode (IStatisticalHitItem item) { this.item = item; this.hitCount = 0; this.children = null; } } public class LoadedMethod : BaseLoadedMethod, IStatisticalHitItem, IHeapItemSetStatisticsSubject { ulong clicks; public ulong Clicks { get { return clicks; } internal set { clicks = value; } } public static Comparison CompareByTotalClicks = delegate (LoadedMethod a, LoadedMethod b) { return a.Clicks.CompareTo (b.Clicks); }; public static Comparison CompareByEffectiveClicks = delegate (LoadedMethod a, LoadedMethod b) { return (a.Clicks - a.CalledClicks).CompareTo (b.Clicks - b.CalledClicks); }; string IHeapItemSetStatisticsSubject.Description { get { return Class.Name + "." + Name; } } ulong calledClicks; public ulong CalledClicks { get { return calledClicks; } internal set { calledClicks = value; } } uint statisticalHits; public uint StatisticalHits { get { return statisticalHits; } internal set { statisticalHits = value; } } string IStatisticalHitItem.Name { get { return Class.Name + "." + this.Name; } } StatisticalHitItemCallCounts callCounts; public bool HasCallCounts { get { return (callCounts != null); } } public StatisticalHitItemCallCounts CallCounts { get { if (callCounts == null) { callCounts = new StatisticalHitItemCallCounts (); } return callCounts; } } ulong startJit; public ulong StartJit { get { return startJit; } internal set { startJit = value; } } ulong jitClicks; public ulong JitClicks { get { return jitClicks; } internal set { jitClicks = value; } } public static Comparison CompareByJitClicks = delegate (LoadedMethod a, LoadedMethod b) { return a.JitClicks.CompareTo (b.JitClicks); }; public class ClicksPerCalledMethod { LoadedMethod method; public LoadedMethod Method { get { return method; } } ulong clicks; public ulong Clicks { get { return clicks; } internal set { clicks = value; } } public static Comparison CompareByClicks = delegate (ClicksPerCalledMethod a, ClicksPerCalledMethod b) { return a.Clicks.CompareTo (b.Clicks); }; public ClicksPerCalledMethod (LoadedMethod method) { this.method = method; clicks = 0; } } Dictionary clicksPerCalledMethod; public ClicksPerCalledMethod[] Methods { get { if (clicksPerCalledMethod != null) { ClicksPerCalledMethod[] result = new ClicksPerCalledMethod [clicksPerCalledMethod.Count]; clicksPerCalledMethod.Values.CopyTo (result, 0); return result; } else { return new ClicksPerCalledMethod [0]; } } } public class CallsPerCallerMethod { LoadedMethod method; public LoadedMethod Callees { get { return method; } } uint calls; public uint Calls { get { return calls; } internal set { calls = value; } } public static Comparison CompareByCalls = delegate (CallsPerCallerMethod a, CallsPerCallerMethod b) { return a.Calls.CompareTo (b.Calls); }; public CallsPerCallerMethod (LoadedMethod method) { this.method = method; calls = 0; } } Dictionary callsPerCallerMethod; public CallsPerCallerMethod[] Callers { get { if (callsPerCallerMethod != null) { CallsPerCallerMethod[] result = new CallsPerCallerMethod [callsPerCallerMethod.Count]; callsPerCallerMethod.Values.CopyTo (result, 0); return result; } else { return new CallsPerCallerMethod [0]; } } } internal void MethodCalled (ulong clicks, LoadedMethod caller) { this.clicks += clicks; if (caller != null) { caller.CalleeReturns (this, clicks); if (callsPerCallerMethod == null) { callsPerCallerMethod = new Dictionary (); } CallsPerCallerMethod callerCalls; if (callsPerCallerMethod.ContainsKey (caller.ID)) { callerCalls = callsPerCallerMethod [caller.ID]; } else { callerCalls = new CallsPerCallerMethod (caller); callsPerCallerMethod.Add (caller.ID, callerCalls); } callerCalls.Calls += 1; } } internal void CalleeReturns (LoadedMethod callee, ulong clicks) { if (clicksPerCalledMethod == null) { clicksPerCalledMethod = new Dictionary (); } ClicksPerCalledMethod calledMethodClicks; if (clicksPerCalledMethod.ContainsKey (callee.ID)) { calledMethodClicks = clicksPerCalledMethod [callee.ID]; } else { calledMethodClicks = new ClicksPerCalledMethod (callee); clicksPerCalledMethod.Add (callee.ID, calledMethodClicks); } calledMethodClicks.Clicks += clicks; calledClicks += clicks; } public static readonly LoadedMethod LoadedMethodUnavailable = new LoadedMethod (0, LoadedClass.LoadedClassUnavailable, false, "(METHOD UNAVAILABLE)"); public static readonly LoadedMethod LoadedMethodForStackTraceUnavailable = new LoadedMethod (0, LoadedClass.LoadedClassUnavailable, false, "(CALL STACK UNAVAILABLE)"); public LoadedMethod (uint id, LoadedClass c, bool isWrapper, string name): base (id, c, isWrapper, name) { clicks = 0; calledClicks = 0; jitClicks = 0; statisticalHits = 0; } } public class UnmanagedFunctionFromID : BaseUnmanagedFunctionFromID, IStatisticalHitItem { uint statisticalHits; public uint StatisticalHits { get { return statisticalHits; } internal set { statisticalHits = value; } } string IStatisticalHitItem.Name { get { return "[" + Region.Name + "]" + this.Name; } } StatisticalHitItemCallCounts callCounts; public bool HasCallCounts { get { return (callCounts != null); } } public StatisticalHitItemCallCounts CallCounts { get { if (callCounts == null) { callCounts = new StatisticalHitItemCallCounts (); } return callCounts; } } public UnmanagedFunctionFromID (uint id, string name, ExecutableMemoryRegion region) : base (id, name, region) { statisticalHits = 0; } } public class UnmanagedFunctionFromRegion : BaseUnmanagedFunctionFromRegion, IStatisticalHitItem { uint statisticalHits; public uint StatisticalHits { get { return statisticalHits; } internal set { statisticalHits = value; } } public UnmanagedFunctionFromRegion () { statisticalHits = 0; } StatisticalHitItemCallCounts callCounts; public bool HasCallCounts { get { return (callCounts != null); } } public StatisticalHitItemCallCounts CallCounts { get { if (callCounts == null) { callCounts = new StatisticalHitItemCallCounts (); } return callCounts; } } string IStatisticalHitItem.Name { get { IExecutableMemoryRegion r = Region; return String.Format ("[{0}({1}-{2})]{3}", r != null ? r.Name : "NULL", this.StartOffset, this.EndOffset, this.Name); } } } public class ExecutableMemoryRegion : BaseExecutableMemoryRegion, IStatisticalHitItem { uint statisticalHits; public uint StatisticalHits { get { return statisticalHits; } internal set { statisticalHits = value; } } internal void IncrementStatisticalHits () { statisticalHits ++; } string IStatisticalHitItem.Name { get { return String.Format ("[{0}](UNKNOWN)", this.Name); } } StatisticalHitItemCallCounts callCounts; public bool HasCallCounts { get { return (callCounts != null); } } public StatisticalHitItemCallCounts CallCounts { get { if (callCounts == null) { callCounts = new StatisticalHitItemCallCounts (); } return callCounts; } } public ExecutableMemoryRegion (uint id, string name, uint fileOffset, ulong startAddress, ulong endAddress) : base (id, name, fileOffset, startAddress, endAddress) { statisticalHits = 0; } } public interface IHeapItem : IAllocatedObject { LoadedMethod AllocatorMethod {get;} StackTrace AllocationCallStack {get;} bool AllocationHappenedAtJitTime {get;} } public class HeapObject : BaseHeapObject, IHeapItem { AllocatedObject allocation; public AllocatedObject Allocation { get { return allocation; } set { allocation = value; if ((allocation.Class != Class) || (allocation.ID != ID)) { throw new Exception (String.Format ("Cannot accept allocation of class {0} and ID {1} for object of class {2} and ID {3}", allocation.Class, allocation.ID, Class, ID)); } } } public void FindAllocation (ProviderOfPreviousAllocationsSets previousSetsProvider) { foreach (HeapItemSet allocations in previousSetsProvider.PreviousAllocationsSets ()) { allocation = allocations [ID]; if (allocation != null) { return; } } } public LoadedMethod AllocatorMethod { get { return allocation != null ? allocation.AllocatorMethod : null; } } public StackTrace AllocationCallStack { get { return allocation != null ? allocation.Trace : null; } } public bool AllocationHappenedAtJitTime { get { return allocation != null ? allocation.AllocationHappenedAtJitTime : false; } } public HeapObject (ulong ID) : base (ID) {} } public class AllocatedObject : IHeapItem { ulong id; public ulong ID { get { return id; } } LoadedClass c; public LoadedClass Class { get { return c; } } uint size; public uint Size { get { return size; } } LoadedMethod caller; public LoadedMethod Caller { get { return caller; } } public LoadedMethod AllocatorMethod { get { return caller; } } bool jitTime; public bool JitTime { get { return jitTime; } } public bool AllocationHappenedAtJitTime { get { return jitTime; } } StackTrace trace; public StackTrace Trace { get { return trace; } } public StackTrace AllocationCallStack { get { return trace; } } public AllocatedObject (ulong id, LoadedClass c, uint size, LoadedMethod caller, bool jitTime, StackTrace trace) { this.id = id; this.c = c; this.size = size; this.caller = caller; this.jitTime = jitTime; this.trace = trace; } } public class HeapSnapshot : BaseHeapSnapshot { public class AllocationStatisticsPerClass { LoadedClass c; public LoadedClass Class { get { return c; } internal set { c = value; } } uint allocatedBytes; public uint AllocatedBytes { get { return allocatedBytes; } } uint freedBytes; public uint FreedBytes { get { return freedBytes; } } public static Comparison CompareByAllocatedBytes = delegate (AllocationStatisticsPerClass a, AllocationStatisticsPerClass b) { return a.AllocatedBytes.CompareTo (b.AllocatedBytes); }; public void BytesFreed (uint bytes) { allocatedBytes -= bytes; freedBytes += bytes; } public AllocationStatisticsPerClass (LoadedClass c) { this.c = c; this.allocatedBytes = c.CurrentlyAllocatedBytes; this.freedBytes = 0; } } AllocationStatisticsPerClass[] allocationStatistics; public AllocationStatisticsPerClass[] AllocationStatistics { get { int count = 0; foreach (AllocationStatisticsPerClass aspc in allocationStatistics) { if (aspc != null) { count ++; } } AllocationStatisticsPerClass[] result = new AllocationStatisticsPerClass [count]; count = 0; foreach (AllocationStatisticsPerClass aspc in allocationStatistics) { if (aspc != null) { result [count] = aspc; count ++; } } return result; } } public void HeapObjectUnreachable (LoadedClass c, uint size) { AllocationStatisticsPerClass statisticsPerClass = allocationStatistics [c.ID]; statisticsPerClass.BytesFreed (size); } public HeapSnapshot (uint collection, ulong startCounter, DateTime startTime, ulong endCounter, DateTime endTime, TimeSpan headerStartTime, LoadedClass[] initialAllocations, bool recordSnapshot) : base (delegate (ulong ID) {return new HeapObject (ID);}, collection, startCounter, startTime, endCounter, endTime, headerStartTime, recordSnapshot) { uint maxClassId = 0; foreach (LoadedClass c in initialAllocations) { if (c.ID > maxClassId) { maxClassId = c.ID; } } allocationStatistics = new AllocationStatisticsPerClass [maxClassId + 1]; foreach (LoadedClass c in initialAllocations) { AllocationStatisticsPerClass statisticsPerClass = new AllocationStatisticsPerClass (c); allocationStatistics [c.ID] = statisticsPerClass; } } } public interface IHeapItemFilter where HI : IHeapItem { string Description { get; } bool Filter (HI heapItem); } public interface IAllocatedObjectFilter : IHeapItemFilter { } public interface IHeapObjectFilter : IHeapItemFilter { } public abstract class FilterHeapItemByClass : IHeapItemFilter where HI : IHeapItem { protected LoadedClass c; public LoadedClass Class { get { return c; } } public abstract bool Filter (HI heapItem); string description; public string Description { get { return description; } } public FilterHeapItemByClass (LoadedClass c, string description) { this.c = c; this.description = description; } } public abstract class FilterHeapItemByAllocatorMethod : IHeapItemFilter where HI : IHeapItem { protected LoadedMethod allocatorMethod; public LoadedMethod AllocatorMethod { get { return allocatorMethod; } } public abstract bool Filter (HI heapItem); string description; public string Description { get { return description; } } protected FilterHeapItemByAllocatorMethod (LoadedMethod allocatorMethod, string description) { this.allocatorMethod = allocatorMethod; this.description = description; } } public class HeapItemWasAllocatedByMethod : FilterHeapItemByAllocatorMethod where HI : IHeapItem { public override bool Filter (HI heapItem) { return heapItem.AllocatorMethod == AllocatorMethod; } public HeapItemWasAllocatedByMethod (LoadedMethod allocatorMethod) : base (allocatorMethod, String.Format ("Object was allocated by {0}", allocatorMethod.Name)) { } } public class FilterHeapItemByAllocationCallStack : IHeapItemFilter where HI : IHeapItem { protected StackTrace allocationCallStack; public StackTrace AllocationCallStack { get { return allocationCallStack; } } public bool Filter (HI heapItem) { return heapItem.AllocationCallStack == allocationCallStack; } string description; public string Description { get { return description; } } public FilterHeapItemByAllocationCallStack (StackTrace allocationCallStack) { this.allocationCallStack = allocationCallStack; this.description = String.Format ("Allocation has call stack:\n{0}", allocationCallStack.FullDescription); } } public class HeapItemIsOfClass : FilterHeapItemByClass where HI : IHeapItem { protected static string BuildDescription (LoadedClass c) { return String.Format ("Object has class {0}", c.Name); } public override bool Filter (HI heapItem) { return heapItem.Class == c; } public HeapItemIsOfClass (LoadedClass c) : base (c, BuildDescription (c)) { } } public class HeapObjectIsOfClass : HeapItemIsOfClass, IHeapObjectFilter { public HeapObjectIsOfClass (LoadedClass c) : base (c) { } } public class AllocatedObjectIsOfClass : HeapItemIsOfClass, IAllocatedObjectFilter { public AllocatedObjectIsOfClass (LoadedClass c) : base (c) { } } public abstract class FilterHeapObjectByClass : FilterHeapItemByClass, IHeapObjectFilter { protected FilterHeapObjectByClass (LoadedClass c, string description) : base (c, description) { } } public class HeapObjectReferencesObjectOfClass : FilterHeapObjectByClass { static string BuildDescription (LoadedClass c) { return String.Format ("Object references object of class {0}", c.Name); } public override bool Filter (HeapObject heapObject) { foreach (HeapObject ho in heapObject.References) { if (ho.Class == c) { return true; } } return false; } public HeapObjectReferencesObjectOfClass (LoadedClass c) : base (c, BuildDescription (c)) { } } public class HeapObjectIsReferencedByObjectOfClass : FilterHeapObjectByClass { static string BuildDescription (LoadedClass c) { return String.Format ("Object is referenced by object of class {0}", c.Name); } public override bool Filter (HeapObject heapObject) { foreach (HeapObject ho in heapObject.BackReferences) { if (ho.Class == c) { return true; } } return false; } public HeapObjectIsReferencedByObjectOfClass (LoadedClass c) : base (c, BuildDescription (c)) { } } public interface IHeapItemSetStatisticsSubject { string Description {get;} uint ID {get;} } public delegate HISSS GetHeapItemStatisticsSubject (HI item) where HI : IHeapItem where HISSS : IHeapItemSetStatisticsSubject; public delegate HISSBS NewHeapItemStatisticsBySubject (HISSS subject) where HISSS : IHeapItemSetStatisticsSubject where HISSBS : HeapItemSetStatisticsBySubject; public interface IHeapItemSetStatisticsBySubject { IHeapItemSetStatisticsSubject Subject {get;} uint ItemsCount {get;} uint AllocatedBytes {get;} } public abstract class HeapItemSetStatisticsBySubject : IHeapItemSetStatisticsBySubject where HISSS : IHeapItemSetStatisticsSubject { HISSS subject; protected HISSS Subject { get { return subject; } } IHeapItemSetStatisticsSubject IHeapItemSetStatisticsBySubject.Subject { get { return subject; } } uint itemsCount; public uint ItemsCount { get { return itemsCount; } } uint allocatedBytes; public uint AllocatedBytes { get { return allocatedBytes; } } internal void AddItem (IHeapItem item) { itemsCount ++; allocatedBytes += item.Size; } protected abstract HISSS GetUnavailableSubject (); public HeapItemSetStatisticsBySubject (HISSS subject) { this.subject = subject != null ? subject : GetUnavailableSubject (); this.itemsCount = 0; this.allocatedBytes = 0; } public static Comparison> CompareByAllocatedBytes = delegate (HeapItemSetStatisticsBySubject a, HeapItemSetStatisticsBySubject b) { return a.AllocatedBytes.CompareTo (b.AllocatedBytes); }; } public class HeapItemSetClassStatistics : HeapItemSetStatisticsBySubject { public LoadedClass Class { get { return Subject; } } protected override LoadedClass GetUnavailableSubject () { return LoadedClass.LoadedClassUnavailable; } public HeapItemSetClassStatistics (LoadedClass c) : base (c) { } } public class HeapItemSetMethodStatistics : HeapItemSetStatisticsBySubject { public LoadedMethod Method { get { return Subject; } } protected override LoadedMethod GetUnavailableSubject () { return LoadedMethod.LoadedMethodUnavailable; } public HeapItemSetMethodStatistics (LoadedMethod method) : base (method) { } } public class HeapItemSetCallStackStatistics : HeapItemSetStatisticsBySubject { public StackTrace CallStack { get { return Subject; } } protected override StackTrace GetUnavailableSubject () { return StackTrace.StackTraceUnavailable; } public HeapItemSetCallStackStatistics (StackTrace callStack) : base (callStack) { } } public interface IHeapItemSet { bool ContainsItem (ulong id); string ShortDescription {get;} string LongDescription {get;} IHeapItem[] Elements {get;} HeapItemSetClassStatistics[] ClassStatistics {get;} HeapItemSetMethodStatistics[] AllocatorMethodStatistics {get;} HeapItemSetCallStackStatistics[] AllocationCallStackStatistics {get;} uint AllocatedBytes {get;} bool ObjectAllocationsArePresent {get;} void FindObjectAllocations (ProviderOfPreviousAllocationsSets previousSetsProvider); } public interface ProviderOfPreviousAllocationsSets { IEnumerable> PreviousAllocationsSets (); } public abstract class HeapItemSet : IHeapItemSet where HI : IHeapItem { public static Comparison CompareHeapItemsByID = delegate (HI a, HI b) { return a.ID.CompareTo (b.ID); }; string shortDescription; public string ShortDescription { get { return shortDescription; } } string longDescription; public string LongDescription { get { return longDescription; } } HI[] elements; public HI[] Elements { get { return elements; } } IHeapItem[] IHeapItemSet.Elements { get { IHeapItem[] result = new IHeapItem [elements.Length]; Array.Copy (elements, result, elements.Length); return result; } } HeapItemSetClassStatistics[] classStatistics; public HeapItemSetClassStatistics[] ClassStatistics { get { return classStatistics; } } uint allocatedBytes; public uint AllocatedBytes { get { return allocatedBytes; } } protected HISSBS[] BuildStatistics (GetHeapItemStatisticsSubject getSubject, NewHeapItemStatisticsBySubject newStatistics) where HISSS : IHeapItemSetStatisticsSubject where HISSBS : HeapItemSetStatisticsBySubject { Dictionary statistics = new Dictionary (); foreach (HI hi in elements) { HISSS subject = getSubject (hi); HISSBS s; uint id; if (subject != null) { id = subject.ID; } else { id = 0;; } if (statistics.ContainsKey (id)) { s = statistics [id]; } else { s = newStatistics (subject); statistics [id] = s; } s.AddItem (hi); } HISSBS[] result = new HISSBS [statistics.Values.Count]; statistics.Values.CopyTo (result, 0); Array.Sort (result, HeapItemSetStatisticsBySubject.CompareByAllocatedBytes); Array.Reverse (result); return result; } HeapItemSetMethodStatistics[] allocatorMethodStatistics; public HeapItemSetMethodStatistics[] AllocatorMethodStatistics { get { if ((allocatorMethodStatistics == null) && ObjectAllocationsArePresent) { allocatorMethodStatistics = BuildStatistics (delegate (HI item) { return item.AllocatorMethod; }, delegate (LoadedMethod m) { return new HeapItemSetMethodStatistics (m); }); } return allocatorMethodStatistics; } } public bool HasAllocatorMethodStatistics { get { return allocatorMethodStatistics != null; } } HeapItemSetCallStackStatistics[] allocationCallStackStatistics; public HeapItemSetCallStackStatistics[] AllocationCallStackStatistics { get { if ((allocationCallStackStatistics == null) && ObjectAllocationsArePresent) { allocationCallStackStatistics = BuildStatistics (delegate (HI item) { return item.AllocationCallStack; }, delegate (StackTrace s) { return new HeapItemSetCallStackStatistics (s); }); } return allocationCallStackStatistics; } } public bool HasAllocationCallStackStatistics { get { return allocationCallStackStatistics != null; } } public void CompareWithSet (HeapItemSet otherSet, out HeapItemSet onlyInThisSet, out HeapItemSet onlyInOtherSet) where OHI : IHeapItem { HeapItemSetFromComparison.PerformComparison (this, otherSet, out onlyInThisSet, out onlyInOtherSet); } public HeapItemSet IntersectWithSet (HeapItemSet otherSet) where OHI : IHeapItem { return HeapItemSetFromComparison.PerformIntersection (this, otherSet); } public HI this [ulong id] { get { int lowIndex = -1; int highIndex = elements.Length; while (true) { int span = (highIndex - lowIndex) / 2; if (span > 0) { int middleIndex = lowIndex + span; HI middleElement = elements [middleIndex]; ulong middleID = middleElement.ID; if (middleID > id) { highIndex = middleIndex; } else if (middleID < id) { lowIndex = middleIndex; } else { return middleElement; } } else { return default (HI); } } } } public HI this [HI item] { get { return this [item.ID]; } } public bool ContainsItem (ulong id) { return this [id] != null; } public HeapItemSet ObjectsReferencingItemInSet (HeapItemSet objectSet) { return Mono.Profiler.HeapItemSetFromComparison.ObjectsReferencingItemInSet (this, objectSet); } public HeapItemSet ObjectsReferencedByItemInSet (HeapItemSet objectSet) { return Mono.Profiler.HeapItemSetFromComparison.ObjectsReferencedByItemInSet (this, objectSet); } static void FindObjectAllocations (HeapItemSet baseSet, ProviderOfPreviousAllocationsSets previousSetsProvider) { foreach (HeapObject heapObject in baseSet.Elements) { if (heapObject.Allocation == null) { heapObject.FindAllocation (previousSetsProvider); } } } bool objectAllocationsArePresent; public bool ObjectAllocationsArePresent { get { return objectAllocationsArePresent; } } public void FindObjectAllocations (ProviderOfPreviousAllocationsSets previousSetsProvider) { if ((! objectAllocationsArePresent)) { HeapItemSet baseSet = this as HeapItemSet; if (baseSet != null) { FindObjectAllocations (baseSet, previousSetsProvider); objectAllocationsArePresent = true; } } } protected HeapItemSet (string shortDescription, string longDescription, HI[] elements, bool objectAllocationsArePresent) { this.shortDescription = shortDescription; this.longDescription = longDescription; this.elements = elements; this.objectAllocationsArePresent = objectAllocationsArePresent; allocatedBytes = 0; Array.Sort (this.elements, CompareHeapItemsByID); classStatistics = BuildStatistics (delegate (HI item) { allocatedBytes += item.Size; return item.Class; }, delegate (LoadedClass c) { return new HeapItemSetClassStatistics (c); }); } } public class HeapObjectSetFromSnapshot : HeapItemSet { HeapSnapshot heapSnapshot; public HeapSnapshot HeapSnapshot { get { return heapSnapshot; } } public HeapObjectSetFromSnapshot (HeapSnapshot heapSnapshot): base (String.Format ("Heap at {0}.{1:000}s", heapSnapshot.HeaderStartTime.Seconds, heapSnapshot.HeaderStartTime.Milliseconds), String.Format ("Heap snapshot taken at {0}.{1:000}s", heapSnapshot.HeaderStartTime.Seconds, heapSnapshot.HeaderStartTime.Milliseconds), heapSnapshot.HeapObjects, false) { this.heapSnapshot = heapSnapshot; } } public class AllocatedObjectSetFromEvents : HeapItemSet { public AllocatedObjectSetFromEvents (TimeSpan timeFromStart, AllocatedObject[] allocations): base (String.Format ("Allocations {0}.{1:000}s", timeFromStart.Seconds, timeFromStart.Milliseconds), String.Format ("Allocations taken from {0}.{1:000}s", timeFromStart.Seconds, timeFromStart.Milliseconds), allocations, true) { } } public class HeapItemSetFromFilter : HeapItemSet where HI : IHeapItem { HeapItemSet baseSet; public HeapItemSet BaseSet { get { return baseSet; } } IHeapItemFilter filter; public IHeapItemFilter Filter { get { return filter; } } static HI[] filterSet (HeapItemSet baseSet, IHeapItemFilter filter) { List newSet = new List (); foreach (HI hi in baseSet.Elements) { if (filter.Filter (hi)) { newSet.Add (hi); } } HI[] result = new HI [newSet.Count]; newSet.CopyTo (result); return result; } public HeapItemSetFromFilter (HeapItemSet baseSet, IHeapItemFilter filter): base (filter.Description, String.Format ("{0} and {1}", filter.Description, baseSet.LongDescription), filterSet (baseSet, filter), baseSet.ObjectAllocationsArePresent) { this.baseSet = baseSet; this.filter = filter; } } public class HeapItemSetFromComparison : HeapItemSet where HI : IHeapItem where OHI : IHeapItem { HeapItemSet baseSet; public HeapItemSet BaseSet { get { return baseSet; } } HeapItemSet otherSet; public HeapItemSet OtherSet { get { return otherSet; } } static string buildShortDescription (HeapItemSet otherSet, string relation) { return String.Format("Object {0} in {1}", relation, otherSet.ShortDescription); } static string buildLongDescription (HeapItemSet otherSet, string relation) { return String.Format("Object {0} in {1}", relation, otherSet.LongDescription); } public static void PerformComparison (HeapItemSet firstSet, HeapItemSet secondSet, out HeapItemSet onlyInFirstSet, out HeapItemSet onlyInSecondSet) where HI1 : IHeapItem where HI2 : IHeapItem { List onlyInFirst = new List (); List onlyInSecond = new List (); int firstIndex = 0; int secondIndex = 0; HI1[] firstObjects = firstSet.Elements; HI2[] secondObjects = secondSet.Elements; while ((firstIndex < firstObjects.Length) || (secondIndex < secondObjects.Length)) { if (firstIndex >= firstObjects.Length) { while (secondIndex < secondObjects.Length) { onlyInSecond.Add (secondObjects [secondIndex]); secondIndex ++; } } else if (secondIndex >= secondObjects.Length) { while (firstIndex < secondObjects.Length) { onlyInFirst.Add (firstObjects [firstIndex]); firstIndex ++; } } else { HI1 firstObject = firstObjects [firstIndex]; HI2 secondObject = secondObjects [secondIndex]; if (firstObject.ID < secondObject.ID) { onlyInFirst.Add (firstObject); firstIndex ++; } else if (secondObject.ID < firstObject.ID) { onlyInSecond.Add (secondObject); secondIndex ++; } else { firstIndex ++; secondIndex ++; } } } onlyInFirstSet = new HeapItemSetFromComparison(firstSet, secondSet, onlyInFirst.ToArray (), "not"); onlyInSecondSet = new HeapItemSetFromComparison(secondSet, firstSet, onlyInSecond.ToArray (), "not"); } public static HeapItemSet PerformIntersection (HeapItemSet firstSet, HeapItemSet secondSet) where HI1 : IHeapItem where HI2 : IHeapItem { List result = new List (); int firstIndex = 0; int secondIndex = 0; HI1[] firstObjects = firstSet.Elements; HI2[] secondObjects = secondSet.Elements; Console.WriteLine ("Inside PerformIntersection..."); while ((firstIndex < firstObjects.Length) && (secondIndex < secondObjects.Length)) { HI1 firstObject = firstObjects [firstIndex]; HI2 secondObject = secondObjects [secondIndex]; if (firstObject.ID < secondObject.ID) { firstIndex ++; } else if (secondObject.ID < firstObject.ID) { secondIndex ++; } else { result.Add (firstObject); firstIndex ++; secondIndex ++; } } return new HeapItemSetFromComparison(firstSet, secondSet, result.ToArray (), "also"); } static bool ObjectReferencesItemInSet (HeapItemSet itemSet, HeapObject o) { foreach (HeapObject reference in o.References) { if (itemSet.ContainsItem (reference.ID)) { return true; } } return false; } public static HeapItemSet ObjectsReferencingItemInSet (HeapItemSet itemSet, HeapItemSet objectSet) { List result = new List (); HeapObject[] objects = objectSet.Elements; foreach (HeapObject o in objects) { if (ObjectReferencesItemInSet (itemSet, o)) { result.Add (o); } } return new HeapItemSetFromComparison(objectSet, itemSet, result.ToArray (), "references item"); } static bool ObjectIsReferencedByItemInSet (HeapItemSet itemSet, HeapObject o) { foreach (HeapObject reference in o.BackReferences) { if (itemSet.ContainsItem (reference.ID)) { return true; } } return false; } public static HeapItemSet ObjectsReferencedByItemInSet (HeapItemSet itemSet, HeapItemSet objectSet) { List result = new List (); HeapObject[] objects = objectSet.Elements; foreach (HeapObject o in objects) { if (ObjectIsReferencedByItemInSet (itemSet, o)) { result.Add (o); } } return new HeapItemSetFromComparison(objectSet, itemSet, result.ToArray (), "is referenced by item"); } HeapItemSetFromComparison (HeapItemSet baseSet, HeapItemSet otherSet, HI[] heapItems, string relation): base (buildShortDescription (otherSet, relation), buildLongDescription (otherSet, relation), heapItems, baseSet.ObjectAllocationsArePresent) { this.baseSet = baseSet; this.otherSet = otherSet; } } public class LoadedElementFactory : ILoadedElementFactory { bool recordHeapSnapshots = true; public bool RecordHeapSnapshots { get { return recordHeapSnapshots; } set { recordHeapSnapshots = value; } } public LoadedAssembly NewAssembly (uint id, string name, string baseName, uint major, uint minor, uint build, uint revision, string culture, string publicKeyToken, bool retargetable) { return new LoadedAssembly (id, name, baseName, major, minor, build, revision, culture, publicKeyToken, retargetable); } public LoadedClass NewClass (uint id, LoadedAssembly assembly, string name, uint size) { return new LoadedClass (id, assembly, name, size); } public LoadedMethod NewMethod (uint id, LoadedClass c, bool isWrapper, string name) { return new LoadedMethod (id, c, isWrapper, name); } public ExecutableMemoryRegion NewExecutableMemoryRegion (uint id, string fileName, uint fileOffset, ulong startAddress, ulong endAddress) { return new ExecutableMemoryRegion (id, fileName, fileOffset, startAddress, endAddress); } public HeapSnapshot NewHeapSnapshot (uint collection, ulong startCounter, DateTime startTime, ulong endCounter, DateTime endTime, TimeSpan headerStartTime, LoadedClass[] initialAllocations, bool recordSnapshots) { return new HeapSnapshot (collection, startCounter, startTime, endCounter, endTime, headerStartTime, initialAllocations, recordSnapshots); } public UnmanagedFunctionFromID NewUnmanagedFunction (uint id, string name, ExecutableMemoryRegion region) { return new UnmanagedFunctionFromID (id, name, region); } } public class AllocationSummary : BaseAllocationSummary { public AllocationSummary (uint collection, ulong startCounter, DateTime startTime) : base (collection, startCounter, startTime) { } } public interface MonitorAggregatedDataHandler { ulong TicksContended {get;} void AddTicksContended (ulong increment); ulong ContentionCount {get;} void IncrementContentionCount (); ulong FailCount {get;} void IncrementFailCount (); void Reset (); void WriteName (TextWriter writer, int depth); void WriteIndividualStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth); void WriteFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth); } public interface MonitorContainerDataHandler : MonitorAggregatedDataHandler { MonitorAggregatedDataHandler[] ComponentData {get;} } public struct MonitorAggregatedData { ulong ticksContended; public ulong TicksContended { get { return ticksContended; } } public void AddTicksContended (ulong increment) { ticksContended += increment; } uint contentionCount; public ulong ContentionCount { get { return contentionCount; } } public void IncrementContentionCount () { contentionCount ++; } uint failCount; public ulong FailCount { get { return failCount; } } public void IncrementFailCount () { failCount ++; } public void Reset () { ticksContended = 0; contentionCount = 0; failCount = 0; } } public abstract class BaseMonitorStatisticsCollector : MonitorAggregatedDataHandler { protected MonitorAggregatedData data; public ulong TicksContended { get { return data.TicksContended; } } public abstract void AddTicksContended (ulong increment); public ulong ContentionCount { get { return data.ContentionCount; } } public abstract void IncrementContentionCount (); public ulong FailCount { get { return data.FailCount; } } public abstract void IncrementFailCount (); public abstract void Reset (); public abstract void WriteName (TextWriter writer, int depth); protected static readonly string IndentationString = " "; protected void WriteIndentation (TextWriter writer, int depth) { for (int i = 0; i < depth; i++) { writer.Write (IndentationString); } } public void WriteIndividualStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth) { if (owner == null) { owner = this; } WriteIndentation (writer, depth); //double secondsContended = processor.ClicksToSeconds (TicksContended); //double ownerSecondsContended = processor.ClicksToSeconds (owner.TicksContended); writer.Write ("{0,5:F2}% ({1:F6} ticks) contention time ({2} contentions, {3} failures) in ", //(secondsContended / ownerSecondsContended) * 100.0, (((double) TicksContended) / owner.TicksContended) * 100.0, //secondsContended, TicksContended, ContentionCount, FailCount); WriteName (writer, depth); writer.WriteLine (); } public abstract void WriteFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth); protected static void WriteComponentStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, MonitorAggregatedDataHandler[] components, ProfilerEventHandler processor, int depth) { foreach (MonitorAggregatedDataHandler component in components) { component.WriteFullStatistics (writer, owner, processor, depth + 1); } } protected static void WriteSimpleContainerComponentStatistics (TextWriter writer, MonitorContainerDataHandler container, ProfilerEventHandler processor, int depth) { WriteComponentStatistics (writer, container, container.ComponentData, processor, depth); } protected static void WriteSimpleContainerFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, MonitorContainerDataHandler container, ProfilerEventHandler processor, int depth) { container.WriteIndividualStatistics (writer, owner, processor, depth); WriteComponentStatistics (writer, container, container.ComponentData, processor, depth); } public static Comparison CompareStatistics = delegate (MonitorAggregatedDataHandler a, MonitorAggregatedDataHandler b) { int result = b.TicksContended.CompareTo (a.TicksContended); if (result != 0) { return result; } else { return b.ContentionCount.CompareTo (a.ContentionCount); } }; } public abstract class SimpleMonitorStatistics : BaseMonitorStatisticsCollector { public override void AddTicksContended (ulong increment) { data.AddTicksContended (increment); } public override void IncrementContentionCount () { data.IncrementContentionCount (); } public override void IncrementFailCount () { data.IncrementFailCount (); } public override void Reset () { data.Reset (); } } public class GlobalMonitorStatistics : SimpleMonitorStatistics, MonitorContainerDataHandler { Dictionary statistics; public MonitorStatisticsByClass[] Statistics { get { MonitorStatisticsByClass[] result = new MonitorStatisticsByClass [statistics.Count]; statistics.Values.CopyTo (result, 0); Array.Sort (result, CompareStatistics); return result; } } public MonitorAggregatedDataHandler[] ComponentData { get { return Statistics; } } public void HandleEvent (ulong threadId, MonitorEvent eventCode, LoadedClass c, ulong objectId, StackTrace trace, ulong counter) { MonitorStatisticsByClass target; if (! statistics.ContainsKey (c.ID)) { target = new MonitorStatisticsByClass (this, c); statistics [c.ID] = target; } else { target = statistics [c.ID]; } target.HandleEvent (threadId, eventCode, objectId, trace, counter); } public string Name { get { return "Global statistics"; } } public override void WriteName (TextWriter writer, int depth) { writer.Write (Name); } public override void WriteFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth) { WriteSimpleContainerFullStatistics (writer, owner, this, processor, depth); } public void WriteStatistics (TextWriter writer, ProfilerEventHandler processor) { WriteFullStatistics (writer, this, processor, 0); } public bool ContainsData { get { return statistics.Count > 0; } } public GlobalMonitorStatistics () { statistics = new Dictionary (); } } public abstract class DependentMonitorStatistics : BaseMonitorStatisticsCollector where MS : MonitorAggregatedDataHandler { MS owner; public MS Owner { get { return owner; } } public override void AddTicksContended (ulong increment) { data.AddTicksContended (increment); owner.AddTicksContended (increment); } public override void IncrementContentionCount () { data.IncrementContentionCount (); owner.IncrementContentionCount (); } public override void IncrementFailCount () { data.IncrementFailCount (); owner.IncrementFailCount (); } public override void Reset () { data.Reset (); owner.Reset (); } protected DependentMonitorStatistics (MS owner) { this.owner = owner; } } public class MonitorStatisticsByCallerPerClass : SimpleMonitorStatistics, MonitorContainerDataHandler { LoadedMethod caller; public LoadedMethod Caller { get { return caller; } } Dictionary> statistics; public MonitorStatisticsByCallStack[] Statistics { get { MonitorStatisticsByCallStack[] result = new MonitorStatisticsByCallStack [statistics.Count]; statistics.Values.CopyTo (result, 0); Array.Sort (result, CompareStatistics); return result; } } public MonitorAggregatedDataHandler[] ComponentData { get { return Statistics; } } public MonitorStatisticsByCallStack HandleEvent (MonitorEvent eventCode, StackTrace trace) { MonitorStatisticsByCallStack target; if (! statistics.ContainsKey (trace.ID)) { target = new MonitorStatisticsByCallStack (this, trace); statistics [trace.ID] = target; } else { target = statistics [trace.ID]; } target.HandleEvent (eventCode); return target; } public string Name { get { return caller.Class.Name + "." + caller.Name; } } public override void WriteName (TextWriter writer, int depth) { writer.Write (Name); } public override void WriteFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth) { WriteSimpleContainerFullStatistics (writer, owner, this, processor, depth); } public MonitorStatisticsByCallerPerClass (LoadedMethod caller) { this.caller = caller; statistics = new Dictionary> (); } } public class MonitorStatisticsByClass : DependentMonitorStatistics, MonitorContainerDataHandler { LoadedClass c; public LoadedClass Class { get { return c; } } Dictionary statistics; public MonitorStatistics[] Statistics { get { MonitorStatistics[] result = new MonitorStatistics [statistics.Count]; statistics.Values.CopyTo (result, 0); Array.Sort (result, CompareStatistics); return result; } } public MonitorAggregatedDataHandler[] ComponentData { get { return Statistics; } } Dictionary statisticsByCaller; public MonitorStatisticsByCallerPerClass[] StatisticsByCaller { get { MonitorStatisticsByCallerPerClass[] result = new MonitorStatisticsByCallerPerClass [statisticsByCaller.Count]; statisticsByCaller.Values.CopyTo (result, 0); Array.Sort (result, CompareStatistics); return result; } } public MonitorAggregatedDataHandler[] ComponentDataByCaller { get { return StatisticsByCaller; } } public void HandleEvent (ulong threadId, MonitorEvent eventCode, ulong objectId, StackTrace trace, ulong counter) { MonitorStatisticsByCallerPerClass callerPerClassTarget; if (statisticsByCaller.ContainsKey (trace.TopMethod.ID)) { callerPerClassTarget = statisticsByCaller [trace.TopMethod.ID]; } else { callerPerClassTarget = new MonitorStatisticsByCallerPerClass (trace.TopMethod); statisticsByCaller [trace.TopMethod.ID] = callerPerClassTarget; } MonitorStatisticsByCallStack tracePerClassDestination = callerPerClassTarget.HandleEvent (eventCode, trace); MonitorStatistics target; if (statistics.ContainsKey (objectId)) { target = statistics [objectId]; } else { target = new MonitorStatistics (this, objectId); statistics [objectId] = target; } target.HandleEvent (threadId, eventCode, trace, counter, tracePerClassDestination); } public string Name { get { return c.Name; } } public override void WriteName (TextWriter writer, int depth) { writer.Write (Name); } public override void WriteFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth) { WriteIndividualStatistics (writer, owner, processor, depth); WriteIndentation (writer, depth + 1); writer.WriteLine ("Statistics by caller:"); WriteComponentStatistics (writer, this, ComponentDataByCaller, processor, depth + 1); WriteIndentation (writer, depth + 1); writer.WriteLine ("Statistics by monitor:"); WriteComponentStatistics (writer, this, ComponentData, processor, depth + 1); } public MonitorStatisticsByClass (GlobalMonitorStatistics gms, LoadedClass c) : base (gms) { this.c = c; statistics = new Dictionary (); statisticsByCaller = new Dictionary (); } } public class MonitorStatistics : DependentMonitorStatistics, MonitorContainerDataHandler { struct ThreadState { public ulong lastCounterValue; //public bool isPerformingRetry; } ThreadState currentThreadState; ulong currentThreadId; Dictionary threadStates; void SetCurrentThread (ulong threadId) { if (currentThreadId != threadId) { threadStates [currentThreadId] = currentThreadState; if (! threadStates.ContainsKey (threadId)) { threadStates [threadId] = new ThreadState (); } currentThreadState = threadStates [threadId]; currentThreadId = threadId; } } public void HandleEvent (ulong threadId, MonitorEvent eventCode, StackTrace trace, ulong counter, MonitorStatisticsByCallStack tracePerClassDestination) { uint methodId = trace.TopMethod.ID; MonitorStatisticsByCaller target; if (! statistics.ContainsKey (methodId)) { target = new MonitorStatisticsByCaller (this, trace.TopMethod); statistics [methodId] = target; } else { target = statistics [methodId]; } MonitorStatisticsByCallStack destination = target.HandleEvent (eventCode, trace); SetCurrentThread (threadId); switch (eventCode) { case MonitorEvent.CONTENTION: tracePerClassDestination.IncrementContentionCount (); destination.IncrementContentionCount (); currentThreadState.lastCounterValue = counter; break; case MonitorEvent.DONE: tracePerClassDestination.AddTicksContended (counter - currentThreadState.lastCounterValue); destination.AddTicksContended (counter - currentThreadState.lastCounterValue); currentThreadState.lastCounterValue = counter; break; case MonitorEvent.FAIL: tracePerClassDestination.AddTicksContended (counter - currentThreadState.lastCounterValue); destination.AddTicksContended (counter - currentThreadState.lastCounterValue); currentThreadState.lastCounterValue = counter; tracePerClassDestination.IncrementFailCount (); destination.IncrementFailCount (); break; default: throw new Exception (String.Format ("Invalid MonitorEvent code {0}", eventCode)); } } ulong objectId; public ulong ObjectId { get { return objectId; } } Dictionary statistics; public MonitorStatisticsByCaller[] Statistics { get { MonitorStatisticsByCaller[] result = new MonitorStatisticsByCaller [statistics.Count]; statistics.Values.CopyTo (result, 0); Array.Sort (result, CompareStatistics); return result; } } public MonitorAggregatedDataHandler[] ComponentData { get { return Statistics; } } public string Name { get { return "object " + ObjectId; } } public override void WriteName (TextWriter writer, int depth) { writer.Write (Name); } public override void WriteFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth) { WriteSimpleContainerFullStatistics (writer, owner, this, processor, depth); } public MonitorStatistics (MonitorStatisticsByClass msbc, ulong objectId) : base (msbc) { this.objectId = objectId; currentThreadState.lastCounterValue = 0; currentThreadId = 0; threadStates = new Dictionary (); threadStates [0] = new ThreadState (); statistics = new Dictionary (); } } public class MonitorStatisticsByCaller : DependentMonitorStatistics, MonitorContainerDataHandler { LoadedMethod caller; public LoadedMethod Caller { get { return caller; } } Dictionary> statistics; public MonitorStatisticsByCallStack[] Statistics { get { MonitorStatisticsByCallStack[] result = new MonitorStatisticsByCallStack [statistics.Count]; statistics.Values.CopyTo (result, 0); Array.Sort (result, CompareStatistics); return result; } } public MonitorAggregatedDataHandler[] ComponentData { get { return Statistics; } } public MonitorStatisticsByCallStack HandleEvent (MonitorEvent eventCode, StackTrace trace) { MonitorStatisticsByCallStack target; if (! statistics.ContainsKey (trace.ID)) { target = new MonitorStatisticsByCallStack (this, trace); statistics [trace.ID] = target; } else { target = statistics [trace.ID]; } target.HandleEvent (eventCode); return target; } public string Name { get { return caller.Class.Name + "." + caller.Name; } } public override void WriteName (TextWriter writer, int depth) { writer.Write (Name); } public override void WriteFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth) { WriteSimpleContainerFullStatistics (writer, owner, this, processor, depth); } public MonitorStatisticsByCaller (MonitorStatistics ms, LoadedMethod caller) : base (ms) { this.caller = caller; statistics = new Dictionary> (); } } public class MonitorStatisticsByCallStack : DependentMonitorStatistics where C : MonitorContainerDataHandler { StackTrace trace; public StackTrace Trace { get { return trace; } } public void HandleEvent (MonitorEvent eventCode) { } public string Name { get { return trace.FullDescription; } } public override void WriteName (TextWriter writer, int depth) { trace.Write (writer, depth + 2, IndentationString); } public override void WriteFullStatistics (TextWriter writer, MonitorAggregatedDataHandler owner, ProfilerEventHandler processor, int depth) { WriteIndividualStatistics (writer, owner, processor, depth); } public MonitorStatisticsByCallStack (C owner, StackTrace trace) : base (owner) { this.trace = trace; } } } mono-tools-4.2/Mono.Profiler/profiler-decoder-library/Reader.cs0000664000175000017500000001707012413742070026625 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.IO; using System.Collections.Generic; namespace Mono.Profiler { public interface ILogFileReader { BlockData ReadBlock (); bool HasEnded {get;} } public interface IDataBlockRecycler { void RecycleData (byte [] data); byte [] NewData (int size); } public class SyncLogFileReader : ILogFileReader, IDataBlockRecycler { System.IO.FileStream stream; bool hasEnded = false; public bool HasEnded { get { return hasEnded; } } ulong counter = 0; byte[] cachedData; public virtual void RecycleData (byte [] data) { if (cachedData == null || cachedData.Length < data.Length) { cachedData = data; } } public virtual byte[] NewData (int size) { if (cachedData != null && cachedData.Length > size) { byte[] result = cachedData; cachedData = null; return result; } else { return new byte[size]; } } uint fileOffset = 0; public SyncLogFileReader (System.IO.FileStream stream) { this.stream = stream; } public SyncLogFileReader (string fileName) { this.stream = new System.IO.FileStream (fileName, System.IO.FileMode.Open); } public void Close () { stream.Close (); } public BlockData ReadBlock () { if (! hasEnded) { byte [] header; byte [] block; BlockCode code; int length; int bytesRead; BlockData result = null; header = new byte [BlockData.BLOCK_HEADER_SIZE]; bytesRead = stream.Read (header, 0, BlockData.BLOCK_HEADER_SIZE); if (bytesRead == 0) { return null; } else if (bytesRead < BlockData.BLOCK_HEADER_SIZE) { throw new DecodingException (result, 0, String.Format ("Invalid header: length is {0} instead of {1}", bytesRead, BlockData.BLOCK_HEADER_SIZE)); } fileOffset += (uint) BlockData.BLOCK_HEADER_SIZE; code = BlockData.DecodeHeaderBlockCode (header); length = BlockData.DecodeHeaderBlockLength (header); if (code == BlockCode.END) { hasEnded = true; } counter += BlockData.DecodeHeaderBlockCounterDelta (header); block = NewData (length); stream.Read (block, 0, length); result = new BlockData (fileOffset, code, length, counter, block); fileOffset += (uint) length; return result; } else { return null; } } } public class SeekableLogFileReader : IDataBlockRecycler { public class Block { uint fileOffset; public uint FileOffset { get { return fileOffset; } } BlockCode code; public BlockCode Code { get { return code; } } uint length; public uint Length { get { return length; } } ulong counter; public ulong Counter { get { return counter; } } TimeSpan timeFromStart; public TimeSpan TimeFromStart { get { return timeFromStart; } internal set { timeFromStart = value; } } public Block (uint fileOffset, BlockCode code, uint length, ulong counter) { this.fileOffset = fileOffset; this.code = code; this.length = length; this.counter = counter; } } ulong startCounter; public ulong StartCounter { get { return startCounter; } } DateTime startTime; public DateTime StartTime { get { return startTime; } } ulong endCounter; public ulong EndCounter { get { return endCounter; } } DateTime endTime; public DateTime EndTime { get { return endTime; } } byte[] cachedData; public virtual void RecycleData (byte [] data) { if (cachedData == null || cachedData.Length < data.Length) { cachedData = data; } } public virtual byte[] NewData (int size) { if (cachedData != null && cachedData.Length > size) { byte[] result = cachedData; cachedData = null; return result; } else { return new byte[size]; } } System.IO.FileStream stream; Block[] blocks; public Block[] Blocks { get { return blocks; } } void InitializeBlocks () { uint fileOffset = 0; bool hasEnded = false; List result = new List (); ulong counter = 0; byte [] header = new byte [BlockData.BLOCK_HEADER_SIZE]; ProfilerEventHandler eventProcessor = new ProfilerEventHandler (); while (! hasEnded) { int bytesRead = stream.Read (header, 0, BlockData.BLOCK_HEADER_SIZE); if (bytesRead != BlockData.BLOCK_HEADER_SIZE) { if (bytesRead == 0) { Console.WriteLine ("WARNING: File truncated at offset {0} without end block", fileOffset); break; } else { throw new Exception (String.Format ("At file offset {0} block header is not complete", fileOffset)); } } fileOffset += (uint) BlockData.BLOCK_HEADER_SIZE; counter += BlockData.DecodeHeaderBlockCounterDelta (header); Block block = new Block (fileOffset, BlockData.DecodeHeaderBlockCode (header), (uint) BlockData.DecodeHeaderBlockLength (header), counter); result.Add (block); fileOffset += block.Length; stream.Seek (fileOffset, SeekOrigin.Begin); if (block.Code == BlockCode.INTRO) { ReadBlock (block).Decode (eventProcessor); startCounter = eventProcessor.StartCounter; startTime = eventProcessor.StartTime; } if (block.Code == BlockCode.END) { hasEnded = true; ReadBlock (block).Decode (eventProcessor); endCounter = eventProcessor.EndCounter; endTime = eventProcessor.EndTime; } } blocks = result.ToArray (); foreach (Block block in blocks) { block.TimeFromStart = eventProcessor.ClicksToTimeSpan (block.Counter); } } public BlockData ReadBlock (Block block) { stream.Seek (block.FileOffset, SeekOrigin.Begin); byte[] data = NewData ((int) block.Length); stream.Read (data, 0, (int) block.Length); return new BlockData (block.FileOffset, block.Code, (int) block.Length, block.Counter, data); } public SeekableLogFileReader (System.IO.FileStream stream) { this.stream = stream; InitializeBlocks (); } public SeekableLogFileReader (string fileName) { this.stream = new System.IO.FileStream (fileName, System.IO.FileMode.Open); InitializeBlocks (); } } #if false public class AsyncLogFileReader { System.IO.FileStream stream; System.IAsyncResult nextHeaderOperation; System.IAsyncResult nextBlockOperation; byte [] nextHeader; byte [] nextBlock; bool hadEnded; public void ReadBlock () { if (! hadEnded) { } else { } } } #endif } mono-tools-4.2/Mono.Profiler/profiler-decoder-library/Decoder.cs0000664000175000017500000014301412413742070026766 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.IO; namespace Mono.Profiler { [FlagsAttribute] public enum ProfilerFlags { APPDOMAIN_EVENTS = 1 << 0, ASSEMBLY_EVENTS = 1 << 1, MODULE_EVENTS = 1 << 2, CLASS_EVENTS = 1 << 3, JIT_COMPILATION = 1 << 4, INLINING = 1 << 5, EXCEPTIONS = 1 << 6, ALLOCATIONS = 1 << 7, GC = 1 << 8, THREADS = 1 << 9, REMOTING = 1 << 10, TRANSITIONS = 1 << 11, ENTER_LEAVE = 1 << 12, COVERAGE = 1 << 13, INS_COVERAGE = 1 << 14, STATISTICAL = 1 << 15, METHOD_EVENTS = 1 << 16 } public enum BlockCode { INTRO = 1, END = 2, MAPPING = 3, LOADED = 4, UNLOADED = 5, EVENTS = 6, STATISTICAL = 7, HEAP_DATA = 8, HEAP_SUMMARY = 9, DIRECTIVES = 10 } public class BlockData { static TextWriter debugLog = null; public static TextWriter DebugLog { get { return debugLog; } set { debugLog = value; } } public void LogLine (string format, params object[] args) { if (debugLog != null) { debugLog.WriteLine (format, args); } } static readonly DateTime epoch = new DateTime (1970, 1, 1, 0, 0, 0, 0); static TimeSpan microsecondsToTimeSpan (ulong microseconds) { return TimeSpan.FromTicks ((long) microseconds * 10); } static DateTime microsecondsFromEpochToDateTime (ulong microseconds) { return epoch + microsecondsToTimeSpan (microseconds); } public readonly static int BLOCK_HEADER_SIZE = 10; public static BlockCode DecodeHeaderBlockCode (byte[] header) { if (header.Length == BLOCK_HEADER_SIZE) { return (BlockCode) (header [0] | (header [1] << 8)); } else { throw new Exception (String.Format ("Wrong header length (0)", header.Length)); } } public static int DecodeHeaderBlockLength (byte[] header) { if (header.Length == BLOCK_HEADER_SIZE) { return header [2] | (header [3] << 8) | (header [4] << 16) | (header [5] << 24); } else { throw new Exception (String.Format ("Wrong header length (0)", header.Length)); } } public static uint DecodeHeaderBlockCounterDelta (byte[] header) { if (header.Length == BLOCK_HEADER_SIZE) { return (uint) (header [6] | (header [7] << 8) | (header [8] << 16) | (header [9] << 24)); } else { throw new Exception (String.Format ("Wrong header length (0)", header.Length)); } } uint fileOffset; public uint FileOffset { get { return fileOffset; } } BlockCode code; public BlockCode Code { get { return code; } } int length; public int Length { get { return length; } } ulong headerStartCounter; public ulong HeaderStartCounter { get { return headerStartCounter; } } byte[] data; public byte Data (uint index) { return data [index]; } public byte this [uint index] { get { return data [index]; } } const byte SEVEN_BITS_MASK = 0x7f; const byte EIGHT_BIT_MASK = 0x80; byte ReadByte (ref uint offsetInBlock) { byte result = data [offsetInBlock]; offsetInBlock ++; return result; } uint ReadUint (ref uint offsetInBlock) { int factor = 0; uint r = 0; byte v; do { v = data [offsetInBlock]; r |= (((uint)(v & SEVEN_BITS_MASK)) << factor); offsetInBlock ++; factor += 7; } while ((v & EIGHT_BIT_MASK) == 0); return r; } ulong ReadUlong (ref uint offsetInBlock) { int factor = 0; ulong r = 0; byte v; do { v = data [offsetInBlock]; r |= (((ulong)(v & SEVEN_BITS_MASK)) << factor); offsetInBlock ++; factor += 7; } while ((v & EIGHT_BIT_MASK) == 0); return r; } string ReadString (ref uint offsetInBlock) { int count = 0; while (data [offsetInBlock + count] != 0) { //LogLine ("Read string: data [offsetInBlock + count] is {0}", (char) data [offsetInBlock + count]); count++; } //LogLine ("Read string: count is finally {0}", count); //result = System.Text.Encoding.UTF8.GetString (data, (int) offsetInBlock, count); //result = System.Text.Encoding.ASCII.GetString (data, (int) offsetInBlock, count); System.Text.StringBuilder builder = new System.Text.StringBuilder (); for (int i = 0; i < count; i++) { //LogLine ("Read string: putting data [offsetInBlock + i] ({0}, i = {1}) in builder [i]", (char) data [offsetInBlock + i], i); //builder [i] = (char) data [offsetInBlock + i]; builder.Append ((char) data [offsetInBlock + i]); } offsetInBlock += (uint) (count + 1); return builder.ToString (); } enum LoadedItemInfo { MODULE = 1, ASSEMBLY = 2, APPDOMAIN = 4, SUCCESS = 8, FAILURE = 16 } const int PACKED_EVENT_CODE_BITS = 3; const byte PACKED_EVENT_CODE_MASK = ((1 << PACKED_EVENT_CODE_BITS)-1); const int PACKED_EVENT_DATA_BITS = (8 - PACKED_EVENT_CODE_BITS); const byte PACKED_EVENT_DATA_MASK = ((1 << PACKED_EVENT_DATA_BITS)-1); enum PackedEventCode { METHOD_ENTER = 1, METHOD_EXIT_IMPLICIT = 2, METHOD_EXIT_EXPLICIT = 3, CLASS_ALLOCATION = 4, METHOD_EVENT = 5, CLASS_EVENT = 6, OTHER_EVENT = 7 } enum MethodEvent { JIT = 0, FREED = 1, MASK = 1 } MethodEvent MethodEventFromEventCode (int eventCode) { return (MethodEvent) (eventCode & (byte) MethodEvent.MASK); } enum ClassEvent { LOAD = 0, UNLOAD = 1, EXCEPTION = 2, LOCK = 3, MASK = 3 } ClassEvent ClassEventFromEventCode (int eventCode) { return (ClassEvent) (eventCode & (byte) ClassEvent.MASK); } enum EventResult { SUCCESS = 0, FAILURE = 4 } const int EVENT_RESULT_MASK = (int) EventResult.FAILURE; enum GenericEvent { THREAD = 1, GC_COLLECTION = 2, GC_MARK = 3, GC_SWEEP = 4, GC_RESIZE = 5, GC_STOP_WORLD = 6, GC_START_WORLD = 7, JIT_TIME_ALLOCATION = 8, STACK_SECTION = 9, MASK = 15 } GenericEvent GenericEventFromEventCode (int eventCode) { return (GenericEvent) (eventCode & (byte) GenericEvent.MASK); } enum EventKind { START = 0, END = 1 } EventKind EventKindFromEventCode (int eventCode) { return ((eventCode & (1<<4)) != 0) ? EventKind.END : EventKind.START; } bool EventSuccessFromEventCode (int eventCode) { return ((eventCode & EVENT_RESULT_MASK) == (int) EventResult.FAILURE) ? false : true; } enum StatisticalCode { END = 0, METHOD = 1, UNMANAGED_FUNCTION_ID = 2, UNMANAGED_FUNCTION_NEW_ID = 3, UNMANAGED_FUNCTION_OFFSET_IN_REGION = 4, CALL_CHAIN = 5, REGIONS = 7 } enum HeapSnapshotCode { NONE = 0, OBJECT = 1, FREE_OBJECT_CLASS = 2, MASK = 3 } static void DecodeGarbageCollectionEventValue (uint eventValue, out uint collection, out uint generation) { collection = eventValue >> 8; generation = eventValue & 0xff; } public void Decode (IProfilerEventHandler handler, IDataBlockRecycler blockRecycler) where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where EH : ILoadedElementHandler where HO: IHeapObject where HS: IHeapSnapshot { try { Decode (handler); } finally { blockRecycler.RecycleData (data); data = null; } } public void Decode (IProfilerEventHandler handler) where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where EH : ILoadedElementHandler where HO: IHeapObject where HS: IHeapSnapshot { uint offsetInBlock = 0; StackSectionElement[] stackSection = new StackSectionElement [32]; if (data == null) { throw new DecodingException (this, 0, "Decoding used block"); } handler.InitializeData (data, 0); try { //LogLine (" *** DECODING at offset {0} (code {1})", fileOffset, code); switch (code) { case BlockCode.INTRO : { uint version; string runtimeFile; uint flags; ulong startCounter; ulong startTime; version = ReadUint (ref offsetInBlock); runtimeFile = ReadString (ref offsetInBlock); flags = ReadUint (ref offsetInBlock); startCounter = ReadUlong (ref offsetInBlock); startTime = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK INTRO: version {0}, runtimeFile {1}, flags {2}, startCounter {3}, startTime {4}", version, runtimeFile, (ProfilerFlags) flags, startCounter, startTime); handler.Start (version, runtimeFile, (ProfilerFlags) flags, startCounter, microsecondsFromEpochToDateTime (startTime)); handler.DataProcessed (offsetInBlock); break; } case BlockCode.END : { uint version; ulong endCounter; ulong endTime; version = ReadUint (ref offsetInBlock); endCounter = ReadUlong (ref offsetInBlock); endTime = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK END: version {0}, endCounter {1}, endTime {2}", version, endCounter, endTime); handler.End (version, endCounter, microsecondsFromEpochToDateTime (endTime)); handler.DataProcessed (offsetInBlock); break; } case BlockCode.LOADED : { byte kind = ReadByte (ref offsetInBlock); ulong startCounter = ReadUlong (ref offsetInBlock); ulong endCounter = ReadUlong (ref offsetInBlock); ulong threadId = ReadUlong (ref offsetInBlock); uint id; if (handler.Directives.LoadedElementsCarryId) { id = ReadUint (ref offsetInBlock); } else { id = 0; } string itemName = ReadString (ref offsetInBlock); bool success = ((kind & (byte)LoadedItemInfo.SUCCESS) != 0); kind &= (byte) (LoadedItemInfo.APPDOMAIN|LoadedItemInfo.ASSEMBLY|LoadedItemInfo.MODULE); //LogLine ("BLOCK LOADED: kind {0}, startCounter {1}, endCounter {2}, threadId {3}, itemName {4}", (LoadedItemInfo) kind, startCounter, endCounter, threadId, itemName); switch ((LoadedItemInfo) kind) { case LoadedItemInfo.APPDOMAIN: { handler.ApplicationDomainLoaded (threadId, id, startCounter, endCounter, itemName, success); handler.DataProcessed (offsetInBlock); break; } case LoadedItemInfo.ASSEMBLY: { string baseName; uint major; uint minor; uint build; uint revision; string culture; string publicKeyToken; bool retargetable; if (handler.Directives.ClassesCarryAssemblyId) { baseName = ReadString (ref offsetInBlock); major = ReadUint (ref offsetInBlock); minor = ReadUint (ref offsetInBlock); build = ReadUint (ref offsetInBlock); revision = ReadUint (ref offsetInBlock); culture = ReadString (ref offsetInBlock); publicKeyToken = ReadString (ref offsetInBlock); retargetable = (ReadUint (ref offsetInBlock) != 0); } else { int commaPosition = itemName.IndexOf (','); if (commaPosition > 0) { baseName = itemName.Substring (0, commaPosition); } else { baseName = "UNKNOWN"; } major = 0; minor = 0; build = 0; revision = 0; culture = "neutral"; publicKeyToken = "null"; retargetable = false; } handler.LoadedElements.NewAssembly (id, itemName, baseName, major, minor, build, revision, culture, publicKeyToken, retargetable); handler.AssemblyLoaded (threadId, id, startCounter, endCounter, itemName, success); handler.DataProcessed (offsetInBlock); break; } case LoadedItemInfo.MODULE: { handler.ModuleLoaded (threadId, id, startCounter, endCounter, itemName, success); handler.DataProcessed (offsetInBlock); break; } default: { throw new DecodingException (this, offsetInBlock, String.Format ("unknown load event kind {0}", kind)); } } break; } case BlockCode.UNLOADED : { byte kind = ReadByte (ref offsetInBlock); ulong startCounter = ReadUlong (ref offsetInBlock); ulong endCounter = ReadUlong (ref offsetInBlock); ulong threadId = ReadUlong (ref offsetInBlock); uint id; if (handler.Directives.LoadedElementsCarryId) { id = ReadUint (ref offsetInBlock); } else { id = 0; } string itemName = ReadString (ref offsetInBlock); //LogLine ("BLOCK UNLOADED: kind {0}, startCounter {1}, endCounter {2}, threadId {3}, itemName {4}", (LoadedItemInfo) kind, startCounter, endCounter, threadId, itemName); switch ((LoadedItemInfo) kind) { case LoadedItemInfo.APPDOMAIN: { handler.ApplicationDomainUnloaded (threadId, id, startCounter, endCounter, itemName); handler.DataProcessed (offsetInBlock); break; } case LoadedItemInfo.ASSEMBLY: { handler.AssemblyUnloaded (threadId, id, startCounter, endCounter, itemName); handler.DataProcessed (offsetInBlock); break; } case LoadedItemInfo.MODULE: { handler.ModuleUnloaded (threadId, id, startCounter, endCounter, itemName); handler.DataProcessed (offsetInBlock); break; } default: { throw new DecodingException (this, offsetInBlock, String.Format ("unknown unload event kind {0}", kind)); } } break; } case BlockCode.MAPPING : { ulong startCounter = ReadUlong (ref offsetInBlock); ulong startTime = ReadUlong (ref offsetInBlock); ulong threadId = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK MAPPING (START): startCounter {0}, startTime {1}, threadId {2}", startCounter, startTime, threadId); handler.StartBlock (startCounter, microsecondsFromEpochToDateTime (startTime), threadId); handler.SetCurrentThread (threadId); handler.DataProcessed (offsetInBlock); uint itemId; for (itemId = ReadUint (ref offsetInBlock); itemId != 0; itemId = ReadUint (ref offsetInBlock)) { uint assemblyId; if (handler.Directives.ClassesCarryAssemblyId) { assemblyId = ReadUint (ref offsetInBlock); } else { assemblyId = 0; } string itemName = ReadString (ref offsetInBlock); //LogLine ("BLOCK MAPPING (CLASS): itemId {0}, assemblyId = {1}, itemName {2}, size {3}", itemId, assemblyId, itemName, 0); handler.LoadedElements.NewClass (itemId, handler.LoadedElements.GetAssembly (assemblyId), itemName, 0); } for (itemId = ReadUint (ref offsetInBlock); itemId != 0; itemId = ReadUint (ref offsetInBlock)) { uint classId = ReadUint (ref offsetInBlock); uint wrapperValue; if (handler.Directives.MethodsCarryWrapperFlag) { wrapperValue = ReadUint (ref offsetInBlock); } else { wrapperValue = 0; } bool isWrapper = (wrapperValue != 0) ? true : false; string itemName = ReadString (ref offsetInBlock); //LogLine ("BLOCK MAPPING (METHOD): itemId {0}, classId {1}, itemName {2}, size {3}", itemId, classId, itemName, 0); handler.LoadedElements.NewMethod (itemId, handler.LoadedElements.GetClass (classId), isWrapper, itemName); } ulong endCounter = ReadUlong (ref offsetInBlock); ulong endTime = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK MAPPING (END): endCounter {0}, endTime {1}", endCounter, endTime); handler.EndBlock (endCounter, microsecondsFromEpochToDateTime (endTime), threadId); handler.DataProcessed (offsetInBlock); break; } case BlockCode.EVENTS : { ulong startCounter = ReadUlong (ref offsetInBlock); ulong startTime = ReadUlong (ref offsetInBlock); ulong threadId = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK EVENTS (START): startCounter {0}, startTime {1}, threadId {2}", startCounter, startTime, threadId); handler.StartBlock (startCounter, microsecondsFromEpochToDateTime (startTime), threadId); handler.SetCurrentThread (threadId); handler.DataProcessed (offsetInBlock); ulong baseCounter = ReadUlong (ref offsetInBlock); byte eventCode; for (eventCode = ReadByte (ref offsetInBlock); eventCode != 0; eventCode = ReadByte (ref offsetInBlock)) { PackedEventCode packedCode = (PackedEventCode) (eventCode & PACKED_EVENT_CODE_MASK); int packedData = ((eventCode >> PACKED_EVENT_CODE_BITS) & PACKED_EVENT_DATA_MASK); switch (packedCode) { case PackedEventCode.CLASS_ALLOCATION: { handler.AllocationDataProcessed (); uint classId = ReadUint (ref offsetInBlock); uint classSize = ReadUint (ref offsetInBlock); classId <<= PACKED_EVENT_DATA_BITS; classId |= (uint) packedData; uint callerId = 0; if (handler.Directives.AllocationsCarryCallerMethod) { callerId = ReadUint (ref offsetInBlock); } ulong objectId = 0; if (handler.Directives.AllocationsCarryId) { objectId = ReadUlong (ref offsetInBlock); } //LogLine ("BLOCK EVENTS (PACKED:CLASS_ALLOCATION): classId {0}, classSize {1}, callerId {2}", classId, classSize, callerId); handler.Allocation (handler.LoadedElements.GetClass (classId), classSize, (callerId != 0) ? handler.LoadedElements.GetMethod (callerId) : default (LM), false, objectId, 0); handler.DataProcessed (offsetInBlock); break; } case PackedEventCode.CLASS_EVENT: { ClassEvent classEventCode = ClassEventFromEventCode (packedData); switch (classEventCode) { case ClassEvent.EXCEPTION: { uint classId = ReadUint (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; //LogLine ("BLOCK EVENTS (CLASS:EXCEPTION): classId {0}, counterDelta {1}", classId, counterDelta); handler.Exception (handler.LoadedElements.GetClass (classId), baseCounter); handler.DataProcessed (offsetInBlock); break; } case ClassEvent.LOAD: { uint classId = ReadUint (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (CLASS:LOAD): classId {0}, classSize {1}, kind {2}", classId, counterDelta, kind); if (kind == EventKind.START) { handler.ClassStartLoad (handler.LoadedElements.GetClass (classId), baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.ClassEndLoad (handler.LoadedElements.GetClass (classId), baseCounter, EventSuccessFromEventCode (packedData)); handler.DataProcessed (offsetInBlock); } break; } case ClassEvent.UNLOAD: { uint classId = ReadUint (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (CLASS:UNLOAD): classId {0}, counterDelta {1}, kind {2}", classId, counterDelta, kind); if (kind == EventKind.START) { handler.ClassStartUnload (handler.LoadedElements.GetClass (classId), baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.ClassEndUnload (handler.LoadedElements.GetClass (classId), baseCounter); handler.DataProcessed (offsetInBlock); } break; } case ClassEvent.LOCK: { handler.LockContentionDataProcessed (); uint classId = ReadUint (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; uint lockEvent = ReadUint (ref offsetInBlock); ulong objectId = ReadUlong (ref offsetInBlock); handler.MonitorEvent ((MonitorEvent) lockEvent, handler.LoadedElements.GetClass (classId), objectId, baseCounter); break; } default: { throw new DecodingException (this, offsetInBlock, String.Format ("unknown class event {0}", classEventCode)); } } break; } case PackedEventCode.METHOD_ENTER: { handler.CallDataProcessed (); uint methodId = ReadUint (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; methodId <<= PACKED_EVENT_DATA_BITS; methodId |= (uint) packedData; //LogLine ("BLOCK EVENTS (PACKED:METHOD_ENTER): methodId {0}, counterDelta {1}", methodId, counterDelta); handler.MethodEnter (handler.LoadedElements.GetMethod (methodId), baseCounter); handler.DataProcessed (offsetInBlock); break; } case PackedEventCode.METHOD_EXIT_EXPLICIT: { handler.CallDataProcessed (); uint methodId = ReadUint (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; methodId <<= PACKED_EVENT_DATA_BITS; methodId |= (uint) packedData; //LogLine ("BLOCK EVENTS (PACKED:METHOD_EXIT_EXPLICIT): methodId {0}, counterDelta {1}", methodId, counterDelta); handler.MethodExit (handler.LoadedElements.GetMethod (methodId), baseCounter); handler.DataProcessed (offsetInBlock); break; } case PackedEventCode.METHOD_EXIT_IMPLICIT: { handler.CallDataProcessed (); //LogLine ("BLOCK EVENTS (PACKED:METHOD_EXIT_IMPLICIT): counterDelta {0}", 0); throw new DecodingException (this, offsetInBlock, "PackedEventCode.METHOD_EXIT_IMPLICIT unsupported"); } case PackedEventCode.METHOD_EVENT: { MethodEvent methodEventCode = MethodEventFromEventCode (packedData); switch (methodEventCode) { case MethodEvent.FREED: { uint methodId = ReadUint (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; //LogLine ("BLOCK EVENTS (METHOD:FREED): methodId {0}, counterDelta {1}", methodId, counterDelta); handler.MethodFreed (handler.LoadedElements.GetMethod (methodId), baseCounter); handler.DataProcessed (offsetInBlock); break; } case MethodEvent.JIT: { handler.JitTimeDataProcessed (); uint methodId = ReadUint (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (METHOD:JIT): methodId {0}, counterDelta {1}, kind {2}", methodId, counterDelta, kind); if (kind == EventKind.START) { handler.MethodJitStart (handler.LoadedElements.GetMethod (methodId), baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.MethodJitEnd (handler.LoadedElements.GetMethod (methodId), baseCounter, EventSuccessFromEventCode (packedData)); handler.DataProcessed (offsetInBlock); } break; } default: { throw new DecodingException (this, offsetInBlock, String.Format ("unknown method event {0}", methodEventCode)); } } break; } case PackedEventCode.OTHER_EVENT: { GenericEvent genericEventCode = GenericEventFromEventCode (packedData); switch (genericEventCode) { case GenericEvent.GC_COLLECTION: { handler.GcTimeDataProcessed (); uint collection; uint generation; DecodeGarbageCollectionEventValue (ReadUint (ref offsetInBlock), out collection, out generation); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (OTHER:GC_COLLECTION): generation {0}, counterDelta {1}, kind {2}", generation, counterDelta, kind); if (kind == EventKind.START) { handler.GarbageCollectionStart (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.GarbageCollectionEnd (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } break; } case GenericEvent.GC_MARK: { handler.GcTimeDataProcessed (); uint collection; uint generation; DecodeGarbageCollectionEventValue (ReadUint (ref offsetInBlock), out collection, out generation); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (OTHER:GC_MARK): generation {0}, counterDelta {1}, kind {2}", generation, counterDelta, kind); if (kind == EventKind.START) { handler.GarbageCollectionMarkStart (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.GarbageCollectionMarkEnd (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } break; } case GenericEvent.GC_SWEEP: { handler.GcTimeDataProcessed (); uint collection; uint generation; DecodeGarbageCollectionEventValue (ReadUint (ref offsetInBlock), out collection, out generation); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (OTHER:GC_SWEEP): generation {0}, counterDelta {1}, kind {2}", generation, counterDelta, kind); if (kind == EventKind.START) { handler.GarbageCollectionSweepStart (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.GarbageCollectionSweepEnd (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } break; } case GenericEvent.GC_RESIZE: { handler.GcTimeDataProcessed (); ulong newSize = ReadUlong (ref offsetInBlock); uint collection = ReadUint (ref offsetInBlock); //LogLine ("BLOCK EVENTS (OTHER:GC_RESIZE): newSize {0}, collection {1}", newSize, collection); handler.GarbageCollectionResize (collection, newSize); handler.DataProcessed (offsetInBlock); break; } case GenericEvent.GC_STOP_WORLD: { handler.GcTimeDataProcessed (); uint collection; uint generation; DecodeGarbageCollectionEventValue (ReadUint (ref offsetInBlock), out collection, out generation); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (OTHER:GC_STOP_WORLD): generation {0}, counterDelta {1}, kind {2}", generation, counterDelta, kind); if (kind == EventKind.START) { handler.GarbageCollectionStopWorldStart (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.GarbageCollectionStopWorldEnd (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } break; } case GenericEvent.GC_START_WORLD: { handler.GcTimeDataProcessed (); uint collection; uint generation; DecodeGarbageCollectionEventValue (ReadUint (ref offsetInBlock), out collection, out generation); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (OTHER:GC_START_WORLD): generation {0}, counterDelta {1}, kind {2}", generation, counterDelta, kind); if (kind == EventKind.START) { handler.GarbageCollectionStartWorldStart (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.GarbageCollectionStartWorldEnd (collection, generation, baseCounter); handler.DataProcessed (offsetInBlock); } break; } case GenericEvent.THREAD: { ulong eventThreadId = ReadUlong (ref offsetInBlock); ulong counterDelta = ReadUlong (ref offsetInBlock); baseCounter += counterDelta; EventKind kind = EventKindFromEventCode (packedData); //LogLine ("BLOCK EVENTS (OTHER:THREAD): eventThreadId {0}, counterDelta {1}, kind {2}", eventThreadId, counterDelta, kind); if (kind == EventKind.START) { handler.ThreadStart (eventThreadId, baseCounter); handler.DataProcessed (offsetInBlock); } else { handler.ThreadEnd (eventThreadId, baseCounter); handler.DataProcessed (offsetInBlock); } break; } case GenericEvent.JIT_TIME_ALLOCATION: { handler.AllocationDataProcessed (); uint classId = ReadUint (ref offsetInBlock); uint classSize = ReadUint (ref offsetInBlock); uint callerId = 0; if (handler.Directives.AllocationsCarryCallerMethod) { callerId = ReadUint (ref offsetInBlock); } ulong objectId = 0; if (handler.Directives.AllocationsCarryId) { objectId = ReadUlong (ref offsetInBlock); } //LogLine ("BLOCK EVENTS (OTHER:JIT_TIME_ALLOCATION): classId {0}, classSize {1}, callerId {2}", classId, classSize, callerId); handler.Allocation (handler.LoadedElements.GetClass (classId), classSize, (callerId != 0) ? handler.LoadedElements.GetMethod (callerId) : default (LM), true, objectId, 0); handler.DataProcessed (offsetInBlock); break; } case GenericEvent.STACK_SECTION: { uint lastValidFrame = ReadUint (ref offsetInBlock); uint topSectionSize = ReadUint (ref offsetInBlock); if (stackSection.Length < topSectionSize) { stackSection = new StackSectionElement [topSectionSize * 2]; } for (int i = 0; i < topSectionSize; i++) { uint methodId = ReadUint (ref offsetInBlock); stackSection [i].IsBeingJitted = ((methodId & 1) != 0) ? true : false; methodId >>= 1; stackSection [i].Method = handler.LoadedElements.GetMethod (methodId); } handler.AdjustStack (lastValidFrame, topSectionSize, stackSection); handler.DataProcessed (offsetInBlock); break; } default: { throw new DecodingException (this, offsetInBlock, String.Format ("unknown generic event {0}", genericEventCode)); } } break; } default: { throw new DecodingException (this, offsetInBlock, String.Format ("unknown packed event code {0}", packedCode)); } } } ulong endCounter = ReadUlong (ref offsetInBlock); ulong endTime = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK EVENTS (END): endCounter {0}, endTime {1}", endCounter, endTime); handler.EndBlock (endCounter, microsecondsFromEpochToDateTime (endTime), threadId); handler.DataProcessed (offsetInBlock); break; } case BlockCode.STATISTICAL : { handler.StatisticalDataProcessed (); ulong startCounter = ReadUlong (ref offsetInBlock); ulong startTime = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK STATISTICAL (START): startCounter {0}, startTime {1}", startCounter, startTime); handler.StartBlock (startCounter, microsecondsFromEpochToDateTime (startTime), 0); handler.DataProcessed (offsetInBlock); uint id; for (id = ReadUint (ref offsetInBlock); id != (uint) StatisticalCode.END; id = ReadUint (ref offsetInBlock)) { StatisticalCode statisticalCode = (StatisticalCode) (id & 7); switch (statisticalCode) { case StatisticalCode.METHOD: { uint methodId = id >> 3; //LogLine ("BLOCK STATISTICAL (METHOD): methodId {0}", methodId); if (methodId != 0) { handler.MethodStatisticalHit (handler.LoadedElements.GetMethod (methodId)); handler.DataProcessed (offsetInBlock); } else { handler.UnknownMethodStatisticalHit (); handler.DataProcessed (offsetInBlock); } break; } case StatisticalCode.UNMANAGED_FUNCTION_ID: { uint functionId = id >> 3; UFI function = handler.LoadedElements.GetUnmanagedFunctionByID (functionId); handler.UnmanagedFunctionStatisticalHit (function); handler.DataProcessed (offsetInBlock); break; } case StatisticalCode.UNMANAGED_FUNCTION_NEW_ID: { uint regionId = id >> 3; uint functionId = ReadUint (ref offsetInBlock); string name = ReadString (ref offsetInBlock); MR region = handler.LoadedElements.GetExecutableMemoryRegion (regionId); UFI function = handler.LoadedElements.NewUnmanagedFunction (functionId, name, region); handler.UnmanagedFunctionStatisticalHit (function); handler.DataProcessed (offsetInBlock); break; } case StatisticalCode.UNMANAGED_FUNCTION_OFFSET_IN_REGION: { uint regionId = id >> 3; if (regionId != 0) { MR region = handler.LoadedElements.GetExecutableMemoryRegion (regionId); uint offset = ReadUint (ref offsetInBlock); UFR function = region.GetFunction (offset); if (function != null) { //LogLine ("BLOCK STATISTICAL (FUNCTION): regionId {0}, offset {1}", regionId, offset); handler.UnmanagedFunctionStatisticalHit (function); handler.DataProcessed (offsetInBlock); } else { //LogLine ("BLOCK STATISTICAL (FUNCTION): regionId {0}, unknown offset {1}", regionId, offset); handler.UnknownUnmanagedFunctionStatisticalHit (region, offset); handler.DataProcessed (offsetInBlock); } } else { ulong address = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK STATISTICAL (FUNCTION): unknown address {0}", address); handler.UnknownUnmanagedFunctionStatisticalHit (address); handler.DataProcessed (offsetInBlock); } break; } case StatisticalCode.CALL_CHAIN: { uint chainDepth = id >> 3; //LogLine ("BLOCK STATISTICAL (CHAIN): starting chain of depth {0}", chainDepth); handler.StatisticalCallChainStart (chainDepth); handler.DataProcessed (offsetInBlock); break; } case StatisticalCode.REGIONS: { uint regionId; for (regionId = ReadUint (ref offsetInBlock); regionId != 0; regionId = ReadUint (ref offsetInBlock)) { //LogLine ("BLOCK STATISTICAL (REGION): invalidated regionId {0}", regionId); handler.LoadedElements.InvalidateExecutableMemoryRegion (regionId); } for (regionId = ReadUint (ref offsetInBlock); regionId != 0; regionId = ReadUint (ref offsetInBlock)) { ulong start = ReadUlong (ref offsetInBlock); uint size = ReadUint (ref offsetInBlock); uint regionFileOffset = ReadUint (ref offsetInBlock); string fileName = ReadString (ref offsetInBlock); //LogLine ("BLOCK STATISTICAL (REGION): added regionId {0} (fileName {1}, fileOffset {2}, start {3}, end {4}, size {5})", regionId, fileName, regionFileOffset, start, start + size, size); handler.LoadedElements.NewExecutableMemoryRegion (regionId, fileName, regionFileOffset, start, start + size); //MR region = handler.LoadedElements.NewExecutableMemoryRegion (regionId, fileName, fileOffset, start, start + size); //UF[] functions = region.Functions; //LogLine ("BLOCK STATISTICAL (REGION): in regionId {0}, got {1} functions", regionId, functions.Length); //foreach (UF function in functions) { //LogLine ("BLOCK STATISTICAL (REGION): in regionId {0}, got function [{1}-{2}] {3}", regionId, function.StartOffset, function.EndOffset, function.Name); //} } handler.LoadedElements.SortExecutableMemoryRegions (); handler.DataProcessed (offsetInBlock); break; } } } ulong endCounter = ReadUlong (ref offsetInBlock); ulong endTime = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK STATISTICAL (END): endCounter {0}, endTime {1}", endCounter, endTime); handler.EndBlock (endCounter, microsecondsFromEpochToDateTime (endTime), 0); break; } case BlockCode.HEAP_DATA : { handler.HeapSnapshotDataProcessed (); ulong jobStartCounter = ReadUlong (ref offsetInBlock); ulong jobStartTime = ReadUlong (ref offsetInBlock); ulong jobEndCounter = ReadUlong (ref offsetInBlock); ulong jobEndTime = ReadUlong (ref offsetInBlock); uint collection = ReadUint (ref offsetInBlock); HS snapshot = handler.LoadedElements.NewHeapSnapshot (collection, jobStartCounter, microsecondsFromEpochToDateTime (jobStartTime), jobEndCounter, microsecondsFromEpochToDateTime (jobEndTime), handler.ClicksToTimeSpan (headerStartCounter), handler.LoadedElements.Classes, handler.LoadedElements.RecordHeapSnapshots); handler.HeapReportStart (snapshot); handler.DataProcessed (offsetInBlock); ulong startCounter = ReadUlong (ref offsetInBlock); ulong startTime = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK HEAP_DATA (START): ({0}:{1}-{2}:{3}) startCounter {4}, startTime {5}", jobStartCounter, jobStartTime, jobEndCounter, jobEndTime, startCounter, startTime); handler.StartBlock (startCounter, microsecondsFromEpochToDateTime (startTime), 0); handler.DataProcessed (offsetInBlock); ulong item; ulong[] references = new ulong [50]; for (item = ReadUlong (ref offsetInBlock); item != 0; item = ReadUlong (ref offsetInBlock)) { HeapSnapshotCode itemCode = (HeapSnapshotCode) (((int) item) & ((int) HeapSnapshotCode.MASK)); //LogLine ("Got raw value {0} (code {1})", item, itemCode); switch (itemCode) { case HeapSnapshotCode.FREE_OBJECT_CLASS: { uint classId = (uint) (item >> 2); uint size = ReadUint (ref offsetInBlock); LC c = handler.LoadedElements.GetClass (classId); //LogLine (" Class id {0}, size {1}", classId, size); handler.HeapObjectUnreachable (c, size); handler.DataProcessed (offsetInBlock); break; } case HeapSnapshotCode.OBJECT: { uint classId = ReadUint (ref offsetInBlock); uint size = ReadUint (ref offsetInBlock); int referencesCount = (int) ReadUint (ref offsetInBlock); ulong objectId = item & (~ ((ulong) HeapSnapshotCode.MASK)); //LogLine (" Object id {0}, references {1}", objectId, referencesCount); if (references.Length < referencesCount) { references = new ulong [referencesCount + 50]; } for (int i = 0; i < referencesCount; i++) { references [i] = ReadUlong (ref offsetInBlock); //LogLine (" reference[{0}] {1}", i, references [i]); } LC c = handler.LoadedElements.GetClass (classId); HO o = snapshot.NewHeapObject (objectId, c, size, references, referencesCount); handler.HeapObjectReachable (o); handler.DataProcessed (offsetInBlock); break; } default: { throw new DecodingException (this, offsetInBlock, String.Format ("unknown item code {0}", itemCode)); } } } handler.HeapReportEnd (snapshot); handler.DataProcessed (offsetInBlock); ulong endCounter = ReadUlong (ref offsetInBlock); ulong endTime = ReadUlong (ref offsetInBlock); //LogLine ("BLOCK HEAP_DATA (END): endCounter {0}, endTime {1}", endCounter, endTime); handler.EndBlock (endCounter, microsecondsFromEpochToDateTime (endTime), 0); handler.DataProcessed (offsetInBlock); break; } case BlockCode.HEAP_SUMMARY : { handler.HeapSummaryDataProcessed (); ulong startCounter = ReadUlong (ref offsetInBlock); ulong startTime = ReadUlong (ref offsetInBlock); uint collection = ReadUint (ref offsetInBlock); //LogLine ("BLOCK HEAP_SUMMARY (START): ([]{0}:{1}) startCounter {4}, startTime {5}", collection, startCounter, startTime); handler.StartBlock (startCounter, microsecondsFromEpochToDateTime (startTime), 0); handler.AllocationSummaryStart (collection, startCounter, microsecondsFromEpochToDateTime (startTime)); handler.DataProcessed (offsetInBlock); uint id; for (id = ReadUint (ref offsetInBlock); id != 0; id = ReadUint (ref offsetInBlock)) { uint reachableInstances = ReadUint (ref offsetInBlock); uint reachableBytes = ReadUint (ref offsetInBlock); uint unreachableInstances = ReadUint (ref offsetInBlock); uint unreachableBytes = ReadUint (ref offsetInBlock); LC c = handler.LoadedElements.GetClass (id); handler.ClassAllocationSummary (c, reachableInstances, reachableBytes, unreachableInstances, unreachableBytes); handler.DataProcessed (offsetInBlock); } ulong endCounter = ReadUlong (ref offsetInBlock); ulong endTime = ReadUlong (ref offsetInBlock); handler.AllocationSummaryEnd (collection, endCounter, microsecondsFromEpochToDateTime (endTime)); handler.DataProcessed (offsetInBlock); //LogLine ("BLOCK HEAP_SUMMARY (END): endCounter {0}, endTime {1}", endCounter, endTime); handler.EndBlock (endCounter, microsecondsFromEpochToDateTime (endTime), 0); handler.DataProcessed (offsetInBlock); break; } case BlockCode.DIRECTIVES : { ulong startCounter = ReadUlong (ref offsetInBlock); ulong startTime = ReadUlong (ref offsetInBlock); handler.StartBlock (startCounter, microsecondsFromEpochToDateTime (startTime), 0); handler.DataProcessed (offsetInBlock); //LogLine ("BLOCK DIRECTIVES (START): startCounter {0}, startTime {1}", startCounter, startTime); DirectiveCodes directive = (DirectiveCodes) ReadUint (ref offsetInBlock); while (directive != DirectiveCodes.END) { switch (directive) { case DirectiveCodes.ALLOCATIONS_CARRY_CALLER: //LogLine ("BLOCK DIRECTIVES (START): ALLOCATIONS_CARRY_CALLER"); handler.Directives.AllocationsCarryCallerMethodReceived (); break; case DirectiveCodes.ALLOCATIONS_HAVE_STACK: //LogLine ("BLOCK DIRECTIVES (START): ALLOCATIONS_HAVE_STACK"); handler.Directives.AllocationsHaveStackTraceReceived (); break; case DirectiveCodes.ALLOCATIONS_CARRY_ID: //LogLine ("BLOCK DIRECTIVES (START): ALLOCATIONS_CARRY_ID"); handler.Directives.AllocationsCarryIdReceived (); break; case DirectiveCodes.LOADED_ELEMENTS_CARRY_ID: //LogLine ("BLOCK DIRECTIVES (START): LOADED_ELEMENTS_CARRY_ID"); handler.Directives.LoadedElementsCarryIdReceived (); break; case DirectiveCodes.CLASSES_CARRY_ASSEMBLY_ID: //LogLine ("BLOCK DIRECTIVES (START): CLASSES_CARRY_ASSEMBLY_ID"); handler.Directives.ClassesCarryAssemblyIdReceived (); break; case DirectiveCodes.METHODS_CARRY_WRAPPER_FLAG: //LogLine ("BLOCK DIRECTIVES (START): METHODS_CARRY_WRAPPER_FLAG"); handler.Directives.MethodsCarryWrapperFlagReceived (); break; default: throw new DecodingException (this, offsetInBlock, String.Format ("unknown directive {0}", directive)); } directive = (DirectiveCodes) ReadUint (ref offsetInBlock); } ulong endCounter = ReadUlong (ref offsetInBlock); ulong endTime = ReadUlong (ref offsetInBlock); handler.EndBlock (endCounter, microsecondsFromEpochToDateTime (endTime), 0); handler.DataProcessed (offsetInBlock); //LogLine ("BLOCK DIRECTIVES (END): endCounter {0}, endTime {1}", endCounter, endTime); break; } default: { throw new DecodingException (this, offsetInBlock, String.Format ("unknown block code {0}", code)); } } if (length != (int) offsetInBlock) { throw new DecodingException (this, offsetInBlock, String.Format ("Block ended at offset {0} but its declared length is {1}", offsetInBlock, length)); } } catch (DecodingException e) { if (handleExceptions) { HandleDecodingException (e, offsetInBlock, handler); } throw e; } catch (Exception e) { if (handleExceptions) { HandleRegularException (e, offsetInBlock, handler); } throw new DecodingException(this, offsetInBlock, e.Message, e); } } bool handleExceptions = true; void DumpDebugInformation (uint offsetInBlock, IProfilerEventHandler handler) where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where EH : ILoadedElementHandler where HO: IHeapObject where HS: IHeapSnapshot { if (debugLog != null) { debugLog.WriteLine ("Attempting to decode data printing block contents..."); handleExceptions = false; try { DebugProfilerEventHandler debugHandler = new DebugProfilerEventHandler (handler, debugLog); debugLog.WriteLine ("Current block of type {0} (file offset {1}, length {2})", Code, FileOffset, Length); Decode (debugHandler); } catch (Exception e) { debugLog.WriteLine ("While attempting decoding, got exception {0}", e.Message); DumpData (data, debugLog, offsetInBlock - 8, offsetInBlock + 24); } finally { handleExceptions = true; } } } void HandleDecodingException (DecodingException e, uint offsetInBlock, IProfilerEventHandler handler) where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where EH : ILoadedElementHandler where HO: IHeapObject where HS: IHeapSnapshot { if (debugLog != null) { debugLog.WriteLine ("ERROR: DecodingException in block of code {0}, length {1}, file offset {2}, block offset {3}: {4}", e.FailingData.Code, e.FailingData.Length, e.FailingData.FileOffset, e.OffsetInBlock, e.Message); debugLog.WriteLine (e.StackTrace); if (e.InnerException != null) { debugLog.WriteLine ("Original stack trace:"); debugLog.WriteLine (e.InnerException.StackTrace); } DumpDebugInformation (offsetInBlock, handler); } throw e; } void HandleRegularException (Exception e, uint offsetInBlock, IProfilerEventHandler handler) where LC : ILoadedClass where LM : ILoadedMethod where UFR : IUnmanagedFunctionFromRegion where UFI : IUnmanagedFunctionFromID where MR : IExecutableMemoryRegion where EH : ILoadedElementHandler where HO: IHeapObject where HS: IHeapSnapshot { if (debugLog != null) { debugLog.WriteLine ("ERROR: Exception in block of code {0}, length {1}, file offset {2}, block offset {3}: {4}", Code, Length, FileOffset, offsetInBlock, e.Message); debugLog.WriteLine (e.StackTrace); DumpDebugInformation (offsetInBlock, handler); } throw e; } static public void DumpData (byte[] data, TextWriter output, uint startOffset, uint endOffset) { uint currentIndex = 0; while (startOffset < endOffset) { if (currentIndex % 8 == 0) { if ((currentIndex != 0)) { output.WriteLine (); } output.Write (" [{0}-{1}]", startOffset, startOffset + 7); } output.Write (" "); output.Write (data [startOffset]); startOffset ++; currentIndex ++; } output.WriteLine (); } public BlockData (uint fileOffset, BlockCode code, int length, ulong headerStartCounter, byte[] data) { this.fileOffset = fileOffset; this.code = code; this.length = length; this.headerStartCounter = headerStartCounter; this.data = data; } } public class FileOperationException : System.Exception { public FileOperationException (string message) : base (message) { } public FileOperationException (System.Exception e) : base (String.Format ("Exception {0}: {1}", e.GetType().FullName, e.Message)) { } } public class DecodingException : System.Exception { BlockData data; public BlockData FailingData { get { return data; } } uint offsetInBlock; public uint OffsetInBlock { get { return offsetInBlock; } } public DecodingException (BlockData data, uint offsetInBlock, string message) : base (message) { this.data = data; this.offsetInBlock = offsetInBlock; } public DecodingException (BlockData data, uint offsetInBlock, string message, Exception cause) : base (message, cause) { this.data = data; this.offsetInBlock = offsetInBlock; } } } mono-tools-4.2/Mono.Profiler/profiler-decoder-library/Makefile.in0000664000175000017500000003757312642235731027160 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = Mono.Profiler/profiler-decoder-library ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 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)$(programfilesdir)" DATA = $(programfiles_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ BUILDDIR = $(top_builddir)/Mono.Profiler/lib ASSEMBLY = $(BUILDDIR)/mprof-decoder-library.dll @ENABLE_DEBUG_FALSE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ @ENABLE_DEBUG_TRUE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG @ENABLE_DEBUG_FALSE@ASSEMBLY_MDB = @ENABLE_DEBUG_TRUE@ASSEMBLY_MDB = $(ASSEMBLY).mdb programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AssemblyInfo.cs \ BaseTypes.cs \ Decoder.cs \ EventProcessor.cs \ NativeLibraryReader.cs \ ObjectModel.cs \ Reader.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = REFERENCES = System build_references = $(addprefix /r:, $(REFERENCES)) EXTRA_DIST = profiler-decoder-library.csproj $(FILES) $(RESOURCES) 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) --gnu Mono.Profiler/profiler-decoder-library/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Mono.Profiler/profiler-decoder-library/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): 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: ctags CTAGS: cscope cscopelist: 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 $(DATA) installdirs: for dir in "$(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) 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-programfilesDATA 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: uninstall-programfilesDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-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 tags-am uninstall \ uninstall-am uninstall-programfilesDATA .PRECIOUS: Makefile $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) mkdir -p $(BUILDDIR) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:library $(build_sources) $(build_references) # 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-tools-4.2/Mono.Profiler/profiler-decoder-library/AssemblyInfo.cs0000664000175000017500000000205312413742070030011 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-tools-4.2/Mono.Profiler/profiler-decoder-library/NativeLibraryReader.cs0000664000175000017500000001065312413742070031321 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.IO; using System.Globalization; using System.Collections.Generic; using System.Diagnostics; using System.Text.RegularExpressions; namespace Mono.Profiler { public class NativeLibraryReader { static string[] RunExternalProcess (string executableName, string arguments) { Process p = new Process (); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.FileName = executableName; p.StartInfo.Arguments = arguments; p.Start(); // Do not wait for the child process to exit before // reading to the end of its redirected stream. // p.WaitForExit (); // Read the output stream first and then wait. string output = p.StandardOutput.ReadToEnd (); p.WaitForExit (); string[] outputLines = output.Split ('\n'); return outputLines; } static Regex nmSymbolLine = new Regex ("([a-fA-F0-9]+)\\s([a-zA-Z])\\s(.*)$"); static Regex nmFileNotFound = new Regex ("(.*)nm:(.*)No such file$"); static Regex nmNoSymbols = new Regex ("(.*)nm:(.*)No symbols$"); static Regex nmUnknownProblem = new Regex ("(.*)nm:(.*)$"); public static void FillFunctions (MR region) where UFR : IUnmanagedFunctionFromRegion where MR : IExecutableMemoryRegion { FillFunctionsUsingNm (region); } static void FillFunctionsUsingNm (MR region) where UFR : IUnmanagedFunctionFromRegion where MR : IExecutableMemoryRegion { try { string[] outputLines = RunExternalProcess ("/usr/bin/nm", "-n " + region.Name); if (outputLines.Length == 1) { Match m = nmFileNotFound.Match (outputLines [0]); if (m.Success) { return; } m = nmNoSymbols.Match (outputLines [0]); if (m.Success || (outputLines [0].Length == 0)) { outputLines = RunExternalProcess ("/usr/bin/nm", "-n -D " + region.Name); if (outputLines.Length == 1) { m = nmUnknownProblem.Match (outputLines [0]); if (m.Success) { return; } } } else { m = nmUnknownProblem.Match (outputLines [0]); if (m.Success) { return; } } } else if (outputLines.Length == 0) { outputLines = RunExternalProcess ("/usr/bin/nm", "-n -D " + region.Name); } IUnmanagedFunctionFromRegion lastFunction = null; foreach (string outputLine in outputLines) { Match m = nmSymbolLine.Match (outputLine); if (m.Success) { ulong symbolOffset = (ulong) Int64.Parse (m.Groups [1].Value, NumberStyles.HexNumber); String symbolType = m.Groups [2].Value; String symbolName = m.Groups [3].Value; if (symbolOffset >= region.StartAddress + region.FileOffset) { symbolOffset -= region.StartAddress; if (lastFunction != null) { lastFunction.EndOffset = (uint) symbolOffset -1; lastFunction = null; } if ((symbolType == "T") || (symbolType == "t")) { lastFunction = region.NewFunction (symbolName, (uint) symbolOffset); } } } } if (lastFunction != null) { lastFunction.EndOffset = (uint) (region.EndAddress - region.StartAddress); } } catch (Exception e) { Console.Error.WriteLine ("Exception: {0}", e.Message); } } } } mono-tools-4.2/Mono.Profiler/profiler-decoder-library/Makefile.am0000664000175000017500000000163512642235713027135 0ustar00directhexdirecthex00000000000000BUILDDIR= $(top_builddir)/Mono.Profiler/lib ASSEMBLY = $(BUILDDIR)/mprof-decoder-library.dll if ENABLE_DEBUG CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG ASSEMBLY_MDB = $(ASSEMBLY).mdb else CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ ASSEMBLY_MDB = endif programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AssemblyInfo.cs \ BaseTypes.cs \ Decoder.cs \ EventProcessor.cs \ NativeLibraryReader.cs \ ObjectModel.cs \ Reader.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = REFERENCES = System build_references = $(addprefix /r:, $(REFERENCES)) $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) mkdir -p $(BUILDDIR) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:library $(build_sources) $(build_references) EXTRA_DIST = profiler-decoder-library.csproj $(FILES) $(RESOURCES) mono-tools-4.2/Mono.Profiler/profiler-decoder-library/EventProcessor.cs0000664000175000017500000005307612413742070030412 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.IO; using System.Collections.Generic; namespace Mono.Profiler { class UnknownStatisticalHitsCollector : IStatisticalHitItem { uint statisticalHits; public uint StatisticalHits { get { return statisticalHits; } internal set { statisticalHits = value; } } internal void IncrementStatisticalHits () { statisticalHits ++; } public string Name { get { return "[UNKNOWN MEMORY REGION]"; } } StatisticalHitItemCallCounts callCounts; public bool HasCallCounts { get { return (callCounts != null); } } public StatisticalHitItemCallCounts CallCounts { get { if (callCounts == null) { callCounts = new StatisticalHitItemCallCounts (); } return callCounts; } } public UnknownStatisticalHitsCollector () { statisticalHits = 0; } } public class ProfilerEventHandler : BaseProfilerEventHandler,HeapObject,HeapSnapshot> { Dictionary perThreadStacks; CallStack stack; UnknownStatisticalHitsCollector unknownStatisticalHitsCollector; GlobalMonitorStatistics globalMonitorStatistics; public GlobalMonitorStatistics GlobalMonitorStatistics { get { return globalMonitorStatistics; } } StackTrace.Factory stackTraceFactory; public StackTrace[] RootFrames { get { return stackTraceFactory.RootFrames; } } uint version; public uint Version { get { return version; } } string runtimeFile; public string RuntimeFile { get { return runtimeFile; } } ProfilerFlags flags; public ProfilerFlags Flags { get { return flags; } } ulong startCounter; public ulong StartCounter { get { return startCounter; } } DateTime startTime; public DateTime StartTime { get { return startTime; } } ulong endCounter; public ulong EndCounter { get { return endCounter; } } DateTime endTime; public DateTime EndTime { get { return endTime; } } ulong currentCounter; public ulong CurrentCounter { get { return currentCounter; } } DateTime currentTime; public DateTime CurrentTime { get { return currentTime; } } double ticksPerCounterUnit; public override Double TicksPerCounterUnit { get { return ticksPerCounterUnit; } } void UpdateTicksPerCounterUnit () { if (currentCounter > startCounter) { ulong counterSpan = currentCounter - startCounter; TimeSpan timeSpan = currentTime - startTime; ticksPerCounterUnit = ((double)timeSpan.Ticks) / ((double)counterSpan); } } void UpdateCounterAndTime (ulong currentCounter, DateTime currentTime) { this.currentCounter = currentCounter; this.currentTime = currentTime; UpdateTicksPerCounterUnit (); } public DateTime CounterToDateTime (ulong counter) { return StartTime + TimeSpan.FromTicks ((long) (ticksPerCounterUnit * (double)(counter - StartCounter))); } public override TimeSpan ClicksToTimeSpan (ulong clicks) { return TimeSpan.FromTicks ((long) (ticksPerCounterUnit * (double)clicks)); } public double ClicksToSeconds (ulong clicks) { return (ticksPerCounterUnit * (double)clicks) / TimeSpan.TicksPerSecond; } List allocatedObjects = null; public bool RecordAllocations { get { return allocatedObjects != null; } set { if (value) { if (allocatedObjects != null) { allocatedObjects.Clear (); } else { allocatedObjects = new List (); } } else { allocatedObjects = null; } } } public AllocatedObject[] AllocatedObjects { get { if (RecordAllocations) { AllocatedObject[] result = allocatedObjects.ToArray (); allocatedObjects.Clear (); return result; } else { return null; } } } protected void RecordAllocation (LoadedClass c, ulong objectId, uint size, LoadedMethod caller, bool jitTime, StackTrace trace) { if (RecordAllocations) { allocatedObjects.Add (new AllocatedObject (objectId, c, size, caller, jitTime, trace)); } } public override void Start (uint version, string runtimeFile, ProfilerFlags flags, ulong startCounter, DateTime startTime) { this.version = version; this.runtimeFile = runtimeFile; this.flags = flags; this.startCounter = startCounter; this.startTime = startTime; } public override void End (uint version, ulong endCounter, DateTime endTime) { if (this.version != version) { throw new Exception (String.Format ("Version {0} specified at start is inconsistent witn {1} specified at end", this.version, version)); } this.endCounter = endCounter; this.endTime = endTime; UpdateCounterAndTime (endCounter, endTime); } public override void StartBlock (ulong startCounter, DateTime startTime, ulong threadId) { UpdateCounterAndTime (startCounter, startTime); } public override void EndBlock (ulong endCounter, DateTime endTime, ulong threadId) { UpdateCounterAndTime (endCounter, endTime); } public override void ModuleLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) {} public override void ModuleUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name) {} public override void AssemblyLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) {} public override void AssemblyUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name) {} public override void ApplicationDomainLoaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name, bool success) {} public override void ApplicationDomainUnloaded (ulong threadId, uint id, ulong startCounter, ulong endCounter, string name) {} public override void SetCurrentThread (ulong threadId) { if (perThreadStacks.ContainsKey (threadId)) { stack = perThreadStacks [threadId]; } else { stack = new CallStack (threadId); perThreadStacks.Add (threadId, stack); } } public override void ClassStartLoad (LoadedClass c, ulong counter) {} public override void ClassEndLoad (LoadedClass c, ulong counter, bool success) {} public override void ClassStartUnload (LoadedClass c, ulong counter) {} public override void ClassEndUnload (LoadedClass c, ulong counter) {} public override void Allocation (LoadedClass c, uint size, LoadedMethod caller, bool jitTime, ulong objectId, ulong counter) { StackTrace trace; if (Directives.AllocationsHaveStackTrace) { trace = stackTraceFactory.NewStackTrace (stack); } else { trace = null; } if (caller == null) { if ((stack != null) && (stack.StackTop != null)) { caller = stack.StackTop.Method; jitTime = stack.StackTop.IsBeingJitted; } } c.InstanceCreated (size, caller, jitTime, trace); RecordAllocation (c, objectId, size, caller, jitTime, trace); } public override void MonitorEvent (MonitorEvent eventCode, LoadedClass c, ulong objectId, ulong counter) { //Console.WriteLine ("MonitorEvent {0} class {1} object {2} counter {3}", eventCode, c.Name, objectId, counter); StackTrace trace = stackTraceFactory.NewStackTrace (stack); if (trace == null ) { trace = StackTrace.StackTraceUnavailable; } globalMonitorStatistics.HandleEvent (stack.ThreadId, eventCode, c, objectId, trace, counter); } public override void Exception (LoadedClass c, ulong counter) {} public override void MethodEnter (LoadedMethod m, ulong counter) { stack.MethodEnter (m, counter); } public override void MethodExit (LoadedMethod m, ulong counter) { stack.MethodExit (stackTraceFactory, m, counter); } public override void MethodJitStart (LoadedMethod m, ulong counter) { m.StartJit = counter; stack.MethodJitStart (m, counter); } public override void MethodJitEnd (LoadedMethod m, ulong counter, bool success) { m.JitClicks += (counter - m.StartJit); stack.MethodJitEnd (stackTraceFactory, m, counter); } public override void MethodFreed (LoadedMethod m, ulong counter) {} public override void AdjustStack (uint lastValidFrame, uint topSectionSize, StackSectionElement[] topSection) { stack.AdjustStack (lastValidFrame, topSectionSize, topSection); } uint remainingCallersInChain; IStatisticalHitItem lastCallee; StatisticalHitItemTreeNode lastCalleeNode; bool eventsArePartOfChain; int currentChainIndex; IStatisticalHitItem[] currentChain; // Returns true if the hit must be counted (this is the first chain item) bool HandleCallChain (IStatisticalHitItem caller) { if (eventsArePartOfChain) { bool result; if (lastCallee != null) { lastCallee.CallCounts.AddCaller (caller); caller.CallCounts.AddCallee (lastCallee); } if (lastCalleeNode != null) { lastCalleeNode = lastCalleeNode.AddChild (caller); } else { lastCalleeNode = statisticalItemsByCaller.AddChild (caller); } currentChain [currentChainIndex] = caller; currentChainIndex ++; if (remainingCallersInChain > 0) { //Console.WriteLine ("HandleCallChain[{0}] {1} on {2}", remainingCallersInChain, caller.Name, lastCallee.Name); remainingCallersInChain --; result = false; } else { //Console.WriteLine ("HandleCallChain[{0}] {1}", remainingCallersInChain, caller.Name); result = true; StatisticalHitItemTreeNode currentNode = statisticalItemsByCallee; while (currentChainIndex > 0) { currentChainIndex --; currentNode = currentNode.AddChild (currentChain [currentChainIndex]); } eventsArePartOfChain = false; Array.Clear (currentChain, 0, currentChain.Length); } lastCallee = caller; return result; } else { return true; } } public override void StatisticalCallChainStart (uint chainDepth) { lastCallee = null; lastCalleeNode = null; remainingCallersInChain = chainDepth; eventsArePartOfChain = true; currentChainIndex = 0; if (currentChain != null) { Array.Clear (currentChain, 0, currentChain.Length); } else { currentChain = new IStatisticalHitItem [32]; } //Console.WriteLine ("StatisticalCallChainStart ({0})", chainDepth); } public override void MethodStatisticalHit (LoadedMethod m) { if (HandleCallChain (m)) { m.StatisticalHits ++; } } public override void UnmanagedFunctionStatisticalHit (UnmanagedFunctionFromRegion f) { if (HandleCallChain (f)) { f.StatisticalHits ++; } } public override void UnmanagedFunctionStatisticalHit (UnmanagedFunctionFromID f) { if (HandleCallChain (f)) { f.StatisticalHits ++; } } public override void UnknownUnmanagedFunctionStatisticalHit (ExecutableMemoryRegion region, uint offset) { if (HandleCallChain (region)) { region.IncrementStatisticalHits (); } } public override void UnknownUnmanagedFunctionStatisticalHit (ulong address) { if (HandleCallChain (unknownStatisticalHitsCollector)) { unknownStatisticalHitsCollector.IncrementStatisticalHits (); } } public override void ThreadStart (ulong threadId, ulong counter) {} public override void ThreadEnd (ulong threadId, ulong counter) {} public IStatisticalHitItem[] StatisticalHitItems { get { LoadedMethod[] methods = LoadedElements.Methods; ExecutableMemoryRegion [] regions = LoadedElements.ExecutableMemoryRegions; UnmanagedFunctionFromRegion[][] regionFunctions = new UnmanagedFunctionFromRegion [regions.Length][]; UnmanagedFunctionFromID[] idFunctions = LoadedElements.UnmanagedFunctionsByID; int resultIndex = 0; for (int i = 0; i < regions.Length; i++) { ExecutableMemoryRegion region = regions [i]; regionFunctions [i] = region.Functions; resultIndex += regionFunctions [i].Length; } IStatisticalHitItem[] result = new IStatisticalHitItem [resultIndex + methods.Length + idFunctions.Length + regions.Length + 1]; resultIndex = 0; for (int i = 0; i < regions.Length; i++) { UnmanagedFunctionFromRegion[] functions = regionFunctions [i]; Array.ConstrainedCopy (functions, 0, result, resultIndex, functions.Length); resultIndex += functions.Length; } Array.ConstrainedCopy (methods, 0, result, resultIndex, methods.Length); resultIndex += methods.Length; Array.ConstrainedCopy (idFunctions, 0, result, resultIndex, idFunctions.Length); resultIndex += idFunctions.Length; Array.ConstrainedCopy (regions, 0, result, resultIndex, regions.Length); resultIndex += regions.Length; result [resultIndex] = unknownStatisticalHitsCollector; return result; } } StatisticalHitItemTreeNode statisticalItemsByCaller = new StatisticalHitItemTreeNode (null); public StatisticalHitItemTreeNode[] StatisticalItemsByCaller { get { return statisticalItemsByCaller.Children; } } StatisticalHitItemTreeNode statisticalItemsByCallee = new StatisticalHitItemTreeNode (null); public StatisticalHitItemTreeNode[] StatisticalItemsByCallee { get { return statisticalItemsByCallee.Children; } } public class GcStatistics { ProfilerEventHandler data; uint collection; public ulong Collection { get { return collection; } } ulong startCounter; public ulong StartCounter { get { return startCounter; } internal set { startCounter = value; } } ulong endCounter; public ulong EndCounter { get { return endCounter; } internal set { endCounter = value; } } ulong markStartCounter; public ulong MarkStartCounter { get { return markStartCounter; } internal set { markStartCounter = value; } } ulong markEndCounter; public ulong MarkEndCounter { get { return markEndCounter; } internal set { markEndCounter = value; } } ulong sweepStartCounter; public ulong SweepStartCounter { get { return sweepStartCounter; } internal set { sweepStartCounter = value; } } ulong sweepEndCounter; public ulong SweepEndCounter { get { return sweepEndCounter; } internal set { sweepEndCounter = value; } } uint generation; public uint Generation { get { return generation; } internal set { generation = value; } } ulong? newHeapSize; public ulong? NewHeapSize { get { return newHeapSize; } internal set { newHeapSize = value; } } public double Start { get { return data.ClicksToSeconds (startCounter - data.StartCounter); } } public double Duration { get { return data.ClicksToSeconds (endCounter - startCounter); } } public double MarkDuration { get { return data.ClicksToSeconds (markEndCounter - markStartCounter); } } public double SweepDuration { get { return data.ClicksToSeconds (sweepEndCounter - sweepStartCounter); } } public GcStatistics (ProfilerEventHandler data, uint collection) { this.data = data; this.collection = collection; startCounter = 0; endCounter = 0; markStartCounter = 0; markEndCounter = 0; sweepStartCounter = 0; sweepEndCounter = 0; generation = 0; newHeapSize = null; } } List gcStatistics; static Comparison compareGcStatisticsByAllocation = delegate (GcStatistics a, GcStatistics b) { return a.Collection.CompareTo (b.Collection); }; public GcStatistics[] GarbageCollectioncStatistics { get { GcStatistics[] result = gcStatistics.ToArray (); Array.Sort (result, compareGcStatisticsByAllocation); return result; } } GcStatistics currentGcStatistics; List pendingGcStatistics; GcStatistics GetGcStatistics (uint collection) { if ((currentGcStatistics != null) && (currentGcStatistics.Collection == collection)) { return currentGcStatistics; } else { foreach (GcStatistics gcs in pendingGcStatistics) { if (gcs.Collection == collection) { GcStatistics result = gcs; if (currentGcStatistics != null) { pendingGcStatistics.Add (currentGcStatistics); } currentGcStatistics = result; return result; } } return NewGcStatistics (collection); } } GcStatistics NewGcStatistics (uint collection) { GcStatistics result = new GcStatistics (this, collection); if (currentGcStatistics != null) { pendingGcStatistics.Add (currentGcStatistics); } currentGcStatistics = result; return result; } public override void GarbageCollectionStart (uint collection, uint generation, ulong counter) { GcStatistics gcs = NewGcStatistics (collection); gcs.Generation = generation; gcs.StartCounter = counter; } public override void GarbageCollectionEnd (uint collection, uint generation, ulong counter) { GcStatistics gcs = GetGcStatistics (collection); gcs.EndCounter = counter; pendingGcStatistics.Remove (gcs); gcStatistics.Add (gcs); currentGcStatistics = null; } public override void GarbageCollectionMarkStart (uint collection, uint generation, ulong counter) { GcStatistics gcs = GetGcStatistics (collection); gcs.MarkStartCounter = counter; } public override void GarbageCollectionMarkEnd (uint collection, uint generation, ulong counter) { GcStatistics gcs = GetGcStatistics (collection); gcs.MarkEndCounter = counter; } public override void GarbageCollectionSweepStart (uint collection, uint generation, ulong counter) { GcStatistics gcs = GetGcStatistics (collection); gcs.SweepStartCounter = counter; } public override void GarbageCollectionSweepEnd (uint collection, uint generation, ulong counter) { GcStatistics gcs = GetGcStatistics (collection); gcs.SweepEndCounter = counter; } public override void GarbageCollectionResize (uint collection, ulong newSize) { GcStatistics gcs = NewGcStatistics (collection); gcs.NewHeapSize = newSize; gcStatistics.Add (gcs); currentGcStatistics = null; } HeapSnapshot currentHeapSnapshot = null; public override void HeapReportStart (HeapSnapshot snapshot) { currentHeapSnapshot = snapshot; } public override void HeapObjectUnreachable (LoadedClass c, uint size) { c.InstanceFreed (size); currentHeapSnapshot.HeapObjectUnreachable (c, size); } public override void HeapObjectReachable (HeapObject o) { } public override void HeapReportEnd (HeapSnapshot snapshot) { snapshot.InitializeBackReferences (); } List allocationSummaries; public AllocationSummary [] AllocationSummaries { get { return allocationSummaries.ToArray (); } } AllocationSummary currentAllocationSummary; public override void AllocationSummaryStart (uint collection, ulong startCounter, DateTime startTime) { currentAllocationSummary = new AllocationSummary (collection, startCounter, startTime); } public override void ClassAllocationSummary (LoadedClass c, uint reachableInstances, uint reachableBytes, uint unreachableInstances, uint unreachableBytes) { if (currentAllocationSummary != null) { currentAllocationSummary.RecordData (c, reachableInstances, reachableBytes, unreachableInstances, unreachableBytes); } } public override void AllocationSummaryEnd (uint collection, ulong endCounter, DateTime endTime) { if ((currentAllocationSummary != null) && (currentAllocationSummary.Collection == collection)) { currentAllocationSummary.EndCounter = endCounter; currentAllocationSummary.EndTime = endTime; allocationSummaries.Add (currentAllocationSummary); currentAllocationSummary = null; } } public ProfilerEventHandler () : base (new LoadedElementHandler (new LoadedElementFactory ())) { perThreadStacks = new Dictionary (); stack = null; stackTraceFactory = new StackTrace.Factory (); unknownStatisticalHitsCollector = new UnknownStatisticalHitsCollector (); gcStatistics = new List (); pendingGcStatistics = new List (); currentGcStatistics = null; allocationSummaries = new List (); currentAllocationSummary = null; globalMonitorStatistics = new GlobalMonitorStatistics (); } } } mono-tools-4.2/Mono.Profiler/profiler-decoder-library/profiler-decoder-library.csproj0000664000175000017500000000554512413742070033211 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 2.0 {3C7942A8-2A4D-4C70-A670-65984F738EBB} Library v2.0 65001 true full true ..\lib prompt 4 false true DEBUG mprof-decoder-library none true bin\Release prompt 4 false true profiler-decoder-library mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/0000775000175000017500000000000012642235744024262 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/ChangeLog0000664000175000017500000000221612413742070026024 0ustar00directhexdirecthex000000000000002009-05-21 Mike Kestner * *: replace MD 1.0 solution files with 2.0 msbuild files, and turn on makefile synchronization instead of generated makefiles. 2008-11-03 Massimiliano Mantione * Main.cs: Added "explorer" parameter to the model constructor, and removed debugging code. 2008-08-20 Massimiliano Mantione * Main.cs: Fix warning. * gtk-gui/gui.stetic: regenerated with correct pathnames. 2008-08-12 Massimiliano Mantione * mprof-heap-viewer.in: Fixed for integration into mono-tools; 2008-08-12 Massimiliano Mantione * Makefile.am: Fixed for integration into mono-tools; 2008-08-04 Massimiliano Mantione Added man page. 2008-08-01 Massimiliano Mantione * Makefile.am, heap-snapshot-viewer.mdp: renamed output assembly. * heap-snapshot-viewer.in: renamed to mprof-heap-viewer.in 2008-08-01 Massimiliano Mantione * Makefile.am: Regenerated from MonoDevelop. 2008-04-13 Massimiliano Mantione Initial code commit (just a plain MonoDevelop GTK# project for now). mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/Main.cs0000664000175000017500000000357512413742070025476 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.IO; using Gtk; namespace Mono.Profiler { class HeapSnapshotViewerMain { public static void Main (string[] args) { if (args.Length != 1) { Console.WriteLine ("Please specify one input file"); return; } SeekableLogFileReader reader = null; try { reader = new SeekableLogFileReader (args [0]); } catch (IOException){ Console.Error.WriteLine ("It was not possible to open the file {0}", args [0]); return; } Application.Init (); MainWindow win = new MainWindow (); win.Show (); win.HeapExplorer.Model = new HeapExplorerTreeModel (reader, win.HeapExplorer); win.HeapExplorer.Model.Initialize (); Application.Run (); } } }mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/Makefile.in0000664000175000017500000004763212642235730026336 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = Mono.Profiler/heap-snapshot-viewer ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mprof-heap-viewer 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)$(programfilesdir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(programfiles_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/mprof-heap-viewer.in \ ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ASSEMBLY = $(top_builddir)/Mono.Profiler/lib/mprof-heap-viewer.exe @ENABLE_DEBUG_FALSE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ @ENABLE_DEBUG_TRUE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug "-define:DEBUG" @ENABLE_DEBUG_FALSE@ASSEMBLY_MDB = @ENABLE_DEBUG_TRUE@ASSEMBLY_MDB = $(ASSEMBLY).mdb programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) bin_SCRIPTS = mprof-heap-viewer man_MANS = man/man1/mprof-heap-viewer.1 CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AssemblyInfo.cs \ gtk-gui/generated.cs \ gtk-gui/Mono.Profiler.MainWindow.cs \ Main.cs \ MainWindow.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = \ gtk-gui/gui.stetic \ gtk-gui/objects.xml build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_args = $(addprefix -resource:, $(build_resources)) REFERENCES = \ $(GLADE_SHARP_20_LIBS) \ $(GLIB_SHARP_20_LIBS) \ $(GTK_SHARP_LIBS) \ -r:Mono.Posix \ -r:System DLL_REFERENCES = PROJECT_REFERENCES = \ ../lib/mprof-decoder-library.dll \ ../lib/mprof-heap-snapshot-explorer.dll build_references = $(addprefix -r:, $(PROJECT_REFERENCES)) $(REFERENCES) EXTRA_DIST = heap-snapshot-viewer.csproj $(FILES) $(RESOURCES) $(man_MANS) 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) --gnu Mono.Profiler/heap-snapshot-viewer/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Mono.Profiler/heap-snapshot-viewer/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): mprof-heap-viewer: $(top_builddir)/config.status $(srcdir)/mprof-heap-viewer.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-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: ctags CTAGS: cscope cscopelist: 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) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(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) 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-man 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-programfilesDATA uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-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 tags-am \ uninstall uninstall-am uninstall-binSCRIPTS uninstall-man \ uninstall-man1 uninstall-programfilesDATA .PRECIOUS: Makefile $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(PROJECT_REFERENCES) mkdir -p $(shell dirname $(ASSEMBLY)) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:exe $(build_sources) $(build_resources_args) $(build_references) # 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-tools-4.2/Mono.Profiler/heap-snapshot-viewer/heap-snapshot-viewer.csproj0000664000175000017500000000732012413742070031546 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.21022 2.0 {C7CC60B3-F642-4C60-9B6D-14C1F5EEA1F3} Exe . mprof-heap-viewer v2.0 65001 true full true ..\lib DEBUG prompt 4 true none true bin\Release prompt 4 true gui.stetic objects.xml {CF955735-EE08-4307-B898-494A3A6391C9} heap-snapshot-explorer {3C7942A8-2A4D-4C70-A670-65984F738EBB} profiler-decoder-library mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/AssemblyInfo.cs0000664000175000017500000000207112413742070027173 0ustar00directhexdirecthex00000000000000// AssemblyInfo.cs created with MonoDevelop // User: massi at 10:50 PM 4/14/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // 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("heap-snapshot-viewer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // If the build and revision are set to '*' they will be updated automatically. [assembly: AssemblyVersion("1.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-tools-4.2/Mono.Profiler/heap-snapshot-viewer/mprof-heap-viewer.in0000664000175000017500000000011112413742070030127 0ustar00directhexdirecthex00000000000000#!/bin/sh exec mono "@prefix@/lib/@PACKAGE@/mprof-heap-viewer.exe" "$@" mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/MainWindow.cs0000664000175000017500000000107712413742070026661 0ustar00directhexdirecthex00000000000000// MainWindow.cs created with MonoDevelop // User: massi at 10:50 PM 4/14/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using Gtk; namespace Mono.Profiler { public partial class MainWindow: Gtk.Window { public MainWindow (): base (Gtk.WindowType.Toplevel) { Build (); } public Mono.Profiler.HeapSnapshotExplorer HeapExplorer { get { return heapExplorer; } } protected void OnDeleteEvent (object sender, DeleteEventArgs a) { Application.Quit (); a.RetVal = true; } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/gtk-gui/0000775000175000017500000000000012642235744025631 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/gtk-gui/objects.xml0000664000175000017500000000004312413742070027770 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/gtk-gui/generated.cs0000664000175000017500000000175512413742070030115 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ 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 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-tools-4.2/Mono.Profiler/heap-snapshot-viewer/gtk-gui/Mono.Profiler.MainWindow.cs0000664000175000017500000000264712413742070032724 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ namespace Mono.Profiler { public partial class MainWindow { private Mono.Profiler.HeapSnapshotExplorer heapExplorer; protected virtual void Build() { Stetic.Gui.Initialize(this); // Widget Mono.Profiler.MainWindow this.Name = "Mono.Profiler.MainWindow"; this.Title = Mono.Unix.Catalog.GetString("MainWindow"); this.WindowPosition = ((Gtk.WindowPosition)(4)); // Container child Mono.Profiler.MainWindow.Gtk.Container+ContainerChild this.heapExplorer = new Mono.Profiler.HeapSnapshotExplorer(); this.heapExplorer.Events = ((Gdk.EventMask)(256)); this.heapExplorer.Name = "heapExplorer"; this.Add(this.heapExplorer); if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 468; this.DefaultHeight = 300; this.Show(); this.DeleteEvent += new Gtk.DeleteEventHandler(this.OnDeleteEvent); } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/gtk-gui/gui.stetic0000664000175000017500000000204312413742070027620 0ustar00directhexdirecthex00000000000000 .. 2.12 MainWindow CenterOnParent ButtonPressMask mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/Makefile.am0000664000175000017500000000265012642235713026315 0ustar00directhexdirecthex00000000000000ASSEMBLY = $(top_builddir)/Mono.Profiler/lib/mprof-heap-viewer.exe if ENABLE_DEBUG CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug "-define:DEBUG" ASSEMBLY_MDB = $(ASSEMBLY).mdb else CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ ASSEMBLY_MDB = endif programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) bin_SCRIPTS = mprof-heap-viewer man_MANS=man/man1/mprof-heap-viewer.1 CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AssemblyInfo.cs \ gtk-gui/generated.cs \ gtk-gui/Mono.Profiler.MainWindow.cs \ Main.cs \ MainWindow.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = \ gtk-gui/gui.stetic \ gtk-gui/objects.xml build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_args = $(addprefix -resource:, $(build_resources)) REFERENCES = \ $(GLADE_SHARP_20_LIBS) \ $(GLIB_SHARP_20_LIBS) \ $(GTK_SHARP_LIBS) \ -r:Mono.Posix \ -r:System DLL_REFERENCES = PROJECT_REFERENCES = \ ../lib/mprof-decoder-library.dll \ ../lib/mprof-heap-snapshot-explorer.dll build_references = $(addprefix -r:, $(PROJECT_REFERENCES)) $(REFERENCES) $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(PROJECT_REFERENCES) mkdir -p $(shell dirname $(ASSEMBLY)) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:exe $(build_sources) $(build_resources_args) $(build_references) EXTRA_DIST = heap-snapshot-viewer.csproj $(FILES) $(RESOURCES) $(man_MANS) mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/man/0000775000175000017500000000000012642235744025035 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/man/man1/0000775000175000017500000000000012642235744025671 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/heap-snapshot-viewer/man/man1/mprof-heap-viewer.10000664000175000017500000000326112413742070031301 0ustar00directhexdirecthex00000000000000.TH "mprof-heap-viewer" 1 .SH NAME mprof-heap-viewer \- GUI viewer for the logging profiler heap snapshots .SH SYNOPSIS .B mprof-heap-viewer file .SH DESCRIPTION .B mprof-heap-viewer GUI viewer for the logging profiler heap snapshots .PP WARNING: this application is unfinished and experimental. Nevertheless it should work, and bug reports are encouraged. .PP This program decodes the contents of a logging profiler output file and locates all the heap snapshots inside it. The user can then select each individual snapshot and decide to load it in memory and explore its contents. .PP The GUI is organized to work on "object sets" (listed in a tree view on the left). All operations are performed with a popup menu on the choosen set. .PP Initially the sets are the heap snapshots (of course a heap snapshot can be considered a set of objects!). For each set the GUI shows on the right a list that breaks it down by class (one row for each class). .PP The user can then refine each set using a "filter", to select a subset. Examples of filters are "all objects of class X", or "all objects that reference an object of class X". This way the user explores the sets breaking them down to subsets (each subset in the GUI is a child of its owner set on the tree view). .PP Moreover the user can issue a "compare" operation between two arbitrary sets A and B, which will compute two subsets: "A - B" (the objects of A which are not in B, a subsect of A) and "B - A" (the reverse). This can help in understanding what changed on the heap between garbage collections. .SH Options .PP None .SH ENVIRONMENT VARIABLES .PP None .SH SEE ALSO mono(1) .BR .SH COPYRIGHT Copyright (C) 2008 Novell, Inc (http://www.novell.com) mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/0000775000175000017500000000000012642235744024621 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/ChangeLog0000664000175000017500000000440512413742070026365 0ustar00directhexdirecthex000000000000002009-08-12 Massimiliano Mantione * HeapExplorerTreeModel.cs (HeapExplorerTreeModel.Initialize): Also decode LOADED blocks so we know about assemblies. 2009-05-21 Mike Kestner * *: replace MD 1.0 solution files with 2.0 msbuild files, and turn on makefile synchronization instead of generated makefiles. 2009-03-17 Massimiliano Mantione * HeapSnapshotExplorer.cs: Use "Text" instead of "Markup" to set the tree and list cells contents. 2009-03-16 Massimiliano Mantione * HeapSnapshotExplorer.cs: Modified the delegates of the MenuItem actions specifiying the whole signature, otherwise GTK# cannot call them (the parameter marshalling throws an "argument has an incompatible type" exception). 2008-12-01 Massimiliano Mantione * HeapExplorerTreeModel.cs: Linked all root nodes n a list, so that it is possible to find the allocation event of a given heap object (now IRootNode implements the ProviderOfPreviousAllocationsSets interface). * HeapSnapshotExplorer.cs: Created class StatisticsNodeMenuHandler (implemented for classes, methods and call stacks) to rationalize the hadling of menus), and turned ClassStatisticsNode into a more general StatisticsNode because now it works with all the three abov concepts. * LoadedClassChooser.cs: Make the dialog work with methods and call stacks instead of just classes. 2008-11-03 Massimiliano Mantione * HeapExplorerTreeModel.cs: Massive refactory of "Node" class, making it generic in terms of the node contents (HeapObject-AllocatedObject). Moreover, made so that each node type can choose its own context menu. * HeapSnapshotExplorer.cs: Likewise. * LoadedClassChooser.cs: Likewise. * HeapExplorerActions.cs: Likewise. * gtk-gui/gui.stetic: Likewise. 2008-10-13 Massimiliano Mantione * HeapExplorerTreeModel.cs: Use new HeapObject non-generic class. 2008-08-12 Massimiliano Mantione * Makefile.am: Fixed for integration into mono-tools; 2008-08-04 Massimiliano Mantione Removed .pc file generation. 2008-08-01 Massimiliano Mantione * Makefile.am, gtk-gui/gui.stetic heap-snapshot-explorer.mdp: renamed output assembly. mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/MyClass.cs0000664000175000017500000000042412413742070026512 0ustar00directhexdirecthex00000000000000// MyClass.cs created with MonoDevelop // User: massi at 11:36 AM 4/17/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; namespace heapsnapshotexplorer { public class MyClass { public MyClass() { } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/Makefile.in0000664000175000017500000004070312642235730026665 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = Mono.Profiler/heap-snapshot-explorer ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 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)$(programfilesdir)" DATA = $(programfiles_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ BUILDDIR = $(top_builddir)/Mono.Profiler/lib ASSEMBLY = $(BUILDDIR)/mprof-heap-snapshot-explorer.dll @ENABLE_DEBUG_FALSE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ @ENABLE_DEBUG_TRUE@CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug "-define:DEBUG" @ENABLE_DEBUG_FALSE@ASSEMBLY_MDB = @ENABLE_DEBUG_TRUE@ASSEMBLY_MDB = $(ASSEMBLY).mdb programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AssemblyInfo.cs \ gtk-gui/generated.cs \ gtk-gui/Mono.Profiler.HeapExplorerActions.cs \ gtk-gui/Mono.Profiler.HeapSnapshotExplorer.cs \ gtk-gui/Mono.Profiler.LoadedClassChooser.cs \ HeapExplorerActions.cs \ HeapExplorerTreeModel.cs \ HeapSnapshotExplorer.cs \ LoadedClassChooser.cs \ MyClass.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = \ gtk-gui/gui.stetic \ gtk-gui/objects.xml build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_args = $(addprefix -resource:, $(build_resources)) REFERENCES = PACKAGE_REFERENCES = \ -pkg:gtk-sharp-2.0 \ -r:Mono.Posix \ -r:System DLL_REFERENCES = PROJECT_REFERENCES = ../lib/mprof-decoder-library.dll build_references = $(addprefix /r:,$(PROJECT_REFERENCES)) $(PACKAGE_REFERENCES) EXTRA_DIST = heap-snapshot-explorer.csproj $(FILES) $(RESOURCES) 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) --gnu Mono.Profiler/heap-snapshot-explorer/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Mono.Profiler/heap-snapshot-explorer/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): 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: ctags CTAGS: cscope cscopelist: 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 $(DATA) installdirs: for dir in "$(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) 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-programfilesDATA 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: uninstall-programfilesDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-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 tags-am uninstall \ uninstall-am uninstall-programfilesDATA .PRECIOUS: Makefile $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(PROJECT_REFERENCES) mkdir -p $(BUILDDIR) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:library $(build_sources) $(build_resources_args) $(build_references) # 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-tools-4.2/Mono.Profiler/heap-snapshot-explorer/HeapExplorerTreeModel.cs0000664000175000017500000003345012413742070031343 0ustar00directhexdirecthex00000000000000// Author: // Massimiliano Mantione (massi@ximian.com) // // (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; using System.Collections.Generic; using Gtk; namespace Mono.Profiler { public class HeapExplorerTreeModel { public interface INode { IHeapItemSet Items {get;} string Description {get;} TreeIter TreeIter {get;} INode Parent {get;} IRootNode Root {get;} string Count {get;} string AllocatedBytes {get;} Menu ContextMenu {get;} } public interface IRootNode : INode, ProviderOfPreviousAllocationsSets { AllocationsNode PreviousAllocationsNode {get;} } public abstract class Node : INode where HI : IHeapItem { public abstract HeapItemSet Items {get;} IHeapItemSet INode.Items { get { return Items; } } protected abstract SubSetNode NewSubSet (HeapItemSet items); public virtual string Description { get { return Items.ShortDescription; } } protected HeapExplorerTreeModel model; TreeIter treeIter; public TreeIter TreeIter { get { return treeIter; } } Node parent; public Node Parent { get { return parent; } } INode INode.Parent { get { return parent; } } public Node Root { get { if (parent != null) { return parent.Root; } else { return this; } } } IRootNode INode.Root { get { return (IRootNode) Root; } } AllocationsNode previousAllocationsNode; public AllocationsNode PreviousAllocationsNode { get { return previousAllocationsNode; } } public IEnumerable> PreviousAllocationsSets () { AllocationsNode currentNode = this.PreviousAllocationsNode; while (currentNode != null) { if (currentNode.Items == null) { currentNode.ReadEvents (); } yield return currentNode.Items; currentNode = currentNode.PreviousAllocationsNode; } } public string Count { get { if (Items != null) { return Items.Elements.Length.ToString (); } else { return ""; } } } public string AllocatedBytes { get { if (Items != null) { return Items.AllocatedBytes.ToString (); } else { return ""; } } } protected TreeIter HandleNodeCreation () { if (parent != null) { TreeIter result = model.Model.AppendNode (parent.TreeIter); model.Model.SetValue (result, 0, this); return result; } else { return model.Model.AppendValues (this); } } public SubSetNode Filter (IHeapItemFilter filter) { HeapItemSetFromFilter subSet = new HeapItemSetFromFilter (Items, filter); SubSetNode result = NewSubSet (subSet); return result; } public void CompareWithNode (Node otherNode) where OHI : IHeapItem { HeapItemSet onlyInThisSet; HeapItemSet onlyInOtherSet; Items.CompareWithSet (otherNode.Items, out onlyInThisSet, out onlyInOtherSet); NewSubSet (onlyInThisSet); otherNode.NewSubSet (onlyInOtherSet); } public void IntersectWithNode (Node otherNode) where OHI : IHeapItem { NewSubSet (Items.IntersectWithSet (otherNode.Items)); } public void SelectObjectsReferencingItem (Node objectsNode) { objectsNode.NewSubSet (Items.ObjectsReferencingItemInSet (objectsNode.Items)); } public void SelectObjectsReferencedByItem (Node objectsNode) { objectsNode.NewSubSet (Items.ObjectsReferencedByItemInSet (objectsNode.Items)); } public abstract Menu ContextMenu {get;} protected Node (HeapExplorerTreeModel model, Node parent, AllocationsNode previousAllocationsNode) { this.model = model; this.parent = parent; this.previousAllocationsNode = previousAllocationsNode; this.treeIter = HandleNodeCreation (); } } public class SnapshotNode : Node, IRootNode { SeekableLogFileReader.Block heapBlock; HeapSnapshot snapshot; public HeapSnapshot Snapshot { get { return snapshot; } } HeapObjectSetFromSnapshot items; public override HeapItemSet Items { get { return items; } } public void ReadSnapshot () { if (items == null) { model.heapEventProcessor.RecordAllocations = true; model.Reader.ReadBlock (heapBlock).Decode (model.heapEventProcessor, model.Reader); snapshot = model.heapEventProcessor.LastHeapSnapshot; items = new HeapObjectSetFromSnapshot (snapshot); model.Model.SetValue (TreeIter, 0, this); } } public override string Description { get { if (items != null) { return items.ShortDescription; } else { return String.Format ("Heap block ({0}.{1:000}s)", heapBlock.TimeFromStart.Seconds, heapBlock.TimeFromStart.Milliseconds); } } } protected override SubSetNode NewSubSet (HeapItemSet items) { return new HeapObjectSubSetNode (model, this, items); } public override Menu ContextMenu { get { if (items != null) { if (model.Explorer.NodeIsMarked) { if (model.Explorer.MarkIsForComparison) { return model.Explorer.CompareObjectSet; } else if (model.Explorer.MarkIsForFiltering) { return model.Explorer.FilterObjectSetUsingSelection; } else { throw new Exception ("Mark is buggy"); } } else { return model.Explorer.FilterObjectSet; } } else { return model.Explorer.LoadHeapSnapshotBlock; } } } public SnapshotNode (HeapExplorerTreeModel model, SeekableLogFileReader.Block heapBlock, AllocationsNode previousAllocationsNode) : base (model, null, previousAllocationsNode) { this.heapBlock = heapBlock; this.items = null; this.snapshot = null; } } public class AllocationsNode : Node, IRootNode { SeekableLogFileReader.Block[] eventBlocks; AllocatedObjectSetFromEvents items; public override HeapItemSet Items { get { return items; } } public void ReadEvents () { if (items == null) { model.heapEventProcessor.RecordAllocations = true; foreach (SeekableLogFileReader.Block eventBlock in eventBlocks) { model.Reader.ReadBlock (eventBlock).Decode (model.heapEventProcessor, model.Reader); } items = new AllocatedObjectSetFromEvents (eventBlocks [0].TimeFromStart, model.heapEventProcessor.AllocatedObjects); model.Model.SetValue (TreeIter, 0, this); } } public override string Description { get { if (items != null) { return items.ShortDescription; } else { return String.Format ("Events ({0}.{1:000}s)", eventBlocks [0].TimeFromStart.Seconds, eventBlocks [0].TimeFromStart.Milliseconds); } } } protected override SubSetNode NewSubSet (HeapItemSet items) { return new AllocatedObjectSubSetNode (model, this, items); } public override Menu ContextMenu { get { if (items != null) { if (model.Explorer.NodeIsMarked) { if (model.Explorer.MarkIsForComparison) { return model.Explorer.CompareAllocationSet; } else if (model.Explorer.MarkIsForFiltering) { return model.Explorer.FilterAllocationSetUsingSelection; } else { throw new Exception ("Mark is buggy"); } } else { return model.Explorer.FilterAllocationSet; } } else { return model.Explorer.LoadAllocationsBlocks; } } } public AllocationsNode (HeapExplorerTreeModel model, SeekableLogFileReader.Block[] eventBlocks, AllocationsNode previousAllocationsNode) : base (model, null, previousAllocationsNode) { this.eventBlocks = eventBlocks; this.items = null; } } public abstract class SubSetNode : Node where HI : IHeapItem { HeapItemSet items; public override HeapItemSet Items { get { return items; } } protected SubSetNode (HeapExplorerTreeModel model, Node parent, HeapItemSet items) : base (model, parent, null) { this.items = items; } } public class HeapObjectSubSetNode : SubSetNode { protected override SubSetNode NewSubSet (HeapItemSet items) { return new HeapObjectSubSetNode (model, this, items); } public override Menu ContextMenu { get { if (model.Explorer.NodeIsMarked) { if (model.Explorer.MarkIsForComparison) { return model.Explorer.CompareObjectSet; } else if (model.Explorer.MarkIsForFiltering) { return model.Explorer.FilterObjectSetUsingSelection; } else { throw new Exception ("Mark is buggy"); } } else { return model.Explorer.FilterObjectSet; } } } public HeapObjectSubSetNode (HeapExplorerTreeModel model, Node parent, HeapItemSet items) : base (model, parent, items) { } } public class AllocatedObjectSubSetNode : SubSetNode { protected override SubSetNode NewSubSet (HeapItemSet items) { return new AllocatedObjectSubSetNode (model, this, items); } public override Menu ContextMenu { get { if (model.Explorer.NodeIsMarked) { if (model.Explorer.MarkIsForComparison) { return model.Explorer.CompareAllocationSet; } else if (model.Explorer.MarkIsForFiltering) { return model.Explorer.FilterAllocationSetUsingSelection; } else { throw new Exception ("Mark is buggy"); } } else { return model.Explorer.FilterAllocationSet; } } } public AllocatedObjectSubSetNode (HeapExplorerTreeModel model, Node parent, HeapItemSet items) : base (model, parent, items) { } } TreeStore model; public TreeStore Model { get { return model; } } SeekableLogFileReader reader; public SeekableLogFileReader Reader { get { return reader; } } protected class HeapEventProcessor : ProfilerEventHandler { HeapSnapshot lastHeapSnapshot = null; public HeapSnapshot LastHeapSnapshot { get { return lastHeapSnapshot; } } public override void HeapReportStart (HeapSnapshot snapshot) { lastHeapSnapshot = snapshot; } public override void HeapObjectUnreachable (LoadedClass c, uint size) { lastHeapSnapshot.HeapObjectUnreachable (c, size); } public override void HeapObjectReachable (HeapObject o) { } public override void HeapReportEnd (HeapSnapshot snapshot) { lastHeapSnapshot.InitializeBackReferences (); } } protected HeapEventProcessor heapEventProcessor; List rootNodes; public IRootNode[] RootNodes { get { return rootNodes.ToArray (); } } HeapSnapshotExplorer explorer; public HeapSnapshotExplorer Explorer { get { return explorer; } } AllocationsNode CreateAllocationsNode (List eventBlocks, AllocationsNode previousAllocationsNode) { AllocationsNode node; if (eventBlocks.Count > 0) { node = new AllocationsNode (this, eventBlocks.ToArray (), previousAllocationsNode); rootNodes.Add (node); } else { node = null; } eventBlocks.Clear (); return node; } public void Initialize () { List eventBlocks = new List (); AllocationsNode previousAllocationsNode = null; Reset (); foreach (SeekableLogFileReader.Block block in reader.Blocks) { if (block.Code == BlockCode.HEAP_DATA) { previousAllocationsNode = CreateAllocationsNode (eventBlocks, previousAllocationsNode); SnapshotNode node = new SnapshotNode (this, block, previousAllocationsNode); rootNodes.Add (node); } else if (block.Code == BlockCode.EVENTS) { eventBlocks.Add (block); } else if (block.Code == BlockCode.DIRECTIVES) { reader.ReadBlock (block).Decode (heapEventProcessor, reader); } else if ((block.Code == BlockCode.MAPPING) || (block.Code == BlockCode.LOADED)){ reader.ReadBlock (block).Decode (heapEventProcessor, reader); } else if (block.Code == BlockCode.INTRO) { reader.ReadBlock (block).Decode (heapEventProcessor, reader); } else if (block.Code == BlockCode.END) { reader.ReadBlock (block).Decode (heapEventProcessor, reader); } } CreateAllocationsNode (eventBlocks, previousAllocationsNode); } public void Reset () { model.Clear (); } public HeapExplorerTreeModel (SeekableLogFileReader reader, HeapSnapshotExplorer explorer) { model = new TreeStore (new Type [] {typeof (INode)}); heapEventProcessor = new HeapEventProcessor (); this.reader = reader; this.explorer = explorer; rootNodes = new List (); } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/LoadedClassChooser.cs0000664000175000017500000000515312413742070030644 0ustar00directhexdirecthex00000000000000// LoadedClassChooser.cs created with MonoDevelop // User: massi at 10:14 PM 4/18/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using Gtk; namespace Mono.Profiler { public partial class LoadedClassChooser : Gtk.Dialog { IHeapItemSetStatisticsSubject result; public IHeapItemSetStatisticsSubject Result { get { return result; } } IHeapItemSetStatisticsBySubject currentSelection; LoadedClassChooser() { this.Build(); HeapSnapshotExplorer.PrepareTreeViewForStatisticsDisplay (ClassList); ClassList.NodeSelection.Changed += new EventHandler (OnSelectionChanged); currentSelection = null; } void OnSelectionChanged (object o, System.EventArgs args) { Gtk.NodeSelection selection = (Gtk.NodeSelection) o; HeapSnapshotExplorer.StatisticsNode node = (HeapSnapshotExplorer.StatisticsNode) selection.SelectedNode; if (node != null) { currentSelection = node.Statistics; } else { currentSelection = null; } } void FillList (IHeapItemSetStatisticsBySubject[] statistics) { HeapSnapshotExplorer.FillTreeViewWithStatistics (ClassList, statistics); currentSelection = null; } protected virtual void OnCancel (object sender, System.EventArgs e) { result = null; } protected virtual void OnOK (object sender, System.EventArgs e) { if (currentSelection != null) { result = currentSelection.Subject; } else { result = null; } } static LoadedClassChooser chooser; static IHeapItemSetStatisticsSubject ChooseSubject (IHeapItemSetStatisticsBySubject[] subjects, string subjectName) { IHeapItemSetStatisticsSubject result; if (chooser == null) { chooser = new LoadedClassChooser (); } chooser.Title = "Choose " + subjectName; chooser.FillList (subjects); ResponseType response = (ResponseType) chooser.Run (); if (response == ResponseType.Ok) { result = chooser.result; } else { result = null; } chooser.Hide (); return result; } public static LoadedClass ChooseClass (IHeapItemSetStatisticsBySubject[] subjects) { IHeapItemSetStatisticsSubject result = ChooseSubject (subjects, "class"); return result as LoadedClass; } public static LoadedMethod ChooseMethod (IHeapItemSetStatisticsBySubject[] subjects) { IHeapItemSetStatisticsSubject result = ChooseSubject (subjects, "method"); return result as LoadedMethod; } public static StackTrace ChooseCallStack (IHeapItemSetStatisticsBySubject[] subjects) { IHeapItemSetStatisticsSubject result = ChooseSubject (subjects, "call stack"); return result as StackTrace; } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/HeapExplorerActions.cs0000664000175000017500000000122612413742070031057 0ustar00directhexdirecthex00000000000000// HeapExplorerActions.cs created with MonoDevelop // User: massi at 11:40 AM 4/17/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; namespace Mono.Profiler { public partial class HeapExplorerActions : Gtk.ActionGroup { HeapSnapshotExplorer explorer; public HeapSnapshotExplorer Explorer { get { return explorer; } set { explorer = value; } } public HeapExplorerActions() : base("Mono.Profiler.HeapExplorerActions") { this.Build(); } protected virtual void OnLoadData (object sender, System.EventArgs e) { explorer.OnLoadHeapSnapshotData (); } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/AssemblyInfo.cs0000664000175000017500000000207312413742070027534 0ustar00directhexdirecthex00000000000000// AssemblyInfo.cs created with MonoDevelop // User: massi at 11:36 AM 4/17/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // 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("heap-snapshot-explorer")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // If the build and revision are set to '*' they will be updated automatically. [assembly: AssemblyVersion("1.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-tools-4.2/Mono.Profiler/heap-snapshot-explorer/heap-snapshot-explorer.csproj0000664000175000017500000001013612413742070032443 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.21022 2.0 {CF955735-EE08-4307-B898-494A3A6391C9} Library v2.0 65001 mprof-heap-snapshot-explorer true full true ..\lib DEBUG prompt 4 true false none true bin\Release prompt 4 false true heap-snapshot-explorer gui.stetic objects.xml {3C7942A8-2A4D-4C70-A670-65984F738EBB} profiler-decoder-library mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/gtk-gui/0000775000175000017500000000000012642235744026170 5ustar00directhexdirecthex00000000000000mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/gtk-gui/Mono.Profiler.HeapExplorerActions.cs0000664000175000017500000000424312413742070035120 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ namespace Mono.Profiler { public partial class HeapExplorerActions { private Gtk.Action loadDataAction; private Gtk.Action filterByClassAction; private Gtk.Action filterByClassOfReferencedObjectAction; private Gtk.Action filterByClassOfReferencingObjectAction; public virtual void Build() { // Action group Mono.Profiler.HeapExplorerActions this.loadDataAction = new Gtk.Action("loadDataAction", Mono.Unix.Catalog.GetString("Load data"), null, "gtk-add"); this.loadDataAction.ShortLabel = Mono.Unix.Catalog.GetString("Load data"); this.Add(this.loadDataAction, null); this.filterByClassAction = new Gtk.Action("filterByClassAction", Mono.Unix.Catalog.GetString("Filter by class"), null, null); this.filterByClassAction.ShortLabel = Mono.Unix.Catalog.GetString("Filter by class"); this.Add(this.filterByClassAction, null); this.filterByClassOfReferencedObjectAction = new Gtk.Action("filterByClassOfReferencedObjectAction", Mono.Unix.Catalog.GetString("Filter by class of referenced object"), null, null); this.filterByClassOfReferencedObjectAction.ShortLabel = Mono.Unix.Catalog.GetString("Filter by class of referenced object"); this.Add(this.filterByClassOfReferencedObjectAction, null); this.filterByClassOfReferencingObjectAction = new Gtk.Action("filterByClassOfReferencingObjectAction", Mono.Unix.Catalog.GetString("Filter by class of referencing object"), null, null); this.filterByClassOfReferencingObjectAction.ShortLabel = Mono.Unix.Catalog.GetString("Filter by class of referencing object"); this.Add(this.filterByClassOfReferencingObjectAction, null); } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/gtk-gui/objects.xml0000664000175000017500000000031512413742070030331 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/gtk-gui/Mono.Profiler.LoadedClassChooser.cs0000664000175000017500000000751012413742070034702 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ namespace Mono.Profiler { public partial class LoadedClassChooser { private Gtk.ScrolledWindow GtkScrolledWindow; private Gtk.NodeView ClassList; private Gtk.Button buttonCancel; private Gtk.Button buttonOk; protected virtual void Build() { Stetic.Gui.Initialize(this); // Widget Mono.Profiler.LoadedClassChooser this.Name = "Mono.Profiler.LoadedClassChooser"; this.Title = Mono.Unix.Catalog.GetString("Choose item"); this.WindowPosition = ((Gtk.WindowPosition)(4)); this.Modal = true; // Internal child Mono.Profiler.LoadedClassChooser.VBox Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.GtkScrolledWindow = new Gtk.ScrolledWindow(); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this.ClassList = new Gtk.NodeView(); this.ClassList.CanFocus = true; this.ClassList.Name = "ClassList"; this.ClassList.Reorderable = true; this.ClassList.SearchColumn = 0; this.GtkScrolledWindow.Add(this.ClassList); w1.Add(this.GtkScrolledWindow); Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(w1[this.GtkScrolledWindow])); w3.Position = 0; // Internal child Mono.Profiler.LoadedClassChooser.ActionArea Gtk.HButtonBox w4 = this.ActionArea; w4.Name = "dialog1_ActionArea"; w4.Spacing = 6; w4.BorderWidth = ((uint)(5)); w4.LayoutStyle = ((Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new 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); Gtk.ButtonBox.ButtonBoxChild w5 = ((Gtk.ButtonBox.ButtonBoxChild)(w4[this.buttonCancel])); w5.Expand = false; w5.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new 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"; this.AddActionWidget(this.buttonOk, -5); Gtk.ButtonBox.ButtonBoxChild w6 = ((Gtk.ButtonBox.ButtonBoxChild)(w4[this.buttonOk])); w6.Position = 1; w6.Expand = false; w6.Fill = false; if ((this.Child != null)) { this.Child.ShowAll(); } this.DefaultWidth = 400; this.DefaultHeight = 300; this.Show(); this.Response += new Gtk.ResponseHandler(this.OnOK); this.Close += new System.EventHandler(this.OnCancel); } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/gtk-gui/generated.cs0000664000175000017500000000601312413742070030444 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ 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 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 { private static Gtk.ActionGroup group1; public static Gtk.ActionGroup GetActionGroup(System.Type type) { return Stetic.ActionGroups.GetActionGroup(type.FullName); } public static Gtk.ActionGroup GetActionGroup(string name) { if ((name == "Mono.Profiler.HeapExplorerActions")) { if ((Stetic.ActionGroups.group1 == null)) { Stetic.ActionGroups.group1 = new Mono.Profiler.HeapExplorerActions(); } return Stetic.ActionGroups.group1; } else { return null; } } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/gtk-gui/gui.stetic0000664000175000017500000001470012413742070030162 0ustar00directhexdirecthex00000000000000 .. 2.12 Action Load data Load data gtk-add Action Filter by class Filter by class Action Filter by class of referenced object Filter by class of referenced object Action Filter by class of referencing object Filter by class of referencing object True 124 In True True False In True True Choose item CenterOnParent True 2 False False 2 In ClassList True True True 0 True 0 True 6 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 mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/gtk-gui/Mono.Profiler.HeapSnapshotExplorer.cs0000664000175000017500000000562712413742070035326 0ustar00directhexdirecthex00000000000000// ------------------------------------------------------------------------------ // // This code was generated by a tool. // // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // // ------------------------------------------------------------------------------ namespace Mono.Profiler { public partial class HeapSnapshotExplorer { private Gtk.HPaned hpaned1; private Gtk.ScrolledWindow GtkScrolledWindow; private Gtk.TreeView Tree; private Gtk.ScrolledWindow GtkScrolledWindow1; private Gtk.NodeView PerClassStatistics; protected virtual void Build() { Stetic.Gui.Initialize(this); // Widget Mono.Profiler.HeapSnapshotExplorer Stetic.BinContainer.Attach(this); this.Name = "Mono.Profiler.HeapSnapshotExplorer"; // Container child Mono.Profiler.HeapSnapshotExplorer.Gtk.Container+ContainerChild this.hpaned1 = new Gtk.HPaned(); this.hpaned1.CanFocus = true; this.hpaned1.Name = "hpaned1"; this.hpaned1.Position = 124; // Container child hpaned1.Gtk.Paned+PanedChild this.GtkScrolledWindow = new Gtk.ScrolledWindow(); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this.Tree = new Gtk.TreeView(); this.Tree.CanFocus = true; this.Tree.Name = "Tree"; this.GtkScrolledWindow.Add(this.Tree); this.hpaned1.Add(this.GtkScrolledWindow); Gtk.Paned.PanedChild w2 = ((Gtk.Paned.PanedChild)(this.hpaned1[this.GtkScrolledWindow])); w2.Resize = false; // Container child hpaned1.Gtk.Paned+PanedChild this.GtkScrolledWindow1 = new Gtk.ScrolledWindow(); this.GtkScrolledWindow1.Name = "GtkScrolledWindow1"; this.GtkScrolledWindow1.ShadowType = ((Gtk.ShadowType)(1)); // Container child GtkScrolledWindow1.Gtk.Container+ContainerChild this.PerClassStatistics = new Gtk.NodeView(); this.PerClassStatistics.CanFocus = true; this.PerClassStatistics.Name = "PerClassStatistics"; this.GtkScrolledWindow1.Add(this.PerClassStatistics); this.hpaned1.Add(this.GtkScrolledWindow1); this.Add(this.hpaned1); if ((this.Child != null)) { this.Child.ShowAll(); } this.Show(); this.Tree.ButtonPressEvent += new Gtk.ButtonPressEventHandler(this.OnTreeButtonPress); this.PerClassStatistics.ButtonPressEvent += new Gtk.ButtonPressEventHandler(this.OnListButtonPress); } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/HeapSnapshotExplorer.cs0000664000175000017500000005574312413742070031273 0ustar00directhexdirecthex00000000000000// HeapSnapshotExplorer.cs created with MonoDevelop // User: massi at 11:38 AM 4/17/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using Gtk; namespace Mono.Profiler { [System.ComponentModel.ToolboxItem (true)] public partial class HeapSnapshotExplorer : Gtk.Bin { HeapExplorerTreeModel model; public HeapExplorerTreeModel Model { get { return model; } set { model = value; Tree.Model = model.Model; } } HeapExplorerTreeModel.INode currentSelection; public HeapExplorerTreeModel.INode CurrentSelection { get { return currentSelection; } } StatisticsNode currentListSelection; public StatisticsNode CurrentListSelection { get { return currentListSelection; } } abstract class StatisticsNodeMenuHandler { HeapSnapshotExplorer explorer; public HeapSnapshotExplorer Explorer { get { return explorer; } } protected abstract Menu GetContextMenu (); public void ShowContextMenu () { if ((explorer.CurrentSelection != null) && (explorer.CurrentListSelection != null)) { Menu contextMenu = GetContextMenu (); if (contextMenu != null) { contextMenu.Popup (); } } } protected void FilterCurrentSet (IHeapItemFilter filter) where HI : IHeapItem { HeapExplorerTreeModel.Node node = (HeapExplorerTreeModel.Node) Explorer.CurrentSelection; node.Filter (filter); } protected StatisticsNodeMenuHandler (HeapSnapshotExplorer explorer) { this.explorer = explorer; } } class StatisticsNodeMenuHandlerForClasses : StatisticsNodeMenuHandler { void FilterCurrentSetByCurrentClass () { LoadedClass currentClass = (LoadedClass) Explorer.CurrentListSelection.Statistics.Subject; if (Explorer.CurrentSelection is HeapExplorerTreeModel.Node) { FilterCurrentSet (new HeapItemIsOfClass (currentClass)); } if (Explorer.CurrentSelection is HeapExplorerTreeModel.Node) { FilterCurrentSet (new HeapItemIsOfClass (currentClass)); } } Menu menu; protected override Menu GetContextMenu () { return menu; } public StatisticsNodeMenuHandlerForClasses (HeapSnapshotExplorer explorer) : base (explorer) { menu = new Menu (); MenuItem menuItem; menuItem = new MenuItem ("Filter current set by this class"); menuItem.Activated += delegate (object sender, EventArgs e) { FilterCurrentSetByCurrentClass (); }; menu.Add (menuItem); menuItem = new MenuItem ("Show statistics by caller method"); menuItem.Activated += delegate (object sender, EventArgs e) { explorer.FillStatisticsListWithMethodData (); }; menu.Add (menuItem); menu.ShowAll (); } } class StatisticsNodeMenuHandlerForMethods : StatisticsNodeMenuHandler { void FilterCurrentSetByCurrentMethod () { LoadedMethod currentMethod = (LoadedMethod) Explorer.CurrentListSelection.Statistics.Subject; if (Explorer.CurrentSelection is HeapExplorerTreeModel.Node) { FilterCurrentSet (new HeapItemWasAllocatedByMethod (currentMethod)); } if (Explorer.CurrentSelection is HeapExplorerTreeModel.Node) { FilterCurrentSet (new HeapItemWasAllocatedByMethod (currentMethod)); } } Menu menu; protected override Menu GetContextMenu () { return menu; } public StatisticsNodeMenuHandlerForMethods (HeapSnapshotExplorer explorer) : base (explorer) { menu = new Menu (); MenuItem menuItem; menuItem = new MenuItem ("Filter current set by this method"); menuItem.Activated += delegate (object sender, EventArgs e) { FilterCurrentSetByCurrentMethod (); }; menu.Add (menuItem); menuItem = new MenuItem ("Show statistics by call stack"); menuItem.Activated += delegate (object sender, EventArgs e) { explorer.FillStatisticsListWithCallStackData (); }; menu.Add (menuItem); menu.ShowAll (); } } class StatisticsNodeMenuHandlerForCallStacks : StatisticsNodeMenuHandler { void FilterCurrentSetByCurrentCallStack () { StackTrace currentCallStack = (StackTrace) Explorer.CurrentListSelection.Statistics.Subject; if (Explorer.CurrentSelection is HeapExplorerTreeModel.Node) { FilterCurrentSet (new FilterHeapItemByAllocationCallStack (currentCallStack)); } if (Explorer.CurrentSelection is HeapExplorerTreeModel.Node) { FilterCurrentSet (new FilterHeapItemByAllocationCallStack (currentCallStack)); } } Menu menu; protected override Menu GetContextMenu () { return menu; } public StatisticsNodeMenuHandlerForCallStacks (HeapSnapshotExplorer explorer) : base (explorer) { menu = new Menu (); MenuItem menuItem; menuItem = new MenuItem ("Filter current set by this call stack"); menuItem.Activated += delegate (object sender, EventArgs e) { FilterCurrentSetByCurrentCallStack (); }; menu.Add (menuItem); menu.ShowAll (); } } StatisticsNodeMenuHandler currentListMenuHandler; StatisticsNodeMenuHandlerForClasses listMenuHandlerForClasses; StatisticsNodeMenuHandlerForMethods listMenuHandlerForMethods; StatisticsNodeMenuHandlerForCallStacks listMenuHandlerForCallStacks; void FillStatisticsListWithClassData () { currentListMenuHandler = listMenuHandlerForClasses; if (currentSelection != null) { if (currentSelection.Items != null) { FillTreeViewWithStatistics (PerClassStatistics, currentSelection.Items.ClassStatistics); } else { PerClassStatistics.NodeStore.Clear (); } } currentListSelection = null; } void FillStatisticsListWithMethodData () { currentListMenuHandler = listMenuHandlerForMethods; if (currentSelection != null) { if (currentSelection.Items != null) { if (! currentSelection.Items.ObjectAllocationsArePresent) { currentSelection.Items.FindObjectAllocations (currentSelection.Root); } FillTreeViewWithStatistics (PerClassStatistics, currentSelection.Items.AllocatorMethodStatistics); } else { PerClassStatistics.NodeStore.Clear (); } } currentListSelection = null; } void FillStatisticsListWithCallStackData () { currentListMenuHandler = listMenuHandlerForCallStacks; if (currentSelection != null) { if (currentSelection.Items != null) { if (! currentSelection.Items.ObjectAllocationsArePresent) { currentSelection.Items.FindObjectAllocations (currentSelection.Root); } FillTreeViewWithStatistics (PerClassStatistics, currentSelection.Items.AllocationCallStackStatistics); } else { PerClassStatistics.NodeStore.Clear (); } } currentListSelection = null; } [Gtk.TreeNode (ListOnly=true)] public class StatisticsNode : Gtk.TreeNode { IHeapItemSetStatisticsBySubject statistics; public IHeapItemSetStatisticsBySubject Statistics { get { return statistics; } } public string Description { get { return statistics.Subject.Description; } } public uint ItemsCount { get { return statistics.ItemsCount; } } public uint AllocatedBytes { get { return statistics.AllocatedBytes; } } public StatisticsNode (IHeapItemSetStatisticsBySubject statistics) { this.statistics = statistics; } } public static void PrepareTreeViewForStatisticsDisplay (NodeView view) { view.AppendColumn ("Description", new Gtk.CellRendererText (), delegate (TreeViewColumn column, CellRenderer cell, ITreeNode treeNode) { StatisticsNode node = (StatisticsNode) treeNode; ((CellRendererText) cell).Text = node.Description; }); view.AppendColumn ("Object count", new Gtk.CellRendererText (), delegate (TreeViewColumn column, CellRenderer cell, ITreeNode treeNode) { StatisticsNode node = (StatisticsNode) treeNode; ((CellRendererText) cell).Text = node.ItemsCount.ToString (); }); view.AppendColumn ("Allocated bytes", new Gtk.CellRendererText (), delegate (TreeViewColumn column, CellRenderer cell, ITreeNode treeNode) { StatisticsNode node = (StatisticsNode) treeNode; ((CellRendererText) cell).Text = node.AllocatedBytes.ToString (); }); view.NodeStore = new Gtk.NodeStore (typeof (StatisticsNode)); } public static void FillTreeViewWithStatistics (NodeView view, IHeapItemSetStatisticsBySubject[] statistics) { view.NodeStore.Clear (); foreach (IHeapItemSetStatisticsBySubject s in statistics) { view.NodeStore.AddNode (new StatisticsNode (s)); } } HeapExplorerTreeModel.Node markedObjectNode; public HeapExplorerTreeModel.Node MarkedObjectNode { get { return markedObjectNode; } } HeapExplorerTreeModel.Node markedAllocationNode; public HeapExplorerTreeModel.Node MarkedAllocationNode { get { return markedAllocationNode; } } public bool NodeIsMarked { get { return (markedObjectNode != null) || (markedAllocationNode != null); } } public HeapExplorerTreeModel.INode MarkedNode { get { return (markedObjectNode != null) ? (HeapExplorerTreeModel.INode) markedObjectNode : (markedAllocationNode != null) ? (HeapExplorerTreeModel.INode) markedAllocationNode : null; } } bool markIsForComparison; public bool MarkIsForComparison { get { return markIsForComparison; } } bool markIsForFiltering; public bool MarkIsForFiltering { get { return markIsForFiltering; } } Menu loadHeapSnapshotBlock; public Menu LoadHeapSnapshotBlock { get { return loadHeapSnapshotBlock; } } Menu loadAllocationsBlocks; public Menu LoadAllocationsBlocks { get { return loadAllocationsBlocks; } } Menu filterObjectSet; public Menu FilterObjectSet { get { return filterObjectSet; } } Menu filterAllocationSet; public Menu FilterAllocationSet { get { return filterAllocationSet; } } Menu compareObjectSet; public Menu CompareObjectSet { get { return compareObjectSet; } } Menu compareAllocationSet; public Menu CompareAllocationSet { get { return compareAllocationSet; } } Menu filterObjectSetUsingSelection; public Menu FilterObjectSetUsingSelection { get { return filterObjectSetUsingSelection; } } Menu filterAllocationSetUsingSelection; public Menu FilterAllocationSetUsingSelection { get { return filterAllocationSetUsingSelection; } } public HeapSnapshotExplorer() { Build(); MenuItem menuItem; OnClearMark (); loadHeapSnapshotBlock = new Menu (); menuItem = new MenuItem ("Load block data"); menuItem.Activated += delegate { OnLoadHeapSnapshotData (); }; loadHeapSnapshotBlock.Append (menuItem); loadAllocationsBlocks = new Menu (); menuItem = new MenuItem ("Load block data"); menuItem.Activated += delegate { OnLoadAllocationsEventData (); }; loadAllocationsBlocks.Append (menuItem); filterObjectSet = new Menu (); menuItem = new MenuItem ("Filter by object class"); menuItem.Activated += delegate { OnFilterByClass (); }; filterObjectSet.Append (menuItem); menuItem = new MenuItem ("Filter by \"references object of class\""); menuItem.Activated += delegate { OnFilterByReferencesObjectOfClass (); }; filterObjectSet.Append (menuItem); menuItem = new MenuItem ("Filter by \"is referenced by object of class\""); menuItem.Activated += delegate { OnFilterByIsReferencedByObjectOfClass (); }; filterObjectSet.Append (menuItem); menuItem = new MenuItem ("Mark set for comparison"); menuItem.Activated += delegate { OnMarkObjectSetForComparison (); }; filterObjectSet.Append (menuItem); menuItem = new MenuItem ("Mark set for \"set reference\" filtering"); menuItem.Activated += delegate { OnMarkObjectSetForFiltering (); }; filterObjectSet.Append (menuItem); filterAllocationSet = new Menu (); menuItem = new MenuItem ("Filter by object class"); menuItem.Activated += delegate { OnFilterByClass (); }; filterAllocationSet.Append (menuItem); menuItem = new MenuItem ("Mark set for comparison"); menuItem.Activated += delegate { OnMarkAllocationSetForComparison (); }; filterAllocationSet.Append (menuItem); // For now no set based filtering for allocations... //menuItem = new MenuItem ("Mark set for filtering"); //menuItem.Activated += delegate { // OnMarkAllocationSetForFiltering (); //}; //filterAllocationSet.Append (menuItem); compareObjectSet = new Menu (); menuItem = new MenuItem ("Perform comparison with this set"); menuItem.Activated += delegate { OnCompareWithSet (); }; compareObjectSet.Append (menuItem); menuItem = new MenuItem ("Perform intersection with this set"); menuItem.Activated += delegate { OnIntersectWithSet (); }; compareObjectSet.Append (menuItem); menuItem = new MenuItem ("Clear selection"); menuItem.Activated += delegate { OnClearMark (); }; compareObjectSet.Append (menuItem); compareAllocationSet = new Menu (); menuItem = new MenuItem ("Perform comparison with this set"); menuItem.Activated += delegate { OnCompareWithSet (); }; compareAllocationSet.Append (menuItem); menuItem = new MenuItem ("Perform intersection with this set"); menuItem.Activated += delegate { OnIntersectWithSet (); }; compareAllocationSet.Append (menuItem); menuItem = new MenuItem ("Clear selection"); menuItem.Activated += delegate { OnClearMark (); }; compareAllocationSet.Append (menuItem); filterObjectSetUsingSelection = new Menu (); menuItem = new MenuItem ("Select objects referencing objects in this set"); menuItem.Activated += delegate { OnFilterByReferencesObjectInSet (); }; filterObjectSetUsingSelection.Append (menuItem); menuItem = new MenuItem ("Select objects referenced by objects in this set"); menuItem.Activated += delegate { OnFilterByIsReferencedByObjectInSet (); }; filterObjectSetUsingSelection.Append (menuItem); menuItem = new MenuItem ("Clear selection"); menuItem.Activated += delegate { OnClearMark (); }; filterObjectSetUsingSelection.Append (menuItem); filterAllocationSetUsingSelection = new Menu (); menuItem = new MenuItem ("Select objects referencing objects in this set"); menuItem.Activated += delegate { OnFilterByReferencesObjectInSet (); }; filterAllocationSetUsingSelection.Append (menuItem); menuItem = new MenuItem ("Select objects referenced by objects in this set"); menuItem.Activated += delegate { OnFilterByIsReferencedByObjectInSet (); }; filterAllocationSetUsingSelection.Append (menuItem); menuItem = new MenuItem ("Clear selection"); menuItem.Activated += delegate { OnClearMark (); }; filterAllocationSetUsingSelection.Append (menuItem); PrepareTreeViewForStatisticsDisplay (PerClassStatistics); PerClassStatistics.NodeSelection.Changed += delegate (object o, EventArgs args) { currentListSelection = (StatisticsNode) PerClassStatistics.NodeSelection.SelectedNode; }; listMenuHandlerForClasses = new StatisticsNodeMenuHandlerForClasses (this); listMenuHandlerForMethods = new StatisticsNodeMenuHandlerForMethods (this); listMenuHandlerForCallStacks = new StatisticsNodeMenuHandlerForCallStacks (this); Tree.Selection.Changed += delegate (object o, EventArgs args) { TreeSelection selection = (TreeSelection) o; TreeIter iter; if (selection.GetSelected (out iter)) { currentSelection = (HeapExplorerTreeModel.INode) Tree.Model.GetValue (iter, 0); FillStatisticsListWithClassData (); } }; Gtk.TreeViewColumn setColumn = new Gtk.TreeViewColumn (); Gtk.TreeViewColumn countColumn = new Gtk.TreeViewColumn (); Gtk.TreeViewColumn bytesColumn = new Gtk.TreeViewColumn (); setColumn.Title = "Object set"; countColumn.Title = "Object count"; bytesColumn.Title = "Bytes"; Gtk.CellRendererText setCell = new Gtk.CellRendererText (); Gtk.CellRendererText countCell = new Gtk.CellRendererText (); Gtk.CellRendererText bytesCell = new Gtk.CellRendererText (); setColumn.PackStart (setCell, true); countColumn.PackStart (countCell, true); bytesColumn.PackStart (bytesCell, true); setColumn.SetCellDataFunc (setCell, delegate (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { HeapExplorerTreeModel.INode node = (HeapExplorerTreeModel.INode) model.GetValue (iter, 0); CellRendererText textCell = (CellRendererText) cell; textCell.Text = node.Description; if (node != MarkedNode) { textCell.Style = Pango.Style.Normal; } else { textCell.Style = Pango.Style.Italic; } }); countColumn.SetCellDataFunc (countCell, delegate (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { HeapExplorerTreeModel.INode node = (HeapExplorerTreeModel.INode) model.GetValue (iter, 0); CellRendererText textCell = (CellRendererText) cell; textCell.Text = node.Count; if (node != MarkedNode) { textCell.Style = Pango.Style.Normal; } else { textCell.Style = Pango.Style.Italic; } }); bytesColumn.SetCellDataFunc (bytesCell, delegate (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { HeapExplorerTreeModel.INode node = (HeapExplorerTreeModel.INode) model.GetValue (iter, 0); CellRendererText textCell = (CellRendererText) cell; textCell.Text = node.AllocatedBytes; if (node != MarkedNode) { textCell.Style = Pango.Style.Normal; } else { textCell.Style = Pango.Style.Italic; } }); setColumn.AddAttribute (setCell, "text", 0); countColumn.AddAttribute (countCell, "text", 1); bytesColumn.AddAttribute (bytesCell, "text", 2); Tree.AppendColumn (setColumn); Tree.AppendColumn (countColumn); Tree.AppendColumn (bytesColumn); loadHeapSnapshotBlock.ShowAll (); loadAllocationsBlocks.ShowAll (); filterObjectSet.ShowAll (); filterAllocationSet.ShowAll (); compareObjectSet.ShowAll (); compareAllocationSet.ShowAll (); filterObjectSetUsingSelection.ShowAll (); filterAllocationSetUsingSelection.ShowAll (); } public void OnLoadHeapSnapshotData () { HeapExplorerTreeModel.SnapshotNode node = CurrentSelection as HeapExplorerTreeModel.SnapshotNode; if ((node != null) && (node.Items == null)) { node.ReadSnapshot (); } } public void OnLoadAllocationsEventData () { HeapExplorerTreeModel.AllocationsNode node = CurrentSelection as HeapExplorerTreeModel.AllocationsNode; if ((node != null) && (node.Items == null)) { node.ReadEvents (); } } public void OnFilterByClass () where HI : IHeapItem { HeapExplorerTreeModel.Node node = CurrentSelection as HeapExplorerTreeModel.Node; if (node != null) { LoadedClass c = LoadedClassChooser.ChooseClass (CurrentSelection.Items.ClassStatistics); if (c != null) { HeapItemIsOfClass filter = new HeapItemIsOfClass (c); node.Filter (filter); } } } public void OnFilterByReferencesObjectOfClass () { HeapExplorerTreeModel.Node node = CurrentSelection as HeapExplorerTreeModel.Node; if (node!= null) { LoadedClass c = LoadedClassChooser.ChooseClass (node.Root.Items.ClassStatistics); if (c != null) { HeapObjectReferencesObjectOfClass filter = new HeapObjectReferencesObjectOfClass (c); node.Filter (filter); } } } public void OnFilterByIsReferencedByObjectOfClass () { HeapExplorerTreeModel.Node node = CurrentSelection as HeapExplorerTreeModel.Node; if (node != null) { LoadedClass c = LoadedClassChooser.ChooseClass (node.Root.Items.ClassStatistics); if (c != null) { IHeapObjectFilter filter = new HeapObjectIsReferencedByObjectOfClass (c); node.Filter (filter); } } } public void OnMarkObjectSetForComparison () { markedObjectNode = CurrentSelection as HeapExplorerTreeModel.Node; markedAllocationNode = null; markIsForComparison = true; markIsForFiltering = false; } public void OnMarkObjectSetForFiltering () { markedObjectNode = CurrentSelection as HeapExplorerTreeModel.Node; markedAllocationNode = null; markIsForComparison = false; markIsForFiltering = true; } public void OnMarkAllocationSetForComparison () { markedObjectNode = null; markedAllocationNode = CurrentSelection as HeapExplorerTreeModel.Node; markIsForComparison = true; markIsForFiltering = false; } public void OnMarkAllocationSetForFiltering () { markedObjectNode = null; markedAllocationNode = CurrentSelection as HeapExplorerTreeModel.Node; markIsForComparison = false; markIsForFiltering = true; } public void OnClearMark () { markedObjectNode = null; markedAllocationNode = null; markIsForComparison = false; markIsForFiltering = false; } public void OnCompareWithSet () where HI : IHeapItem { HeapExplorerTreeModel.Node node = CurrentSelection as HeapExplorerTreeModel.Node; if (node != null) { if (markedObjectNode != null) { node.CompareWithNode (markedObjectNode); } else if (markedAllocationNode != null) { node.CompareWithNode (markedAllocationNode); } OnClearMark (); } } public void OnIntersectWithSet () where HI : IHeapItem { HeapExplorerTreeModel.Node node = CurrentSelection as HeapExplorerTreeModel.Node; if (node != null) { if (markedObjectNode != null) { markedObjectNode.IntersectWithNode (node); } else if (markedAllocationNode != null) { markedAllocationNode.IntersectWithNode (node); } OnClearMark (); } } public void OnFilterByReferencesObjectInSet () where HI : IHeapItem { HeapExplorerTreeModel.Node itemNode = CurrentSelection as HeapExplorerTreeModel.Node; if ((itemNode != null) && (markedObjectNode != null)) { itemNode.SelectObjectsReferencingItem (markedObjectNode); OnClearMark (); } } public void OnFilterByIsReferencedByObjectInSet () where HI : IHeapItem { HeapExplorerTreeModel.Node itemNode = CurrentSelection as HeapExplorerTreeModel.Node; if ((itemNode != null) && (markedObjectNode != null)) { itemNode.SelectObjectsReferencedByItem (markedObjectNode); OnClearMark (); } } [GLib.ConnectBefore] protected virtual void OnTreeButtonPress (object o, Gtk.ButtonPressEventArgs args) { if (args.Event.Button == 3) { if (CurrentSelection != null) { CurrentSelection.ContextMenu.Popup (); } } } [GLib.ConnectBefore] protected virtual void OnListButtonPress (object o, Gtk.ButtonPressEventArgs args) { if (args.Event.Button == 3) { currentListMenuHandler.ShowContextMenu (); } } } } mono-tools-4.2/Mono.Profiler/heap-snapshot-explorer/Makefile.am0000664000175000017500000000275712642235713026664 0ustar00directhexdirecthex00000000000000BUILDDIR = $(top_builddir)/Mono.Profiler/lib ASSEMBLY = $(BUILDDIR)/mprof-heap-snapshot-explorer.dll if ENABLE_DEBUG CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ -debug "-define:DEBUG" ASSEMBLY_MDB = $(ASSEMBLY).mdb else CSFLAGS = -noconfig -codepage:utf8 -warn:4 -optimize+ ASSEMBLY_MDB = endif programfilesdir = $(pkglibdir) programfiles_DATA = $(ASSEMBLY) $(ASSEMBLY_MDB) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY_MDB) FILES = \ AssemblyInfo.cs \ gtk-gui/generated.cs \ gtk-gui/Mono.Profiler.HeapExplorerActions.cs \ gtk-gui/Mono.Profiler.HeapSnapshotExplorer.cs \ gtk-gui/Mono.Profiler.LoadedClassChooser.cs \ HeapExplorerActions.cs \ HeapExplorerTreeModel.cs \ HeapSnapshotExplorer.cs \ LoadedClassChooser.cs \ MyClass.cs build_sources = $(addprefix $(srcdir)/, $(FILES)) RESOURCES = \ gtk-gui/gui.stetic \ gtk-gui/objects.xml build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_args = $(addprefix -resource:, $(build_resources)) REFERENCES = PACKAGE_REFERENCES = \ -pkg:gtk-sharp-2.0 \ -r:Mono.Posix \ -r:System DLL_REFERENCES = PROJECT_REFERENCES = ../lib/mprof-decoder-library.dll build_references = $(addprefix /r:,$(PROJECT_REFERENCES)) $(PACKAGE_REFERENCES) $(ASSEMBLY) $(ASSEMBLY_MDB): $(build_sources) $(build_resources) $(PROJECT_REFERENCES) mkdir -p $(BUILDDIR) $(MCS) $(CSFLAGS) -out:$(ASSEMBLY) -target:library $(build_sources) $(build_resources_args) $(build_references) EXTRA_DIST = heap-snapshot-explorer.csproj $(FILES) $(RESOURCES) mono-tools-4.2/Mono.Profiler/Makefile.am0000664000175000017500000000024612413742070022236 0ustar00directhexdirecthex00000000000000SUBDIRS = profiler-decoder-library profiler-file-decoder heap-snapshot-explorer heap-snapshot-viewer Mono.Profiler.Widgets mprof-gui EXTRA_DIST = Mono.Profiler.sln mono-tools-4.2/NEWS0000664000175000017500000000000012413742070016174 0ustar00directhexdirecthex00000000000000mono-tools-4.2/install-sh0000755000175000017500000003452312550553153017524 0ustar00directhexdirecthex00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2013-12-25.23; # 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. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # 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_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 is_target_a_directory=possibly 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 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi 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 if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi 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 "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` 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-writable 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 oIFS=$IFS IFS=/ set -f set fnord $dstdir shift 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` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && 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-tools-4.2/gsharp/0000775000175000017500000000000012642235743017003 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gsharp/ChangeLog0000664000175000017500000001070012413742070020543 0ustar00directhexdirecthex000000000000002010-02-14 Miguel de Icaza * Fix the "Show Gtk" pane feature. Show an expander with a sample. Perhaps we need some samples here. 2009-09-11 Marek Safar * Shell.cs: Replaced Report.Stderr with Evaluator.MessageOutput. 2009-09-07 Miguel de Icaza * Shell.cs: Add poor man's autocompletion to GSharp. I probably should copy the way MonoDevelop pops up the completion window to be right. 2008-12-18 Miguel de Icaza * gtk-gui/Mono.CSharp.Gui.MainWindow.cs: Change hierarchy so that we can show/hide the Gtk# panel without crashing. 2008-11-13 Mike Kestner * MainWindow.cs: break a Gtk# 2.10 dependency 2008-11-06 Miguel de Icaza * MainWindow.cs: Add support for loading settings (window position, pane display and aggregate history here as well). Hook up View/Pane display here. * InteractiveGraphicsBase (PaneContainer): Expose a new property, a Gtk.Container that can be used to quickly prototype code by having a handy container in the same space as the shell. 2008-11-05 Miguel de Icaza Add support for loading files specified on the command line. * Shell.cs: History saving and loading. * Shell.cs: Hook up the GuiStream, which redirects Console Stdout and Stderr to the GUI Shell. Readline still remains unimplemented. touchups to improve the output. 2008-11-05 Miguel de Icaza * Shell.cs: First load the System.Drawing assembly, only then call the using statement on it. 2008-11-02 Miguel de Icaza * Shell.cs: Support multiple data transformations on the result. 2008-11-02 Sebastien Pouliot * Makefile.am: Fix typo that broke make distcheck * MainWindows.cs: Fix compilation. 2008-11-02 Miguel de Icaza * InteractiveGraphicsBase.cs (RegisterRenderHandler, UnregisterRenderHandler): new methods to allow scripts to register their own rendering handlers. (Attached): useful property to determine if we are running on an attached process or not. (MainWindow): pointer to the current main window. * MainWindow.cs: Add support for loading startup files. * Main.cs: Move bitmap rendering here, to split it out from the Shell. * Shell.c: Now can use any provided hook to render graphics on the screen. 2008-10-31 Sandy Armstrong * gsharp.desktop.in: Add .desktop file for gsharp. Name/Comment/GenericName could use some review, and no Icon is set yet. * Makefile.am: Support for .desktop file. 2008-10-24 Miguel de Icaza * Shell.cs: Added history support. 2008-10-21 Sebastien Pouliot * Makefile.am: Remove gsharp.exe[.mdb] at clean-time. Fix "make distcheck" 2008-10-09 Marek Habersack * Makefile.am (gsharp_sources): added InteractiveGraphicsBase.cs and SysDrawing.cs. (assemblies): add reference to System.Drawing 2008-10-08 Miguel de Icaza * Shell.cs: Loads System.Drawing and special cases rendering of Bitmaps. * InteractiveGraphicsBase.cs: A new base class for interactive code, provides a cute and simple Plot() function for interactive use. * SysDrawing.cs: Integration between System.Drawing and Gtk# 2008-10-09 Daniel Nauck * Makefile.am: fix makefile 2008-10-09 Daniel Nauck * gsharp.in: add start script 2008-10-09 Daniel Nauck * Makefile.am: fix makefile 2008-09-28 Miguel de Icaza * History.cs: Remove history, will implement a different system than the bash-like system. This model does not match. * Main.cs: Use a cool trick from Alan McGovern to guess whether the host application had Gtk running or not. 2008-09-28 Miguel de Icaza * MainWindow.cs: New dialog box, based on Paolo's dialog box. * gtk-gui/Mono.CSharp.Gui.MainWindow.cs: Add support for injecting ourselves into a process. * Main.cs: Add support for injecting the code into the target process. 2008-09-28 Miguel de Icaza 2008-09-28 Miguel de Icaza Added new files for a GUI Gtk# csharp command line interpreter, based on Aaron's BooShell for Banshee and the `csharp' command line tool. The idea is to turn this into a module that can be attached into Gtk# applications. mono-tools-4.2/gsharp/gsharp.exe.config.in0000664000175000017500000000017412413742070022635 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gsharp/Main.cs0000664000175000017500000000750412413742070020214 0ustar00directhexdirecthex00000000000000// Main.cs created with MonoDevelop // User: miguel at 10:22 PM 9/27/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // using System; using Gtk; using System.Threading; using System.Diagnostics; using System.Reflection; using Mono.Options; using System.Collections.Generic; using System.IO; namespace Mono.CSharp.Gui { class MainClass { public static bool Attached; public static bool HostHasGtkRunning; public static bool Debug; static Evaluator evaluator; public static void ShowHelp (OptionSet p) { Console.WriteLine ("Usage it: gsharp [--agent] [file1 [fileN]]"); p.WriteOptionDescriptions (Console.Out); } static void ResetOutput () { var stdout = new StreamWriter (Console.OpenStandardOutput ()) { AutoFlush = true }; var stderr = new StreamWriter (Console.OpenStandardError ()) { AutoFlush = true }; Console.SetOut (stdout); Console.SetError (stderr); } public static void Main (string[] args) { bool agent = false; OptionSet p = null; p = new OptionSet () { { "agent", "Start up as an agent", f => agent = f != null }, { "help", "Shows the help", f => { ShowHelp (p); Environment.Exit (0); } }, { "debug", "Runs in debug mode, does not redirect IO to the window", f => Debug = true } }; List extra = null; try { extra = p.Parse (args); } catch (OptionException) { ShowHelp (p); } if (agent) StartAgent (); else Start ("C# InteractiveBase Shell", extra); } static void AssemblyLoaded (object sender, AssemblyLoadEventArgs e) { evaluator.ReferenceAssembly (e.LoadedAssembly); } internal static object RenderBitmaps (object o) { System.Drawing.Bitmap bitmap = o as System.Drawing.Bitmap; if (bitmap == null) return null; return new BitmapWidget (bitmap); } public static void StartAgent () { Attached = true; // First, try to detect if Gtk.Application.Run is running, // to determine whether we need to run a mainloop oursvels or not. // // This test is not bullet proof, its just a simple guess. // // Thanks to Alan McGovern for this brilliant hack. // ManualResetEvent handle = new ManualResetEvent(false); Gtk.Application.Invoke (delegate { handle.Set (); }); HostHasGtkRunning = handle.WaitOne (3000, true); InteractiveGraphicsBase.Attached = true; Gtk.Application.Invoke (delegate { try { evaluator = new Evaluator (new CompilerContext (new CompilerSettings (), new ConsoleReportPrinter ())); } catch { return; } try { // Add all assemblies loaded later AppDomain.CurrentDomain.AssemblyLoad += AssemblyLoaded; // Add all currently loaded assemblies foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) evaluator.ReferenceAssembly (a); Start (String.Format ("Attached C# Interactive Shell at Process {0}", Process.GetCurrentProcess ().Id), null); } finally { AppDomain.CurrentDomain.AssemblyLoad -= AssemblyLoaded; } }); } public static void Start (string title, List files) { if (!HostHasGtkRunning) Application.Init (); InteractiveGraphicsBase.RegisterTransformHandler (RenderBitmaps); MainWindow m = new MainWindow (); InteractiveGraphicsBase.MainWindow = m; InteractiveGraphicsBase.PaneContainer = m.PaneContainer; m.Title = title; m.LoadStartupFiles (); if (files != null) m.LoadFiles (files, false); m.ShowAll (); if (!HostHasGtkRunning){ try { GLib.ExceptionManager.UnhandledException += delegate (GLib.UnhandledExceptionArgs a) { ResetOutput (); Console.WriteLine ("Application terminating: " + a.ExceptionObject); }; Application.Run (); } catch (Exception e) { ResetOutput (); throw; } } } } } mono-tools-4.2/gsharp/Shell.cs0000664000175000017500000003763612413742070020410 0ustar00directhexdirecthex00000000000000/*************************************************************************** * CSharpShell.cs, based on the BooShell.cs from Banshee. * * Copyright (C) 2006-2008 Novell, Inc. * Written by Aaron Bockover . * Miguel de Icaza (miguel@gnome.org). * * Based on ShellTextView.boo in the MonoDevelop Boo Binding * originally authored by Peter Johanson ****************************************************************************/ /* 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 System.Diagnostics; using System.Text; using System.Text.RegularExpressions; using System.Collections.Generic; using System.Collections; using System.IO; using Gtk; using Mono.CSharp; using System.ComponentModel; using System.Runtime.InteropServices; using System.Xml.Linq; using System.Linq; namespace Mono.CSharp.Gui { [ToolboxItem (true)] public class Shell : TextView { TextMark end_of_last_processing; string expr; Evaluator evaluator; CompilerContext context; List history = new List (); int history_cursor; MainWindow container; public MainWindow Container { get { return container; }} public Shell(MainWindow container) : base() { this.container = container; WrapMode = WrapMode.Word; CreateTags (); Pango.FontDescription font_description = new Pango.FontDescription(); font_description.Family = "Monospace"; ModifyFont(font_description); TextIter end = Buffer.EndIter; Buffer.InsertWithTagsByName (ref end, "Mono C# Shell, type 'help;' for help\n\nEnter statements or expressions below.\n", "Comment"); ShowPrompt (false); context = new CompilerContext (new CompilerSettings (), new ConsoleReportPrinter ()); evaluator = new Evaluator (context); evaluator.DescribeTypeExpressions = true; evaluator.InteractiveBaseClass = typeof (InteractiveGraphicsBase); evaluator.Run ("LoadAssembly (\"System.Drawing\");"); evaluator.Run ("using System; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Drawing;"); if (!MainClass.Debug){ GuiStream error_stream = new GuiStream ("Error", (x, y) => Output (x, y)); StreamWriter gui_output = new StreamWriter (error_stream); gui_output.AutoFlush = true; Console.SetError (gui_output); GuiStream stdout_stream = new GuiStream ("Stdout", (x, y) => Output (x, y)); gui_output = new StreamWriter (stdout_stream); gui_output.AutoFlush = true; Console.SetOut (gui_output); } } void CreateTags () { TextTag freeze_tag = new TextTag("Freezer") { Editable = false }; Buffer.TagTable.Add(freeze_tag); TextTag prompt_tag = new TextTag("Prompt") { Foreground = "blue", //Background = "#f8f8f8", Weight = Pango.Weight.Bold }; Buffer.TagTable.Add(prompt_tag); TextTag prompt_continuation_tag = new TextTag("PromptContinuation") { Foreground = "orange", //Background = "#f8f8f8", Weight = Pango.Weight.Bold }; Buffer.TagTable.Add(prompt_continuation_tag); TextTag error_tag = new TextTag("Error") { Foreground = "red" }; Buffer.TagTable.Add(error_tag); TextTag stdout_tag = new TextTag("Stdout") { Foreground = "#006600" }; Buffer.TagTable.Add(stdout_tag); TextTag comment = new TextTag ("Comment") { Foreground = "#3f7f5f" }; Buffer.TagTable.Add (comment); } public event EventHandler QuitRequested; // // Returns true if the line is complete, so that the line can be entered // into the history, false if this was partial // public bool Evaluate (string s) { string res = null; object result; bool result_set; StringWriter errorwriter = new StringWriter (); var old_printer = context.Report.SetPrinter (new StreamReportPrinter (errorwriter)); try { res = evaluator.Evaluate (s, out result, out result_set); } catch (Exception e){ expr = null; ShowError (e.ToString ()); ShowPrompt (true, false); return true; } finally { context.Report.SetPrinter (old_printer); } // Partial input if (res != null){ ShowPrompt (false, true); return false; } string error = errorwriter.ToString (); if (error.Length > 0){ ShowError (error); ShowPrompt (false, false); } else { if (result_set){ ShowResult (result); ShowPrompt (true, false); } else ShowPrompt (false, false); } expr = null; return true; } string GetCurrentExpression () { string input = InputLine; return expr == null ? input : expr + "\n" + input; } [Conditional("DEBUG_HISTORY")] void DumpHistory () { for (int i = 0; i < history.Count; i++) Console.WriteLine ("{0} {1}: {2}", i == history_cursor ? "==>" : " ", i, history [i]); Console.WriteLine ("--- {0} --- ", history_cursor); } protected override bool OnKeyPressEvent(Gdk.EventKey evnt) { if(Cursor.Compare (InputLineBegin) < 0) { Buffer.MoveMark(Buffer.SelectionBound, InputLineEnd); Buffer.MoveMark(Buffer.InsertMark, InputLineEnd); } switch (evnt.Key){ case Gdk.Key.Return: case Gdk.Key.KP_Enter: string input_line = InputLine; history [history.Count-1] = input_line; history_cursor = history.Count; string expr_copy = expr = GetCurrentExpression (); // Insert a new line before we evaluate. TextIter end = Buffer.EndIter; Buffer.InsertWithTagsByName (ref end, "\n", "Stdout"); if (Evaluate (expr)){ if (expr_copy != input_line){ history.Add (expr_copy); history_cursor = history.Count; } } history.Add (""); DumpHistory (); if (InteractiveBase.QuitRequested && QuitRequested != null) QuitRequested (this, EventArgs.Empty); return true; case Gdk.Key.Up: if (history_cursor == 0){ DumpHistory (); return true; } string input = InputLine; if (!String.IsNullOrEmpty (input)){ DumpHistory (); history [history_cursor] = input; } history_cursor--; InputLine = (string) history [history_cursor]; DumpHistory (); return true; case Gdk.Key.Down: if (history_cursor+1 >= history.Count){ DumpHistory (); return true; } history_cursor++; InputLine = (string) history [history_cursor]; DumpHistory (); return true; case Gdk.Key.Left: if(Cursor.Compare(InputLineBegin) <= 0) { return true; } break; case Gdk.Key.Home: Buffer.MoveMark(Buffer.InsertMark, InputLineBegin); if((evnt.State & Gdk.ModifierType.ShiftMask) != Gdk.ModifierType.ShiftMask) { Buffer.MoveMark(Buffer.SelectionBound, InputLineBegin); } return true; case Gdk.Key.Tab: string saved_text = InputLine; string prefix; string [] completions = evaluator.GetCompletions (LineUntilCursor, out prefix); if (completions == null) return true; if (completions.Length == 1){ TextIter cursor = Cursor; Buffer.Insert (ref cursor, completions [0]); return true; } Console.WriteLine (); foreach (var s in completions){ Console.Write (prefix); Console.Write (s); Console.Write (" "); } // Insert a new line before we evaluate. end = Buffer.EndIter; Buffer.InsertWithTagsByName (ref end, "\n", "Stdout"); ShowPrompt (false); InputLine = saved_text; #if false Gtk.TextIter start = Cursor; if (prefix.Length != 0) MoveVisually (ref start, -prefix.Length); int x, y; GdkWindow.GetOrigin (out x, out y); var r = GetIterLocation (start); x += r.X; y += r.Y; var w = new Gtk.Window (WindowType.Popup); w.SetUposition (x, y); w.SetUsize (100, 100); foreach (var s in completions){ Console.WriteLine ("{0}[{1}]", prefix, s); } w.ShowAll (); Console.WriteLine ("Position: x={0} y={1}", x + r.X, y +r.Y); #endif return true; default: break; } return base.OnKeyPressEvent(evnt); } public void ShowPrompt(bool newline) { ShowPrompt (newline, false); } private void ShowPrompt (bool newline, bool continuation) { TextIter end_iter = Buffer.EndIter; if(newline) { Buffer.Insert(ref end_iter, "\n"); } string prompt = continuation ? InteractiveBase.ContinuationPrompt : InteractiveBase.Prompt; Buffer.Insert(ref end_iter, prompt); Buffer.PlaceCursor(Buffer.EndIter); ScrollMarkOnscreen(Buffer.InsertMark); end_of_last_processing = Buffer.CreateMark(null, Buffer.EndIter, true); Buffer.ApplyTag(Buffer.TagTable.Lookup("Freezer"), Buffer.StartIter, InputLineBegin); TextIter prompt_start_iter = InputLineBegin; prompt_start_iter.LineIndex -= prompt.Length; TextIter prompt_end_iter = InputLineBegin; prompt_end_iter.LineIndex -= 1; Buffer.ApplyTag(Buffer.TagTable.Lookup(continuation ? "PromptContinuation" : "Prompt"), prompt_start_iter, prompt_end_iter); } public void Output (string kind, string s) { TextIter end = Buffer.EndIter; Buffer.InsertWithTagsByName (ref end, s, kind); } public void ShowResult (object res) { TextIter end = Buffer.EndIter; var handlers = new List (InteractiveGraphicsBase.type_handlers); //object original = res; bool retry; do { retry = false; foreach (var render_handler in handlers){ object transformed = render_handler (res); if (transformed == null || transformed == res) continue; if (transformed is Gtk.Widget){ Gtk.Widget w = (Gtk.Widget) transformed; TextChildAnchor anchor = Buffer.CreateChildAnchor (ref end); w.Show (); AddChildAtAnchor (w, anchor); return; } else { res = transformed; handlers.Remove (render_handler); retry = true; break; } } } while (retry && handlers.Count > 0); StringWriter pretty = new StringWriter (); try { PrettyPrint (pretty, res); } catch (Exception e) { Console.WriteLine (e); } Buffer.InsertWithTagsByName (ref end, pretty.ToString (), "Stdout"); } public void ShowError (string err) { TextIter end = Buffer.EndIter; Buffer.InsertWithTagsByName (ref end, err, "Error"); } TextIter InputLineBegin { get { return Buffer.GetIterAtMark(end_of_last_processing); } } TextIter InputLineEnd { get { return Buffer.EndIter; } } TextIter Cursor { get { return Buffer.GetIterAtMark(Buffer.InsertMark); } } public Evaluator Evaluator { get { return evaluator; } } string InputLine { get { return Buffer.GetText(InputLineBegin, InputLineEnd, false); } set { TextIter start = InputLineBegin; TextIter end = InputLineEnd; Buffer.Delete(ref start, ref end); start = InputLineBegin; Buffer.Insert(ref start, value); ScrollMarkOnscreen(Buffer.InsertMark); } } string LineUntilCursor { get { return Buffer.GetText (InputLineBegin, Cursor, false); } } static void p (TextWriter output, string s) { output.Write (s); } static string EscapeString (string s) { return s.Replace ("\"", "\\\""); } static void EscapeChar (TextWriter output, char c) { if (c == '\''){ output.Write ("'\\''"); return; } if (c > 32){ output.Write ("'{0}'", c); return; } switch (c){ case '\a': output.Write ("'\\a'"); break; case '\b': output.Write ("'\\b'"); break; case '\n': output.Write ("'\\n'"); break; case '\v': output.Write ("'\\v'"); break; case '\r': output.Write ("'\\r'"); break; case '\f': output.Write ("'\\f'"); break; case '\t': output.Write ("'\\t"); break; default: output.Write ("'\\x{0:x}", (int) c); break; } } internal XElement SaveHistory () { var doc = new XElement ( "history", from x in history select new XElement ("item", x)); return doc; } internal void LoadHistory (IEnumerable items) { if (items == null){ history.Add (""); return; } foreach (var e in items){ string s = e.Value; if (s == null || s.Length == 0) continue; history.Add (s); } history.Add (""); history_cursor = history.Count-1; } internal static void PrettyPrint (TextWriter output, object result) { if (result == null){ p (output, "null"); return; } if (result is Array){ Array a = (Array) result; p (output, "{ "); int top = a.GetUpperBound (0); for (int i = a.GetLowerBound (0); i <= top; i++){ PrettyPrint (output, a.GetValue (i)); if (i != top) p (output, ", "); } p (output, " }"); } else if (result is bool){ if ((bool) result) p (output, "true"); else p (output, "false"); } else if (result is string){ p (output, String.Format ("\"{0}\"", EscapeString ((string)result))); } else if (result is IDictionary){ IDictionary dict = (IDictionary) result; int top = dict.Count, count = 0; p (output, "{"); foreach (DictionaryEntry entry in dict){ count++; p (output, "{ "); try { PrettyPrint (output, entry.Key); } catch { p (output, ""); } p (output, ", "); try { PrettyPrint (output, entry.Value); } catch { p (output, ""); } if (count != top) p (output, " }, "); else p (output, " }"); } p (output, "}"); } else if (result is IEnumerable) { int i = 0; p (output, "{ "); try { foreach (object item in (IEnumerable) result) { if (i++ != 0) p (output, ", "); PrettyPrint (output, item); } } catch { p (output, ""); } p (output, " }"); } else if (result is char){ EscapeChar (output, (char) result); } else { try { p (output, result.ToString ()); } catch { p (output, ""); } } } } public class GuiStream : Stream { string kind; Action callback; public GuiStream (string k, Action cb) { kind = k; callback = cb; } public override bool CanRead { get { return false; } } public override bool CanSeek { get { return false; } } public override bool CanWrite { get { return true; } } public override long Length { get { return 0; } } public override long Position { get { return 0; } set {} } public override void Flush () { } public override int Read ([In,Out] byte[] buffer, int offset, int count) { return -1; } public override long Seek (long offset, SeekOrigin origin) { return 0; } public override void SetLength (long value) { } public override void Write (byte[] buffer, int offset, int count) { callback (kind, Encoding.UTF8.GetString (buffer, offset, count)); } } } mono-tools-4.2/gsharp/Options.cs0000664000175000017500000007710612413742070020770 0ustar00directhexdirecthex00000000000000// // Options.cs // // Authors: // Jonathan Pryor // // Copyright (C) 2008 Novell (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. // // Compile With: // gmcs -debug+ -r:System.Core Options.cs -o:NDesk.Options.dll // gmcs -debug+ -d:LINQ -r:System.Core Options.cs -o:NDesk.Options.dll // // The LINQ version just changes the implementation of // OptionSet.Parse(IEnumerable), and confers no semantic changes. // // A Getopt::Long-inspired option parsing library for C#. // // NDesk.Options.OptionSet is built upon a key/value table, where the // key is a option format string and the value is a delegate that is // invoked when the format string is matched. // // Option format strings: // Regex-like BNF Grammar: // name: .+ // type: [=:] // sep: ( [^{}]+ | '{' .+ '}' )? // aliases: ( name type sep ) ( '|' name type sep )* // // Each '|'-delimited name is an alias for the associated action. If the // format string ends in a '=', it has a required value. If the format // string ends in a ':', it has an optional value. If neither '=' or ':' // is present, no value is supported. `=' or `:' need only be defined on one // alias, but if they are provided on more than one they must be consistent. // // Each alias portion may also end with a "key/value separator", which is used // to split option values if the option accepts > 1 value. If not specified, // it defaults to '=' and ':'. If specified, it can be any character except // '{' and '}' OR the *string* between '{' and '}'. If no separator should be // used (i.e. the separate values should be distinct arguments), then "{}" // should be used as the separator. // // Options are extracted either from the current option by looking for // the option name followed by an '=' or ':', or is taken from the // following option IFF: // - The current option does not contain a '=' or a ':' // - The current option requires a value (i.e. not a Option type of ':') // // The `name' used in the option format string does NOT include any leading // option indicator, such as '-', '--', or '/'. All three of these are // permitted/required on any named option. // // Option bundling is permitted so long as: // - '-' is used to start the option group // - all of the bundled options are a single character // - at most one of the bundled options accepts a value, and the value // provided starts from the next character to the end of the string. // // This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value' // as '-Dname=value'. // // Option processing is disabled by specifying "--". All options after "--" // are returned by OptionSet.Parse() unchanged and unprocessed. // // Unprocessed options are returned from OptionSet.Parse(). // // Examples: // int verbose = 0; // OptionSet p = new OptionSet () // .Add ("v", v => ++verbose) // .Add ("name=|value=", v => Console.WriteLine (v)); // p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"}); // // The above would parse the argument string array, and would invoke the // lambda expression three times, setting `verbose' to 3 when complete. // It would also print out "A" and "B" to standard output. // The returned array would contain the string "extra". // // C# 3.0 collection initializers are supported and encouraged: // var p = new OptionSet () { // { "h|?|help", v => ShowHelp () }, // }; // // System.ComponentModel.TypeConverter is also supported, allowing the use of // custom data types in the callback type; TypeConverter.ConvertFromString() // is used to convert the value option to an instance of the specified // type: // // var p = new OptionSet () { // { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) }, // }; // // Random other tidbits: // - Boolean options (those w/o '=' or ':' in the option format string) // are explicitly enabled if they are followed with '+', and explicitly // disabled if they are followed with '-': // string a = null; // var p = new OptionSet () { // { "a", s => a = s }, // }; // p.Parse (new string[]{"-a"}); // sets v != null // p.Parse (new string[]{"-a+"}); // sets v != null // p.Parse (new string[]{"-a-"}); // sets v == null // using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Globalization; using System.IO; using System.Runtime.Serialization; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; #if LINQ using System.Linq; #endif #if TEST using NDesk.Options; #endif #if NDESK_OPTIONS namespace NDesk.Options #else namespace Mono.Options #endif { public class OptionValueCollection : IList, IList { List values = new List (); OptionContext c; internal OptionValueCollection (OptionContext c) { this.c = c; } #region ICollection void ICollection.CopyTo (Array array, int index) {(values as ICollection).CopyTo (array, index);} bool ICollection.IsSynchronized {get {return (values as ICollection).IsSynchronized;}} object ICollection.SyncRoot {get {return (values as ICollection).SyncRoot;}} #endregion #region ICollection public void Add (string item) {values.Add (item);} public void Clear () {values.Clear ();} public bool Contains (string item) {return values.Contains (item);} public void CopyTo (string[] array, int arrayIndex) {values.CopyTo (array, arrayIndex);} public bool Remove (string item) {return values.Remove (item);} public int Count {get {return values.Count;}} public bool IsReadOnly {get {return false;}} #endregion #region IEnumerable IEnumerator IEnumerable.GetEnumerator () {return values.GetEnumerator ();} #endregion #region IEnumerable public IEnumerator GetEnumerator () {return values.GetEnumerator ();} #endregion #region IList int IList.Add (object value) {return (values as IList).Add (value);} bool IList.Contains (object value) {return (values as IList).Contains (value);} int IList.IndexOf (object value) {return (values as IList).IndexOf (value);} void IList.Insert (int index, object value) {(values as IList).Insert (index, value);} void IList.Remove (object value) {(values as IList).Remove (value);} void IList.RemoveAt (int index) {(values as IList).RemoveAt (index);} bool IList.IsFixedSize {get {return false;}} object IList.this [int index] {get {return this [index];} set {(values as IList)[index] = value;}} #endregion #region IList public int IndexOf (string item) {return values.IndexOf (item);} public void Insert (int index, string item) {values.Insert (index, item);} public void RemoveAt (int index) {values.RemoveAt (index);} private void AssertValid (int index) { if (c.Option == null) throw new InvalidOperationException ("OptionContext.Option is null."); if (index >= c.Option.MaxValueCount) throw new ArgumentOutOfRangeException ("index"); if (c.Option.OptionValueType == OptionValueType.Required && index >= values.Count) throw new OptionException (string.Format ( c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName), c.OptionName); } public string this [int index] { get { AssertValid (index); return index >= values.Count ? null : values [index]; } set { values [index] = value; } } #endregion public List ToList () { return new List (values); } public string[] ToArray () { return values.ToArray (); } public override string ToString () { return string.Join (", ", values.ToArray ()); } } public class OptionContext { private Option option; private string name; private int index; private OptionSet set; private OptionValueCollection c; public OptionContext (OptionSet set) { this.set = set; this.c = new OptionValueCollection (this); } public Option Option { get {return option;} set {option = value;} } public string OptionName { get {return name;} set {name = value;} } public int OptionIndex { get {return index;} set {index = value;} } public OptionSet OptionSet { get {return set;} } public OptionValueCollection OptionValues { get {return c;} } } public enum OptionValueType { None, Optional, Required, } public abstract class Option { string prototype, description; string[] names; OptionValueType type; int count; string[] separators; protected Option (string prototype, string description) : this (prototype, description, 1) { } protected Option (string prototype, string description, int maxValueCount) { if (prototype == null) throw new ArgumentNullException ("prototype"); if (prototype.Length == 0) throw new ArgumentException ("Cannot be the empty string.", "prototype"); if (maxValueCount < 0) throw new ArgumentOutOfRangeException ("maxValueCount"); this.prototype = prototype; this.names = prototype.Split ('|'); this.description = description; this.count = maxValueCount; this.type = ParsePrototype (); if (this.count == 0 && type != OptionValueType.None) throw new ArgumentException ( "Cannot provide maxValueCount of 0 for OptionValueType.Required or " + "OptionValueType.Optional.", "maxValueCount"); if (this.type == OptionValueType.None && maxValueCount > 1) throw new ArgumentException ( string.Format ("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount), "maxValueCount"); if (Array.IndexOf (names, "<>") >= 0 && ((names.Length == 1 && this.type != OptionValueType.None) || (names.Length > 1 && this.MaxValueCount > 1))) throw new ArgumentException ( "The default option handler '<>' cannot require values.", "prototype"); } public string Prototype {get {return prototype;}} public string Description {get {return description;}} public OptionValueType OptionValueType {get {return type;}} public int MaxValueCount {get {return count;}} public string[] GetNames () { return (string[]) names.Clone (); } public string[] GetValueSeparators () { if (separators == null) return new string [0]; return (string[]) separators.Clone (); } protected static T Parse (string value, OptionContext c) { Type tt = typeof (T); bool nullable = tt.IsValueType && tt.IsGenericType && !tt.IsGenericTypeDefinition && tt.GetGenericTypeDefinition () == typeof (Nullable<>); Type targetType = nullable ? tt.GetGenericArguments () [0] : typeof (T); TypeConverter conv = TypeDescriptor.GetConverter (targetType); T t = default (T); try { if (value != null) t = (T) conv.ConvertFromString (value); } catch (Exception e) { throw new OptionException ( string.Format ( c.OptionSet.MessageLocalizer ("Could not convert string `{0}' to type {1} for option `{2}'."), value, targetType.Name, c.OptionName), c.OptionName, e); } return t; } internal string[] Names {get {return names;}} internal string[] ValueSeparators {get {return separators;}} static readonly char[] NameTerminator = new char[]{'=', ':'}; private OptionValueType ParsePrototype () { char type = '\0'; List seps = new List (); for (int i = 0; i < names.Length; ++i) { string name = names [i]; if (name.Length == 0) throw new ArgumentException ("Empty option names are not supported.", "prototype"); int end = name.IndexOfAny (NameTerminator); if (end == -1) continue; names [i] = name.Substring (0, end); if (type == '\0' || type == name [end]) type = name [end]; else throw new ArgumentException ( string.Format ("Conflicting option types: '{0}' vs. '{1}'.", type, name [end]), "prototype"); AddSeparators (name, end, seps); } if (type == '\0') return OptionValueType.None; if (count <= 1 && seps.Count != 0) throw new ArgumentException ( string.Format ("Cannot provide key/value separators for Options taking {0} value(s).", count), "prototype"); if (count > 1) { if (seps.Count == 0) this.separators = new string[]{":", "="}; else if (seps.Count == 1 && seps [0].Length == 0) this.separators = null; else this.separators = seps.ToArray (); } return type == '=' ? OptionValueType.Required : OptionValueType.Optional; } private static void AddSeparators (string name, int end, ICollection seps) { int start = -1; for (int i = end+1; i < name.Length; ++i) { switch (name [i]) { case '{': if (start != -1) throw new ArgumentException ( string.Format ("Ill-formed name/value separator found in \"{0}\".", name), "prototype"); start = i+1; break; case '}': if (start == -1) throw new ArgumentException ( string.Format ("Ill-formed name/value separator found in \"{0}\".", name), "prototype"); seps.Add (name.Substring (start, i-start)); start = -1; break; default: if (start == -1) seps.Add (name [i].ToString ()); break; } } if (start != -1) throw new ArgumentException ( string.Format ("Ill-formed name/value separator found in \"{0}\".", name), "prototype"); } public void Invoke (OptionContext c) { OnParseComplete (c); c.OptionName = null; c.Option = null; c.OptionValues.Clear (); } protected abstract void OnParseComplete (OptionContext c); public override string ToString () { return Prototype; } } [Serializable] public class OptionException : Exception { private string option; public OptionException () { } public OptionException (string message, string optionName) : base (message) { this.option = optionName; } public OptionException (string message, string optionName, Exception innerException) : base (message, innerException) { this.option = optionName; } protected OptionException (SerializationInfo info, StreamingContext context) : base (info, context) { this.option = info.GetString ("OptionName"); } public string OptionName { get {return this.option;} } [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)] public override void GetObjectData (SerializationInfo info, StreamingContext context) { base.GetObjectData (info, context); info.AddValue ("OptionName", option); } } public delegate void OptionAction (TKey key, TValue value); public class OptionSet : KeyedCollection { public OptionSet () : this (delegate (string f) {return f;}) { } public OptionSet (Converter localizer) { this.localizer = localizer; } Converter localizer; public Converter MessageLocalizer { get {return localizer;} } protected override string GetKeyForItem (Option item) { if (item == null) throw new ArgumentNullException ("option"); if (item.Names != null && item.Names.Length > 0) return item.Names [0]; // This should never happen, as it's invalid for Option to be // constructed w/o any names. throw new InvalidOperationException ("Option has no names!"); } [Obsolete ("Use KeyedCollection.this[string]")] protected Option GetOptionForName (string option) { if (option == null) throw new ArgumentNullException ("option"); try { return base [option]; } catch (KeyNotFoundException) { return null; } } protected override void InsertItem (int index, Option item) { base.InsertItem (index, item); AddImpl (item); } protected override void RemoveItem (int index) { base.RemoveItem (index); Option p = Items [index]; // KeyedCollection.RemoveItem() handles the 0th item for (int i = 1; i < p.Names.Length; ++i) { Dictionary.Remove (p.Names [i]); } } protected override void SetItem (int index, Option item) { base.SetItem (index, item); RemoveItem (index); AddImpl (item); } private void AddImpl (Option option) { if (option == null) throw new ArgumentNullException ("option"); List added = new List (option.Names.Length); try { // KeyedCollection.InsertItem/SetItem handle the 0th name. for (int i = 1; i < option.Names.Length; ++i) { Dictionary.Add (option.Names [i], option); added.Add (option.Names [i]); } } catch (Exception) { foreach (string name in added) Dictionary.Remove (name); throw; } } public new OptionSet Add (Option option) { base.Add (option); return this; } sealed class ActionOption : Option { Action action; public ActionOption (string prototype, string description, int count, Action action) : base (prototype, description, count) { if (action == null) throw new ArgumentNullException ("action"); this.action = action; } protected override void OnParseComplete (OptionContext c) { action (c.OptionValues); } } public OptionSet Add (string prototype, Action action) { return Add (prototype, null, action); } public OptionSet Add (string prototype, string description, Action action) { if (action == null) throw new ArgumentNullException ("action"); Option p = new ActionOption (prototype, description, 1, delegate (OptionValueCollection v) { action (v [0]); }); base.Add (p); return this; } public OptionSet Add (string prototype, OptionAction action) { return Add (prototype, null, action); } public OptionSet Add (string prototype, string description, OptionAction action) { if (action == null) throw new ArgumentNullException ("action"); Option p = new ActionOption (prototype, description, 2, delegate (OptionValueCollection v) {action (v [0], v [1]);}); base.Add (p); return this; } sealed class ActionOption : Option { Action action; public ActionOption (string prototype, string description, Action action) : base (prototype, description, 1) { if (action == null) throw new ArgumentNullException ("action"); this.action = action; } protected override void OnParseComplete (OptionContext c) { action (Parse (c.OptionValues [0], c)); } } sealed class ActionOption : Option { OptionAction action; public ActionOption (string prototype, string description, OptionAction action) : base (prototype, description, 2) { if (action == null) throw new ArgumentNullException ("action"); this.action = action; } protected override void OnParseComplete (OptionContext c) { action ( Parse (c.OptionValues [0], c), Parse (c.OptionValues [1], c)); } } public OptionSet Add (string prototype, Action action) { return Add (prototype, null, action); } public OptionSet Add (string prototype, string description, Action action) { return Add (new ActionOption (prototype, description, action)); } public OptionSet Add (string prototype, OptionAction action) { return Add (prototype, null, action); } public OptionSet Add (string prototype, string description, OptionAction action) { return Add (new ActionOption (prototype, description, action)); } protected virtual OptionContext CreateOptionContext () { return new OptionContext (this); } #if LINQ public List Parse (IEnumerable arguments) { bool process = true; OptionContext c = CreateOptionContext (); c.OptionIndex = -1; var def = GetOptionForName ("<>"); var unprocessed = from argument in arguments where ++c.OptionIndex >= 0 && (process || def != null) ? process ? argument == "--" ? (process = false) : !Parse (argument, c) ? def != null ? Unprocessed (null, def, c, argument) : true : false : def != null ? Unprocessed (null, def, c, argument) : true : true select argument; List r = unprocessed.ToList (); if (c.Option != null) c.Option.Invoke (c); return r; } #else public List Parse (IEnumerable arguments) { OptionContext c = CreateOptionContext (); c.OptionIndex = -1; bool process = true; List unprocessed = new List (); Option def = Contains ("<>") ? this ["<>"] : null; foreach (string argument in arguments) { ++c.OptionIndex; if (argument == "--") { process = false; continue; } if (!process) { Unprocessed (unprocessed, def, c, argument); continue; } if (!Parse (argument, c)) Unprocessed (unprocessed, def, c, argument); } if (c.Option != null) c.Option.Invoke (c); return unprocessed; } #endif private static bool Unprocessed (ICollection extra, Option def, OptionContext c, string argument) { if (def == null) { extra.Add (argument); return false; } c.OptionValues.Add (argument); c.Option = def; c.Option.Invoke (c); return false; } private readonly Regex ValueOption = new Regex ( @"^(?--|-|/)(?[^:=]+)((?[:=])(?.*))?$"); protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value) { if (argument == null) throw new ArgumentNullException ("argument"); flag = name = sep = value = null; Match m = ValueOption.Match (argument); if (!m.Success) { return false; } flag = m.Groups ["flag"].Value; name = m.Groups ["name"].Value; if (m.Groups ["sep"].Success && m.Groups ["value"].Success) { sep = m.Groups ["sep"].Value; value = m.Groups ["value"].Value; } return true; } protected virtual bool Parse (string argument, OptionContext c) { if (c.Option != null) { ParseValue (argument, c); return true; } string f, n, s, v; if (!GetOptionParts (argument, out f, out n, out s, out v)) return false; Option p; if (Contains (n)) { p = this [n]; c.OptionName = f + n; c.Option = p; switch (p.OptionValueType) { case OptionValueType.None: c.OptionValues.Add (n); c.Option.Invoke (c); break; case OptionValueType.Optional: case OptionValueType.Required: ParseValue (v, c); break; } return true; } // no match; is it a bool option? if (ParseBool (argument, n, c)) return true; // is it a bundled option? if (ParseBundledValue (f, string.Concat (n + s + v), c)) return true; return false; } private void ParseValue (string option, OptionContext c) { if (option != null) foreach (string o in c.Option.ValueSeparators != null ? option.Split (c.Option.ValueSeparators, StringSplitOptions.None) : new string[]{option}) { c.OptionValues.Add (o); } if (c.OptionValues.Count == c.Option.MaxValueCount || c.Option.OptionValueType == OptionValueType.Optional) c.Option.Invoke (c); else if (c.OptionValues.Count > c.Option.MaxValueCount) { throw new OptionException (localizer (string.Format ( "Error: Found {0} option values when expecting {1}.", c.OptionValues.Count, c.Option.MaxValueCount)), c.OptionName); } } private bool ParseBool (string option, string n, OptionContext c) { Option p; string rn; if (n.Length >= 1 && (n [n.Length-1] == '+' || n [n.Length-1] == '-') && Contains ((rn = n.Substring (0, n.Length-1)))) { p = this [rn]; string v = n [n.Length-1] == '+' ? option : null; c.OptionName = option; c.Option = p; c.OptionValues.Add (v); p.Invoke (c); return true; } return false; } private bool ParseBundledValue (string f, string n, OptionContext c) { if (f != "-") return false; for (int i = 0; i < n.Length; ++i) { Option p; string opt = f + n [i].ToString (); string rn = n [i].ToString (); if (!Contains (rn)) { if (i == 0) return false; throw new OptionException (string.Format (localizer ( "Cannot bundle unregistered option '{0}'."), opt), opt); } p = this [rn]; switch (p.OptionValueType) { case OptionValueType.None: Invoke (c, opt, n, p); break; case OptionValueType.Optional: case OptionValueType.Required: { string v = n.Substring (i+1); c.Option = p; c.OptionName = opt; ParseValue (v.Length != 0 ? v : null, c); return true; } default: throw new InvalidOperationException ("Unknown OptionValueType: " + p.OptionValueType); } } return true; } private static void Invoke (OptionContext c, string name, string value, Option option) { c.OptionName = name; c.Option = option; c.OptionValues.Add (value); option.Invoke (c); } private const int OptionWidth = 29; public void WriteOptionDescriptions (TextWriter o) { foreach (Option p in this) { int written = 0; if (!WriteOptionPrototype (o, p, ref written)) continue; if (written < OptionWidth) o.Write (new string (' ', OptionWidth - written)); else { o.WriteLine (); o.Write (new string (' ', OptionWidth)); } List lines = GetLines (localizer (GetDescription (p.Description))); o.WriteLine (lines [0]); string prefix = new string (' ', OptionWidth+2); for (int i = 1; i < lines.Count; ++i) { o.Write (prefix); o.WriteLine (lines [i]); } } } bool WriteOptionPrototype (TextWriter o, Option p, ref int written) { string[] names = p.Names; int i = GetNextOptionIndex (names, 0); if (i == names.Length) return false; if (names [i].Length == 1) { Write (o, ref written, " -"); Write (o, ref written, names [0]); } else { Write (o, ref written, " --"); Write (o, ref written, names [0]); } for ( i = GetNextOptionIndex (names, i+1); i < names.Length; i = GetNextOptionIndex (names, i+1)) { Write (o, ref written, ", "); Write (o, ref written, names [i].Length == 1 ? "-" : "--"); Write (o, ref written, names [i]); } if (p.OptionValueType == OptionValueType.Optional || p.OptionValueType == OptionValueType.Required) { if (p.OptionValueType == OptionValueType.Optional) { Write (o, ref written, localizer ("[")); } Write (o, ref written, localizer ("=" + GetArgumentName (0, p.MaxValueCount, p.Description))); string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0 ? p.ValueSeparators [0] : " "; for (int c = 1; c < p.MaxValueCount; ++c) { Write (o, ref written, localizer (sep + GetArgumentName (c, p.MaxValueCount, p.Description))); } if (p.OptionValueType == OptionValueType.Optional) { Write (o, ref written, localizer ("]")); } } return true; } static int GetNextOptionIndex (string[] names, int i) { while (i < names.Length && names [i] == "<>") { ++i; } return i; } static void Write (TextWriter o, ref int n, string s) { n += s.Length; o.Write (s); } private static string GetArgumentName (int index, int maxIndex, string description) { if (description == null) return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); string[] nameStart; if (maxIndex == 1) nameStart = new string[]{"{0:", "{"}; else nameStart = new string[]{"{" + index + ":"}; for (int i = 0; i < nameStart.Length; ++i) { int start, j = 0; do { start = description.IndexOf (nameStart [i], j); } while (start >= 0 && j != 0 ? description [j++ - 1] == '{' : false); if (start == -1) continue; int end = description.IndexOf ("}", start); if (end == -1) continue; return description.Substring (start + nameStart [i].Length, end - start - nameStart [i].Length); } return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); } private static string GetDescription (string description) { if (description == null) return string.Empty; StringBuilder sb = new StringBuilder (description.Length); int start = -1; for (int i = 0; i < description.Length; ++i) { switch (description [i]) { case '{': if (i == start) { sb.Append ('{'); start = -1; } else if (start < 0) start = i + 1; break; case '}': if (start < 0) { if ((i+1) == description.Length || description [i+1] != '}') throw new InvalidOperationException ("Invalid option description: " + description); ++i; sb.Append ("}"); } else { sb.Append (description.Substring (start, i - start)); start = -1; } break; case ':': if (start < 0) goto default; start = i + 1; break; default: if (start < 0) sb.Append (description [i]); break; } } return sb.ToString (); } private static List GetLines (string description) { List lines = new List (); if (string.IsNullOrEmpty (description)) { lines.Add (string.Empty); return lines; } int length = 80 - OptionWidth - 2; int start = 0, end; do { end = GetLineEnd (start, length, description); bool cont = false; if (end < description.Length) { char c = description [end]; if (c == '-' || (char.IsWhiteSpace (c) && c != '\n')) ++end; else if (c != '\n') { cont = true; --end; } } lines.Add (description.Substring (start, end - start)); if (cont) { lines [lines.Count-1] += "-"; } start = end; if (start < description.Length && description [start] == '\n') ++start; } while (end < description.Length); return lines; } private static int GetLineEnd (int start, int length, string description) { int end = System.Math.Min (start + length, description.Length); int sep = -1; for (int i = start; i < end; ++i) { switch (description [i]) { case ' ': case '\t': case '\v': case '-': case ',': case '.': case ';': sep = i; break; case '\n': return i; } } if (sep == -1 || end == description.Length) return end; return sep; } } } mono-tools-4.2/gsharp/DescribeType.cs0000664000175000017500000000275712413742070021717 0ustar00directhexdirecthex00000000000000// DescribeType.cs //Authors: ${Author} // // Copyright (c) 2008 [copyright holders] // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.CSharp.Gui { public partial class DescribeType : Gtk.Dialog { public string TypeName { get { return entry1.Text; } } protected virtual void OnEntry1Activated (object sender, System.EventArgs e) { Respond (Gtk.ResponseType.Ok); } public DescribeType() { this.Build(); } } } mono-tools-4.2/gsharp/TypeView.cs0000664000175000017500000000676112413742070021110 0ustar00directhexdirecthex00000000000000// TypeView.cs //Authors: ${Author} // // Copyright (c) 2008 [copyright holders] // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gtk; using Gdk; namespace Mono.CSharp.Gui { [System.ComponentModel.ToolboxItem(true)] public class TypeView : TextView { MainWindow container; public TypeView(MainWindow container) : base () { WrapMode = Gtk.WrapMode.None; CreateTags (); Pango.FontDescription font_description = new Pango.FontDescription(); font_description.Family = "Monospace"; ModifyFont(font_description); this.container = container; } double press_x = -1, press_y = -1; void CreateTags () { TextTag keyword = new TextTag ("keyword") { Weight = Pango.Weight.Bold }; TextTag deftag = new TextTag ("default"){ }; Buffer.TagTable.Add (keyword); Buffer.TagTable.Add (deftag); } string current_tag; Dictionary typetags = new Dictionary (); static int typec; string GetTypeTag (Type t) { if (typetags.ContainsKey (t)){ return typetags [t].Name; } TextTag typetag = new TextTag ("t" + (typec++)){ Foreground = "blue", Weight = Pango.Weight.Bold }; typetag.TextEvent += delegate (object o, TextEventArgs e){ EventButton eb = e.Event as EventButton; if (eb != null && eb.Button == 1){ if (eb.Type == EventType.ButtonPress){ press_x = eb.X; press_y = eb.Y; } else if (eb.Type == EventType.ButtonRelease){ if (press_x != -1){ int dx = System.Math.Abs ((int)(eb.X - press_x)); int dy = System.Math.Abs ((int)(eb.Y - press_y)); if (dx < 8 && dy < 8){ container.Describe (t); } } press_x = -1; } } }; Buffer.TagTable.Add (typetag); return typetag.Name; } public void ShowType (Type t) { Buffer.Clear (); current_tag = "default"; GuiStream guistream = new GuiStream (null, (x,y) => { TextIter end = Buffer.EndIter; Buffer.InsertWithTagsByName (ref end, y, current_tag); }); StreamWriter writer = new StreamWriter (guistream); Outline outliner = new Outline (t, writer, true, false, false); outliner.OutlineNotificationEvent += delegate (int kind, object value) { switch (kind){ case 0: current_tag = "default"; break; case 1: current_tag = GetTypeTag ((Type) value); break; } }; outliner.OutlineType (); writer.Flush (); } } } mono-tools-4.2/gsharp/Makefile.in0000664000175000017500000004606212642235732021056 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gsharp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = gsharp gsharp.exe.config 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)$(desktopdir)" \ "$(DESTDIR)$(gsharpdir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(desktop_DATA) $(gsharp_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/gsharp.exe.config.in \ $(srcdir)/gsharp.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ gsharpdir = $(prefix)/lib/gsharp @DMCS_PRESENT_FALSE@COMPILER = $(GMCS) @DMCS_PRESENT_TRUE@COMPILER = $(DMCS) bin_SCRIPTS = gsharp gsharp_DATA = gsharp.exe gsharp.exe.config desktopdir = $(datadir)/applications desktop_DATA = gsharp.desktop packages = -pkg:gtk-sharp-2.0 -pkg:glib-sharp-2.0 assemblies = -r:System -r:Mono.CSharp -r:Mono.Management -r:Mono.Posix -r:System.Drawing -r:System.Xml.Linq -r:System.Core -r:System.Xml gsharp_sources = \ $(srcdir)/AssemblyInfo.cs \ $(srcdir)/DescribeType.cs \ $(srcdir)/InteractiveGraphicsBase.cs \ $(srcdir)/Main.cs \ $(srcdir)/MainWindow.cs \ $(srcdir)/Options.cs \ $(srcdir)/ProcessSelector.cs \ $(srcdir)/Shell.cs \ $(srcdir)/SysDrawing.cs \ $(srcdir)/TypeView.cs \ $(srcdir)/gtk-gui/generated.cs \ $(srcdir)/gtk-gui/Mono.CSharp.Gui.MainWindow.cs \ $(srcdir)/gtk-gui/Mono.CSharp.Gui.ProcessSelector.cs \ $(srcdir)/gtk-gui/Mono.CSharp.Gui.DescribeType.cs \ $(srcdir)/outline.cs EXTRA_DIST = $(gsharp_sources) gsharp.in $(desktop_DATA).in close.png gsharp.exe.config.in CLEANFILES = $(gsharp_DATA) $(gsharp_DATA).mdb $(desktop_DATA) 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) --gnu gsharp/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gsharp/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): gsharp: $(top_builddir)/config.status $(srcdir)/gsharp.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gsharp.exe.config: $(top_builddir)/config.status $(srcdir)/gsharp.exe.config.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-desktopDATA: $(desktop_DATA) @$(NORMAL_INSTALL) @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(desktopdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(desktopdir)" || 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)$(desktopdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \ done uninstall-desktopDATA: @$(NORMAL_UNINSTALL) @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(desktopdir)'; $(am__uninstall_files_from_dir) install-gsharpDATA: $(gsharp_DATA) @$(NORMAL_INSTALL) @list='$(gsharp_DATA)'; test -n "$(gsharpdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(gsharpdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(gsharpdir)" || 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)$(gsharpdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(gsharpdir)" || exit $$?; \ done uninstall-gsharpDATA: @$(NORMAL_UNINSTALL) @list='$(gsharp_DATA)'; test -n "$(gsharpdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(gsharpdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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)$(desktopdir)" "$(DESTDIR)$(gsharpdir)"; 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) 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-desktopDATA install-gsharpDATA 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-desktopDATA \ uninstall-gsharpDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-binSCRIPTS \ install-data install-data-am install-desktopDATA install-dvi \ install-dvi-am install-exec install-exec-am install-gsharpDATA \ 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 tags-am \ uninstall uninstall-am uninstall-binSCRIPTS \ uninstall-desktopDATA uninstall-gsharpDATA .PRECIOUS: Makefile gsharp.exe: $(gsharp_sources) $(COMPILER) -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG -target:exe -out:gsharp.exe $(gsharp_sources) $(packages) $(assemblies) -resource:$(srcdir)/close.png,close.png $(desktop_DATA): $(desktop_DATA).in sed -e "s|\@bindir\@|$(bindir)|" $< > $@ # 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-tools-4.2/gsharp/gsharp.in0000664000175000017500000000011612413742070020605 0ustar00directhexdirecthex00000000000000#!/bin/sh exec @RUNTIME@ $MONO_OPTIONS "@prefix@/lib/gsharp/gsharp.exe" "$@" mono-tools-4.2/gsharp/outline.cs0000664000175000017500000006005312413742070021005 0ustar00directhexdirecthex00000000000000// // outline -- support for rendering in monop // Some code stolen from updater.cs in monodoc. // // Authors: // Ben Maurer (bmaurer@users.sourceforge.net) // // (C) 2004 Ben Maurer // // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.CodeDom.Compiler; using System.IO; using System.Text; namespace Mono.CSharp { public class Outline { bool declared_only; bool show_private; bool filter_obsolete; IndentedTextWriter o; Type t; public delegate void NotificationEvent (int kind, object value); public event NotificationEvent OutlineNotificationEvent; public Outline (Type t, TextWriter output, bool declared_only, bool show_private, bool filter_obsolete) { this.t = t; this.o = new IndentedTextWriter (output, "\t"); this.declared_only = declared_only; this.show_private = show_private; this.filter_obsolete = filter_obsolete; } public void OutlineType () { bool first, ns = !String.IsNullOrEmpty (t.Namespace); if (ns){ o.WriteLine ("namespace " + t.Namespace + " {"); o.Indent++; ns = true; } OutlineAttributes (); o.Write (GetTypeVisibility (t)); if (t.IsClass && !t.IsSubclassOf (typeof (System.MulticastDelegate))) { if (t.IsSealed) o.Write (t.IsAbstract ? " static" : " sealed"); else if (t.IsAbstract) o.Write (" abstract"); } o.Write (" "); o.Write (GetTypeKind (t)); o.Write (" "); Type [] interfaces = (Type []) Comparer.Sort (TypeGetInterfaces (t, declared_only)); Type parent = t.BaseType; if (t.IsSubclassOf (typeof (System.MulticastDelegate))) { MethodInfo method; method = t.GetMethod ("Invoke"); RenderType (method.ReturnType); o.Write (" "); o.Write (GetTypeName (t)); o.Write (" ("); OutlineParams (method.GetParameters ()); o.Write (")"); #if NET_2_0 WriteGenericConstraints (t.GetGenericArguments ()); #endif o.WriteLine (";"); return; } o.Write (GetTypeName (t)); if (((parent != null && parent != typeof (object) && parent != typeof (ValueType)) || interfaces.Length != 0) && ! t.IsEnum) { first = true; o.Write (" : "); if (parent != null && parent != typeof (object) && parent != typeof (ValueType)) { RenderType (parent); first = false; } foreach (Type intf in interfaces) { if (!first) o.Write (", "); first = false; RenderType (intf); } } if (t.IsEnum) { Type underlyingType = System.Enum.GetUnderlyingType (t); if (underlyingType != typeof (int)){ o.Write (" : "); RenderType (underlyingType); } } #if NET_2_0 WriteGenericConstraints (t.GetGenericArguments ()); #endif o.WriteLine (" {"); o.Indent++; if (t.IsEnum) { bool is_first = true; foreach (FieldInfo fi in t.GetFields (BindingFlags.Public | BindingFlags.Static)) { if (! is_first) o.WriteLine (","); is_first = false; o.Write (fi.Name); } o.WriteLine (); o.Indent--; o.WriteLine ("}"); return; } first = true; foreach (ConstructorInfo ci in t.GetConstructors (DefaultFlags)) { if (! ShowMember (ci)) continue; if (first) o.WriteLine (); first = false; OutlineConstructor (ci); o.WriteLine (); } first = true; foreach (MethodInfo m in Comparer.Sort (t.GetMethods (DefaultFlags))) { if (! ShowMember (m)) continue; if ((m.Attributes & MethodAttributes.SpecialName) != 0) continue; if (first) o.WriteLine (); first = false; OutlineMethod (m); o.WriteLine (); } first = true; foreach (MethodInfo m in t.GetMethods (DefaultFlags)) { if (! ShowMember (m)) continue; if ((m.Attributes & MethodAttributes.SpecialName) == 0) continue; if (!(m.Name.StartsWith ("op_"))) continue; if (first) o.WriteLine (); first = false; OutlineOperator (m); o.WriteLine (); } first = true; foreach (PropertyInfo pi in Comparer.Sort (t.GetProperties (DefaultFlags))) { if (! ((pi.CanRead && ShowMember (pi.GetGetMethod (true))) || (pi.CanWrite && ShowMember (pi.GetSetMethod (true))))) continue; if (first) o.WriteLine (); first = false; OutlineProperty (pi); o.WriteLine (); } first = true; foreach (FieldInfo fi in t.GetFields (DefaultFlags)) { if (! ShowMember (fi)) continue; if (first) o.WriteLine (); first = false; OutlineField (fi); o.WriteLine (); } first = true; foreach (EventInfo ei in Comparer.Sort (t.GetEvents (DefaultFlags))) { if (! ShowMember (ei.GetAddMethod (true))) continue; if (first) o.WriteLine (); first = false; OutlineEvent (ei); o.WriteLine (); } first = true; foreach (Type ntype in Comparer.Sort (t.GetNestedTypes (DefaultFlags))) { if (! ShowMember (ntype)) continue; if (first) o.WriteLine (); first = false; new Outline (ntype, o, declared_only, show_private, filter_obsolete).OutlineType (); } o.Indent--; o.WriteLine ("}"); if (ns){ o.Indent--; o.WriteLine ("}"); } } BindingFlags DefaultFlags { get { BindingFlags f = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; if (declared_only) f |= BindingFlags.DeclaredOnly; return f; } } // FIXME: add other interesting attributes? void OutlineAttributes () { if (t.IsSerializable) o.WriteLine ("[Serializable]"); if (t.IsDefined (typeof (System.FlagsAttribute), true)) o.WriteLine ("[Flags]"); if (t.IsDefined (typeof (System.ObsoleteAttribute), true)) o.WriteLine ("[Obsolete]"); } void OutlineEvent (EventInfo ei) { MethodBase accessor = ei.GetAddMethod (true); o.Write (GetMethodVisibility (accessor)); o.Write ("event "); RenderType (ei.EventHandlerType); o.Write (" "); o.Write (ei.Name); o.Write (";"); } void OutlineConstructor (ConstructorInfo ci) { o.Write (GetMethodVisibility (ci)); o.Write (RemoveGenericArity (t.Name)); o.Write (" ("); OutlineParams (ci.GetParameters ()); o.Write (");"); } void OutlineProperty (PropertyInfo pi) { ParameterInfo [] idxp = pi.GetIndexParameters (); MethodBase g = pi.GetGetMethod (true); MethodBase s = pi.GetSetMethod (true); MethodBase accessor = g != null ? g : s; if (pi.CanRead && pi.CanWrite) { // Get the more accessible accessor if ((g.Attributes & MethodAttributes.MemberAccessMask) != (s.Attributes & MethodAttributes.MemberAccessMask)) { if (g.IsPublic) accessor = g; else if (s.IsPublic) accessor = s; else if (g.IsFamilyOrAssembly) accessor = g; else if (s.IsFamilyOrAssembly) accessor = s; else if (g.IsAssembly || g.IsFamily) accessor = g; else if (s.IsAssembly || s.IsFamily) accessor = s; } } o.Write (GetMethodVisibility (accessor)); o.Write (GetMethodModifiers (accessor)); RenderType (pi.PropertyType); o.Write (" "); if (idxp.Length == 0) o.Write (pi.Name); else { o.Write ("this ["); OutlineParams (idxp); o.Write ("]"); } o.WriteLine (" {"); o.Indent ++; if (g != null && ShowMember (g)) { if ((g.Attributes & MethodAttributes.MemberAccessMask) != (accessor.Attributes & MethodAttributes.MemberAccessMask)) o.Write (GetMethodVisibility (g)); o.WriteLine ("get;"); } if (s != null && ShowMember (s)) { if ((s.Attributes & MethodAttributes.MemberAccessMask) != (accessor.Attributes & MethodAttributes.MemberAccessMask)) o.Write (GetMethodVisibility (s)); o.WriteLine ("set;"); } o.Indent --; o.Write ("}"); } void OutlineMethod (MethodInfo mi) { if (MethodIsExplicitIfaceImpl (mi)) { RenderType (mi.ReturnType); o.Write (" "); // MSFT has no way to get the method that we are overriding // from the interface. this would allow us to pretty print // the type name (and be more correct if there compiler // were to do some strange naming thing). } else { o.Write (GetMethodVisibility (mi)); o.Write (GetMethodModifiers (mi)); RenderType (mi.ReturnType); o.Write (" "); } o.Write (mi.Name); #if NET_2_0 o.Write (FormatGenericParams (mi.GetGenericArguments ())); #endif o.Write (" ("); OutlineParams (mi.GetParameters ()); o.Write (")"); #if NET_2_0 WriteGenericConstraints (mi.GetGenericArguments ()); #endif o.Write (";"); } void OutlineOperator (MethodInfo mi) { o.Write (GetMethodVisibility (mi)); o.Write (GetMethodModifiers (mi)); if (mi.Name == "op_Explicit" || mi.Name == "op_Implicit") { o.Write (mi.Name.Substring (3).ToLower ()); o.Write (" operator "); RenderType (mi.ReturnType); } else { RenderType (mi.ReturnType); o.Write (" operator "); o.Write (OperatorFromName (mi.Name)); } o.Write (" ("); OutlineParams (mi.GetParameters ()); o.Write (");"); } void OutlineParams (ParameterInfo [] pi) { int i = 0; foreach (ParameterInfo p in pi) { if (p.ParameterType.IsByRef) { o.Write (p.IsOut ? "out " : "ref "); RenderType (p.ParameterType.GetElementType ()); } else if (p.IsDefined (typeof (ParamArrayAttribute), false)) { o.Write ("params "); RenderType (p.ParameterType); } else { RenderType (p.ParameterType); } o.Write (" "); o.Write (p.Name); if (i + 1 < pi.Length) o.Write (", "); i++; } } void OutlineField (FieldInfo fi) { if (fi.IsPublic) o.Write ("public "); if (fi.IsFamily) o.Write ("protected "); if (fi.IsPrivate) o.Write ("private "); if (fi.IsAssembly) o.Write ("internal "); if (fi.IsLiteral) o.Write ("const "); else if (fi.IsStatic) o.Write ("static "); if (fi.IsInitOnly) o.Write ("readonly "); RenderType (fi.FieldType); o.Write (" "); o.Write (fi.Name); if (fi.IsLiteral) { object v = fi.GetValue (this); // TODO: Escape values here o.Write (" = "); if (v is char) o.Write ("'{0}'", v); else if (v is string) o.Write ("\"{0}\"", v); else o.Write (fi.GetValue (this)); } o.Write (";"); } static string GetMethodVisibility (MethodBase m) { // itnerfaces have no modifiers here if (m.DeclaringType.IsInterface) return ""; if (m.IsPublic) return "public "; if (m.IsFamily) return "protected "; if (m.IsPrivate) return "private "; if (m.IsAssembly) return "internal "; return null; } static string GetMethodModifiers (MethodBase method) { if (method.IsStatic) return "static "; if (method.IsFinal) { // This will happen if you have // class X : IA { // public void A () {} // static void Main () {} // } // interface IA { // void A (); // } // // A needs to be virtual (the CLR requires // methods implementing an iface be virtual), // but can not be inherited. It also can not // be inherited. In C# this is represented // with no special modifiers if (method.IsVirtual) return null; return "sealed "; } // all interface methods are "virtual" but we don't say that in c# if (method.IsVirtual && !method.DeclaringType.IsInterface) { if (method.IsAbstract) return "abstract "; return ((method.Attributes & MethodAttributes.NewSlot) != 0) ? "virtual " : "override "; } return null; } static string GetTypeKind (Type t) { if (t.IsEnum) return "enum"; if (t.IsClass) { if (t.IsSubclassOf (typeof (System.MulticastDelegate))) return "delegate"; else return "class"; } if (t.IsInterface) return "interface"; if (t.IsValueType) return "struct"; return "class"; } static string GetTypeVisibility (Type t) { switch (t.Attributes & TypeAttributes.VisibilityMask){ case TypeAttributes.Public: case TypeAttributes.NestedPublic: return "public"; case TypeAttributes.NestedFamily: case TypeAttributes.NestedFamANDAssem: case TypeAttributes.NestedFamORAssem: return "protected"; default: return "internal"; } } #if NET_2_0 string FormatGenericParams (Type [] args) { StringBuilder sb = new StringBuilder (); if (args.Length == 0) return ""; sb.Append ("<"); for (int i = 0; i < args.Length; i++) { if (i > 0) sb.Append (","); RenderType (args [i]); } sb.Append (">"); return sb.ToString (); } #endif void RenderType (Type t) { if (OutlineNotificationEvent != null){ o.Flush (); OutlineNotificationEvent (1, t); o.Write (FormatType (t)); o.Flush (); OutlineNotificationEvent (0, null); } else { o.Write (FormatType (t)); } } // TODO: fine tune this so that our output is less verbose. We need to figure // out a way to do this while not making things confusing. string FormatType (Type t) { string type = GetFullName (t); if (!type.StartsWith ("System.")) { if (t.Namespace == this.t.Namespace) return t.Name; return type; } if (t.HasElementType) { Type et = t.GetElementType (); if (t.IsArray) return FormatType (et) + " []"; if (t.IsPointer) return FormatType (et) + " *"; if (t.IsByRef) return "ref " + FormatType (et); } switch (type) { case "System.Byte": return "byte"; case "System.SByte": return "sbyte"; case "System.Int16": return "short"; case "System.Int32": return "int"; case "System.Int64": return "long"; case "System.UInt16": return "ushort"; case "System.UInt32": return "uint"; case "System.UInt64": return "ulong"; case "System.Single": return "float"; case "System.Double": return "double"; case "System.Decimal": return "decimal"; case "System.Boolean": return "bool"; case "System.Char": return "char"; case "System.String": return "string"; case "System.Object": return "object"; case "System.Void": return "void"; } if (type.LastIndexOf(".") == 6) return type.Substring(7); // // If the namespace of the type is the namespace of what // we are printing (or is a member of one if its children // don't print it. This basically means that in C# we would // automatically get the namespace imported by virtue of the // namespace {} block. // if (this.t.Namespace.StartsWith (t.Namespace + ".") || t.Namespace == this.t.Namespace) return type.Substring (t.Namespace.Length + 1); return type; } public static string RemoveGenericArity (string name) { int start = 0; StringBuilder sb = new StringBuilder (); while (start < name.Length) { int pos = name.IndexOf ('`', start); if (pos < 0) { sb.Append (name.Substring (start)); break; } sb.Append (name.Substring (start, pos-start)); pos++; while ((pos < name.Length) && Char.IsNumber (name [pos])) pos++; start = pos; } return sb.ToString (); } string GetTypeName (Type t) { StringBuilder sb = new StringBuilder (); GetTypeName (sb, t); return sb.ToString (); } void GetTypeName (StringBuilder sb, Type t) { sb.Append (RemoveGenericArity (t.Name)); #if NET_2_0 sb.Append (FormatGenericParams (t.GetGenericArguments ())); #endif } string GetFullName (Type t) { StringBuilder sb = new StringBuilder (); GetFullName_recursed (sb, t, false); return sb.ToString (); } void GetFullName_recursed (StringBuilder sb, Type t, bool recursed) { #if NET_2_0 if (t.IsGenericParameter) { sb.Append (t.Name); return; } #endif if (t.DeclaringType != null) { GetFullName_recursed (sb, t.DeclaringType, true); sb.Append ("."); } if (!recursed) { string ns = t.Namespace; if ((ns != null) && (ns != "")) { sb.Append (ns); sb.Append ("."); } } GetTypeName (sb, t); } #if NET_2_0 void WriteGenericConstraints (Type [] args) { foreach (Type t in args) { bool first = true; Type[] ifaces = TypeGetInterfaces (t, true); GenericParameterAttributes attrs = t.GenericParameterAttributes & GenericParameterAttributes.SpecialConstraintMask; GenericParameterAttributes [] interesting = { GenericParameterAttributes.ReferenceTypeConstraint, GenericParameterAttributes.NotNullableValueTypeConstraint, GenericParameterAttributes.DefaultConstructorConstraint }; if (t.BaseType != typeof (object) || ifaces.Length != 0 || attrs != 0) { o.Write (" where "); RenderType (t); o.Write (" : "); } if (t.BaseType != typeof (object)) { RenderType (t.BaseType); first = false; } foreach (Type iface in ifaces) { if (!first) o.Write (", "); first = false; RenderType (iface); } foreach (GenericParameterAttributes a in interesting) { if ((attrs & a) == 0) continue; if (!first) o.Write (", "); first = false; switch (a) { case GenericParameterAttributes.ReferenceTypeConstraint: o.Write ("class"); break; case GenericParameterAttributes.NotNullableValueTypeConstraint: o.Write ("struct"); break; case GenericParameterAttributes.DefaultConstructorConstraint: o.Write ("new ()"); break; } } } } #endif string OperatorFromName (string name) { switch (name) { case "op_UnaryPlus": return "+"; case "op_UnaryNegation": return "-"; case "op_LogicalNot": return "!"; case "op_OnesComplement": return "~"; case "op_Increment": return "++"; case "op_Decrement": return "--"; case "op_True": return "true"; case "op_False": return "false"; case "op_Addition": return "+"; case "op_Subtraction": return "-"; case "op_Multiply": return "*"; case "op_Division": return "/"; case "op_Modulus": return "%"; case "op_BitwiseAnd": return "&"; case "op_BitwiseOr": return "|"; case "op_ExclusiveOr": return "^"; case "op_LeftShift": return "<<"; case "op_RightShift": return ">>"; case "op_Equality": return "=="; case "op_Inequality": return "!="; case "op_GreaterThan": return ">"; case "op_LessThan": return "<"; case "op_GreaterThanOrEqual": return ">="; case "op_LessThanOrEqual": return "<="; default: return name; } } bool MethodIsExplicitIfaceImpl (MethodBase mb) { if (!(mb.IsFinal && mb.IsVirtual && mb.IsPrivate)) return false; // UGH msft has no way to get the info about what method is // getting overriden. Another reason to use cecil :-) // //MethodInfo mi = mb as MethodInfo; //if (mi == null) // return false; // //Console.WriteLine (mi.GetBaseDefinition ().DeclaringType); //return mi.GetBaseDefinition ().DeclaringType.IsInterface; // So, we guess that virtual final private methods only come // from ifaces :-) return true; } bool ShowMember (MemberInfo mi) { if (mi.MemberType == MemberTypes.Constructor && ((MethodBase) mi).IsStatic) return false; if (show_private) return true; if (filter_obsolete && mi.IsDefined (typeof (ObsoleteAttribute), false)) return false; switch (mi.MemberType) { case MemberTypes.Constructor: case MemberTypes.Method: MethodBase mb = mi as MethodBase; if (mb.IsFamily || mb.IsPublic || mb.IsFamilyOrAssembly) return true; if (MethodIsExplicitIfaceImpl (mb)) return true; return false; case MemberTypes.Field: FieldInfo fi = mi as FieldInfo; if (fi.IsFamily || fi.IsPublic || fi.IsFamilyOrAssembly) return true; return false; case MemberTypes.NestedType: case MemberTypes.TypeInfo: Type t = mi as Type; switch (t.Attributes & TypeAttributes.VisibilityMask){ case TypeAttributes.Public: case TypeAttributes.NestedPublic: case TypeAttributes.NestedFamily: case TypeAttributes.NestedFamORAssem: return true; } return false; } // What am I !!! return true; } static Type [] TypeGetInterfaces (Type t, bool declonly) { Type [] ifaces = t.GetInterfaces (); if (! declonly) return ifaces; // Handle Object. Also, optimize for no interfaces if (t.BaseType == null || ifaces.Length == 0) return ifaces; ArrayList ar = new ArrayList (); foreach (Type i in ifaces) if (! i.IsAssignableFrom (t.BaseType)) ar.Add (i); return (Type []) ar.ToArray (typeof (Type)); } } public class Comparer : IComparer { delegate int ComparerFunc (object a, object b); ComparerFunc cmp; Comparer (ComparerFunc f) { this.cmp = f; } public int Compare (object a, object b) { return cmp (a, b); } static int CompareType (object a, object b) { Type type1 = (Type) a; Type type2 = (Type) b; if (type1.IsSubclassOf (typeof (System.MulticastDelegate)) != type2.IsSubclassOf (typeof (System.MulticastDelegate))) return (type1.IsSubclassOf (typeof (System.MulticastDelegate)))? -1:1; return string.Compare (type1.Name, type2.Name); } // static Comparer TypeComparer = new Comparer (new ComparerFunc (CompareType)); // static Type [] Sort (Type [] types) // { // Array.Sort (types, TypeComparer); // return types; // } static int CompareMemberInfo (object a, object b) { return string.Compare (((MemberInfo) a).Name, ((MemberInfo) b).Name); } static Comparer MemberInfoComparer = new Comparer (new ComparerFunc (CompareMemberInfo)); public static MemberInfo [] Sort (MemberInfo [] inf) { Array.Sort (inf, MemberInfoComparer); return inf; } static int CompareMethodBase (object a, object b) { MethodBase aa = (MethodBase) a, bb = (MethodBase) b; if (aa.IsStatic == bb.IsStatic) { int c = CompareMemberInfo (a, b); if (c != 0) return c; ParameterInfo [] ap, bp; // // Sort overloads by the names of their types // put methods with fewer params first. // ap = aa.GetParameters (); bp = bb.GetParameters (); int n = System.Math.Min (ap.Length, bp.Length); for (int i = 0; i < n; i ++) if ((c = CompareType (ap [i].ParameterType, bp [i].ParameterType)) != 0) return c; return ap.Length.CompareTo (bp.Length); } if (aa.IsStatic) return -1; return 1; } static Comparer MethodBaseComparer = new Comparer (new ComparerFunc (CompareMethodBase)); public static MethodBase [] Sort (MethodBase [] inf) { Array.Sort (inf, MethodBaseComparer); return inf; } static int ComparePropertyInfo (object a, object b) { PropertyInfo aa = (PropertyInfo) a, bb = (PropertyInfo) b; bool astatic = (aa.CanRead ? aa.GetGetMethod (true) : aa.GetSetMethod (true)).IsStatic; bool bstatic = (bb.CanRead ? bb.GetGetMethod (true) : bb.GetSetMethod (true)).IsStatic; if (astatic == bstatic) return CompareMemberInfo (a, b); if (astatic) return -1; return 1; } static Comparer PropertyInfoComparer = new Comparer (new ComparerFunc (ComparePropertyInfo)); public static PropertyInfo [] Sort (PropertyInfo [] inf) { Array.Sort (inf, PropertyInfoComparer); return inf; } static int CompareEventInfo (object a, object b) { EventInfo aa = (EventInfo) a, bb = (EventInfo) b; bool astatic = aa.GetAddMethod (true).IsStatic; bool bstatic = bb.GetAddMethod (true).IsStatic; if (astatic == bstatic) return CompareMemberInfo (a, b); if (astatic) return -1; return 1; } static Comparer EventInfoComparer = new Comparer (new ComparerFunc (CompareEventInfo)); public static EventInfo [] Sort (EventInfo [] inf) { Array.Sort (inf, EventInfoComparer); return inf; } } }mono-tools-4.2/gsharp/InteractiveGraphicsBase.cs0000664000175000017500000001377412413742070024067 0ustar00directhexdirecthex00000000000000// InteractiveGraphicsBase.cs //Authors: ${Author} // // Copyright (c) 2008 [copyright holders] // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Drawing; using System.Drawing.Drawing2D; using System.Collections.Generic; using Gtk; namespace Mono.CSharp.Gui { public class InteractiveGraphicsBase : Mono.CSharp.InteractiveBase { static internal List type_handlers = new List (); public delegate double DoubleFunc (double a); static int width = 400; static int height = 350; public static new string help { get { return InteractiveBase.help + " RegisterTransformHandler(object => object)\n" + " MainWindow - Gtk# toplevel window\n" + " PaneContainer - Gtk# pane container\n" + "\nSome samples:\n" + " Plot(x=>x*x) - Plots the function\n" + " Image.FromFile (path) - Loads an image\n"; } } public static int PlotHeight { get { return height; } set { if (value < 1) throw new ArgumentException (); height = value; } } public static int PlotWidth { get { return width; } set { if (value < 1) throw new ArgumentException (); width = value; } } static Pen GetPen (int i) { Pen p; switch (i % 4){ case 0: p = new Pen (Color.Blue); break; case 1: p = new Pen (Color.Red); break; case 2: p = new Pen (Color.Green); break; default: p = new Pen (Color.Black); break; } switch ((i >> 2) % 4){ case 0: break; case 1: p.DashStyle = DashStyle.DashDot; break; case 2: p.DashStyle = DashStyle.DashDotDot; break; case 3: p.DashStyle = DashStyle.Dash; break; } return p; } static void DrawAxes (Graphics g, Pen p, float x1, float y1, float x2, float y2) { g.DrawLine (p, x1, 0, x2, 0); g.DrawLine (p, 0, y1, 0, y2); } public static object Plot (DoubleFunc function) { return PlotFunctions (new DoubleFunc [] { function }); } public static object Plot (DoubleFunc f1, DoubleFunc f2) { return PlotFunctions (new DoubleFunc [] { f1, f2 }); } public static object Plot (DoubleFunc f1, DoubleFunc f2, DoubleFunc f3) { return PlotFunctions (new DoubleFunc [] { f1, f2, f3 }); } public static object Plot (DoubleFunc f1, DoubleFunc f2, DoubleFunc f3, DoubleFunc f4) { return PlotFunctions (new DoubleFunc [] { f1, f2, f3, f4 }); } static object PlotFunctions (DoubleFunc [] funcs) { Bitmap b = new Bitmap (width, height); Matrix t = new Matrix (), invert; t.Translate (width/2, height/2); t.Scale (2f, -2f); invert = t.Clone (); invert.Invert (); Point [] bounds = new Point [] { new Point (0, 0), new Point (width, height) }; invert.TransformPoints (bounds); Pen black = new Pen (Color.Black); black.Transform = invert; float x1 = bounds [0].X; float x2 = bounds [1].X; using (Graphics g = System.Drawing.Graphics.FromImage (b)){ g.Transform = t; DrawAxes (g, black, x1, bounds [1].Y, x2, bounds [0].Y); int i = 0; g.SmoothingMode = SmoothingMode.AntiAlias; foreach (var func in funcs){ Pen p = GetPen (i++); p.Transform = invert; PlotFunction (g, p, x1, x2, func); } g.Transform = new Matrix (); g.DrawRectangle (black, 0, 0, width-1, height-1); } return b; } public static void PlotFunction (Graphics g, Pen p, double x1, double x2, DoubleFunc function) { double lx = x1; double ly = (double) function (lx); double step = (x2-x1)/(width/2); for (double x = x1; x < x2; x += step){ double y = function (x); g.DrawLine (p, (float) lx, (float) ly, (float) x, (float) y); lx = x; ly = y; } } public delegate object TransformHandler (object o); public static void RegisterTransformHandler (TransformHandler o) { if (o == null) throw new ArgumentException ("parameter is null"); if (type_handlers.Contains (o)) return; type_handlers.Insert (0, o); } public static void UnregisterTransformHandler (TransformHandler o) { if (o == null) return; type_handlers.Remove (o); } // Whether this is an attached program or not. static bool attached; public static bool Attached { get { return attached; } internal set { attached = value; } } static MainWindow main_window; // A handle to our main window, the contract is Gtk.Window, internally we know its a MainWindow public static Gtk.Window MainWindow { get { return main_window; } internal set { main_window = (MainWindow) value; } } static Gtk.Container pane; public static Gtk.Container PaneContainer { get { return pane; } internal set { pane = value; } } static public new string Describe (object x) { if (x == null) return "object is null"; Type t = x as Type; if (t == null) t = x.GetType (); main_window.Describe (t); return "Described on separate page"; } } } mono-tools-4.2/gsharp/AssemblyInfo.cs0000664000175000017500000000205412413742070021716 0ustar00directhexdirecthex00000000000000// AssemblyInfo.cs created with MonoDevelop // User: miguel at 10:22 PM 9/27/2008 // // To change standard headers go to Edit->Preferences->Coding->Standard Headers // 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("gsharp")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // If the build and revision are set to '*' they will be updated automatically. [assembly: AssemblyVersion("1.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-tools-4.2/gsharp/ProcessSelector.cs0000664000175000017500000000465312413742070022451 0ustar00directhexdirecthex00000000000000// ProcessSelector.cs //Authors: ${Author} // // Copyright (c) 2008 [copyright holders] // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Diagnostics; using Gtk; using Mono.Unix.Native; namespace Mono.CSharp.Gui { public partial class ProcessSelector : Gtk.Dialog { TreeStore procstore; int pid = -1; public ProcessSelector() { this.Build(); CellRendererText t = new CellRendererText (); treeview.AppendColumn ("Process", t, "text", 0); treeview.Selection.Changed += delegate { TreeSelection ts = treeview.Selection; TreeIter iter; TreeModel mod; if (ts.GetSelected (out mod, out iter)) { string proc = mod.GetValue (iter, 0) as string; int r; if (Int32.TryParse (proc.Substring (0, proc.IndexOf ('/')), out r)) pid = r; } }; procstore = new TreeStore (typeof (String)); UpdateTreeView (); treeview.Model = procstore; UpdateTreeView (); } void UpdateTreeView () { var a = new PerformanceCounterCategory ("Mono Memory"); procstore.Clear (); string thispid = Syscall.getpid ().ToString (); foreach (string p in a.GetInstanceNames ()){ if (p.StartsWith (thispid, StringComparison.Ordinal)) continue; procstore.AppendValues (p); } } protected virtual void OnClose (object sender, System.EventArgs e) { } public int PID { get { return pid; } } } } mono-tools-4.2/gsharp/close.png0000664000175000017500000000044512413742070020611 0ustar00directhexdirecthex00000000000000PNG  IHDR Vu\ pHYs  ~tIME #/؃N>tEXtCommentCreated with The GIMP (c) 2003 Jakub 'jimmac' Steiner'3XzIDATxڝ 0C_0}: !2CA&l4]>@|u030r XgCL@(!@"9L_$P{e/{feRq]=?Mj2%IENDB`mono-tools-4.2/gsharp/MainWindow.cs0000664000175000017500000002245712413742070021410 0ustar00directhexdirecthex00000000000000// MainWindow.cs //Authors: Miguel de Icaza (miguel@novell.com) // // Copyright (c) 2008 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 System.Collections; using System.Collections.Generic; using Gtk; using Mono.Attach; using System.Runtime.InteropServices; using System.Xml.Linq; namespace Mono.CSharp.Gui { public partial class MainWindow : Gtk.Window { bool panevisible; static Gdk.Pixbuf close_image; protected virtual void OnAttachToProcessActionActivated (object sender, System.EventArgs e) { ProcessSelector p = new ProcessSelector (); int c = p.Run (); if (c == (int) ResponseType.Ok){ VirtualMachine vm = new VirtualMachine (p.PID); vm.Attach (typeof (MainWindow).Assembly.Location, "--agent"); } p.Destroy (); } public Shell Shell { get; private set; } delegate string ReadLiner (bool primary); public void LoadStartupFiles () { string dir = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "gsharp"); if (!System.IO.Directory.Exists (dir)) return; LoadFiles (System.IO.Directory.GetFiles (dir), true); } public void LoadFiles (IEnumerable list, bool silent) { ArrayList sources = new ArrayList (); ArrayList libraries = new ArrayList (); foreach (string file in list){ string l = file.ToLower (); if (l.EndsWith (".cs")) sources.Add (file); else if (l.EndsWith (".dll")) libraries.Add (file); } foreach (string file in libraries){ Shell.Evaluator.LoadAssembly (file); } foreach (string file in sources){ try { using (System.IO.StreamReader r = System.IO.File.OpenText (file)){ ReadEvalPrintLoopWith (p => r.ReadLine ()); } } catch { if (!silent) throw; } } } string Evaluate (string input) { bool result_set; object result; try { input = Shell.Evaluator.Evaluate (input, out result, out result_set); } catch (Exception e){ Console.WriteLine (e); return null; } return input; } void ReadEvalPrintLoopWith (ReadLiner readline) { string expr = null; while (true){ string input = readline (expr == null); if (input == null) return; if (input == "") continue; expr = expr == null ? input : expr + "\n" + input; expr = Evaluate (expr); } } static string settings; static void InitSettings () { string dir = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "gsharp"); try { System.IO.Directory.CreateDirectory (dir); } catch { return; } settings = System.IO.Path.Combine (dir, "gsharp.xml"); } static MainWindow () { InitSettings (); close_image = Gdk.Pixbuf.LoadFromResource ("close.png"); } public void LoadSettings (Shell shell) { if (settings == null){ shell.LoadHistory (null); return; } XDocument doc; try { doc = XDocument.Load (settings); } catch { shell.LoadHistory (null); return; } int width = -1; int height = -1; int position = -1; try { foreach (var e in doc.Root.Elements ()){ switch (e.Name.LocalName){ case "history": shell.LoadHistory (e.Elements ()); break; case "Width": width = Int32.Parse (e.Value); break; case "Height": height = Int32.Parse (e.Value); break; case "PaneVisible": panevisible = Int32.Parse (e.Value) == 1; break; case "PanePosition": position = Int32.Parse (e.Value); break; } } } catch { } width = System.Math.Max (width, 200); height = System.Math.Max (height, 120); Resize (width, height); if (position >= 0) hpaned.Position = position; } public void SaveSettings () { if (settings == null) return; try { var doc = new XDocument ( new XElement ("Root", Shell.SaveHistory (), new XElement ("Width", Allocation.Width), new XElement ("Height", Allocation.Height), new XElement ("PaneVisible", PaneVisible ? 1 : 0), new XElement ("PanePosition", hpaned.Position))); doc.Save (settings, SaveOptions.DisableFormatting); } catch (Exception e ) { Console.WriteLine ("oops" + e); } } public bool PaneVisible { get { return notebook1.Page == 0; } } // // Keeps track of the helper Gtk Pane used for toying with Gtk# widgets // void SetDisplayPane (bool visible) { if (!(PaneVisible ^ visible)) return; if (visible){ notebook1.Page = 0; shellnotebook.Reparent (paned_container); } else { notebook1.Page = 1; shellnotebook.Reparent (standalone_container); } } public Container PaneContainer { get { return eventbox; } } public Notebook ShellNotebook { get { return shellnotebook; } } Dictionary pages = new Dictionary (); public void AddPage (Type t, Widget w) { pages [t] = w; HBox h = new HBox (false, 0); h.PackStart (new Label (t.ToString ()), false, false, 0); Button b = new Button (new Image (close_image)); b.SetSizeRequest (18, 18); b.Clicked += delegate { shellnotebook.Remove (w); pages.Remove (t); if (shellnotebook.NPages == 1) shellnotebook.ShowTabs = false; }; h.PackStart (b, false, false, 0); h.ShowAll (); shellnotebook.Page = shellnotebook.AppendPage (w, h); if (shellnotebook.NPages > 1) shellnotebook.ShowTabs = true; } public bool FindPage (Type t) { if (pages.ContainsKey (t)){ Widget w = pages [t]; for (int i = 0; i < shellnotebook.NPages; i++){ Widget nth = shellnotebook.GetNthPage (i); if (nth == w){ shellnotebook.Page = i; return true; } } } return false; } public void Describe (Type t) { if (t == null) throw new ArgumentNullException (); if (FindPage (t)) return; TypeView tv = new TypeView (this); tv.KeyPressEvent += HandleKeyPressEvent; tv.ShowType (t); ScrolledWindow scrolled = new ScrolledWindow (); scrolled.Add (tv); scrolled.ShowAll (); AddPage (t, scrolled); } public MainWindow() : base(Gtk.WindowType.Toplevel) { this.Build(); Title = "C# Shell"; // This is the page with no pane notebook1.Page = 1; gtkpane.Toggled += delegate { SetDisplayPane (gtkpane.Active); }; Shell = new Shell (this); LoadSettings (Shell); gtkpane.Active = panevisible; Shell.QuitRequested += OnQuitActionActivated; Shell.ShowAll (); sw.Add (Shell); Focus = Shell; KeyPressEvent += HandleKeyPressEvent; } [GLib.ConnectBefore] void HandleKeyPressEvent(object o, KeyPressEventArgs args) { Gdk.EventKey ev = args.Event; if ((ev.State & Gdk.ModifierType.ControlMask) == Gdk.ModifierType.ControlMask){ switch (ev.Key){ case Gdk.Key.Page_Down: if (shellnotebook.Page+1 == shellnotebook.NPages) shellnotebook.Page = 0; else shellnotebook.Page = shellnotebook.Page + 1; args.RetVal = true; return; case Gdk.Key.Page_Up: if (shellnotebook.Page == 0) shellnotebook.Page = shellnotebook.NPages -1; else shellnotebook.Page = shellnotebook.Page - 1; args.RetVal = true; return; default: return; } } } protected virtual void OnQuitActionActivated (object sender, System.EventArgs e) { SaveSettings (); if (MainClass.Attached){ this.Destroy (); } else { Application.Quit (); } } protected override bool OnDeleteEvent (Gdk.Event args) { if (!MainClass.Attached){ Console.WriteLine ("Quitting"); Application.Quit (); } return false; } protected virtual void OnDescribeTypeActionActivated (object sender, System.EventArgs e) { DescribeType dt = new DescribeType (); int c = dt.Run (); Type t = null; if (c == (int) Gtk.ResponseType.Ok){ try { t = System.Type.GetType (dt.TypeName); } catch { } } if (t == null){ MessageDialog d = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, "The type {0} was not found", dt.TypeName); d.Run (); d.Destroy (); } else Describe (t); dt.Destroy (); } } } mono-tools-4.2/gsharp/gtk-gui/0000775000175000017500000000000012642235743020352 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gsharp/gtk-gui/Mono.CSharp.Gui.MainWindow.cs0000664000175000017500000002357212413742070025567 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.CSharp.Gui { public partial class MainWindow { private global::Gtk.UIManager UIManager; private global::Gtk.Action FileAction; private global::Gtk.Action QuitAction; private global::Gtk.Action AttachToProcessAction; private global::Gtk.Action HelpAction; private global::Gtk.Action AboutAction; private global::Gtk.Action ViewAction; private global::Gtk.ToggleAction gtkpane; private global::Gtk.Action ToolsAction; private global::Gtk.Action DescribeTypeAction; private global::Gtk.VBox vbox1; private global::Gtk.MenuBar menubar1; private global::Gtk.Notebook notebook1; private global::Gtk.HPaned hpaned; private global::Gtk.EventBox paned_container; private global::Gtk.VBox vbox2; private global::Gtk.Expander expander1; private global::Gtk.Label label4; private global::Gtk.Label GtkLabel4; private global::Gtk.EventBox eventbox; private global::Gtk.Label label1; private global::Gtk.EventBox standalone_container; private global::Gtk.Notebook shellnotebook; private global::Gtk.ScrolledWindow sw; private global::Gtk.Label label3; private global::Gtk.Label label2; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.CSharp.Gui.MainWindow this.UIManager = new global::Gtk.UIManager (); global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup ("Default"); this.FileAction = new global::Gtk.Action ("FileAction", global::Mono.Unix.Catalog.GetString ("_File"), null, null); this.FileAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("File"); w1.Add (this.FileAction, null); this.QuitAction = new global::Gtk.Action ("QuitAction", global::Mono.Unix.Catalog.GetString ("_Quit"), null, "gtk-quit"); this.QuitAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("_Quit"); w1.Add (this.QuitAction, null); this.AttachToProcessAction = new global::Gtk.Action ("AttachToProcessAction", global::Mono.Unix.Catalog.GetString ("Attach to Process"), null, null); this.AttachToProcessAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Attach to Process"); w1.Add (this.AttachToProcessAction, null); this.HelpAction = new global::Gtk.Action ("HelpAction", global::Mono.Unix.Catalog.GetString ("Help"), null, null); this.HelpAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Help"); w1.Add (this.HelpAction, null); this.AboutAction = new global::Gtk.Action ("AboutAction", global::Mono.Unix.Catalog.GetString ("About"), null, null); this.AboutAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("About"); w1.Add (this.AboutAction, null); this.ViewAction = new global::Gtk.Action ("ViewAction", global::Mono.Unix.Catalog.GetString ("View"), null, null); this.ViewAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("View"); w1.Add (this.ViewAction, null); this.gtkpane = new global::Gtk.ToggleAction ("gtkpane", global::Mono.Unix.Catalog.GetString ("Gtk Pane"), null, null); this.gtkpane.ShortLabel = global::Mono.Unix.Catalog.GetString ("Gtk Pane"); w1.Add (this.gtkpane, null); this.ToolsAction = new global::Gtk.Action ("ToolsAction", global::Mono.Unix.Catalog.GetString ("_Tools"), null, null); this.ToolsAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("_Tools"); w1.Add (this.ToolsAction, null); this.DescribeTypeAction = new global::Gtk.Action ("DescribeTypeAction", global::Mono.Unix.Catalog.GetString ("Describe Type"), null, null); this.DescribeTypeAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Describe Type"); w1.Add (this.DescribeTypeAction, null); this.UIManager.InsertActionGroup (w1, 0); this.AddAccelGroup (this.UIManager.AccelGroup); this.Name = "Mono.CSharp.Gui.MainWindow"; this.Title = global::Mono.Unix.Catalog.GetString ("MainWindow"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); this.DefaultWidth = 600; this.DefaultHeight = 500; // Container child Mono.CSharp.Gui.MainWindow.Gtk.Container+ContainerChild this.vbox1 = new global::Gtk.VBox (); this.vbox1.Name = "vbox1"; this.vbox1.Spacing = 6; // Container child vbox1.Gtk.Box+BoxChild this.UIManager.AddUiFromString (""); this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget ("/menubar1"))); this.menubar1.Name = "menubar1"; this.vbox1.Add (this.menubar1); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.menubar1])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox1.Gtk.Box+BoxChild this.notebook1 = new global::Gtk.Notebook (); this.notebook1.CanFocus = true; this.notebook1.Name = "notebook1"; this.notebook1.CurrentPage = 0; this.notebook1.ShowBorder = false; this.notebook1.ShowTabs = false; // Container child notebook1.Gtk.Notebook+NotebookChild this.hpaned = new global::Gtk.HPaned (); this.hpaned.CanFocus = true; this.hpaned.Name = "hpaned"; this.hpaned.Position = 472; // Container child hpaned.Gtk.Paned+PanedChild this.paned_container = new global::Gtk.EventBox (); this.paned_container.Name = "paned_container"; this.hpaned.Add (this.paned_container); global::Gtk.Paned.PanedChild w3 = ((global::Gtk.Paned.PanedChild)(this.hpaned [this.paned_container])); w3.Resize = false; // Container child hpaned.Gtk.Paned+PanedChild this.vbox2 = new global::Gtk.VBox (); this.vbox2.Name = "vbox2"; this.vbox2.Spacing = 6; // Container child vbox2.Gtk.Box+BoxChild this.expander1 = new global::Gtk.Expander (null); this.expander1.CanFocus = true; this.expander1.Name = "expander1"; this.expander1.Expanded = true; // Container child expander1.Gtk.Container+ContainerChild this.label4 = new global::Gtk.Label (); this.label4.Name = "label4"; this.label4.Xpad = 10; this.label4.Xalign = 0.1F; this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("Set the contents of this pane by adding Gtk.Widgets children to the PaneContainer property. The PaneContainer is a Gtk.EventBox. \n\nTry it like this:\n\nLoadPackage (\"gtk-sharp-2.0\");\nvar l = new Label (\"Hello world\");\nPaneContainer.Add (l);\nl.ShowAll ();"); this.label4.UseMarkup = true; this.label4.Wrap = true; this.expander1.Add (this.label4); this.GtkLabel4 = new global::Gtk.Label (); this.GtkLabel4.Name = "GtkLabel4"; this.GtkLabel4.LabelProp = global::Mono.Unix.Catalog.GetString ("PaneContent"); this.GtkLabel4.UseMarkup = true; this.GtkLabel4.UseUnderline = true; this.expander1.LabelWidget = this.GtkLabel4; this.vbox2.Add (this.expander1); global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.expander1])); w5.Position = 0; w5.Expand = false; w5.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.eventbox = new global::Gtk.EventBox (); this.eventbox.Name = "eventbox"; this.vbox2.Add (this.eventbox); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.eventbox])); w6.Position = 1; this.hpaned.Add (this.vbox2); this.notebook1.Add (this.hpaned); // Notebook tab this.label1 = new global::Gtk.Label (); this.label1.Name = "label1"; this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("page1"); this.notebook1.SetTabLabel (this.hpaned, this.label1); this.label1.ShowAll (); // Container child notebook1.Gtk.Notebook+NotebookChild this.standalone_container = new global::Gtk.EventBox (); this.standalone_container.Name = "standalone_container"; // Container child standalone_container.Gtk.Container+ContainerChild this.shellnotebook = new global::Gtk.Notebook (); this.shellnotebook.CanFocus = true; this.shellnotebook.Name = "shellnotebook"; this.shellnotebook.CurrentPage = 0; this.shellnotebook.ShowTabs = false; this.shellnotebook.Scrollable = true; // Container child shellnotebook.Gtk.Notebook+NotebookChild this.sw = new global::Gtk.ScrolledWindow (); this.sw.CanFocus = true; this.sw.Name = "sw"; this.sw.ShadowType = ((global::Gtk.ShadowType)(1)); this.shellnotebook.Add (this.sw); // Notebook tab this.label3 = new global::Gtk.Label (); this.label3.Name = "label3"; this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("C#"); this.shellnotebook.SetTabLabel (this.sw, this.label3); this.label3.ShowAll (); this.standalone_container.Add (this.shellnotebook); this.notebook1.Add (this.standalone_container); global::Gtk.Notebook.NotebookChild w11 = ((global::Gtk.Notebook.NotebookChild)(this.notebook1 [this.standalone_container])); w11.Position = 1; // Notebook tab this.label2 = new global::Gtk.Label (); this.label2.Name = "label2"; this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("page2"); this.notebook1.SetTabLabel (this.standalone_container, this.label2); this.label2.ShowAll (); this.vbox1.Add (this.notebook1); global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.notebook1])); w12.Position = 1; this.Add (this.vbox1); if ((this.Child != null)) { this.Child.ShowAll (); } this.Show (); this.QuitAction.Activated += new global::System.EventHandler (this.OnQuitActionActivated); this.AttachToProcessAction.Activated += new global::System.EventHandler (this.OnAttachToProcessActionActivated); this.DescribeTypeAction.Activated += new global::System.EventHandler (this.OnDescribeTypeActionActivated); } } } mono-tools-4.2/gsharp/gtk-gui/Mono.CSharp.Gui.DescribeType.cs0000664000175000017500000000657012413742070026074 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.CSharp.Gui { public partial class DescribeType { private global::Gtk.HBox hbox1; private global::Gtk.Label label1; private global::Gtk.Entry entry1; private global::Gtk.Button buttonCancel; private global::Gtk.Button buttonOk; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.CSharp.Gui.DescribeType this.Name = "Mono.CSharp.Gui.DescribeType"; this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Internal child Mono.CSharp.Gui.DescribeType.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.hbox1 = new global::Gtk.HBox (); this.hbox1.Name = "hbox1"; this.hbox1.Spacing = 6; // Container child hbox1.Gtk.Box+BoxChild this.label1 = new global::Gtk.Label (); this.label1.Name = "label1"; this.label1.Xpad = 5; this.label1.Ypad = 15; this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("Type name:"); this.hbox1.Add (this.label1); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.label1])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.entry1 = new global::Gtk.Entry (); this.entry1.CanDefault = true; this.entry1.CanFocus = true; this.entry1.Name = "entry1"; this.entry1.IsEditable = true; this.entry1.InvisibleChar = '●'; this.hbox1.Add (this.entry1); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.entry1])); w3.Position = 1; w1.Add (this.hbox1); global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox1])); w4.Position = 0; w4.Expand = false; w4.Fill = false; // Internal child Mono.CSharp.Gui.DescribeType.ActionArea global::Gtk.HButtonBox w5 = this.ActionArea; w5.Name = "dialog1_ActionArea"; w5.Spacing = 6; w5.BorderWidth = ((uint)(5)); w5.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 w6 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w5 [this.buttonCancel])); w6.Expand = false; w6.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"; this.AddActionWidget (this.buttonOk, -5); global::Gtk.ButtonBox.ButtonBoxChild w7 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w5 [this.buttonOk])); w7.Position = 1; w7.Expand = false; w7.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 284; this.DefaultHeight = 133; this.Show (); this.entry1.Activated += new global::System.EventHandler (this.OnEntry1Activated); } } } mono-tools-4.2/gsharp/gtk-gui/generated.cs0000664000175000017500000000106212413742070022626 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 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-tools-4.2/gsharp/gtk-gui/Mono.CSharp.Gui.ProcessSelector.cs0000664000175000017500000000752012413742070026625 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.CSharp.Gui { public partial class ProcessSelector { private global::Gtk.Frame frame1; private global::Gtk.Alignment GtkAlignment; private global::Gtk.ScrolledWindow GtkScrolledWindow; private global::Gtk.TreeView treeview; private global::Gtk.Label GtkLabel; private global::Gtk.Button buttonCancel; private global::Gtk.Button buttonOk; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.CSharp.Gui.ProcessSelector this.Name = "Mono.CSharp.Gui.ProcessSelector"; this.Title = global::Mono.Unix.Catalog.GetString ("Select Mono Process to Attach"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Internal child Mono.CSharp.Gui.ProcessSelector.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.frame1 = new global::Gtk.Frame (); this.frame1.Name = "frame1"; this.frame1.ShadowType = ((global::Gtk.ShadowType)(0)); this.frame1.BorderWidth = ((uint)(2)); // Container child frame1.Gtk.Container+ContainerChild this.GtkAlignment = new global::Gtk.Alignment (0F, 0F, 1F, 1F); this.GtkAlignment.Name = "GtkAlignment"; this.GtkAlignment.LeftPadding = ((uint)(12)); // Container child GtkAlignment.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.treeview = new global::Gtk.TreeView (); this.treeview.CanFocus = true; this.treeview.Name = "treeview"; this.GtkScrolledWindow.Add (this.treeview); this.GtkAlignment.Add (this.GtkScrolledWindow); this.frame1.Add (this.GtkAlignment); this.GtkLabel = new global::Gtk.Label (); this.GtkLabel.Name = "GtkLabel"; this.GtkLabel.LabelProp = global::Mono.Unix.Catalog.GetString ("Processes:"); this.GtkLabel.UseMarkup = true; this.frame1.LabelWidget = this.GtkLabel; w1.Add (this.frame1); global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(w1 [this.frame1])); w5.Position = 0; w5.Padding = ((uint)(3)); // Internal child Mono.CSharp.Gui.ProcessSelector.ActionArea global::Gtk.HButtonBox w6 = this.ActionArea; w6.Name = "dialog1_ActionArea"; w6.Spacing = 6; w6.BorderWidth = ((uint)(5)); w6.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 w7 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w6 [this.buttonCancel])); w7.Expand = false; w7.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 ("_Attach"); this.AddActionWidget (this.buttonOk, -5); global::Gtk.ButtonBox.ButtonBoxChild w8 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w6 [this.buttonOk])); w8.Position = 1; w8.Expand = false; w8.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 400; this.DefaultHeight = 300; this.Show (); this.Close += new global::System.EventHandler (this.OnClose); } } } mono-tools-4.2/gsharp/Makefile.am0000664000175000017500000000304112413742070021025 0ustar00directhexdirecthex00000000000000gsharpdir = $(prefix)/lib/gsharp if DMCS_PRESENT COMPILER=$(DMCS) else COMPILER=$(GMCS) endif bin_SCRIPTS = gsharp gsharp_DATA = gsharp.exe gsharp.exe.config desktopdir = $(datadir)/applications desktop_DATA = gsharp.desktop packages = -pkg:gtk-sharp-2.0 -pkg:glib-sharp-2.0 assemblies = -r:System -r:Mono.CSharp -r:Mono.Management -r:Mono.Posix -r:System.Drawing -r:System.Xml.Linq -r:System.Core -r:System.Xml gsharp_sources = \ $(srcdir)/AssemblyInfo.cs \ $(srcdir)/DescribeType.cs \ $(srcdir)/InteractiveGraphicsBase.cs \ $(srcdir)/Main.cs \ $(srcdir)/MainWindow.cs \ $(srcdir)/Options.cs \ $(srcdir)/ProcessSelector.cs \ $(srcdir)/Shell.cs \ $(srcdir)/SysDrawing.cs \ $(srcdir)/TypeView.cs \ $(srcdir)/gtk-gui/generated.cs \ $(srcdir)/gtk-gui/Mono.CSharp.Gui.MainWindow.cs \ $(srcdir)/gtk-gui/Mono.CSharp.Gui.ProcessSelector.cs \ $(srcdir)/gtk-gui/Mono.CSharp.Gui.DescribeType.cs \ $(srcdir)/outline.cs EXTRA_DIST = $(gsharp_sources) gsharp.in $(desktop_DATA).in close.png gsharp.exe.config.in CLEANFILES = $(gsharp_DATA) $(gsharp_DATA).mdb $(desktop_DATA) gsharp.exe: $(gsharp_sources) $(COMPILER) -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG -target:exe -out:gsharp.exe $(gsharp_sources) $(packages) $(assemblies) -resource:$(srcdir)/close.png,close.png $(desktop_DATA): $(desktop_DATA).in sed -e "s|\@bindir\@|$(bindir)|" $< > $@ mono-tools-4.2/gsharp/gsharp.desktop.in0000664000175000017500000000044212413742070022257 0ustar00directhexdirecthex00000000000000[Desktop Entry] Version=1.0 Name=gsharp Comment=Write C# in an interactive shell, and inject your code into running Mono processes GenericName=Interactive C# Shell Exec=@bindir@/gsharp #Icon=gnome-terminal StartupNotify=true Terminal=false Type=Application Categories=Debugger;Development; mono-tools-4.2/gsharp/SysDrawing.cs0000664000175000017500000000645212413742070021423 0ustar00directhexdirecthex00000000000000// SysDrawing.cs //Authors: ${Author} // // Copyright (c) 2008 [copyright holders] // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 System.Reflection; using System.Runtime.InteropServices; using System.Drawing; namespace Mono.CSharp.Gui { public class BitmapWidget : DrawingArea { System.Drawing.Bitmap b; public BitmapWidget (System.Drawing.Bitmap b) { this.b = b; GraphicsUnit unit = GraphicsUnit.Pixel; // // Quick hack to make stuff not too large // RectangleF bounds = b.GetBounds (ref unit); bounds.Height = System.Math.Min (bounds.Height, 600); bounds.Width = System.Math.Min (bounds.Width, 400); SetSizeRequest ((int) bounds.Width, (int) bounds.Height); } protected override bool OnExposeEvent (Gdk.EventExpose args) { Gdk.Rectangle area = args.Area; using (System.Drawing.Graphics g = GraphicsHelper.FromDrawable (args.Window)){ System.Drawing.Rectangle bounds = new System.Drawing.Rectangle (area.X, area.Y, area.Width, area.Height); g.DrawImage (b, bounds, bounds, System.Drawing.GraphicsUnit.Pixel); } return true; } } public class GraphicsHelper { [DllImport("libgdk-win32-2.0-0.dll")] internal static extern IntPtr gdk_x11_drawable_get_xdisplay (IntPtr raw); [DllImport("libgdk-win32-2.0-0.dll")] internal static extern IntPtr gdk_x11_drawable_get_xid (IntPtr raw); public static System.Drawing.Graphics FromDrawable (Gdk.Drawable drawable) { IntPtr x_drawable; int x_off = 0, y_off = 0; if (drawable is Gdk.Window){ ((Gdk.Window) drawable).GetInternalPaintInfo(out drawable, out x_off, out y_off); } x_drawable = drawable.Handle; IntPtr display = gdk_x11_drawable_get_xdisplay (x_drawable); Type graphics = typeof (System.Drawing.Graphics); MethodInfo mi = graphics.GetMethod ("FromXDrawable", BindingFlags.Static | BindingFlags.NonPublic); if (mi == null) throw new NotImplementedException ("In this implementation I can not get a graphics from a drawable"); object [] args = new object [2] { (IntPtr) gdk_x11_drawable_get_xid (drawable.Handle), (IntPtr) display }; object r = mi.Invoke (null, args); System.Drawing.Graphics g = (System.Drawing.Graphics) r; g.TranslateTransform (-x_off, -y_off); return g; } } } mono-tools-4.2/gendarme/0000775000175000017500000000000012642235743017301 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/ChangeLog0000664000175000017500000003756112413742070021057 0ustar00directhexdirecthex000000000000002010-08-27 Rolf Bjarne Kvinge * self-test.ignore: Add an entry to allow DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule to catch all exceptions it may throw. 2010-08-06 Sebastien Pouliot * AUTHORS: Add Antoine Vandecreme * self-test.ignore: Add entry to ignore PreferEmptyInstanceOverNullRule on ProvideCorrectArgumentsToFormattingMethodsRule since null and empty have different meaning in the rule 2010-06-23 Sebastien Pouliot * self-test.ignore: Remove entries fixed on the console runner, one that does not apply to recent Mono and add comments about defects that can/will be fixed with FX4.0 2010-06-22 Sebastien Pouliot * self-test.ignore: Remove entries fixed with AvoidLargeClassesRule 2010-06-20 Sebastien Pouliot * self-test.ignore: Remove entries fixed with AvoidComplexMethodsRule * README.vsnet: Add the wizard to the self-test instructions 2010-06-18 Sebastien Pouliot * README.vsnet: Add more detailled instructions on how to get and build all required source code * win32-setup/*: Removed - wix is being used since 2.6 2010-06-17 Sebastien Pouliot * self-test.ignore: Remove more AvoidRepetitiveCallsToPropertiesRule entries 2010-06-13 Sebastien Pouliot * self-test.ignore: Remove some fixed AvoidRepetitiveCallsToPropertiesRule 2010-06-11 Sebastien Pouliot * self-test.ignore: Be precise for AvoidRepetitiveCallsToPropertiesRule 2010-06-11 Sebastien Pouliot * self-test.ignore: Remove mode defects and add some that would show up if compiling with FX4 (like VS2010) 2010-06-09 Sebastien Pouliot * self-test.ignore: Remove some (fixed) defects and update some descriptions 2010-06-07 Sebastien Pouliot * self-test.ignore: Use new gd2i to be totally precise for all CheckParametersNullityInVisibleMethodsRule entries. * Makefile.am: Remove win32-setup from dist and replace it with wix. Also add tools (well gd2i for now) to the dist. Make self-test produce xml (along with html) so we can semi-automate gd2i updates on Gendarme 2010-06-07 Sebastien Pouliot * self-test.ignore: Add GendarmeWizard (Windows name) for AvoidRepetitiveCallsToPropertiesRule. Fix a copy-paste typo. Remove two entries for bugs in AvoidUnnecessarySpecializationRule 2010-06-06 Sebastien Pouliot * self-test.ignore: Better document a bug in AvoidUnnecessary SpecializationRule. Remove a (not a) bug on same rule. Add a CSC specific entry 2010-06-06 Sebastien Pouliot * self-test.ignore: Add some CSC-specific ignore entries (different IL being generated) and a new NDesk.Options entry related to the fix to ReturnNullRule. 2010-06-05 Sebastien Pouliot * self-test.ignore: Ignore AvoidSmallNamespaceRule on Gendarme. Framework.Engines namespace 2010-06-04 Sebastien Pouliot * self-test.ignore: Add more precise entries to avoid hiding defects that could/should be fixed. 2010-04-26 Sebastien Pouliot * AUTHORS: Add Rolf Bjarne Kvinge * Makefile.am: Add helpers to test regression against private collection of "weird" assemblies and to get the logs out of ohloh. 2010-01-17 Sebastien Pouliot * self-test.ignore: Update defects to ignore wrt Options.cs 2.1 2010-01-16 Sebastien Pouliot * AssemblyStaticInfo.cs: Update copyright notice up to 2010 * README: Update name/url of our build infrastructure * MIT.X11: Update copyright notice up to 2010 2009-12-20 Sebastien Pouliot * NEWS: Updated for 2.6 2009-12-20 Sebastien Pouliot * Makefile.am: Bundle gendarme.5 2009-08-19 Jesse Jones * self-test.ignore: Added a bunch more entries to allow self-test to run cleanly. At least some of these should be replaced with real fixes in the future. 2009-07-09 Jesse Jones * self-test.ignore: Ignore DecorateThreadsRule defects for wizard methods that call into gendarme from a thread. 2009-02-15 Sebastien Pouliot * AssemblyStaticInfo.cs: Adjust version and copyright * NEWS: Add news for 2.4 2009-01-09 Jesse Jones * Makefike.am: added .PHONY to console target (required on os-x because a console directory exists). 2009-01-03 Jesse Jones * options.make: use checked math only in debug. 2008-12-28 Sebastien Pouliot * self-test.ignore: Ignore AvoidSwitchStatementsRule on Gendarme assemblies since we're using switch extensively and in a way that would be hard to OO-ize while keeping performance and readability 2008-12-23 Cedric Vivier * self-test.ignore: Add entries for ProvideCorrectRegexPatternRule. 2008-12-19 Sebastien Pouliot * Makefile.am: Avoid depending on targets at the high level, when the lower level also do (which reduce directory traversals time). Add a bin (all binaries) and console (console and dependencies only) to the target list (this part based on a patch from Jesse Jones). Change zip-bin to depend on bin and not all. 2008-12-17 Sebastien Pouliot * README, README.vsnet: Update information about the solution files provided for Gendarme. 2008-11-23 Sebastien Pouliot * gendarme.svg: Update logo. * gendarme.mds: Remove unused MD solution (use gendarme.sln) * Makefile.am: Drop gendarme.mds from dist. Add targets to build the zip of binaries and push to ohloh. 2008-11-17 Jesse Jones * Makefile.am: If bin/gendarme.exe.config does not exist copy the console/gendarme.exe.config file. Add options.make to EXTRA_DIST. 2008-11-15 Jesse Jones * options.make: Release and debug now use -checked+. 2008-11-14 Jesse Jones * options.make: Added to allow all of our assemblies to be built with a common set of gmcs options * Makefile.am: Added new DEBUG variable to help target. 2008-11-11 Sebastien Pouliot * AssemblyStaticInfo.cs: Update "special" (VS setup) version 2.3 2008-11-09 Sebastien Pouliot * Makefile.am: Old xml.in files were removed from SVN so there's no need to clean the xml files anymore. 2008-11-09 Andrés G. Aragoneses * README: More info. 2008-11-09 Andrés G. Aragoneses * TODO: * README: Correcting broken link to Roadmap. 2008-11-08 Sebastien Pouliot * NEWS: Update information and date before 2.2 branch. 2008-11-07 Sebastien Pouliot * self-test.ignore: Add entry for NDesk.Options.OptionValueType wrt Gendarme.Rules.Serialization.MarkEnumerationsAsSerializableRule 2008-11-08 Cedric Vivier * NEWS: Add just landed AvoidRedundancyInTypeNameRule to new rules list. 2008-11-07 Alan McGovern * gendarme.sln: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-03 Cedric Vivier * NEWS: Add just landed AvoidRedundancyInMethodNameRule to new rules list. 2008-11-02 Sebastien Pouliot * NEWS: Update before 2.2 branch. 2008-11-02 Jesse Jones * Makefile.am: Added test1 and help targets. test1 builds just enough to run a single rule test dll and runs a single text fixture in the dll (using a TEST1 variable). 2008-10-31 Sebastien Pouliot * gendarme-wizard.desktop: Moved into swf-wizard-runner directory * Makefile.am: Add gendarme.svg to pixmaps 2008-10-30 Sebastien Pouliot * AUTHORS: Add Jesse Jones to the list. 2008-10-30 Sebastien Pouliot * self-test.ignore: Update to fix entry for ReturnNullRule versus ConsiderAddingInterfaceRule and add a new one for OptionSet suffix 2008-10-22 Sebastien Pouliot * self-test.ignore: Update to add an entry about MethodSignatures readonly fields containing the '_' character (which is "by design" since the signatures are for operator methods). 2008-10-22 Néstor Salceda * Makefile.am: This target is not longer needed because we generate the documentation in the same way than rules. 2008-10-20 Sebastien Pouliot * gendarme-wizard.in: Support MONO_OPTIONS too (like gendarme does) 2008-10-12 Sebastien Pouliot * self-test.ignore: Update (and add) some ignore entries. 2008-08-28 Sebastien Pouliot * Makefile.am: Change self-test to report all defects (i.e. not to filter out any defect based on severity or confidence). 2008-07-14 Sebastien Pouliot * NEWS: Update for the next release. * self-test.ignore: Update (and add) some ignore entries. 2008-06-15 Daniel Nauck * gendarme-wizard.desktop: add desktop file 2008-05-28 Sebastien Pouliot * gendarme.in: Add $MONO_OPTIONS since this is more common than the $MONO_EXTRA_ARGS we have been using (and keeping for compatibility) 2008-04-18 Sebastien Pouliot * README: Add (the periodic remainder ;-) that Makefiles are *the* official build system used by Gendarme while others (MonoDevelop and VS.NET) are user-supported. * self-test.ignore: Add ignore entry AvoidDeepInheritanceTreeRule since some FX provided types will never work with the default (4) value. 2008-04-06 Sebastien Pouliot * self-test.ignore: Remove ignore entry for ExitCodeIsLimitedOnUnixRule 2008-04-06 Sebastien Pouliot * self-test.ignore: Ignore NDesk.Options.OptionSet::Add wrt Gendarme.Rules.Performance.DoNotIgnoreMethodResultRule 2008-04-05 Sebastien Pouliot * gendarme.mds: Add wizard to the MD solution. 2008-03-23 Sebastien Pouliot * rules/Gendarme.Rules.Security/Makefile.am * rules/Gendarme.Rules.Design/Makefile.am * rules/Gendarme.Rules.Naming/Makefile.am * rules/Gendarme.Rules.Serialization/Makefile.am * rules/Gendarme.Rules.Ui/Makefile.am * rules/Gendarme.Rules.Exceptions/Makefile.am * rules/Gendarme.Rules.Interoperability/Makefile.am * rules/Gendarme.Rules.Concurrency/Makefile.am * rules/Gendarme.Rules.Correctness/Makefile.am * rules/Gendarme.Rules.Smells/Makefile.am * rules/Gendarme.Rules.BadPractice/Makefile.am * rules/Gendarme.Rules.Performance/Makefile.am * rules/Gendarme.Rules.Portability/Makefile.am * framework/Makefile.am * console/Makefile.am * swf-wizard-runner/Makefile.am: Refer directly to Mono.Cecil assembly, not to a local copy, of it. 2008-03-22 Sebastien Pouliot * gendarme-wizard.in: New. Script to call the Gendarme SWF Wizard * Makefile.am: Add swf-wizard-runner and win32-setup to the build 2008-03-16 Sebastien Pouliot * gendarme.svg: Put GHOP's Steve P. logo into repository. 2008-02-17 Sebastien Pouliot * AssemblyInfo.cs.in: Remove static stuff and keep only the version. * AssemblyStaticInfo.cs: New. Keep static/shared stuff here. * self-test.ignore: New. Start an ignore list for self-test. * gendarme.mds: Update MonoDevelop project file. * Makefile.am: Update build file. 2008-02-12 Sebastien Pouliot * MIT.X11: Update copyrights up to 2008 * TODO: Link to the roadmap available in the Google Group * README: List the most common resources for Gendarme 2008-02-09 Nestor Salceda * Makefile.am: When we target clean, we should also delete doc directory. 2008-02-09 Nestor Salceda * Makefile.am: Added tasks for API documentation generation. One for generating documentation and other for assembling the documentation for distrubution puroposes. 2008-02-06 Sebastien Pouliot * AUTHORS: Welcome new Gendarme hackers: Seo Sanghyeon and Scott Peterson 2008-02-01 Andrew Jorgensen * Makefile.am: Fixes to import gendarme into mono-tools and a good amount of autotools love as well 2008-01-31 Sebastien Pouliot * NEWS: Ready for 0.0.5 2008-01-13 Sebastien Pouliot * Makefile.am: Run framework tests on "make run-test" and ignore non-Gendarme assemblies on "make self-test". 2007-12-30 Sebastien Pouliot * configure.ac: Add Gendarme.Rules.Interoperability 2007-12-20 Sebastien Pouliot * NEWS: Finally 0.0.4 :) 2007-11-29 Sebastien Pouliot * Makefile.am: Change self-test to use the self-test set of rules instead of the default one. 2007-10-07 Sebastien Pouliot * AUTHORS: Add the GSoC 2007 crew! * configure.ac: Add new assemblies. Bump version number for (soon to be ready) next version. * gendarme.mds: Update MonoDevelop solution. 2007-09-14 Nestor Salceda * configure.ad: Add Gendarme.Rules.Smells to the build. 2007-09-13 Nestor Salceda * configure.ac: Add Gendarme.Rules.Naming to the build. 2007-08-31 Nestor Salceda * configure.ac: Install Gendarme.Framework to be reusable (pkg-config) with other runners. 2006-11-08 Sebastien Pouliot * gendarme.sln: Update solution file for VS.NET 2006-11-06 Sebastien Pouliot * configure.ac: Add Gendarme.Rules.Ui to the build and bump version number to 0.0.3.1 (just to avoid confusion with released 0.0.3). 2006-10-16 Sebastien Pouliot * configure.ac: Bump for 0.0.3 release. * NEWS: Update for 0.0.3 release. * README: Update for 0.0.3 release. * TODO: New. Merge my own TODO file with Christian ideas. 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-19 Sebastien Pouliot * gendarme.sln, *.csproj: New files. Added solution and project files for VS.NET 2005. You can now build, test and debug under Windows too 2006-09-17 Sebastien Pouliot * AUTHORS: Added Christian Birkl to the list. * gendarme.in: Move MONO_EXTRA_ARGS after mono (and before gendarme.exe). * Makefile.am: Remove duplicate DISTCLEANFILES. 2006-09-05 Jb Evain * Update to latest Cecil API. 2006-07-31 Sebastien Pouliot * gendarme.mds: New. Solution file for MonoDevelop. 2006-06-19 Sebastien Pouliot * AUTHORS: Added Russell Morris to the author's list. * configure.ac: Updated version to 0.0.2.0. * NEWS: Updated for second release. * README: Updated for second release. 2006-06-19 Russell Morris * configure.ac: Merged initial build of exception-usage checks rule(s) 2006-06-13 Sebastien Pouliot * AssemblyInfo.cs.in: Updated copyright notice (as this is the string that will be displayed by the Gendarme's console runner). * Makefile.am: Added self-test target to run gendarme on itself (in order to promote compliance ;-). Added an alias for dist to dist-zip so all files can be added into the distribution (zip) archive. 2005-12-09 Aaron Tomb * Merged rules for double-check locking and bad recursive invocation checking. 2005-11-02 Sebastien Pouliot * Initial import into SVN. mono-tools-4.2/gendarme/gendarme.svg0000664000175000017500000000665412413742070021607 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gendarme/TODO0000664000175000017500000000015012413742070017755 0ustar00directhexdirecthex00000000000000See http://www.mono-project.com/Gendarme.Roadmap for an up to date list of planned and unplanned tasks. mono-tools-4.2/gendarme/self-test.ignore0000664000175000017500000015431412413742070022414 0ustar00directhexdirecthex00000000000000@ mono-options.ignore # --------------------------------------------------------- # TODO: These should be fixed. R: Gendarme.Rules.Correctness.EnsureLocalDisposalRule M: System.Void Gendarme.Wizard::SaveReportButtonClick(System.Object,System.EventArgs) # we create but give it to cecil M: System.Void Gendarme.Framework.Rocks.ModuleRocks::LoadDebuggingSymbols(Mono.Cecil.ModuleDefinition) # Not sure about this one. R: Gendarme.Rules.Design.Generic.PreferGenericsOverRefObjectRule M: Mono.Cecil.Cil.Instruction Gendarme.Framework.Helpers.StackEntryAnalysis::GetNextInstruction(Mono.Cecil.Cil.Instruction,System.Object&) R: Gendarme.Rules.Exceptions.UseObjectDisposedExceptionRule M: System.Void Gendarme.Wizard::set_Current(Gendarme.Page) R: Gendarme.Rules.Correctness.CheckParametersNullityInVisibleMethodsRule # cannot be null - waiting for code contracts M: System.Void Gendarme.ConsoleRunner::OnAssembly(Gendarme.Framework.RunnerEventArgs) M: System.Void Gendarme.Framework.Runner::TearDown(Gendarme.Framework.IRule) M: System.Void Gendarme.Rules.Concurrency.DecorateThreadsRule::OnAssembly(System.Object,Gendarme.Framework.RunnerEventArgs) M: System.Void Gendarme.Rules.Concurrency.DoNotLockOnWeakIdentityObjectsRule::Analyze(Mono.Cecil.MethodDefinition,Mono.Cecil.MethodReference,Mono.Cecil.Cil.Instruction) # all > 200 rules expose a Check* method that does not check for null (by contract) but we need code contracts to show this M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.AvoidAssemblyVersionMismatchRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.AvoidCallingProblematicMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.AvoidNullCheckWithAsOperatorRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.AvoidVisibleConstantFieldRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.CheckNewExceptionWithoutThrowingRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.CheckNewThreadWithoutStartRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.CloneMethodShouldNotReturnNullRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.ConstructorShouldNotCallVirtualMethodsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.DisableDebuggingCodeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.DoNotDecreaseVisibilityRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.DoNotForgetNotImplementedMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.DoNotUseEnumIsAssignableFromRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.DoNotUseGetInterfaceToCheckAssignabilityRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.GetEntryAssemblyMayReturnNullRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.OnlyUseDisposeForIDisposableTypesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.PreferEmptyInstanceOverNullRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.PreferParamsArrayForVariableArgumentsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.PreferTryParseRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.PreferSafeHandleRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.ReplaceIncompleteOddnessCheckRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.BadPractice.UseFileOpenOnlyWithFileAccessRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.DecorateThreadsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.DoNotUseMethodImplOptionsSynchronizedRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.DoNotUseThreadStaticWithInstanceFieldsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.DoNotUseLockedRegionOutsideMethodRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.DoubleCheckLockingRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.LockAnalyzerRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.NonConstantStaticFieldsShouldNotBeVisibleRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.ProtectCallToEventDelegatesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.ReviewLockUsedOnlyForOperationsOnVariablesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.WriteStaticFieldFromInstanceMethodRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.AvoidCodeWithSideEffectsInConditionalCodeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.AvoidConstructorsInStaticTypesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.AvoidMethodsWithSideEffectsInConditionalCodeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.DoNotRecurseInEqualityRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.BadRecursiveInvocationRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.CallingEqualsWithNullArgRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.CheckParametersNullityInVisibleMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.DeclareEventsExplicitlyRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.DisposableFieldsShouldBeDisposedRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.DoNotRoundIntegersRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.EnsureLocalDisposalRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.FinalizersShouldCallBaseClassFinalizerRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.MethodCanBeMadeStaticRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ProvideCorrectArgumentsToFormattingMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ProvideCorrectRegexPatternRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ProvideValidXmlStringRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ProvideValidXPathExpressionRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ReviewCastOnIntegerDivisionRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ReviewCastOnIntegerMultiplicationRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ReviewDoubleAssignmentRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ReviewSelfAssignmentRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ReviewUselessControlFlowRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ReviewUseOfInt64BitsToDoubleRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.ReviewUseOfModuloOneOnIntegersRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.TypesShouldBeDisposableBaseRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.TypesWithDisposableFieldsShouldBeDisposableRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.TypesWithNativeFieldsShouldBeDisposableRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.UseNoInliningWithGetCallingAssemblyRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.UseValueInPropertySetterRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AbstractTypesShouldNotHavePublicConstructorsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AvoidEmptyInterfaceRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AvoidMultidimensionalIndexerRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AvoidPropertiesWithoutGetAccessorRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AvoidVisibleFieldsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AvoidRefAndOutParametersRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AvoidSmallNamespaceRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AvoidVisibleNestedTypesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.ConsiderAddingInterfaceRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.ConsiderConvertingFieldToNullableRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.ConsiderConvertingMethodToPropertyRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.ConsiderUsingStaticTypeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.DeclareEventHandlersCorrectlyRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.DisposableTypesShouldHaveFinalizerRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.DoNotDeclareSettersOnCollectionPropertiesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.DoNotDeclareVirtualMethodsInSealedTypeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.DoNotDeclareProtectedMembersInSealedTypeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.EnsureSymmetryForOverloadedOperatorsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.EnumsShouldDefineAZeroValueRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.EnumsShouldUseInt32Rule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.ImplementEqualsAndGetHashCodeInPairRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.ImplementIComparableCorrectlyRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.MainShouldNotBePublicRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.MarkAssemblyWithAssemblyVersionRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.MarkAssemblyWithAttributeRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.OperatorEqualsShouldBeOverloadedRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.OverrideEqualsMethodRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.PreferEventsOverMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.PreferIntegerOrStringForIndexersRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.ProvideAlternativeNamesForOperatorOverloadsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.ProvideTryParseAlternativeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.StronglyTypedRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.TypesShouldBeInsideNamespacesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.UseFlagsAttributeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.UseCorrectDisposeSignaturesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.Generic.AvoidExcessiveParametersOnGenericTypesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.Generic.AvoidMethodWithUnusedGenericTypeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.Generic.DoNotDeclareStaticMembersOnGenericTypesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.Generic.DoNotExposeGenericListsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.Generic.ImplementGenericCollectionInterfacesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.Generic.PreferGenericsOverRefObjectRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.AvoidArgumentExceptionDefaultConstructorRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.DoNotDestroyStackTraceRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.DoNotThrowInNonCatchClausesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.DoNotThrowInUnexpectedLocationRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.DoNotSwallowErrorsCatchingNonSpecificExceptionsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.ExceptionShouldBeVisibleRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.InstantiateArgumentExceptionCorrectlyRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.NewExceptionsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.UseObjectDisposedExceptionRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Gendarme.DefectsMustBeReportedRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Gendarme.DoNotThrowExceptionRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Gendarme.MissingEngineDependencyRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Gendarme.UseCorrectSuffixRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Globalization.PreferOverrideBaseRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Globalization.SatelliteResourceMismatchRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.CentralizePInvokesIntoNativeMethodsTypeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.CentralizePInvokesIntoNativeMethodsTypeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.DoNotAssumeIntPtrSizeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.GetLastErrorMustBeCalledRightAfterPInvokeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.MarshalBooleansInPInvokeDeclarationsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.MarshalStringsInPInvokeDeclarationsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.PInvokeShouldNotBeVisibleRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.UseManagedAlternativesToPInvokeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.AutoLayoutTypesShouldNotBeComVisibleRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.AvoidInt64ArgumentsInComVisibleMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.AvoidNonPublicFieldsInComVisibleValueTypesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.AvoidOverloadsInComVisibleInterfacesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.AvoidStaticMembersInComVisibleTypesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.ComVisibleShouldInheritFromComVisibleRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.ComVisibleTypesShouldBeCreatableRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.MarkComSourceInterfacesAsIDispatchRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.Com.ReviewComRegistrationMethodsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.AvoidAlwaysNullFieldRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.AvoidComplexMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.AvoidDeepInheritanceTreeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.AvoidLackOfCohesionOfMethodsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.ConsiderUsingStopwatchRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.PreferStringIsNullOrEmptyRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.ReviewMisleadingFieldNamesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Maintainability.VariableNamesShouldNotMatchFieldNamesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.AvoidRedundancyInMethodNameRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.AvoidRedundancyInTypeNameRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.AvoidTypeInterfaceInconsistencyRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.AvoidNonAlphanumericIdentifierRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.AvoidNonAlphanumericIdentifierRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.DoNotPrefixEventsWithAfterOrBeforeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.DoNotPrefixValuesWithEnumNameRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.DoNotUseReservedInEnumValueNamesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.ParameterNamesShouldMatchOverriddenMethodRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.UseCorrectCasingRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.UsePreferredTermsRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.UsePreferredTermsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.UsePreferredTermsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Naming.UseSingularNameInEnumsUnlessAreFlagsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.NUnit.ProvideMessageOnAssertCallsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.NUnit.UnitTestsMissingTestFixtureRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidConcatenatingCharsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidLargeNumberOfLocalVariablesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidLargeStructureRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidLocalDataStoreSlotRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidMethodWithLargeMaximumStackSizeRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidRepetitiveCallsToPropertiesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidRepetitiveCastsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidReturningArraysOnPropertiesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidTypeGetTypeForConstantStringsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidUnnecessaryOverridesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidUnneededCallsOnStringRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidUnneededFieldInitializationRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidUnneededUnboxingRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidUnsealedUninheritedInternalTypeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidUnusedParametersRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.AvoidUnusedPrivateFieldsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.CompareWithEmptyStringEfficientlyRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.ConsiderCustomAccessorsForNonVisibleEventsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.DoNotIgnoreMethodResultRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.UseSuppressFinalizeOnIDisposableTypeWithFinalizerRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.ImplementEqualsTypeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.MathMinMaxCandidateRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.OverrideValueTypeDefaultsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.PreferCharOverloadRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.PreferLiteralOverInitOnlyFieldsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.RemoveUnusedLocalVariablesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.ReviewLinqMethodRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.UseIsOperatorRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.UseStringEmptyRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.UseTypeEmptyTypesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Portability.DoNotHardcodePathsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Portability.ExitCodeIsLimitedOnUnixRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Portability.ExitCodeIsLimitedOnUnixRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Portability.FeatureRequiresRootPrivilegeOnUnixRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Portability.MonoCompatibilityReviewRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Portability.NewLineLiteralRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.ArrayFieldsShouldNotBeReadOnlyRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.DoNotShortCircuitCertificateCheckRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.NativeFieldsShouldNotBeVisibleRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.StaticConstructorsShouldBePrivateRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.Cas.AddMissingTypeInheritanceDemandRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.Cas.DoNotExposeFieldsInSecuredTypeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.Cas.DoNotExposeMethodsProtectedByLinkDemandRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.Cas.ReviewNonVirtualMethodWithInheritanceDemandRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.Cas.ReviewSealedTypeWithInheritanceDemandRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Security.Cas.ReviewSuppressUnmanagedCodeSecurityUsageRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.DeserializeOptionalFieldRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.ImplementISerializableCorrectlyRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.MarkAllNonSerializableFieldsRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.MarkEnumerationsAsSerializableRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.MissingSerializableAttributeOnISerializableTypeRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.MissingSerializationConstructorRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.UseCorrectSignatureForSerializationMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Smells.AvoidCodeDuplicatedInSameClassRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Smells.AvoidCodeDuplicatedInSiblingClassesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Smells.AvoidLargeClassesRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Smells.AvoidLongMethodsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Smells.AvoidMessageChainsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Smells.AvoidSpeculativeGeneralityRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Smells.AvoidSwitchStatementsRule::CheckMethod(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.UI.AddMatchingArrangeMeasureOverrideRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.UI.ExecutableTargetRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.UI.UseSTAThreadAttributeOnSWFEntryPointsRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) # temp entries (new rule) most need to be fixed but some occurs on different code paths R: Gendarme.Rules.Performance.AvoidRepetitiveCallsToPropertiesRule M: System.Int32 Gendarme.Settings::LoadRulesFromAssembly(System.String,System.String,System.String,System.String) M: System.Boolean Gendarme.Framework.Rocks.MethodRocks::IsOverride(Mono.Cecil.MethodReference) M: System.Void Gendarme.Rules.Concurrency.DecorateThreadsRule::CheckMethodBody(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.ThreadModel Gendarme.Rules.Concurrency.ThreadRocks::ThreadingModel(Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.DisposableFieldsShouldBeDisposedRule::CheckType(Mono.Cecil.TypeDefinition) M: System.Void Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule::ProcessMethod(Mono.Cecil.TypeDefinition,Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule/MethodInfo) M: System.Void Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule::CheckHashMethod() M: System.Void Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule::CheckCloneMethod() M: System.Void Gendarme.Rules.Correctness.ProvideCorrectArgumentsToFormattingMethodsRule::CheckCallToFormatter(Mono.Cecil.Cil.Instruction,Mono.Cecil.MethodDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.DisposableTypesShouldHaveFinalizerRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.Generic.DoNotExposeNestedGenericSignaturesRule::CheckMethod(Mono.Cecil.MethodDefinition) M: System.String Gendarme.Rules.Exceptions.DoNotThrowInUnexpectedLocationRule::ExplainThrow(Mono.Cecil.Cil.Instruction) M: System.Boolean Gendarme.Rules.Exceptions.MissingExceptionConstructorsRule::CheckForInnerExceptionConstructor(Mono.Cecil.IMethodSignature) M: Gendarme.Framework.RuleResult Gendarme.Rules.Exceptions.MissingExceptionConstructorsRule::CheckType(Mono.Cecil.TypeDefinition) M: System.Boolean Gendarme.Rules.Interoperability.GetLastErrorMustBeCalledRightAfterPInvokeRule::CheckPInvoke(Mono.Cecil.Cil.Instruction) M: Mono.Cecil.TypeDefinition Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule::GetInterfaceImplementor(Mono.Cecil.TypeDefinition,System.Collections.Generic.IEnumerable`1) M: System.Boolean Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule::IsSystemObjectMethod(Mono.Cecil.MethodReference) M: System.Void Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule::UpdateParameterLeastType(Mono.Cecil.ParameterReference,System.Collections.Generic.IEnumerable`1) M: Gendarme.Framework.RuleResult Gendarme.Rules.Performance.CompareWithEmptyStringEfficientlyRule::CheckMethod(Mono.Cecil.MethodDefinition) M: System.Boolean Gendarme.Rules.Performance.DoNotIgnoreMethodResultRule::IsCallException(Mono.Cecil.MethodReference) M: System.String Gendarme.Rules.Performance.MathMinMaxCandidateRule::GetPrevious(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction&) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.DeserializeOptionalFieldRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.ImplementISerializableCorrectlyRule::CheckType(Mono.Cecil.TypeDefinition) M: Gendarme.Framework.RuleResult Gendarme.Rules.Serialization.MarkAllNonSerializableFieldsRule::CheckType(Mono.Cecil.TypeDefinition) M: System.Void Gendarme.Wizard::Open(System.String) M: System.Void Gendarme.Wizard::UpdateAssemblies() M: System.Void Gendarme.Wizard::PrepareAnalyze() M: System.Void Gendarme.Wizard::Analyze() M: System.Void Gendarme.Wizard::UpdateReportUI() M: Gendarme.ResultWriter Gendarme.Wizard::GetSelectedWriter(System.Int32,System.String) # CSC only - System.Int32 System.Collections.CollectionBase::get_Count() > 20 (22) but MS.NET use an higher limit to inline... M: System.Boolean Gendarme.Rules.Naming.ParameterNamesShouldMatchOverriddenMethodRule::SignatureMatches(Mono.Cecil.MethodReference,Mono.Cecil.MethodReference,System.Boolean) # 'type' might be re-assigned so the second call to FullName is required M: System.Void Gendarme.Rules.Concurrency.DoNotLockOnWeakIdentityObjectsRule::Analyze(Mono.Cecil.MethodDefinition,Mono.Cecil.MethodReference,Mono.Cecil.Cil.Instruction) # different code path / switch M: System.Void Gendarme.Rules.Correctness.ProvideValidXmlStringRule::CheckCall(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction,Mono.Cecil.MethodReference) M: System.Void Gendarme.Rules.Correctness.ProvideValidXPathExpressionRule::CheckCall(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction,Mono.Cecil.MethodReference) M: System.Boolean Gendarme.Rules.Concurrency.DoNotLockOnWeakIdentityObjectsRule::IsWeakSealedType(Mono.Cecil.TypeReference) # mono bug wrt metatoken id with generics R: Gendarme.Rules.Performance.AvoidUncalledPrivateCodeRule M: System.Nullable`1 Gendarme.Rules.Concurrency.ThreadRocks::Lookup(Mono.Cecil.MemberReference,System.Collections.Generic.IEnumerable`1) # mono compiler bug wrt naming autogenerated variables #660530 R: Gendarme.Rules.Performance.AvoidRepetitiveCallsToPropertiesRule M: System.Void Gendarme.IgnoreFileList::Resolve() M: System.Boolean Gendarme.Settings::Load() M: System.Void Gendarme.XmlResultWriter::CreateDefects() M: System.Void Gendarme.Framework.Engines.SuppressMessageEngine::ResolveTargets() M: System.Collections.Generic.List`1 Gendarme.Framework.Helpers.StackEntryAnalysis::FindLoad(Gendarme.Framework.Helpers.StackEntryAnalysis/InstructionWithLeave,Gendarme.Framework.Helpers.StackEntryAnalysis/StoreSlot) M: System.Void Gendarme.Framework.EngineController::Build(System.Collections.Generic.IList`1) M: System.Void Gendarme.Framework.Runner::Initialize() M: System.Void Gendarme.Framework.Runner::Run() M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.AvoidSmallNamespaceRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: System.Void Gendarme.Rules.Design.AvoidSmallNamespaceRule::TearDown() M: Gendarme.Framework.RuleResult Gendarme.Rules.Design.InternalNamespacesShouldNotExposeTypesRule::CheckAssembly(Mono.Cecil.AssemblyDefinition) M: System.Void Gendarme.Rules.Interoperability.Com.MarkComSourceInterfacesAsIDispatchRule::FindInterfaces() M: System.Boolean Gendarme.Rules.Smells.AvoidSpeculativeGeneralityRule::HasExpectedInheritedTypeCount(Mono.Cecil.TypeReference,System.Int32) M: System.Void Gendarme.XmlResultWriter::CreateDefects() M: System.Boolean Gendarme.Wizard::UpdateActiveRules() M: System.Void Gendarme.Framework.Engines.SuppressMessageEngine::AddIgnore(Mono.Cecil.IMetadataTokenProvider,System.Collections.Generic.IEnumerable`1) # --------------------------------------------------------- # We might want to fix these. # in some cases a null and String.Empty means different things (e.g. absense versus empty) R: Gendarme.Rules.BadPractice.PreferEmptyInstanceOverNullRule M: System.String Gendarme.Rules.Correctness.AvoidMethodsWithSideEffectsInConditionalCodeRule::ConditionalOn(Mono.Cecil.MethodReference) M: System.String Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule::GetReturnTypeSignature(Mono.Cecil.MethodReference) T: Gendarme.Rules.Correctness.ProvideCorrectArgumentsToFormattingMethodsRule # some needs fixing - to be reviewed R: Gendarme.Rules.Smells.AvoidCodeDuplicatedInSameClassRule # StartsHandlerRegion(Mono.Cecil.Cil.Instruction) vs StartsTryRegion(Mono.Cecil.Cil.Instruction) # EndsTryRegion(Mono.Cecil.Cil.Instruction) vs EndsHandlerRegion(Mono.Cecil.Cil.Instruction) T: Gendarme.Framework.Helpers.MethodPrinter # Matches(Mono.Cecil.MethodReference) vs ToString() T: Gendarme.Framework.Helpers.MethodSignature # GetOperand(Mono.Cecil.Cil.Instruction,Mono.Cecil.MethodDefinition) vs GetOperandType(Mono.Cecil.Cil.Instruction,Mono.Cecil.MethodDefinition) # GetOperandType(Mono.Cecil.Cil.Instruction,Mono.Cecil.MethodDefinition) vs GetParameter(Mono.Cecil.Cil.Instruction,Mono.Cecil.MethodDefinition) T: Gendarme.Framework.Rocks.InstructionRocks # Implements(Mono.Cecil.TypeReference,System.String) vs Inherits(Mono.Cecil.TypeReference,System.String) T: Gendarme.Framework.Rocks.TypeRocks # OnType(Gendarme.Framework.RunnerEventArgs) vs OnMethod(Gendarme.Framework.RunnerEventArgs) T: Gendarme.Framework.Runner # GetArgumentType(Mono.Cecil.Cil.Instruction,Mono.Cecil.MethodDefinition) vs CheckMethod(Mono.Cecil.MethodDefinition) T: Gendarme.Rules.Correctness.DoNotRoundIntegersRule # GetPrevious(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction&) vs IsOk(Mono.Cecil.Cil.Instruction) T: Gendarme.Rules.Performance.MathMinMaxCandidateRule # LoadElementMatch(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction,Mono.Cecil.Cil.Instruction) vs LoadIndirectMatch(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction,Mono.Cecil.Cil.Instruction) T: Gendarme.Rules.Performance.AvoidRepetitiveCastsRule # CheckAssembly(Mono.Cecil.AssemblyDefinition) vs CheckMethod(Mono.Cecil.MethodDefinition) T: Gendarme.Rules.Portability.ExitCodeIsLimitedOnUnixRule # GetSignatures and UpdateParameterLeastType - similar loop/switch/case but cannot be merged T: Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule # CheckAssemblyForMethodUsage and GetCache - not clear, needs review T: Gendarme.Rules.Performance.AvoidUncalledPrivateCodeRule # CheckForAny and CheckMethod T: Gendarme.Rules.Performance.ReviewLinqMethodRule # CheckType and ProcessMethods, ProcessMethods and ProcessProperties T: Gendarme.Rules.Design.StronglyTypedRule # 2.8+ M: System.String Gendarme.Rules.Maintainability.PreferStringIsNullOrEmptyRule::GetName(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction) # ParseSeverity(System.String) and ParseConfidence(System.String) are very similar T: Gendarme.ConsoleRunner R: Gendarme.Rules.Smells.AvoidCodeDuplicatedInSiblingClassesRule M: Gendarme.Framework.RuleResult Gendarme.Rules.Correctness.AvoidFloatingPointEqualityRule::CheckMethod(Mono.Cecil.MethodDefinition) # CheckType and GetEngineDependencyValue T: Gendarme.Rules.Gendarme.MissingEngineDependencyRule # DoNotThrowExceptionRule::CheckMethod and MissingEngineDependencyRule::CheckType T: Gendarme.Rules.Gendarme.GendarmeRule R: Gendarme.Rules.Smells.AvoidSpeculativeGeneralityRule T: Gendarme.Framework.EngineController T: Gendarme.Framework.Helpers.MethodSignatures T: Gendarme.Framework.Rocks.ParameterRocks # FIXME - note: some seems to be related to an xMCS bug R: Gendarme.Rules.Performance.AvoidMethodWithLargeMaximumStackSizeRule # Found 1110 maximum stack size (maximum 100). ### autogenerated - should be ignored M: System.Void Gendarme.Wizard::InitializeComponent() # Found 129 maximum stack size (maximum 100). M: System.Collections.Generic.List`1 Gendarme.Framework.Helpers.StackEntryAnalysis::FindLoad(Gendarme.Framework.Helpers.StackEntryAnalysis/InstructionWithLeave,Gendarme.Framework.Helpers.StackEntryAnalysis/StoreSlot) # Found 202 maximum stack size (maximum 100). M: System.Void Gendarme.Rules.Concurrency.DecorateThreadsRule::CheckMethodBody(Mono.Cecil.MethodDefinition) # Found 121 maximum stack size (maximum 100). M: System.Void Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule::ProcessMethod(Mono.Cecil.TypeDefinition,Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule/MethodInfo) # Found 188 maximum stack size (maximum 100). # FIXME R: Gendarme.Rules.Maintainability.AvoidComplexMethodsRule # CC 32 M: System.Void Gendarme.Framework.Helpers.MethodSignatures::.cctor() # CC 29 M: System.Collections.Generic.List`1 Gendarme.Framework.Helpers.StackEntryAnalysis::FindLoad(Gendarme.Framework.Helpers.StackEntryAnalysis/InstructionWithLeave,Gendarme.Framework.Helpers.StackEntryAnalysis/StoreSlot) # CC 43 M: System.Void Gendarme.Rules.Concurrency.DecorateThreadsRule::CheckMethodBody(Mono.Cecil.MethodDefinition) # CC 41 M: Gendarme.Framework.RuleResult Gendarme.Rules.Concurrency.DecorateThreadsRule::CheckMethod(Mono.Cecil.MethodDefinition) # FIXME R: Gendarme.Rules.Smells.AvoidLongMethodsRule # Logical SLOC: 50. Maximum : 40 M: System.Collections.Generic.List`1 Gendarme.Framework.Helpers.StackEntryAnalysis::FindLoad(Gendarme.Framework.Helpers.StackEntryAnalysis/InstructionWithLeave,Gendarme.Framework.Helpers.StackEntryAnalysis/StoreSlot) # Logical SLOC: 64. Maximum : 40 M: System.Void Gendarme.Rules.Concurrency.DecorateThreadsRule::CheckMethodBody(Mono.Cecil.MethodDefinition) # some fixes possible, needs to be reviewed R: Gendarme.Rules.Maintainability.AvoidLackOfCohesionOfMethodsRule T: Gendarme.ConsoleRunner T: Gendarme.Settings T: Gendarme.Framework.Helpers.MethodPrinter T: Gendarme.Framework.Helpers.MethodSignature T: Gendarme.Framework.Defect T: Gendarme.Framework.EngineController T: Gendarme.Rules.Concurrency.DecorateThreadsRule T: Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule T: Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule/MethodInfo T: Gendarme.Rules.Globalization.SatelliteResourceMismatchRule/AssemblyResourceCache T: Gendarme.Rules.Interoperability.DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule T: Gendarme.Rules.Interoperability.UseManagedAlternativesToPInvokeRule/ManagedAlternatives T: Gendarme.Rules.Maintainability.AvoidComplexMethodsRule T: Gendarme.Rules.Maintainability.AvoidLackOfCohesionOfMethodsRule T: Gendarme.Rules.Portability.MonoCompatibilityReviewRule T: Gendarme.Rules.Smells.AvoidLongMethodsRule T: Gendarme.Rules.Smells.CodeDuplicatedLocator T: Gendarme.Rules.Smells.Pattern T: Gendarme.GuiRunner T: Gendarme.Wizard # BUG - suggestion won't compile - two different, incompatible interfaces are used IMethodSignature and IMetadataTokenProvider # rule suggest the first one (same depth) but since it cannot be casted it should propose a base class R: Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule M: System.Boolean Gendarme.Rules.Interoperability.Com.ComRocks::IsTypeComVisible(Mono.Cecil.TypeDefinition) M: System.Boolean Gendarme.Rules.Performance.AvoidUnnecessaryOverridesRule::IsBase(Mono.Cecil.MethodReference,Mono.Cecil.MethodReference) M: System.Boolean Gendarme.Rules.Correctness.BadRecursiveInvocationRule::CompareMethods(Mono.Cecil.MethodReference,Mono.Cecil.MethodReference,System.Boolean) M: System.Boolean Gendarme.Rules.Naming.ParameterNamesShouldMatchOverriddenMethodRule::SignatureMatches(Mono.Cecil.MethodReference,Mono.Cecil.MethodReference,System.Boolean) # --------------------------------------------------------- # These are all OK. # OK - The rule itself needs the literal new line characters to test against them R: Gendarme.Rules.Portability.NewLineLiteralRule M: Gendarme.Framework.RuleResult Gendarme.Rules.Portability.NewLineLiteralRule::CheckMethod(Mono.Cecil.MethodDefinition) # OK - don't apply the rule to itself R: Gendarme.Rules.Portability.DoNotHardcodePathsRule M: System.Void Gendarme.Rules.Portability.DoNotHardcodePathsRule::ProcessUnixProbablyAbsolutePath(System.String) # OK - in those case the specialization has its contextual sense and helps readability R: Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule M: System.Boolean Gendarme.Framework.Rocks.ModuleRocks::HasDebuggingInformation(Mono.Cecil.ModuleDefinition) M: System.Void Gendarme.Framework.Defect::.ctor(Gendarme.Framework.IRule,Mono.Cecil.IMetadataTokenProvider,Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction,Gendarme.Framework.Severity,Gendarme.Framework.Confidence,System.String) # only applies to parameters, so using 'Mono.Cecil.ICustomAttributeProvider' would only be confusing (e.g. code completion) M: System.Boolean Gendarme.Framework.Rocks.ParameterRocks::IsParams(Mono.Cecil.ParameterDefinition) # the bitmask applies only to methods, so using 'Mono.Cecil.IAnnotationProvider' would only be confusing (e.g. code completion) M: Gendarme.Framework.Helpers.OpCodeBitmask Gendarme.Framework.Engines.OpCodeEngine::GetBitmask(Mono.Cecil.MethodDefinition) # the check is done on methods, so using 'Mono.Cecil.IMemberReference' would only be confusing (e.g. code completion) M: System.Boolean Gendarme.Framework.Rocks.MethodRocks::IsEntryPoint(Mono.Cecil.MethodReference) # the check is done on types so using the suggested 'Mono.Cecil.MemberReference' would be confusing (e.g. code completion) M: System.Boolean Gendarme.Framework.Rocks.TypeRocks::IsFloatingPoint(Mono.Cecil.TypeReference) M: System.Boolean Gendarme.Framework.Rocks.TypeRocks::IsNative(Mono.Cecil.TypeReference) # OK - the gendarme framework is not a beginner, nor easy, API R: Gendarme.Rules.Design.AvoidRefAndOutParametersRule M: Mono.Cecil.Cil.Instruction Gendarme.Framework.Helpers.StackEntryAnalysis::GetNextInstruction(Mono.Cecil.Cil.Instruction,System.Object&) # OK - the field is not owned by this type R: Gendarme.Rules.Design.TypesWithDisposableFieldsShouldBeDisposableRule T: Gendarme.GuiRunner # OK - the framework and the runners each have a global catch all to report errors R: Gendarme.Rules.Exceptions.DoNotSwallowErrorsCatchingNonSpecificExceptionsRule M: System.Byte Gendarme.ConsoleRunner::Execute(System.String[]) M: System.Void Gendarme.Framework.Runner::Initialize() M: System.Void Gendarme.GuiRunner::Execute() # OK - DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule might throw exceptions with very uncommon code sequences (obfuscated code for instance) M: Gendarme.Framework.RuleResult Gendarme.Rules.Interoperability.DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule::CheckMethod(Mono.Cecil.MethodDefinition) # FIXME the last one needs validation M: System.Boolean Gendarme.Wizard::CouldCopyReport(System.String&,System.String) # OK - MethodSignatures use the CLR names for operators that starts with "op_" R: Gendarme.Rules.Naming.AvoidNonAlphanumericIdentifierRule T: Gendarme.Framework.Helpers.MethodSignatures # OK - IMethodRule is not declared on purpose on BadPractice.ReturnNullRule R: Gendarme.Rules.Design.ConsiderAddingInterfaceRule T: Gendarme.Rules.BadPractice.ReturnNullRule # OK - RegEx sadly do not provide a TryPattern method R: Gendarme.Rules.Performance.DoNotIgnoreMethodResultRule M: System.Boolean Gendarme.Rules.Correctness.ProvideCorrectRegexPatternRule::CheckPattern(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction,System.String,Gendarme.Framework.Confidence) # OK - The set of potential exceptions of RegEx is unknown R: Gendarme.Rules.Exceptions.DoNotSwallowErrorsCatchingNonSpecificExceptionsRule M: System.Boolean Gendarme.Rules.Correctness.ProvideCorrectRegexPatternRule::CheckPattern(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction,System.String,Gendarme.Framework.Confidence) # OK - we're using switch extensively and in a way that would be hard to OO-ize while keeping performance and readability R: Gendarme.Rules.Smells.AvoidSwitchStatementsRule A: * # OK - small, but slowly growing, namespace R: Gendarme.Rules.Design.AvoidSmallNamespaceRule N: Gendarme.Framework.Engines # The winforms wizard uses Gendarme from a thread so the DecorateThreadsRule will # fire because Gendarme code, like the rules and the runners, are not marked as # thread-safe. R: Gendarme.Rules.Concurrency.DecorateThreadsRule M: System.Void Gendarme.Wizard::UpdateWelcomeUI() M: System.Boolean Gendarme.Wizard::UpdateActiveRules() M: System.Void Gendarme.Wizard::Analyze() # This is internal code. R: Gendarme.Rules.Performance.AvoidReturningArraysOnPropertiesRule M: System.Int32[] Gendarme.Rules.Smells.Pattern::get_Prefixes() # OK - GetFastCyclomaticComplexity and GetSwitchCyclomaticComplexity are meant to be similar R: Gendarme.Rules.Smells.AvoidCodeDuplicatedInSameClassRule T: Gendarme.Rules.Maintainability.AvoidComplexMethodsRule # OK - some field prefix are identical - but they would be hard to avoid while keeping readability R: Gendarme.Rules.Smells.AvoidLargeClassesRule T: Gendarme.Wizard T: Gendarme.Framework.Helpers.OpCodeBitmask T: Gendarme.Framework.Runner # Conditional code is used and, sadly, this leaves useless control flow in the IL R: Gendarme.Rules.Correctness.ReviewUselessControlFlowRule M: System.Void Gendarme.Framework.Helpers.Log::WriteLine(T) M: System.Void Gendarme.Framework.Helpers.Log::WriteLine(T,System.String,System.Object[]) M: System.Void Gendarme.Framework.Helpers.Log::WriteLine(T,Mono.Cecil.MethodDefinition) M: System.Void Gendarme.Framework.Helpers.Log::WriteLine(System.String) M: System.Void Gendarme.Framework.Helpers.Log::WriteLine(System.String,System.String,System.Object[]) M: System.Void Gendarme.Framework.Helpers.Log::WriteLine(System.String,Mono.Cecil.MethodDefinition) # some methods call [Conditional] code where 'this' is used so the compiler can't accept a static method. However the compiled IL could be static R: Gendarme.Rules.Correctness.MethodCanBeMadeStaticRule M: System.String Gendarme.Rules.Correctness.AvoidCodeWithSideEffectsInConditionalCodeRule::Mutates(Mono.Cecil.MethodDefinition,Mono.Cecil.Cil.Instruction) M: System.Boolean Gendarme.Rules.Correctness.AvoidMethodsWithSideEffectsInConditionalCodeRule::IsPure(Mono.Cecil.MethodReference) R: Gendarme.Rules.Smells.AvoidCodeDuplicatedInSameClassRule # OK - (CSC only) GetLoadSlot and GetStoreSlot are identical except for the switch/case (load versus store instructions) - delegating calls won't change defect T: Gendarme.Framework.Helpers.StackEntryAnalysis # OK R: Gendarme.Rules.Naming.AvoidRedundancyInTypeNameRule # ComRocks is not directly used T: Gendarme.Rules.Interoperability.Com.ComRocks # Some Com rules start with 'Com' T: Gendarme.Rules.Interoperability.Com.ComVisibleShouldInheritFromComVisibleRule T: Gendarme.Rules.Interoperability.Com.ComVisibleTypesShouldBeCreatableRule # NUnitRocks is not directly used T: Gendarme.Rules.NUnit.NUnitRocks # OK - different code paths R: Gendarme.Rules.Performance.AvoidRepetitiveCastsRule M: System.Boolean Gendarme.Rules.Security.Cas.SecurityDeclarationRocks::TryProcessPermissionSetAttribute(Mono.Cecil.SecurityDeclaration,System.Security.PermissionSet&) R: Gendarme.Rules.Performance.AvoidUnneededUnboxingRule M: System.Boolean Gendarme.Rules.Security.Cas.SecurityDeclarationRocks::TryProcessPermissionSetAttribute(Mono.Cecil.SecurityDeclaration,System.Security.PermissionSet&) # OK - Runner.Report is being called in a base type or in another type (for Smells) R: Gendarme.Rules.Gendarme.DefectsMustBeReportedRule T: Gendarme.Rules.Design.EnumeratorsShouldBeStronglyTypedRule T: Gendarme.Rules.Design.StronglyTypeICollectionMembersRule T: Gendarme.Rules.Design.ListsAreStronglyTypedRule T: Gendarme.Rules.Design.MarkAssemblyWithComVisibleRule T: Gendarme.Rules.Design.MarkAssemblyWithCLSCompliantRule T: Gendarme.Rules.Exceptions.DoNotThrowReservedExceptionRule T: Gendarme.Rules.Exceptions.AvoidThrowingBasicExceptionsRule T: Gendarme.Rules.Smells.AvoidCodeDuplicatedInSiblingClassesRule T: Gendarme.Rules.Smells.AvoidCodeDuplicatedInSameClassRule T: Gendarme.Rules.UI.SystemWindowsFormsExecutableTargetRule T: Gendarme.Rules.UI.GtkSharpExecutableTargetRule # OK - Gendarme.Framework.Rule may throw exceptions as it is not a real rule R: Gendarme.Rules.Gendarme.DoNotThrowExceptionRule T: Gendarme.Framework.Rule # Type::op_[Ine|e]quality is new and marked as MonoTODO but it does (at least) the same job as the earlier FX provided R: Gendarme.Rules.Portability.MonoCompatibilityReviewRule M: System.Void Gendarme.Framework.Rocks.ModuleRocks::LoadDebuggingSymbols(Mono.Cecil.ModuleDefinition) M: System.Void Gendarme.Framework.Rocks.ModuleRocks::.cctor() M: System.Void Gendarme.Framework.EngineDependencyAttribute::.ctor(System.Type) M: System.Type Gendarme.Framework.Rule::get_Type() M: System.Security.IPermission Gendarme.Rules.Security.Cas.SecurityDeclarationRocks::CreatePermission(Mono.Cecil.SecurityDeclaration,Mono.Cecil.SecurityAttribute) mono-tools-4.2/gendarme/gendarme.in0000664000175000017500000000014012413742070021376 0ustar00directhexdirecthex00000000000000#!/bin/sh exec @RUNTIME@ $MONO_OPTIONS $MONO_EXTRA_ARGS @prefix@/lib/gendarme/gendarme.exe "$@" mono-tools-4.2/gendarme/gendarme-wizard.in0000664000175000017500000000014712413742070022703 0ustar00directhexdirecthex00000000000000#!/bin/sh exec @RUNTIME@ $MONO_OPTIONS $MONO_EXTRA_ARGS @prefix@/lib/gendarme/gendarme-wizard.exe "$@" mono-tools-4.2/gendarme/AUTHORS0000664000175000017500000000155412413742070020346 0ustar00directhexdirecthex00000000000000Sebastien Pouliot Aaron Tomb Russell Morris Christian Birkl Néstor Salceda Nidhi Rawal Lukasz Knop JB Evain Daniel Abramov Andreas Noever Adrian Tsai Seo Sanghyeon Scott Peterson Cedric Vivier Andres G. Aragoneses Peter Johanson Jesse Jones Rolf Bjarne Kvinge Antoine Vandecreme Julien Hoarau N Lum Nicholas Rioux Yuri Stuken mono-tools-4.2/gendarme/Makefile.in0000664000175000017500000006626512642235731021362 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = AssemblyInfo.cs gendarme gendarme-wizard gd2i 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)$(pixmapdir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(pixmap_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/AssemblyInfo.cs.in $(srcdir)/Makefile.in \ $(srcdir)/gd2i.in $(srcdir)/gendarme-wizard.in \ $(srcdir)/gendarme.in AUTHORS ChangeLog NEWS README TODO 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TESTDIRS = framework rules SUBDIRS = $(TESTDIRS) console swf-wizard-runner man wix tools bin_SCRIPTS = gendarme gendarme-wizard gd2i EXTRA_DIST = gendarme.in gendarme-wizard.in AssemblyInfo.cs.in MIT.X11 gendarme.sln self-test.ignore mono-options.ignore gendarme.svg options.make CLEANFILES = gendarme gendarme-wizard bin/rules.xml pixmapdir = $(datadir)/pixmaps pixmap_DATA = gendarme.svg DISTCLEANFILES = \ AssemblyInfo.cs \ Makefile.in wdir = $(shell pwd) test1_file = $(shell find rules -name "\.svn" -prune -o -name "*$(TEST1)*" -print) test1_name = $(strip $(shell echo "$(test1_file)" | grep -oE "Gendarme\.Rules\.[^\\/]+")) test1_namespace = $(strip $(shell echo "$(test1_name)" | sed "s/Gendarme/Test/")) 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) --gnu gendarme/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/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): AssemblyInfo.cs: $(top_builddir)/config.status $(srcdir)/AssemblyInfo.cs.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gendarme: $(top_builddir)/config.status $(srcdir)/gendarme.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gendarme-wizard: $(top_builddir)/config.status $(srcdir)/gendarme-wizard.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gd2i: $(top_builddir)/config.status $(srcdir)/gd2i.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-pixmapDATA: $(pixmap_DATA) @$(NORMAL_INSTALL) @list='$(pixmap_DATA)'; test -n "$(pixmapdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pixmapdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pixmapdir)" || 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)$(pixmapdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pixmapdir)" || exit $$?; \ done uninstall-pixmapDATA: @$(NORMAL_UNINSTALL) @list='$(pixmap_DATA)'; test -n "$(pixmapdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pixmapdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pixmapdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-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-pixmapDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binSCRIPTS 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: uninstall-binSCRIPTS uninstall-pixmapDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ distclean distclean-generic distclean-tags 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-pdf install-pdf-am install-pixmapDATA 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-am uninstall uninstall-am \ uninstall-binSCRIPTS uninstall-pixmapDATA .PRECIOUS: Makefile # Note that PHONY is required on os-x because a directory exists with # that name. .PHONY: console console: cd framework && make ../bin/Gendarme.Framework.dll cd $(wdir)/console && make ../bin/gendarme.exe cd $(wdir)/rules && make rules bin: console cd $(wdir)/swf-wizard-runner && make ../bin/gendarme-wizard.exe test: list='$(TESTDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) test) ; \ done; run-test: bin/gendarme.exe.config list='$(TESTDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) run-test) ; \ done; self-test: all bin/gendarme.exe.config rm -f gendarme.log; \ mono --debug bin/gendarme.exe --config rules/rules.xml --set self-test --xml bin/self-test.xml --html bin/self-test.html \ --ignore=self-test.ignore --severity=all --confidence=all bin/gendarme.exe bin/gendarme-wizard.exe bin/Gendarme.*.dll check-test: all bin/gendarme.exe.config test mono --debug bin/gendarme.exe --config rules/rules.xml --set unit-test --xml bin/unit-test.xml --html bin/unit-test.html \ --ignore=unit-test.ignore --severity=all --confidence=all @unit-test.list test-regress: all mono --debug bin/gendarme.exe --config rules/rules.xml --set self-test --log regress.log \ --severity=all --confidence=all testcases/*.dll testcases/*.exe TEST1 ?= AvoidVisibleConstantFieldTest test1: bin/gendarme.exe.config cd framework && make test cd $(wdir)/rules/Test.Rules && make test cd $(wdir)/rules/$(test1_name) && make test rm -f $(wdir)/gendarme.log cp $(wdir)/bin/gendarme.exe.config $(wdir)/rules/$(test1_name)/$(test1_namespace).dll.config cd $(wdir)/rules/$(test1_name) && MONO_PATH=$(wdir)/bin/:$(wdir)/rules/Test.Rules/:$(MONO_PATH) \ nunit-console2 -fixture=$(test1_namespace).$(TEST1) -nologo $(test1_namespace).dll bin/gendarme.exe.config: cp console/gendarme.exe.config bin/gendarme.exe.config help: @echo "The targets are:" @echo "all - build everything, including documentation" @echo "bin - build all binaries needed to run gendarme" @echo "console - build everything to execute the console runner" @echo "test - build the unit test dlls" @echo "run-test - build and run the unit tests" @echo "self-test - run gendarme on itself, bin/self-test.html will have the results" @echo "test1 - build and run a single unit test named TEST1" @echo "zip-bin - build then create a ZIP file of the binaries needed to run gendarme" @echo " " @echo "Variables include:" @echo "DEBUG - compile a debug version of the assemblies" @echo "TEST1 - used with test1 target, should be a unit test class name" # note: we take care to bundle the version of Mono.Cecil.dll that we compiled against extra-bin: mkdir -p extra; \ cp -u $(CECIL_ASM) extra; # note: this does not bundle Mono.Cecil.Mdb.dll and Mono.Cecil.Pdb.dll (not built outside Windows) # unless they are previously (and manually) copied into the extra/ directory zip-bin: bin extra-bin mkdir gendarme.$(GENDARME_VERSION); \ cd gendarme.$(GENDARME_VERSION); \ cp ../bin/*.exe .; \ cp ../bin/*.dll .; \ cp ../rules/rules.xml .; \ cp ../man/gendarme.1 .; \ cp ../man/gendarme.5 .; \ cp ../AUTHORS ../README ../MIT.X11 ../NEWS .; \ cp ../extra/* .; \ zip gendarme-$(GENDARME_VERSION)-bin.zip *; \ mv *.zip ..; \ cd ..; \ rm -rf gendarme.$(GENDARME_VERSION); # 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-tools-4.2/gendarme/swf-wizard-runner/0000775000175000017500000000000012642235743022705 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/swf-wizard-runner/ChangeLog0000664000175000017500000002105212413742070024447 0ustar00directhexdirecthex000000000000002010-06-17 Sebastien Pouliot * Wizard.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-05-15 Sebastien Pouliot * GuiRunner.cs: Adjust for IIgnoreList changes * Wizard.cs: Remove [ThreadModel] attribute from UpdateAssemblies since it can be called asynchronously 2010-05-08 Sebastien Pouliot * GuiRunner.cs: Track the (non-fatal) warnings to be reported to the user. * Wizard.cs: Catch FileNotFoundException when loading assemblies. This can occurs if .netmodules are used (and absent). Show this warning, if no fatal error occured, to the user at the end of the analysis. Do not let UpdateAssemblies be called (final check) while we're still loading them async 2010-04-26 Sebastien Pouliot * Wizard.cs: Use Action instead of custom delegates (self-test) 2010-01-16 Sebastien Pouliot * Wizard.Designer.cs: Update copyright notice up to 2010 2009-12-08 Sebastien Pouliot * Wizard.cs: Don't throw/crash wizard if an unmanaged dll is added to the list of assemblies. At the moment the assembly is simply ignored. 2009-11-29 Sebastien Pouliot * GuiRunner.cs: Add Execute method that will catch and report unexpected errors while anyalyzing the assembly set. * Wizard.cs: Call GuiRunner.Execute and adjust UI in case there are unexpected errors. * Wizard.Designer.cs: add new UI elements (autogenerated) 2009-07-09 Jesse Jones * Wizard.cs: Marked the async delegate code as threaded. 2009-03-19 Jesse Jones * Wizard.cs: Throws ObjectDisposedException. 2008-12-06 Sebastien Pouliot * Wizard.resx, Resources/gendarme.ico: Update icon 2008-11-24 Sebastien Pouliot * Wizard.Designer.cs: Adjust UI with new logo 2008-11-23 Sebastien Pouliot * Resources/gendarme.png: Update with new logo. * gendarme.ico, Resources/gendarme.ico: Stop fighting with VS.NET about the icon location. * Makefile.am: Update icon location. 2008-11-20 Sebastien Pouliot * Wizard.cs: Clear every bits from severity and confidence bitmasks otherwise all defects will be part of the results. 2008-11-12 Sebastien Pouliot * gendarme-wizard.desktop.in: Add an additional category as required by SUSE. 2008-11-10 Sebastien Pouliot * Wizard.Designer.cs: Fix copyright symbol that probably did not survive the dos2unix transition. 2008-11-07 Sebastien Pouliot * Page.cs: Clearly specify [Serializable] on the enum (self-test) 2008-11-07 Alan McGovern * swf-wizard-runner.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-31 Sebastien Pouliot * gendarme-wizard.desktop.in: Moved from parent directory. Adjusted local (wrt bindir) and changed icon to our SVN file. * Makefile.am: Generate final .desktop file. Include the .in into the dist and cleanup the generated file. 2008-10-29 Sebastien Pouliot * Wizard.Designer.cs: Add button to save the current rules selection as the default one. * Wizard.cs: Add logic to save and load the default rules selection. * Properties/Settings.settings: Add a setting to keep the rules. Sadly it looks like VS designer cannot use generics. * Properties/Settings.Designer.cs: Autogenerated code for Rules. 2008-10-26 Sebastien Pouliot * Makefile.am: Fix typo 2008-10-25 Sebastien Pouliot * GuiRunner.cs: Implement IIgnoreList explicitly instead of implicitly * Wizard.cs: Change visibility of PreAssemblyUpdate and PostTypeUpdate to internal. 2008-10-21 Sebastien Pouliot * Wizard.cs: Change logic to activate rules so it can be reused after the analysis. This makes the before and after states identical and will fix the reporting of rules (along with XmlResultWriter changes) to include only the one that were selected for the analysis. 2008-08-27 Sebastien Pouliot * Page.cs: Add a new Options step to the enum. * Wizard.Designer.cs: Update (vs generated) * Wizard.cs: Add the new Options step to allow users to set a limit to the number of defects reported, to filter based on the severity or the confidence level of the defects and finally on the visibility of the code being analyzed. * Properties/Settings.settings: Update (vs generated) * Properties/Settings.Designer.cs: Update (vs generated) 2008-08-06 Sebastien Pouliot * Wizard.cs: (GetSelectedWriter) Use the index parameter. 2008-08-02 Sebastien Pouliot * Wizard.cs: Remove unneeded call to String.Format [self-test] 2008-07-27 Sebastien Pouliot * Wizard.Designer.cs: Make it look better for high-DPI displays. * Wizard.cs: Display a single version number based on the Gendarme framework. 2008-07-26 Sebastien Pouliot * Wizard.cs: Add an extra [End|Begin]Update on the TreeView before calling Sort. Fix a bug (infinite recursion) under Vista (and Windows 2008 server) operating systems. 2008-07-15 Sebastien Pouliot * gendarme.ico: Add Gendarme icon * Makefile.am: Add icon to dist 2008-07-14 Sebastien Pouliot * GuiRunner.cs: Prefer Assembly.Load to LoadFile (AvoidCalling ProblematicMethodsRule). Also correct the "skip well known" assemblies hack. 2008-06-16 Sebastien Pouliot * Wizard.Designer.cs: Disable auto-scaling since it resize the form based on the font (and look bad on some Linux desktop). 2008-06-08 Sebastien Pouliot * Page.cs: New. Moved un-nested enum from Wizard.cs [self-test] * Wizard.cs: Remove Page nested enum. * Makefile.am: Add Page.cs to the build * swf-wizard-runner.mdp: Update MD project file. 2008-06-01 Sebastien Pouliot * Wizard.cs: Refactor ResultWriter selection. 2008-05-28 Sebastien Pouliot * Makefile.am: Add ../console/Helpers.cs to the build * swf-wizard-runner.mdp: Add ../console/Helpers.cs to the build 2008-05-18 Sebastien Pouliot * swf-wizard-runner.mdp: Refer to System.Xml.Linq from GAC. 2008-05-16 Sebastien Pouliot * Wizard.cs: Sealed class AssemblyInfo (self-test). 2008-05-14 Jb Evain * Makefile.am: reference System.Xml.Linq. 2008-05-03 Sebastien Pouliot * Wizard.cs: Change CouldCopyReport to static (self-test). 2008-04-27 Sebastien Pouliot * Wizard.cs: Don't expose public fields. 2008-04-25 Sebastien Pouliot * GuiRunner.cs: Better progress display. * Wizard.Designer.cs: Show root lines on the rule treeview. * Wizard.cs: Show rules in a tree, per assembly. 2008-04-12 Sebastien Pouliot * Wizard.cs: Load the assemblies asynchronously. Update any loaded assembly if it has changed on disk. Some minor UI improvements, like more accurate progress report suring analysis. * Wizard.Designer.cs: Avoid manual resizing of the wizard. * Wizard.resx: Add icon so the wizard is easier to spot on the taskbar. 2008-03-30 Sebastien Pouliot * swf-wizard-runner.mdp: New. MD project file. It compile but won't execute properly (since I don't know how to set the resource name correctly). * Makefile.am: Use resgen2 2008-03-22 Sebastien Pouliot * GuiRunner.cs: Fix rule loading so it works when the wizard is invoke using a script. * Wizard.cs: Always save an existing copy, if existing, of any report type (instead of re-generating it). Remove check for InvokeRequired since this (often but not always) breaks on MWF. * Wizard.Designer.cs: Enlarge vertical space for logo (not sure why this is required on MWF). * Properties/Resources.resx: Make logo path unix-friendly. * Makefile.am: New. Allow to build the wizard from the command-line. 2008-03-17 Sebastien Pouliot * Gendarme.cs * GuiRunner.cs * swf-wizard-runner.csproj * Wizard.cs * Wizard.resx * Wizard.Designer.cs * Resources/gendarme.png * Properties/Resources.resx * Properties/Resources.Designer.cs * Properties/Settings.settings * Properties/Settings.Designer.cs Initial import of SWF Wizard Runner mono-tools-4.2/gendarme/swf-wizard-runner/Wizard.resx0000664000175000017500000012673112413742070025052 0ustar00directhexdirecthex00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Gendarme is a extensible rule-based tool to find problems in .NET applications and libraries. Gendarme inspects programs and libraries that contain code in ECMA CIL format (Mono and .NET) and looks for common problems with the code, problems that compiler do not typically check or have not historically checked. 20, 17 153, 17 AAABAAYAEBAQAAAABAAoAQAAZgAAACAgEAAAAAQA6AIAAI4BAAAQEAAAAAAYAGgDAAB2BAAAICAAAAAA GACoDAAA3gcAADAwAAAAABgAqBwAAIYUAABAQAAAAAAYACgyAAAuMQAAKAAAABAAAAAgAAAAAQAEAAAA AACAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAIAAAIAAAACAgACAAAAAgACAAICAAACAgIAAwMDAAAAA /wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAAh3cAAAAAAAdURwAAAIAAh0REcId3RwB0RERXRERHAHRE RERERHcAVERERERHRwB0RERERFRHAAdUREREREcAAId3REREUAAAB0RERFdwAAAHRERHd3d3AAdFd1RE RXcACHV3d3dwAAAAdERERHAAAAB0REREcAAAAHMzMzNwAMP/AACD9wAAAQMAAAADAAAAAwAAAAMAAAAD AACAAwAAwAcAAOAHAADgAAAA4AAAAOAHAADwBwAA8AcAAPAHAAAoAAAAIAAAAEAAAAABAAQAAAAAAAAC AAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/ AAAA//8A/wAAAP8A/wD//wAA////APAAAId1cAAAAAAAAAAAAADwAAdURHAAAAAAAAAAAAAA8AB0RERH AAAAAAAAAAAAAPAHRERERwAAAAAAAAcAAADwdERERERwAAAAB3dEcAAA+FREREREcAAHd1RERHAAAPdE REREREd3VERERERwAAB0RERERERERERERERESAAAdERERERERERERERERHgAAHRERERERERERERERHd3 AABUREREREREREREREd0RwAAVERERERERERERER0REcAAHRERERERERERERHRERHAAD3RERERERERERE REREQAAA8HdERERERERERERERHAAAPAAdERERERERERERERwAADwAAd0RERERERERERHAAAA8AAAB3d3 RERERERERwAAAPAAAAd0RERERERHd3AAAADwAAB1RERERERERERFgAAA8AAAdERERERERER3d3eIAPAA AHRERERERXd1RERERFfwAAB0RERER3RERERERER38AAAh0R1d1REREREREd4APAAAAdUVHMzMzMzMzeA AADwAAAAh0RERERERERHAAAA8AAAAAdERERERERERwAAAPAAAAAHREREREREREcAAADwAAAAB0RERERE RERIAAAA8AAAAAdERERERERESAAAAPAAAAADMzMzMzMzMzgAAAD/////h3d3d3d3d3d4/////B////gf ///wD///4A//v8AH+B+AB4AfgAAAHwAAAA8AAAAPAAAADwAAAA8AAAAPAAAAD4AAAB/AAAAf8AAAH/gA AD/+AAA//gAAf/wAAB/8AAAD/AAAAPwAAAD8AAAD/gAAH/8AAD//gAA//4AAP/+AAD//gAA//4AAP/8A AD8oAAAAEAAAACAAAAABABgAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtqKmeFZdaEJKmX+E AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnoWJZT9HTCApTCApcU5VAAAAAAAAAAAAAAAA AAAAAAAAy72//fr6AAAAAAAA2s/RaENKTCApTCApTCApUCUunoWKAAAAxba4jG91c1FYZ0FJVy02noaK AAAAAAAAellgTCApTCApTCApTCApTCApZkBIa0ZNVCozTCApTCApTCApTCApcU1UAAAAAAAAaURLTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApe1phlXp/AAAAAAAAZkBHTCApTCApTCApTCApTCAp TCApTCApTCApTCApTSEqjXB2Xzc/bEhPAAAAAAAAf19lUicwTCApTCApTCApTCApTCApTCApTCApTCAp YTlBTyQtTCApdlRbAAAAAAAAAAAAknZ8YjtDTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApmX+E AAAAAAAAAAAAAAAAzsDCd1VcbEdPcU5VUigwTCApTCApTCApTCApTCApZT9H/fr6AAAAAAAAAAAAAAAA AAAAjG91XzhATCApTCApTCApTCApTCApZD1FgGFnjXB2/fr6AAAAAAAAAAAAAAAAAAAAaURMTCApTCAp TCApTCApVi01bUlQdFFZdVJZe1lgbUhQd1VclHl+AAAAAAAAAAAAeVdeTCApZD5GbElQeFZdZT9HTCAp TCApTCApTCApYDlBcE1Uj3J4AAAAAAAAAAAAvqyvelhfYDlBUHKLS2l7S2h4TWd2TWV0TmRzaHF9/fr6 AAAAAAAAAAAAAAAAAAAAAAAAmn+FTCApTCApTCApTCApTCApTCApTCApb0tSAAAAAAAAAAAAAAAAAAAA AAAAAAAAfV1jTCApTCApTCApTCApTCApTCApTCApcExUAAAAAAAAAAAAAAAAAAAAAAAAAAAAVoyeNZGp NZCpNZCoNY+nNo+nNo6mNo2lVIudAAAAAAAAAAAAw/8AAIPzAAABAwAAAAMAAAADAAAAAwAAAAMAAIAD AADAAwAA4AMAAOAAAADgAAAA4AMAAPAHAADwBwAA8AcAACgAAAAgAAAAQAAAAAEAGAAAAAAAAAwAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADa0NGTeH10UVhlP0aTeH0AAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAACUeH1jPURMIClMIClMICltSVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACKbHJZMTlMIClMIClMIClMIClRJi+c g4gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAACFZ21TKTFMIClMIClMIClMIClMIClMIClxTVQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAD9+vqrlZn9+voAAAAAAAAAAAAAAAAAAAAAAAAAAACYfoNQJS5MIClMIClMIClM IClMIClMIClMIClTKTGji5AAAAAAAAAAAAAAAAAAAAAAAAAAAAD9+vqhiI16WWBrRk5gOEBNISqcg4gA AAAAAAAAAAAAAAAAAAAAAADMvcBlP0dMIClMIClMIClMIClMIClMIClMIClMIClMICl0UVgAAAAAAAAA AADq4uOiio57WmFtSVBgOUFMIClMIClMIClMIClMICl1UlkAAAAAAAAAAAAAAAAAAAAAAAB9XGNMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClVKzSgh4x+XmRvS1JgOUFMIClMIClMIClMIClMIClMIClM IClMIClMIClmQUgAAAAAAAAAAAAAAAAAAACbgYZVLDRMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClQJS68qa0AAAAAAAAAAAAA AAB2U1pMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClfNz94Vl27qa0AAAAAAAAAAAAAAABpREtMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClQJS55WF6We4BoQ0qI anAAAAAAAAAAAAAAAABkPUVMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClZMDmYfYJyTlZMIClMICmRdXoAAAAAAAAAAAAAAABmQEhMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClVKzSTeH1e Nj5MIClMIClMICmbgocAAAAAAAAAAAAAAAB9XGJMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClPJC2EZWtRJi9MIClMIClMIClMICmmj5MAAAAAAAAAAAAA AAD9+vqLbXNbMjpMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClgOED9+voAAAAAAAAAAAAAAAAAAAAAAACnkJVzUFdNISpMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClqRUwA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9+vqNcHZcNDxMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICmEZWsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAACtl5t0UVhNIitMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClnQkn9+voAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACOcXZpQ0t6WF+CY2l0 UlhZMDlMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICmQc3kAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAACljpJ1U1pXLjdMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClTKTFxTlV/X2aGZ22cg4j9+voAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACmjpNk PkZMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClPJC1NIitMIClMIClPIyxiO0PRxMYA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABvS1JMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClZMDhpRExsSE9tSlBzUFeUeH2agIa2oqbh2Nn9+voAAAAAAAAAAAAAAAAA AAAAAAAAAABpQ0tMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClkPUVxTVV1Ull1U1liPENOIytM IClMIClMIClMIClMIClMIClZMDlmP0eFZ20AAAAAAAAAAAAAAAAAAAAAAACAYGZMIClMIClMIClMIClM IClMIClMIClaMTl1Ull1UllSKDBMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClcMztwTVON cHYAAAAAAAAAAAAAAAAAAAAAAADEs7ZnQklMIClMICluSlFkPUVsSlN5XWZkPkZMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMICleNj5xTVWLbnPHuLsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACd hIllP0dMICliO0JRJi9RgaE3qdQ0mrM0mbE0l7E1l682la42lKw3k6s3kak4kqk4kKg5j6h5f4nLvsAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADXy82ZgIRZLzhMIClPKjVNKDNMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMICmZf4QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAACehYpMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMICmkjJEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACBYWdMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICmpk5cAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAByTlVMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMICmvmp4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAABqRUxMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICm1oqUAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0mbMpnropnropnropnropnrop nropnropnropnropnropnropnropnropnropnrqUsr0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAADf1ddKg5ZBf5NCfpNCfpNCfpJCfpJCfpJCfpJCfZFCfZFCfZFCfZFDfZBDfZBD fJBDfJCvuMAAAAAAAAAAAAAAAAAAAAAAAAD8H///+B////AP///gD/8fwAfwH4AHAB+AAAAfAAAADwAA AA8AAAAPAAAADwAAAA8AAAAPAAAAD8AAAB/gAAAf+AAAH/4AAD/+AAA//AAAH/wAAAH8AAAA/AAAAPwA AAP+AAAf/wAAP/+AAD//gAA//4AAP/+AAD//gAA//wAAPygAAAAwAAAAYAAAAAEAGAAAAAAAABsAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACrlZl/X2V4Vl1tSFCr lZkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAACvmp55WF9SKDBMIClMIClMICmAYWcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs5eaYfYJZMDhMIClMIClMIClMIClMIClYLze1oaUAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC9q657WmBMIClMIClMIClM IClMIClMIClMIClMICmEZWsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAC6p6twTVRMIClMIClMIClMIClMIClMIClMIClMIClMIClaMjq4pakAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC4palvS1JMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMICmHaG4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAADRxMatmJz9+voAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADj2tt5V15MIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMICldNT29q64AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAADNv8KehYqFZmx4Vl1bMjpNISqrlZoAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAACPcnhMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICmLbXMA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADFtbiZf4SBYmh2VFpXLjZMIClMIClMIClMIClMICmB YWcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACiiY5SJzBMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClgOUHDsrUAAAAAAAAAAAAAAAD9+vrAr7KUeX5/X2VzUFdUKjNMIClM IClMIClMIClMIClMIClMIClMIClMIClpREvn3+EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs5eZ2VFtM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICmOcXf9+vq6p6uQdHl8 W2JwTVRSJzBMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICmnkZUAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAACiio9MIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMICldNT1tSVBQJS5MIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMICmMb3UAAAAAAAAAAAAAAAAAAAAAAAAAAAD9+vpzUFdMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICl+XmQAAAAAAAAAAAAAAAAAAAAAAAAA AAC1oaRNISpMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClv S1Kdg4gAAAAAAAAAAAAAAAAAAAAAAAAAAACPcnhMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMICl2VFukjZHHt7qkjJH9+voAAAAAAAAAAAAAAAAAAAAAAAB9XGJMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClWLDWQdHq7qayCYmhaMjpuSlL9+voAAAAA AAAAAAAAAAAAAAAAAABzUFdMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICloQ0qy nqKOcXdaMTlMIClMIClzUFcAAAAAAAAAAAAAAAAAAAAAAAAAAAB0UVhMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClpREu2oqZtSFBMIClMIClMIClMIClzUFcAAAAAAAAAAAAAAAAAAAAAAAAA AAB3VVtMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICliPEOynqFZMDhMIClMIClMIClMIClM IClzUFcAAAAAAAAAAAAAAAAAAAAAAAAAAAB+XmVMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClc NDynkJRPJC1MIClMIClMIClMIClMIClMICl1U1oAAAAAAAAAAAAAAAAAAAAAAAAAAADCsbSFZmxPJC1M IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMICloQ0tMIClMIClMIClMIClMIClMIClMIClMICmEZWsAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAACkjJFoQkpMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMICmnkJUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADJur2IaW9TKTFMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICllP0bk29wAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAACljpNsR09MIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICl9 XWMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQw8WKbHJWLDVMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClNISqljpMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAACnkJVwTFNMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICl3VVz9+voAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADe1NWNcHVZMDhMIClMIClMIClM IClTKTF5V15tSE9MIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMICmiio8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAACpk5d3VVx0UVicg4iehYqPcnhXLTVMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMICl0Uln9+voAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9+vqji495WF9SJzBMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClPIyxnQUl3VVx8W2Kgh4wAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC1oqV8 XGJNISpMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClSKDB/ XmWQdHmcgoeFZmx4Vl16WF96WF+RdXv9+voAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAADFtbhtSVBMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClVKzTTxskAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACEZWtMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClZMTnMvsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAB5V15MIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClSKDBwTFR/X2WEZGuJa3GMb3SNb3WNb3WNcHaNcHWJa3FtSFBwTVR0Ulh5V15+XmWGaG6RdHq5pqoA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB9XGNMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMICldNT2CYmiOcXeMcHVqRExNISpMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClYLzeXfIEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACmj5RNISpM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClPIyx+XWSNcHZ0UVhMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClWLDR7WmCbgYYAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAD9+vp5V15MIClMIClMIClMIClMIClbMjpMIClMIClMICleNj6Ja3GNcHZR JzBMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClbMzt9 XWOUen/GtrgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACtmJxhOkJMIClMIClMIClM ICmehYp2U1p9Yml9gZJ2YWtMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMICliO0N/X2aagIXNwMIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAACfhotXLTVMIClMIClMICl2U1pNISo8dpwxsuwlq9swqsUxpsI0o741oLo3nbY5mrM7 lq49lKtAkadBjaRDi6BFh5xBfpI8c4Y4Z3s6ZXhbeIegiI3Yzc8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACxnKB/XmVsR092U1pSJzBMIClMU2l3 u9xBcIxASVlATFs/Tl8/UmI9VGQ8V2g8WWo7XG07XXA6YHM6Y3Y5Zno+cINEeo5HgpZHhZlQjJ8AAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAADKu71NISpMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMICl7WmEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACnkJRMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICl8W2IAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACOcXdM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMICl8W2EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAACAYGZMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMICl8W2IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB2VFpMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICl8W2IAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAD9+vpuSlFMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMICl9XGMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADXy81VKzRMIClMIClMIClMIClMIClMIClMIClMIClM IClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMIClMICl9XGMAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB7o7EviaEv iaEviaEuiaIuiaIuiaIuiqMuiqMuiqMui6Qui6Qui6Qui6Qui6Qui6QujKUujKUujKUtjaYtjaYtjaYt jactjadOkKUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAABRn7Qdx+kdx+kdx+kdx+kdx+kdx+kdx+kdx+kdx+kdx+kdx+kdx+kdx+kd x+kdx+kdx+kdx+kdx+kdx+kdx+kdx+kdx+kdx+k7pr8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACIjJVcaHVcaHVcaHVdZ3RdZ3Re Z3ReZnNfZnJfZnNfZXJfZXFfZXFfZHFgZHBgZHBgZHBgY29gY29hY29hYm9hYm9hYm5iYm2Hho8AAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/4P////8AAP+A/////wAA/gB/////AAD8AH////8AAPgA P////wAA8AA///j/AADgAB//gP8AAOAAH/gA/wAAwAAPAAB/AACAAAAAAH8AAIAAAAAAfwAAAAAAAAB/ AAAAAAAAAH8AAAAAAAAAPwAAAAAAAAA/AAAAAAAAAH8AAAAAAAAAfwAAAAAAAAB/AAAAAAAAAH8AAAAA AAAAfwAAwAAAAAB/AADgAAAAAH8AAPgAAAAA/wAA/AAAAAD/AAD/AAAAAP8AAP+AAAAB/wAA/+AAAAH/ AAD/4AAAA/8AAP/AAAAA/wAA/4AAAAD/AAD/gAAAAP8AAP+AAAAAAQAA/4AAAAAAAAD/gAAAAAAAAP+A AAAAAwAA/8AAAAAfAAD/4AAAAP8AAP/wAAAD/wAA//wAAAP/AAD//AAAA/8AAP/8AAAD/wAA//wAAAP/ AAD//AAAA/8AAP/4AAAD/wAA//gAAAP/AAD/+AAAA/8AAP/4AAAD/wAA//gAAAP/AAAoAAAAQAAAAIAA AAABABgAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA4djZqpOYkXR6iGlveFZdvKqtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAzsDDnIOHcU5VTCApTCApTCApTCApkHR6AAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6qZKXZD5FTCApTCApTCApTCApTCApTCApYDlBxLS2 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwrK1jG91TSIrTCApTCApTCApTCApTCAp TCApTCApTCApk3d9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArJaaakRMTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApYz1ExbW4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqpSZWTA4 TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAplXp/AAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAqZOXVy01TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApZkFIybq9AAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAqJGVVCozTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApmH2CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6vauuqJGW/fr6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAtqKmVy42TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApakZNzL7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA8+3uu6ismH6DhGVrcU5VTyMsTiMru6msAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAybm8bEdPTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApmoCFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA6ODhuqermH2DhWZsbkpSTSIrTCApTCApTCApTCApTCAplXp/AAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8evsh2huTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApbkpRz8LEAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAA5NvcuKWol3yBhWdta0dOTSEqTCApTCApTCApTCApTCApTCApTCAp TCApTCApd1Vc8evsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAooqOTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApnYSJ AAAAAAAAAAAAAAAAAAAAAAAAAAAA4djZt6Onl3yBhmdtaENKTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTSIruaapAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA zb/CZD5GTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApcU5V18vNAAAAAAAA3tTWtaGll3yBhmhuZD5GTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApknZ8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAmH2CTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApoYiNl3yBhmhuYDlBTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApgWJoAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAybq8ZD5FTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApYjtD 3dLUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlXqATCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApt6OnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6fFtiTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTyMsf19ltqOnAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0MLFVSs0 TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApWzM7jXB1tqOn/fr608fJAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAqJGWTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTSIriGlvw7O28uztrJaagWFnjnF3AAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAj3N5TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApXzc/o4yQ7efnpY6Sd1VcTCApTCAp h2huAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhmdtTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApe1phuKWou6isfl5k TCApTCApTCApTCApg2RqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiWtxTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApi21z 2c7QmoCFVy01TCApTCApTCApTCApTCApg2NqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAi21zTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApfV1jxLS3cE1UTCApTCApTCApTCApTCApTCApTCApiWtxAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAjXB1TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApc1BXwbCzXjY+TCApTCApTCApTCApTCApTCApTCApTCApkHR6AAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAj3J4TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApbUhQvKqtUigwTCApTCApTCApTCApTCApTCApTCApTCApTCAp nIOIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAuKWogGBnTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApWTA5lXp/TCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTyQtwbCzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6eLjpY6SXzhATCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApd1Vc/fr6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAwK+yiGpwTSEqTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApj3J4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA/fr6qpSZZkBHTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAprJaaAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxLS3jnJ3TyMsTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApYTpC2c7Q AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6r5qebEdP TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApiGpwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAyLm8lXp/UicwTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApsJufAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6s5+jc1BXTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApeVde8+3uAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAy7y/m4GGViw1TCApTCApTCAp TCApTCApTCApTCApTCApTCApTSEqTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAppY6SAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA tqOmellfTCApTCApTCApTCApUykxfVxipI2RmH2DhGVrTiMrTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApbUlQ3NHTAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAA0MPFoIiMhWZsnYSJxLS3uaeqhmhuUigwTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp pY6SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA08bInoWKdlRbTiMrTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApWC84dFFYlnyB5d3eAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6q5WZbUhQTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApb0tS kHR5qJKWtqKmu6mtwrK1xLS3sp2hp5GVu6ms6ODhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAy7y/kHR5TyMsTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApVy42TyQtTCApTCApTCApTCApTCApTCApTCApTCApgF9m/fr6AAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6kXV7 TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApUykx0cTGAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAqZOXTyQtTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApUigwxre6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAjnJ3TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTSEqYz1Eg2Rqi250i291 jG91jXB1j3J3kXV6knZ8n4aLjnF3kHR6mX+EpY2StKCkyLm739XX/fr6/fr6AAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAi21zTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApb0xTlHl+nYSJnoWJm4GG eVdeVCoyTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTiMrXTU9cE1Uf15lhWdt n4aLzb/BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlnuATCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApUCUufl1jl3yBoYmNiWxx WjE5TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApkHV6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxra5XDQ8 TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApa0dOlHl+l3yA XDQ8TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTyQtfVxirpmdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAj3N4TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTyQthGVr l32Db0xTTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApVCkyf15lmH2Cw7O2/fr6AAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAxLS2bEdOTCApTCApTCApTCApTCApTCApfl5lTCApTCApTCApTCAp YDhAj3N4kHV5UCUuTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApWC83hGVrnIKHybq9/fr6AAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAtKCkVy42TCApTCApTCApTCApTCApmYCF hGVshmhujnN5gYuecZStSiYwTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApXjY+iGlvoYmO0MPF/fr6AAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAApIyRTCApTCAp TCApTCApTCApelhfWzM7TCApOll3Ka/rIazqJqHLLJOuLJCpLoukL4efMIObMX+WM3uRNHaNNHKINm+E N2t/OGd6OWJ1O15xO1psPVZnPlFiP05eQEpZQUVUQ0JQSURRgm93p4+U1srMAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAA49rbpIyQVy01TCApTCApTyQte1lgTCApTCApVGeApN32acfxNaPJQKC3PaC4O6G5O6O8OaW+N6a/ NqjCNarENKvGMq3JMa/LL7DNLrLPLLTSK7bTKbjWKLrYJ7vaJb3cJL7fIsDgIcLjVKm/AAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAuqerkXV7lXuAelhfTSIrTCApTCApSyIsX2uBXWqASyIsTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp n4aLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzb/CUCUuTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCAppY2SAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAs5+jTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApqZOXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAnIOITCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApq5aaAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAjXB2TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAprpmdAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhGVrTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp sZygAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6dlRbTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCAps5+jAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1srMVy42TCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCAptqOmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA tqOnTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApuaeqAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAn4aKTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCAp TCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApTCApvKuuAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZJSkNXSJNXSJNXSJNXWKNXWKNXWKNXWKNHWLNHWLNHWLNHWL NHaMNHaMNHaMNHaMNHaNNHaNNHaNNHaNM3eOM3eOM3eOM3eOM3iNM3iNM3iNM3iNM3iOM3iOM3iOM3iO nrW+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANbHNHcfpHcfpHcfpHcfpHcfpHcfpHcfp HcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfpHcfp HcfpHcfpHcfpHcfpjLrGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/fr6K7XUIL3dILzcILzc ILvcILvcIbrbIbrbIbraIbraIbrZIbrZIbnZIbnZIbjYIbjYIbfXIbfXIbbWIbbWIrbVIrbVIrXUIrXU IrXUIrXUI7TUI7TUI7TTI7TTIrPSIrPSmbvGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4NbX iWxyfFtifFxifFxifVxifVxifVxjfVxjfVxjfVxjfVxjfVxjfV1jfV1jfV1jfV1jfl1kfl1kfl1kfl1k fl1kfl1kfl5kfl5kfl5kfl5kfl5lfl5lf15lf15lf19lf19l0MLEAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA//4H////////+Af////////gA////////8AD////////gAH///////8A Af///////gAA///////8AAD///+H//gAAH//+Af/8AAAf/+AB//gAAA/+AAD/+AAAD+AAAP/wAAAGAAA A//AAAAAAAAD/4AAAAAAAAH/gAAAAAAAAf8AAAAAAAAB/wAAAAAAAAH/AAAAAAAAAf8AAAAAAAAB/wAA AAAAAAH/AAAAAAAAAf8AAAAAAAAB/wAAAAAAAAH/AAAAAAAAAf8AAAAAAAAB/4AAAAAAAAH/4AAAAAAA A//wAAAAAAAD//wAAAAAAAP//gAAAAAAB///gAAAAAAH///AAAAAAAf///AAAAAAD////AAAAAAP///+ AAAAAB////8AAAAAH////AAAAAAP///4AAAAAAf///AAAAAAB///8AAAAAAH///wAAAAAAAH//AAAAAA AAD/8AAAAAAAAP/wAAAAAAAA//gAAAAAAAH/+AAAAAAAD//8AAAAAAB///4AAAAAB////gAAAAAf//// gAAAAB/////gAAAAH////+AAAAAf////4AAAAB/////gAAAAH////+AAAAAf////wAAAAB/////AAAAA H////8AAAAAf////wAAAAB/////AAAAAH////8AAAAAf////gAAAAB////+AAAAAH/8= mono-tools-4.2/gendarme/swf-wizard-runner/Makefile.in0000664000175000017500000004606412642235732024762 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/swf-wizard-runner ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(wizarddir)" "$(DESTDIR)$(desktopdir)" SCRIPTS = $(wizard_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(desktop_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ wizarddir = $(prefix)/lib/gendarme wizard_SCRIPTS = ../bin/gendarme-wizard.exe desktopdir = $(datadir)/applications desktop_DATA = gendarme-wizard.desktop EXTRA_DIST = $(wizard_sources) $(wizard_sources_in) swf-wizard-runner.csproj Wizard.resx Properties/Resources.resx \ Resources/gendarme.png $(wizard_icon) $(desktop_DATA).in CLEANFILES = $(wizard_SCRIPTS) $(wizard_SCRIPTS).mdb Wizard.resources Resources.resources Properties/Resources.resources \ $(desktop_DATA) DISTCLEANFILES = Makefile.in wizard_sources_in = ../AssemblyInfo.cs.in wizard_generated_sources = $(wizard_sources_in:.in=) wizard_sources = \ ../AssemblyStaticInfo.cs \ ../console/Helpers.cs \ ../console/HtmlResultWriter.cs \ ../console/ResultWriter.cs \ ../console/TextResultWriter.cs \ ../console/XmlResultWriter.cs \ Gendarme.cs \ GuiRunner.cs \ Page.cs \ Properties/Resources.Designer.cs \ Properties/Settings.Designer.cs \ Wizard.cs \ Wizard.Designer.cs wizard_build_sources = $(addprefix $(srcdir)/, $(wizard_sources)) \ $(wizard_generated_sources) wizard_resources = Wizard.resx wizard_build_resources = $(addprefix $(srcdir)/, $(wizard_resources)) wizard_properties_resx = Properties/Resources.resx wizard_properties_prefix_resx = $(addprefix $(srcdir)/, $(wizard_properties_resx)) wizard_properties_resource = Properties wizard_properties_build_resource = $(addprefix $(srcdir)/, $(wizard_properties_resource)) wizard_xsl = ../console/gendarme.xsl wizard_build_xsl = $(addprefix $(srcdir)/, $(wizard_xsl)) wizard_icon = Resources/gendarme.ico wizard_build_icon = $(addprefix $(srcdir)/, $(wizard_icon)) 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) --gnu gendarme/swf-wizard-runner/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/swf-wizard-runner/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): install-wizardSCRIPTS: $(wizard_SCRIPTS) @$(NORMAL_INSTALL) @list='$(wizard_SCRIPTS)'; test -n "$(wizarddir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(wizarddir)'"; \ $(MKDIR_P) "$(DESTDIR)$(wizarddir)" || 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)$(wizarddir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(wizarddir)$$dir" || exit $$?; \ } \ ; done uninstall-wizardSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(wizard_SCRIPTS)'; test -n "$(wizarddir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(wizarddir)'; $(am__uninstall_files_from_dir) install-desktopDATA: $(desktop_DATA) @$(NORMAL_INSTALL) @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(desktopdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(desktopdir)" || 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)$(desktopdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \ done uninstall-desktopDATA: @$(NORMAL_UNINSTALL) @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(desktopdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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)$(wizarddir)" "$(DESTDIR)$(desktopdir)"; 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: 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-desktopDATA install-wizardSCRIPTS 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: uninstall-desktopDATA uninstall-wizardSCRIPTS .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-desktopDATA 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 \ install-wizardSCRIPTS installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-desktopDATA uninstall-wizardSCRIPTS .PRECIOUS: Makefile $(desktop_DATA): $(desktop_DATA).in sed -e "s|\@bindir\@|$(bindir)|" $< > $@ Wizard.resources: $(wizard_build_resources) resgen2 /compile $(wizard_build_resources),Wizard.resources Properties/Resources.resources: $(wizard_properties_prefix_resx) mkdir -p Properties; \ resgen2 -usesourcepath -compile $(wizard_properties_prefix_resx),Properties/Resources.resources; ../bin/gendarme-wizard.exe: $(wizard_build_sources) $(wizard_resources) Wizard.resources Properties/Resources.resources $(wizard_build_xsl) $(wizard_build_icon) $(MCS) -debug -target:winexe -r:$(CECIL_ASM) -r:../bin/Gendarme.Framework.dll \ -r:System.Core.dll -r:System.Xml.Linq.dll -r:System.Windows.Forms.dll -r:System.Drawing.dll -r:System.Xml.dll \ -resource:$(wizard_build_xsl) -resource:Wizard.resources,Gendarme.Wizard.resources \ -resource:Properties/Resources.resources,Gendarme.Properties.Resources.resources \ -win32icon:$(wizard_build_icon) -out:$@ $(wizard_build_sources) self-test: $(wizard_SCRIPTS) mono --debug ../bin/gendarme.exe $(wizard_SCRIPTS) # 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-tools-4.2/gendarme/swf-wizard-runner/Gendarme.cs0000664000175000017500000000317112413742070024750 0ustar00directhexdirecthex00000000000000// // Gendarme.cs: A SWF-based Wizard Runner for Gendarme // // Authors: // Sebastien Pouliot // // 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; using System.Windows.Forms; namespace Gendarme { static class WizardRunner { /// /// The main entry point for the application. /// [STAThread] static void Main () { Application.EnableVisualStyles (); Application.SetCompatibleTextRenderingDefault (false); using (Wizard wizard = new Wizard ()) Application.Run (wizard); } } } mono-tools-4.2/gendarme/swf-wizard-runner/swf-wizard-runner.csproj0000664000175000017500000001526512413742070027534 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {3C44DF79-3FEA-4F1D-8568-8744AD92E3F9} WinExe Properties Gendarme GendarmeWizard v4.0 512 Resources\gendarme.ico 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\console\bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true ..\console\bin\Release\ TRACE;RELEASE prompt 4 AllRules.ruleset 3.5 True True Resources.resx True True Settings.settings Form Wizard.cs Wizard.cs Designer Designer ResXFileCodeGenerator Resources.Designer.cs SettingsSingleFileGenerator Settings.Designer.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/swf-wizard-runner/Wizard.cs0000664000175000017500000005213012413742070024465 0ustar00directhexdirecthex00000000000000// // Gendarme.cs: A SWF-based Wizard Runner for Gendarme // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Specialized; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Windows.Forms; using Gendarme.Framework; using Gendarme.Properties; using Mono.Cecil; namespace Gendarme { public partial class Wizard : Form { // This is used for methods which we execute within a thread, but we don't // execute the methods concurrently so we can use single thread. [ThreadModel (ThreadModel.SingleThread)] sealed class AssemblyInfo { private DateTime timestamp; private AssemblyDefinition definition; public DateTime Timestamp { get { return timestamp; } set { timestamp = value; } } public AssemblyDefinition Definition { get { return definition; } set { definition = value; } } } private const string BaseUrl = "http://www.mono-project.com/"; private const string DefaultUrl = BaseUrl + "Gendarme"; private const string BugzillaUrl = "http://bugzilla.novell.com"; static Process process; private bool rules_populated; private Dictionary assemblies; private GuiRunner runner; private int counter; private Action assembly_loader; private IAsyncResult assemblies_loading; private object loader_lock = new object (); private Action rule_loader; private IAsyncResult rules_loading; private Action analyze; private string html_report_filename; private string xml_report_filename; private string text_report_filename; public Wizard () { InitializeComponent (); // hide the tabs from the TabControl/TabPage[s] being [mis-]used // to implement this wizard wizard_tab_control.Top = -24; welcome_link_label.Text = DefaultUrl; Version v = typeof (IRule).Assembly.GetName ().Version; if ((v.Major == 0) && (v.Minor == 0)) welcome_gendarme_label.Text = "Gendarme (development snapshot)"; else welcome_gendarme_label.Text = String.Format (CultureInfo.CurrentCulture, "Gendarme, version {0}", v); assembly_loader = UpdateAssemblies; UpdatePageUI (); } [ThreadModel (ThreadModel.SingleThread)] static void EndCallback (IAsyncResult result) { (result.AsyncState as Action).EndInvoke (result); } static void Open (string filename) { if (process == null) process = new Process (); process.StartInfo.Verb = "open"; process.StartInfo.FileName = filename; process.Start (); } #region general wizard code public Page Current { get { return (Page) wizard_tab_control.SelectedIndex; } set { wizard_tab_control.SelectedIndex = (int) value; UpdatePageUI (); } } public GuiRunner Runner { get { if (runner == null) runner = new GuiRunner (this); return runner; } } private void BackButtonClick (object sender, EventArgs e) { switch (Current) { case Page.Welcome: return; case Page.AddFiles: Current = Page.Welcome; break; case Page.SelectRules: Current = Page.AddFiles; break; case Page.Options: Current = Page.SelectRules; break; case Page.Analyze: // then ask confirmation before aborting // and move back one step if (ConfirmAnalyzeAbort (false)) Current = Page.Options; break; case Page.Report: // move two step back (i.e. skip analyze) Current = Page.Options; break; } } private void NextButtonClick (object sender, EventArgs e) { switch (Current) { case Page.Welcome: Current = Page.AddFiles; break; case Page.AddFiles: Current = Page.SelectRules; break; case Page.SelectRules: Current = Page.Options; break; case Page.Options: UpdateOptions (); Current = Page.Analyze; break; case Page.Analyze: case Page.Report: // should not happen return; } } private void CancelButtonClick (object sender, EventArgs e) { // if we're analyzing... if (Current == Page.Analyze) { // then ask confirmation before aborting if (!ConfirmAnalyzeAbort (true)) return; } Close (); } private void HelpButtonClick (object sender, EventArgs e) { // open web browser to http://www.mono-project.com/Gendarme Open (DefaultUrl); } private void UpdatePageUI () { back_button.Enabled = true; next_button.Enabled = true; cancel_button.Text = "Cancel"; switch (Current) { case Page.Welcome: UpdateWelcomeUI (); break; case Page.AddFiles: UpdateAddFilesUI (); break; case Page.SelectRules: UpdateSelectRulesUI (); break; case Page.Options: UpdateOptionsUI (); break; case Page.Analyze: UpdateAnalyzeUI (); break; case Page.Report: UpdateReportUI (); break; } } #endregion #region Welcome private void UpdateWelcomeUI () { back_button.Enabled = false; if (rule_loader == null) { rule_loader = Runner.LoadRules; rules_loading = rule_loader.BeginInvoke (EndCallback, rule_loader); } } private void GendarmeLinkClick (object sender, LinkLabelLinkClickedEventArgs e) { Open (DefaultUrl); } #endregion #region Add Files private void UpdateAddFilesUI () { if (assemblies == null) assemblies = new Dictionary (); int files_count = file_list_box.Items.Count; bool has_files = (files_count > 0); next_button.Enabled = has_files; remove_file_button.Enabled = has_files; if (has_files) { add_files_count_label.Text = String.Format (CultureInfo.CurrentCulture, "{0} assembl{1} selected", files_count, files_count == 1 ? "y" : "ies"); } else { add_files_count_label.Text = "No assembly selected."; } } private void AddFilesButtonClick (object sender, EventArgs e) { if (open_file_dialog.ShowDialog (this) == DialogResult.OK) { foreach (string filename in open_file_dialog.FileNames) { // don't add duplicates if (!file_list_box.Items.Contains (filename)) { file_list_box.Items.Add (filename); assemblies.Add (filename, new AssemblyInfo ()); } } } UpdatePageUI (); } private void RemoveFileButtonClick (object sender, EventArgs e) { // remove from the last one to the first one // so the indices are still valid during the removal operation for (int i = file_list_box.SelectedIndices.Count - 1; i >= 0; i--) { int remove = file_list_box.SelectedIndices [i]; // if some AssemblyDefinition are already loaded... if (assemblies != null) { // then look if we need to remove them too! assemblies.Remove ((string) file_list_box.Items [remove]); } file_list_box.Items.RemoveAt (remove); } UpdatePageUI (); } public void UpdateAssemblies () { if (IsDisposed) throw new ObjectDisposedException (GetType ().Name); // do not let the final check be done while we're still loading assemblies lock (loader_lock) { foreach (KeyValuePair kvp in assemblies) { DateTime last_write = File.GetLastWriteTimeUtc (kvp.Key); if ((kvp.Value.Definition == null) && (kvp.Value.Timestamp < last_write)) { AssemblyInfo a = kvp.Value; string filename = kvp.Key; try { a.Definition = AssemblyDefinition.ReadAssembly (filename, new ReaderParameters { AssemblyResolver = AssemblyResolver.Resolver }); } catch (BadImageFormatException) { // continue loading & analyzing assemblies Runner.Warn ("Invalid image: " + filename); } catch (FileNotFoundException fnfe) { // e.g. .netmodules // continue loading & analyzing assemblies Runner.Warn (fnfe.Message + " while loading " + filename); } finally { a.Timestamp = last_write; } } } } } #endregion #region Select Rules private void UpdateSelectRulesUI () { // asynchronously load assemblies (or the one that changed) assemblies_loading = assembly_loader.BeginInvoke (EndCallback, assembly_loader); rules_count_label.Text = String.Format (CultureInfo.CurrentCulture, "{0} rules are available.", Runner.Rules.Count); if (rules_loading == null) throw new InvalidOperationException ("rules_loading"); bool completed = rules_loading.IsCompleted; next_button.Enabled = completed; rules_tree_view.Enabled = completed; rules_loading.AsyncWaitHandle.WaitOne (); PopulateRules (); } private void PopulateRules () { if (rules_populated) return; // if settings are empty (like default) then all rules are active StringCollection rules = Settings.Default.Rules; bool all_rules = ((rules == null) || (rules.Count == 0)); Dictionary nodes = new Dictionary (); rules_tree_view.BeginUpdate (); rules_tree_view.AfterCheck -= RulesTreeViewAfterCheck; foreach (IRule rule in Runner.Rules) { TreeNode parent; string full_name = rule.FullName; string name = rule.Name; string name_space = full_name.Substring (0, full_name.Length - name.Length - 1); if (!nodes.TryGetValue (name_space, out parent)) { parent = new TreeNode (name_space); parent.Checked = all_rules; nodes.Add (name_space, parent); rules_tree_view.Nodes.Add (parent); } TreeNode node = new TreeNode (name); node.Checked = all_rules || rules.Contains (full_name); node.Tag = rule; node.ToolTipText = rule.Problem; parent.Nodes.Add (node); // if we have not already setted parent, then we do it if any node is checked if (!all_rules && node.Checked) parent.Checked = true; } foreach (TreeNode node in rules_tree_view.Nodes) { node.ToolTipText = String.Format (CultureInfo.CurrentCulture, "{0} rules available", node.Nodes.Count); } nodes.Clear (); rules_tree_view.AfterCheck += RulesTreeViewAfterCheck; // this extra [End|Begin]Update is brought to you by Vista(tm) // http://forums.msdn.microsoft.com/en-US/netfxbcl/thread/3fd6c4a2-b5c7-4334-b11a-e909b11e8bdc/ rules_tree_view.EndUpdate (); rules_tree_view.BeginUpdate (); rules_tree_view.Sort (); rules_tree_view.EndUpdate (); rules_populated = true; UpdatePageUI (); } private void BrowseDocumentationButtonClick (object sender, EventArgs e) { string url = null; TreeNode selected = rules_tree_view.SelectedNode; if (selected == null) url = DefaultUrl; else { if (selected.Tag == null) { url = BaseUrl + selected.Text; } else { url = (selected.Tag as IRule).Uri.ToString (); } } Open (url); } private void SaveRulesButtonClick (object sender, EventArgs e) { bool all_active = UpdateActiveRules (); // add rule list only if they are not all active if (!all_active) { StringCollection rules = new StringCollection (); foreach (IRule rule in Runner.Rules) { if (rule.Active) rules.Add (rule.FullName); } Settings.Default.Rules = rules; } Settings.Default.Save (); } private void RulesTreeViewAfterCheck (object sender, TreeViewEventArgs e) { if (e.Node.Tag == null) { // childs foreach (TreeNode node in e.Node.Nodes) { node.Checked = e.Node.Checked; } } } [ThreadModel (ThreadModel.SingleThread)] private bool UpdateActiveRules () { bool all_active = true; foreach (TreeNode assembly in rules_tree_view.Nodes) { foreach (TreeNode rule in assembly.Nodes) { if (!rule.Checked) all_active = false; (rule.Tag as Rule).Active = rule.Checked; } } return all_active; } #endregion #region Options private void UpdateOptionsUI () { options_nolimit_checkbox.Checked = (Settings.Default.DefectsLimit == Int32.MaxValue); options_severity_combobox.SelectedIndex = (int) Severity.Audit - Settings.Default.Severity; options_confidence_combobox.SelectedIndex = (int) Confidence.Low - Settings.Default.Confidence; switch ((ApplicabilityScope) Settings.Default.Scope) { case ApplicabilityScope.Visible: options_visible_radiobutton.Checked = true; break; case ApplicabilityScope.NonVisible: options_notvisible_radiobutton.Checked = true; break; case ApplicabilityScope.All: options_all_radiobutton.Checked = true; break; } } private void OptionsNoLimitCheckboxCheckedChanged (object sender, EventArgs e) { options_limit_updown.Enabled = !options_nolimit_checkbox.Checked; } private void UpdateOptions () { // 2^31 is close enough "no limit" Settings.Default.DefectsLimit = options_nolimit_checkbox.Checked ? Int32.MaxValue : (int) options_limit_updown.Value; // hack, this works right now but won't if we add/remove more options Settings.Default.Severity = (int) Severity.Audit - options_severity_combobox.SelectedIndex; Settings.Default.Confidence = (int) Confidence.Low - options_confidence_combobox.SelectedIndex; if (options_visible_radiobutton.Checked) Settings.Default.Scope = (int) ApplicabilityScope.Visible; else if (options_all_radiobutton.Checked) Settings.Default.Scope = (int) ApplicabilityScope.All; else Settings.Default.Scope = (int) ApplicabilityScope.NonVisible; } private void OnOptionsSaveClick (object sender, EventArgs e) { UpdateOptions (); Settings.Default.Save (); } #endregion #region Analyze private void UpdateAnalyzeUI () { // update UI before waiting for assemblies to be loaded progress_bar.Value = 0; next_button.Enabled = false; analyze_status_label.Text = String.Format (CultureInfo.CurrentCulture, "Processing assembly 1 of {0}", assemblies.Count); analyze_defect_label.Text = "Defects Found: 0"; // make sure all assemblies are loaded into memory assemblies_loading.AsyncWaitHandle.WaitOne (); PrepareAnalyze (); analyze = Analyze; analyze.BeginInvoke (EndCallback, analyze); } private void PrepareAnalyze () { // any existing report is now out-of-date html_report_filename = null; xml_report_filename = null; text_report_filename = null; // just to pick up any change between the original load (a few steps bacl) // and the assemblies "right now" sitting on disk UpdateAssemblies (); Runner.Reset (); Runner.Assemblies.Clear (); foreach (KeyValuePair kvp in assemblies) { // add assemblies references to runner AssemblyDefinition ad = kvp.Value.Definition; // an invalid assembly (e.g. non-managed code) will be null at this stage if (ad != null) Runner.Assemblies.Add (ad); } progress_bar.Maximum = Runner.Assemblies.Count; } // TODO: Note that it isn't clear whether we can actually call gendarme from a thread... [ThreadModel (ThreadModel.SingleThread)] private void Analyze () { counter = 0; // apply settings Runner.DefectsLimit = Settings.Default.DefectsLimit; Runner.SeverityBitmask.ClearAll (); Runner.SeverityBitmask.SetDown ((Severity)Settings.Default.Severity); Runner.ConfidenceBitmask.ClearAll (); Runner.ConfidenceBitmask.SetDown ((Confidence) Settings.Default.Confidence); // wizard limits this as a "global" (all rule) setting ApplicabilityScope scope = (ApplicabilityScope) Settings.Default.Scope; foreach (IRule rule in Runner.Rules) { rule.ApplicabilityScope = scope; } // activate rules based on user selection UpdateActiveRules (); // Initialize / Run / TearDown Runner.Execute (); // reset rules as the user selected them (since some rules might have // turned themselves off is they were not needed for the analysis) so // that report used rules correctly UpdateActiveRules (); BeginInvoke ((Action) (() => Current = Page.Report)); } private bool ConfirmAnalyzeAbort (bool quit) { string message = String.Format (CultureInfo.CurrentCulture, "Abort the current analysis being executed {0}Gendarme ?", quit ? "and quit " : String.Empty); return (MessageBox.Show (this, message, "Gendarme", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes); } /// /// Update UI before analyzing an assembly. /// /// RunnerEventArgs that contains the Assembly being analyzed and the Runner internal void PreAssemblyUpdate (RunnerEventArgs e) { progress_bar.Value = counter++; analyze_status_label.Text = String.Format (CultureInfo.CurrentCulture, "Processing assembly {0} of {1}", counter, e.Runner.Assemblies.Count); analyze_assembly_label.Text = "Assembly: " + e.CurrentAssembly.Name.FullName; } /// /// Update UI after analyzing an assembly. /// /// RunnerEventArgs that contains the Assembly being analyzed and the Runner internal void PostTypeUpdate (RunnerEventArgs e) { analyze_defect_label.Text = String.Format (CultureInfo.CurrentCulture, "Defects Found: {0}", e.Runner.Defects.Count); } #endregion #region Report private void UpdateReportUI () { bool has_defects = (Runner.Defects.Count > 0); save_report_button.Enabled = has_defects; view_report_button.Enabled = has_defects; report_subtitle_label.Text = String.Format (CultureInfo.CurrentCulture, "Gendarme has found {0} defects during analysis.", has_defects ? Runner.Defects.Count.ToString (CultureInfo.CurrentCulture) : "no"); cancel_button.Text = "Close"; next_button.Enabled = false; // display an error message and details if we encountered an exception during analysis string error = Runner.Error; bool has_errors = (error.Length > 0); copy_paste_label.Visible = has_errors; bugzilla_linklabel.Text = BugzillaUrl; bugzilla_linklabel.Visible = has_errors; string warnings = Runner.Warnings; bool has_warnings = (warnings.Length > 0); if (has_errors) { unexpected_error_label.Text = "Results are incomplete due to an unexpected error!"; unexpected_error_label.Visible = true; // give priority to errors before warnings error_textbox.Text = error; error_textbox.Visible = true; } else if (has_warnings) { unexpected_error_label.Text = "Results might be incomplete due to the following warnings!"; unexpected_error_label.Visible = true; error_textbox.Text = warnings; error_textbox.Visible = true; } else { unexpected_error_label.Visible = false; error_textbox.Visible = false; } } private static bool CouldCopyReport (ref string currentName, string fileName) { // if possible avoid re-creating the report (as it can // be a long operation) and simply copy the file bool copy = (currentName != null); if (copy) { try { File.Copy (currentName, fileName); } catch (Exception) { // too many things can go wrong when copying copy = false; } } currentName = fileName; return copy; } private ResultWriter GetSelectedWriter (int index, string filename) { switch (index) { case 1: if (CouldCopyReport (ref html_report_filename, filename)) return null; return new HtmlResultWriter (Runner, filename); case 2: if (CouldCopyReport (ref xml_report_filename, filename)) return null; return new XmlResultWriter (Runner, filename); case 3: if (CouldCopyReport (ref text_report_filename, filename)) return null; return new TextResultWriter (Runner, filename); default: return null; } } private void SaveReportButtonClick (object sender, EventArgs e) { if (save_file_dialog.ShowDialog () != DialogResult.OK) return; using (ResultWriter writer = GetSelectedWriter (save_file_dialog.FilterIndex, save_file_dialog.FileName)) { if (writer != null) writer.Report (); } } private void ViewReportButtonClick (object sender, EventArgs e) { // open web browser on html report if (html_report_filename == null) { html_report_filename = Path.ChangeExtension (Path.GetTempFileName (), ".html"); using (HtmlResultWriter writer = new HtmlResultWriter (Runner, html_report_filename)) { writer.Report (); } } Open (html_report_filename); } private void BugzillaLinkClick (object sender, LinkLabelLinkClickedEventArgs e) { Open (BugzillaUrl); } #endregion } } mono-tools-4.2/gendarme/swf-wizard-runner/gendarme-wizard.desktop.in0000664000175000017500000000053512413742070027760 0ustar00directhexdirecthex00000000000000[Desktop Entry] Version=1.0 Name=Gendarme Name[de]=Gendarme GenericName=Gendarme Wizard GenericName[de]=Gendarme Wizard Comment=Inspect your .NET and Mono assemblies Comment[de]=Analysiere deine .NET und Mono Assemblies Type=Application Categories=Development;Profiling; Terminal=false StartupNotify=true Exec=@bindir@/gendarme-wizard Icon=gendarme mono-tools-4.2/gendarme/swf-wizard-runner/Properties/0000775000175000017500000000000012642235743025041 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/swf-wizard-runner/Properties/Resources.Designer.cs0000775000175000017500000000571612413742070031105 0ustar00directhexdirecthex00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Gendarme.Properties { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gendarme.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static System.Drawing.Bitmap gendarme { get { object obj = ResourceManager.GetObject("gendarme", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } } } mono-tools-4.2/gendarme/swf-wizard-runner/Properties/Settings.Designer.cs0000775000175000017500000000613212413742070030724 0ustar00directhexdirecthex00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Gendarme.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("1000")] public int DefectsLimit { get { return ((int)(this["DefectsLimit"])); } set { this["DefectsLimit"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2")] public int Severity { get { return ((int)(this["Severity"])); } set { this["Severity"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("2")] public int Confidence { get { return ((int)(this["Confidence"])); } set { this["Confidence"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("0")] public int Scope { get { return ((int)(this["Scope"])); } set { this["Scope"] = value; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public global::System.Collections.Specialized.StringCollection Rules { get { return ((global::System.Collections.Specialized.StringCollection)(this["Rules"])); } set { this["Rules"] = value; } } } } mono-tools-4.2/gendarme/swf-wizard-runner/Properties/Resources.resx0000664000175000017500000001370112413742070027710 0ustar00directhexdirecthex00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ../Resources/gendarme.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a mono-tools-4.2/gendarme/swf-wizard-runner/Resources/0000775000175000017500000000000012642235743024657 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/swf-wizard-runner/Resources/gendarme.ico0000664000175000017500000006152612413742070027137 0ustar00directhexdirecthex00000000000000(f hv  00@@(2.1( wTGDDpwGtDDWDDGtDDDDDwTDDDDGGtDDDDTGTDDDDGwDDDPDDDWpDDGwwwEwTDEwuwwwptDDDptDDDps333p( @upTDptDDGDDDGtDDDDpwDpTDDDDpwTDDpDDDDDGwTDDDDptDDDDDDDDDDDDHtDDDDDDDDDDDDxtDDDDDDDDDDDwwTDDDDDDDDDDGtGTDDDDDDDDDDtDGtDDDDDDDDDGDDGDDDDDDDDDDDD@wDDDDDDDDDDDptDDDDDDDDDDptDDDDDDDDGwwDDDDDDGtDDDDDGwpuDDDDDDDDEtDDDDDDDwwwtDDDDEwuDDDDWtDDDGtDDDDDDwDuwTDDDDDGxTTs333337DDDDDDDGDDDDDDDGDDDDDDDGDDDDDDDHDDDDDDDH33333338wwwwwwwx?????????( xV]hBJe?GL )L )qNU˽hCJL )L )L )P%.ŶousQXgAIW-6zY`L )L )L )L )L )f@HkFMT*3L )L )L )L )qMTiDKL )L )L )L )L )L )L )L )L )L )L ){Zazf@GL )L )L )L )L )L )L )L )L )M!*pv_7?lHO_eR'0L )L )L )L )L )L )L )L )a9AO$-L )vT[v|b;CL )L )L )L )L )L )L )L )L )L )wU\lGOqNUR(0L )L )L )L )L )e?Gou_8@L )L )L )L )L )d=EagpviDLL )L )L )L )V-5mIPtQYuRY{Y`mHPwU\y~yW^L )d>FlIPxV]e?GL )L )L )L )`9ApMTrxzX_`9APrKi{KhxMgvMetNdshq}L )L )L )L )L )L )L )oKR}]cL )L )L )L )L )L )L )pLTV5555666T( @ ѓx}tQXe?Fx}x}c=DL )L )L )mIPlrY19L )L )L )L )Q&/gmS)1L )L )L )L )L )L )qMT~P%.L )L )L )L )L )L )L )S)1zY`kFN`8@M!*̽e?GL )L )L )L )L )L )L )L )L )tQX㢊{ZamIP`9AL )L )L )L )L )uRY}\cL )L )L )L )L )L )L )L )L )L )U+4~^doKR`9AL )L )L )L )L )L )L )L )L )fAHU,4L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )P%.vSZL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )_7?xV]iDKL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )P%.yX^{hCJjpd=EL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )Y09}rNVL )L )uzf@HL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )U+4x}^6>L )L )L )}\bL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )O$-ekQ&/L )L )L )L )ms[2:L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )`8@sPWM!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )jELpv\4FL )L )L )L )L )L )L )L )L )L )L )L )O$-M"+L )L )O#,b;CoKRL )L )L )L )L )L )L )L )L )L )L )L )L )L )Y08iDLlHOmJPsPWx}iCKL )L )L )L )L )L )L )L )L )L )d=EqMUuRYuSYbFL )L )L )L )L )L )L )L )L )L )L )^6>qMUnsǸe?GL )b;BQ&/Q744456677889y˾͙Y/8L )O*5M(3L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )agL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )rNUL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )jELL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )4)))))))))))))))JAB~B~B~B~B~B~B}B}B}B}C}C}C|C|?????????(0`_exV]mHPyX_R(0L )L )L )ag}Y08L )L )L )L )L )X/7{Z`L )L )L )L )L )L )L )L )ekpMTL )L )L )L )L )L )L )L )L )Z2:oKRL )L )L )L )L )L )L )L )L )L )L )hnƭyW^L )L )L )L )L )L )L )L )L )L )L )L )]5=ͿžflxV][2:M!*rxL )L )L )L )L )L )L )L )L )L )L )L )L )L )msŵbhvTZW.6L )L )L )L )L )agR'0L )L )L )L )L )L )L )L )L )L )L )L )L )L )`9Aòy~_esPWT*3L )L )L )L )L )L )L )L )L )iDKvT[L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )qwty|[bpMTR'0L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )]5=mIPP%.L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ousPWL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )~^dM!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )oKRrxL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )vT[Ƿ}\bL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )V,5tzbhZ2:nJRsPWL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )hCJqwZ19L )L )sPWtQXL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )iDKmHPL )L )L )L )sPWwU[L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )bkqpvQ'0L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )[3;}]czƶa:BL )L )L )L )vSZ}bi}vakL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )b;C_fW-5L )L )L )vSZM!*pDzGGPʻM!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L ){ZaL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[bqwL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[a`fL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[bvTZL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[bnJQL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )}\cU+4L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )}\c{///...............-----NQ;\hu\hu\hu]gt]gt^gt^fs_fr_fs_er_eq_eq_dq`dp`dp`dp`co`coacoaboaboabnbbm????(@0٪tzioxV]ÜqNUL )L )L )L )tzd>EL )L )L )L )L )L )`9AĴ²ouM"+L )L )L )L )L )L )L )L )w}jDLL )L )L )L )L )L )L )L )L )L )c=DŵY08L )L )L )L )L )L )L )L )L )L )L )L )zW-5L )L )L )L )L )L )L )L )L )L )L )L )L )fAHɺT*3L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )}W.6L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )jFM̾~ekqNUO#,N#+ɹlGOL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ầ}flnJRM"+L )L )L )L )L )zhnL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )nJQܸ|gmkGNM!*L )L )L )L )L )L )L )L )L )wU\L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ٷ|gmhCJL )L )L )L )L )L )L )L )L )L )L )L )L )L )M"+Ϳd>FL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )qNUֵ|hnd>FL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )v|}L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|hn`9AL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )bhɺd>EL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )b;CzL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[bL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )O#,_eU+4L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )[3;puL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )M"+ioóagqwsyL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )_7?祎wU\L )L )hngmL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L ){Za~^dL )L )L )L )djkqL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )msКW-5L )L )L )L )L )cjmsL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )}]cĴpMTL )L )L )L )L )L )L )kqpuL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )sPW^6>L )L )L )L )L )L )L )L )tzrxL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )mHPR(0L )L )L )L )L )L )L )L )L )`gL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )Y09zL )L )L )L )L )L )L )L )L )L )O$-㥎_8@L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )wU\jpM!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )rxf@GL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ĴrwO#,L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )a:BlGOL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )jpȹzR'0L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )sPWL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )yW^˼V,5L )L )L )L )L )L )L )L )L )M!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )zY_L )L )L )L )S)1}\b}ekN#+L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )mIPŠflĴhnR(0L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ȞvT[N#+L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )X/8tQX|mHPL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )oKRty²Ĵ˼tyO#,L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )W.6O$-L )L )L )L )L )L )L )L )_fu{L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )S)1O$-L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )R(0ƷrwL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )M!*c=Ddjntououpurwuzv|qwtzȹmsL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )oLSy~yW^T*2L )L )L )L )L )L )L )L )L )L )L )L )L )N#+]5=pMT^egmͿ{L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )P%.~]c|lqZ19L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )uzƶ\4ioL )L )L )L )L )zX_[3;L ):Yw)!&,,./013{4v4r6o7k8gz9bu;^q;Zl=Vg>Qb?N^@JYAETCBPIDQowۤW-5L )L )O$-{Y`L )L )Tgi5@=;;9765421/.,+)('%$"!Tu{{zX_M"+L )L )K",_k]jK",L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ͿP%.L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )pvL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ekL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )vT[L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )W.6L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )d5t5t5t5u5u5u5u4u4u4u4u4v4v4v4v4v4v4v4v3w3w3w3w3x3x3x3x3x3x3x3x5錺+ !!!!!!!!!!!!!!""""""####""ҙ׉lr|[b|\b|\b}\b}\b}\c}\c}\c}\c}\c}\c}]c}]c}]c}]c~]d~]d~]d~]d~]d~]d~^d~^d~^d~^d~^e~^e^e^e_e_e??mono-tools-4.2/gendarme/swf-wizard-runner/Resources/gendarme.png0000775000175000017500000001501112413742070027140 0ustar00directhexdirecthex00000000000000PNG  IHDR>asBIT|d pHYs6tEXtSoftwarewww.inkscape.org<IDATxy\d–aKB¾ HqqZ}jUV{]Z=VSm}DP-[a@&23G͇3'w=\(0[b5jH@@"ڪg@{!yGoG@m3_%8l)j v{i) Cb0!M}Fc nP20=>@QK?8~ vǮkGfGrG<.[@ߒ5/16XCMԇy8#εÐP>1*\Znh Tgts mAHV\ȨR>$<:AZ x<6km- yf;)E$R?X'y]<{}GS@{0Tǽ]8* m )?PheH=@tkeόkh3 o6h7w0 8WC@I _$`k? i$@B®$`Vp+> =%~Um(Ņ0bo?.8eRIBkm`bCV]I"IVc4Pp`䱩Ϩ"jj"r3H6z^: HQ }FiyNM~Wb' BK&OlO%a" ÃKg.=:Ӱ`K uw9`5lC HNB/6JD'hgM?Q揅1|+ss CO (@PQ(F^R0ǎ"J]GPY^sR$q_ct, L~}jjzJ;У/IH͌KBhdB} ?Qd@M-}sŁOnro(tf ٿ8ASFmBup!ItzBND?h'{CAzt-, m!`[.;ls0- H,:@%|߀I*J[9y*j suLs't(huX[N :x~nn=΄.8@\lEVyְ$^U`,S#b{sXei2TIEjw">泊9 ޗ H]=d,,qXwԼyla ql> JrqS!@d7Mi>5xh&I"wng'܌@cԡSWW}Ei.> j_)F>u/fa#FknXpYlveW1דϾ;gŐw_wb{6}4(BF/A{x.5b28>7ϐ5,];caƌb( 5tx?HND~lr;~׭Yte O,=Ú\<we({Y〢(d柑ν(:B^NbDo%8Ƶ^;}[ƕ;fϛs9C8v"!  spfbS=}18&M4ZU]mh05r؈;A?~,f}n*o_Wr5r7 A~sJh4/6i5v6n.zTJ5zAڭq!Վvqs9Ǐ]@2: -_Z@UU͵bbD6?W7E6\cw4؝إsHvvzV; JE ]<{3>ճK[7Q%,ca7*Wf-̸()l$1!JJTШib>E\%J\zkk&gJr':vV:Ehh@rb&ȲnR8}XR B-,CQA=I"we)-V!5uP[Sյ@z@E@Az0  `c#; I++KIy1e#_w]PO/!wv\>55UU5e%u  t<ji~yPhU"sl{I {v+y"ό 23{yVZWYZY6VV֖Ŷ1Nq +NƐ)Z7i#i).lw/y%9$vZ Ҽ 7sACv"[Y=$䚖ث*p)r7ILPzLq;u"^]5 nٹ,~>-5Lc0 **ڝ[6pmY5-Г {%T*.sZ5]k{K‚NEoo7l3Y;6{> !~*{Vti4s1 DtƵ$7 Ѷͽ l'en>u2zܾG/B(Ѐ~A66֖r;{_wڍK?}˴. ?lTvfڵXR[AV۩٭0` mRvv!~?kDŽ^>n(&0YEsd.=~1?IE' J?x) Hw-: ]] H29A"kѷں{GD:(<JLm(鞞}Ӻ}!i9ֺ묐z\ K 0brgG@$7=5翧NDOܿ3č3>v~PhnӘߡDڕz*;j1Шi={qx=BAdo߻+*jѼU!g]v/WUfBvGBՀM_/TZR^#1I‚bOe䧥l9vL?pOԓ[Hȓh7@5k篙m|J+&-#Ai)~=5:)h;q)xiI.2T+建*Mi=$)P)2r -Sw:xrt+4( q唎;wE˷JKi}- :59<>cY ՟0|wë >[>?"3AU[E]nNh )\qސ EVh{@kk덦zgg [jw@pѝ߯Kh["-*,nhи%m%.utim>xXvq25ZVZэYFE]-_:>]b[?S)ԤD@L ~nKcwa7w :\%nFD}( `|;~/p6fGMug~eiE΋Qݥm 0~d`:dX?A^J;BBvv(fLy{di4 W>~IvÏoM$, ;;śj<E Cyfܶl>c[܎O?MOs!}),o#.mFm,h鹼z+EqO/o=39Ea~QaMM$66pUw𬍭UiOPO߲`qeeMqU Naj*n썤i%妠ju=vL*v"t; E&i}]0?~ISG$KЏ^!/xz­4F0MЇPqbVg̳YAQ_7ai.2p-|rr9ůd2ZDۡ(EV%Y#-Sy<^0zlEQ@$_|?-RM0k7,QQZ8P.2D>oa4j t%tu>CQ~'Oaz)dmwz'v1^`-{myMkFJP_ GEה7FeЩm~wݦ& rr-n( P@2[K7 w7^^3ߞѫϨȈEJuMJvIKs`WT۔]%]~. _Pоݛ\d{a+Oli=vo^npU%Nӵ+ 9Ep8؉}AW7ƞaﱗ*%|[RԆhZGa~xzJY)KKQ8^甝U.$z'#*aqQY1nУ/ExʶAʊ ꊪa*e,+#8\*}gD8JkE:AgO]t:2zo]4oc%#ܥ|Gmm+DN4H9ʫX%z$>.ͯQDT,ADpm͐mZ6*2'~:Aچ²վ⫗%nնcb-Z_ ]m]q?kwDvHʄ!/ULzzɏ[8:ckguNTUHo\{#ɢSÛ ڜ.b ~fʲdu)Y^>rZBQ@hq)Py HNsES*k+jiDqDrU&AHhG{}j3~rnY8K`ˎe/5tA$©ՕJZJh ՆAbٿ}ɖȬ|m՚&673 q4I=NVqT9yQ Ej` ;M0zJ:= k%MgܮƥNB}.,=oR_GKhEu?ן'MݞNF‚}:^<:5% l /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose (bool disposing) { if (disposing && (components != null)) { components.Dispose (); } base.Dispose (disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent () { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager (typeof (Wizard)); this.wizard_tab_control = new System.Windows.Forms.TabControl (); this.welcome_tab_page = new System.Windows.Forms.TabPage (); this.welcome_gendarme_label = new System.Windows.Forms.Label (); this.label1 = new System.Windows.Forms.Label (); this.welcome_link_label = new System.Windows.Forms.LinkLabel (); this.label10 = new System.Windows.Forms.Label (); this.welcome_title_label = new System.Windows.Forms.Label (); this.addfiles_tab_page = new System.Windows.Forms.TabPage (); this.add_files_count_label = new System.Windows.Forms.Label (); this.label6 = new System.Windows.Forms.Label (); this.label5 = new System.Windows.Forms.Label (); this.add_files_button = new System.Windows.Forms.Button (); this.remove_file_button = new System.Windows.Forms.Button (); this.file_list_box = new System.Windows.Forms.ListBox (); this.rules_tab_page = new System.Windows.Forms.TabPage (); this.rules_save_button = new System.Windows.Forms.Button (); this.browse_documentation_button = new System.Windows.Forms.Button (); this.rules_count_label = new System.Windows.Forms.Label (); this.label8 = new System.Windows.Forms.Label (); this.label7 = new System.Windows.Forms.Label (); this.rules_tree_view = new System.Windows.Forms.TreeView (); this.options_tab_page = new System.Windows.Forms.TabPage (); this.options_save_button = new System.Windows.Forms.Button (); this.options_all_radiobutton = new System.Windows.Forms.RadioButton (); this.options_visible_radiobutton = new System.Windows.Forms.RadioButton (); this.label12 = new System.Windows.Forms.Label (); this.options_notvisible_radiobutton = new System.Windows.Forms.RadioButton (); this.options_severity_combobox = new System.Windows.Forms.ComboBox (); this.options_confidence_combobox = new System.Windows.Forms.ComboBox (); this.options_limit_updown = new System.Windows.Forms.NumericUpDown (); this.options_nolimit_checkbox = new System.Windows.Forms.CheckBox (); this.label11 = new System.Windows.Forms.Label (); this.label9 = new System.Windows.Forms.Label (); this.label4 = new System.Windows.Forms.Label (); this.label3 = new System.Windows.Forms.Label (); this.label2 = new System.Windows.Forms.Label (); this.analyze_tab_page = new System.Windows.Forms.TabPage (); this.analyze_defect_label = new System.Windows.Forms.Label (); this.analyze_title_label = new System.Windows.Forms.Label (); this.analyze_status_label = new System.Windows.Forms.Label (); this.analyze_assembly_label = new System.Windows.Forms.Label (); this.progress_bar = new System.Windows.Forms.ProgressBar (); this.results_tab_page = new System.Windows.Forms.TabPage (); this.view_report_button = new System.Windows.Forms.Button (); this.save_report_button = new System.Windows.Forms.Button (); this.results_title_label = new System.Windows.Forms.Label (); this.report_subtitle_label = new System.Windows.Forms.Label (); this.help_button = new System.Windows.Forms.Button (); this.cancel_button = new System.Windows.Forms.Button (); this.next_button = new System.Windows.Forms.Button (); this.back_button = new System.Windows.Forms.Button (); this.open_file_dialog = new System.Windows.Forms.OpenFileDialog (); this.save_file_dialog = new System.Windows.Forms.SaveFileDialog (); this.pictureBox1 = new System.Windows.Forms.PictureBox (); this.unexpected_error_label = new System.Windows.Forms.Label (); this.error_textbox = new System.Windows.Forms.TextBox (); this.copy_paste_label = new System.Windows.Forms.Label (); this.bugzilla_linklabel = new System.Windows.Forms.LinkLabel (); this.wizard_tab_control.SuspendLayout (); this.welcome_tab_page.SuspendLayout (); this.addfiles_tab_page.SuspendLayout (); this.rules_tab_page.SuspendLayout (); this.options_tab_page.SuspendLayout (); ((System.ComponentModel.ISupportInitialize) (this.options_limit_updown)).BeginInit (); this.analyze_tab_page.SuspendLayout (); this.results_tab_page.SuspendLayout (); ((System.ComponentModel.ISupportInitialize) (this.pictureBox1)).BeginInit (); this.SuspendLayout (); // // wizard_tab_control // this.wizard_tab_control.Appearance = System.Windows.Forms.TabAppearance.FlatButtons; this.wizard_tab_control.Controls.Add (this.welcome_tab_page); this.wizard_tab_control.Controls.Add (this.addfiles_tab_page); this.wizard_tab_control.Controls.Add (this.rules_tab_page); this.wizard_tab_control.Controls.Add (this.options_tab_page); this.wizard_tab_control.Controls.Add (this.analyze_tab_page); this.wizard_tab_control.Controls.Add (this.results_tab_page); this.wizard_tab_control.Location = new System.Drawing.Point (133, 0); this.wizard_tab_control.Name = "wizard_tab_control"; this.wizard_tab_control.SelectedIndex = 0; this.wizard_tab_control.Size = new System.Drawing.Size (501, 415); this.wizard_tab_control.TabIndex = 0; // // welcome_tab_page // this.welcome_tab_page.Controls.Add (this.welcome_gendarme_label); this.welcome_tab_page.Controls.Add (this.label1); this.welcome_tab_page.Controls.Add (this.welcome_link_label); this.welcome_tab_page.Controls.Add (this.label10); this.welcome_tab_page.Controls.Add (this.welcome_title_label); this.welcome_tab_page.Location = new System.Drawing.Point (4, 25); this.welcome_tab_page.Name = "welcome_tab_page"; this.welcome_tab_page.Padding = new System.Windows.Forms.Padding (3); this.welcome_tab_page.Size = new System.Drawing.Size (493, 386); this.welcome_tab_page.TabIndex = 0; this.welcome_tab_page.Text = "Welcome"; this.welcome_tab_page.UseVisualStyleBackColor = true; // // welcome_gendarme_label // this.welcome_gendarme_label.AutoSize = true; this.welcome_gendarme_label.Dock = System.Windows.Forms.DockStyle.Bottom; this.welcome_gendarme_label.Location = new System.Drawing.Point (3, 192); this.welcome_gendarme_label.Name = "welcome_gendarme_label"; this.welcome_gendarme_label.Padding = new System.Windows.Forms.Padding (12, 0, 0, 1); this.welcome_gendarme_label.Size = new System.Drawing.Size (68, 14); this.welcome_gendarme_label.TabIndex = 2; this.welcome_gendarme_label.Text = "Gendarme"; // // label1 // this.label1.AutoSize = true; this.label1.Dock = System.Windows.Forms.DockStyle.Bottom; this.label1.Location = new System.Drawing.Point (3, 206); this.label1.Name = "label1"; this.label1.Padding = new System.Windows.Forms.Padding (12, 0, 0, 1); this.label1.Size = new System.Drawing.Size (265, 14); this.label1.TabIndex = 1; this.label1.Text = "Copyright © 2005-2011 Novell, Inc. and contributors"; // // welcome_link_label // this.welcome_link_label.AutoSize = true; this.welcome_link_label.Dock = System.Windows.Forms.DockStyle.Bottom; this.welcome_link_label.Location = new System.Drawing.Point (3, 220); this.welcome_link_label.Name = "welcome_link_label"; this.welcome_link_label.Padding = new System.Windows.Forms.Padding (12, 0, 0, 150); this.welcome_link_label.Size = new System.Drawing.Size (215, 163); this.welcome_link_label.TabIndex = 0; this.welcome_link_label.TabStop = true; this.welcome_link_label.Text = "http://www.mono-project.com/Gendarme"; this.welcome_link_label.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler (this.GendarmeLinkClick); // // label10 // this.label10.Dock = System.Windows.Forms.DockStyle.Fill; this.label10.Location = new System.Drawing.Point (3, 28); this.label10.Name = "label10"; this.label10.Padding = new System.Windows.Forms.Padding (12, 12, 12, 0); this.label10.Size = new System.Drawing.Size (487, 355); this.label10.TabIndex = 5; this.label10.Text = resources.GetString ("label10.Text"); // // welcome_title_label // this.welcome_title_label.AutoSize = true; this.welcome_title_label.Dock = System.Windows.Forms.DockStyle.Top; this.welcome_title_label.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); this.welcome_title_label.Location = new System.Drawing.Point (3, 3); this.welcome_title_label.Margin = new System.Windows.Forms.Padding (0); this.welcome_title_label.Name = "welcome_title_label"; this.welcome_title_label.Padding = new System.Windows.Forms.Padding (12, 12, 0, 0); this.welcome_title_label.Size = new System.Drawing.Size (151, 25); this.welcome_title_label.TabIndex = 1; this.welcome_title_label.Text = "Welcome to Gendarme "; // // addfiles_tab_page // this.addfiles_tab_page.Controls.Add (this.add_files_count_label); this.addfiles_tab_page.Controls.Add (this.label6); this.addfiles_tab_page.Controls.Add (this.label5); this.addfiles_tab_page.Controls.Add (this.add_files_button); this.addfiles_tab_page.Controls.Add (this.remove_file_button); this.addfiles_tab_page.Controls.Add (this.file_list_box); this.addfiles_tab_page.Location = new System.Drawing.Point (4, 25); this.addfiles_tab_page.Name = "addfiles_tab_page"; this.addfiles_tab_page.Padding = new System.Windows.Forms.Padding (3); this.addfiles_tab_page.Size = new System.Drawing.Size (493, 386); this.addfiles_tab_page.TabIndex = 1; this.addfiles_tab_page.Text = "Add Files"; this.addfiles_tab_page.UseVisualStyleBackColor = true; // // add_files_count_label // this.add_files_count_label.AutoSize = true; this.add_files_count_label.Location = new System.Drawing.Point (15, 357); this.add_files_count_label.Name = "add_files_count_label"; this.add_files_count_label.Size = new System.Drawing.Size (85, 13); this.add_files_count_label.TabIndex = 9; this.add_files_count_label.Text = "{0} files selected"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point (28, 26); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size (284, 13); this.label6.TabIndex = 8; this.label6.Text = "Add or remove assembly files to be analyzed by Gendarme."; // // label5 // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); this.label5.Location = new System.Drawing.Point (15, 12); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size (147, 13); this.label5.TabIndex = 7; this.label5.Text = "Add Assembly Files "; // // add_files_button // this.add_files_button.Location = new System.Drawing.Point (246, 352); this.add_files_button.Name = "add_files_button"; this.add_files_button.Size = new System.Drawing.Size (115, 23); this.add_files_button.TabIndex = 6; this.add_files_button.Text = "Add files..."; this.add_files_button.UseVisualStyleBackColor = true; this.add_files_button.Click += new System.EventHandler (this.AddFilesButtonClick); // // remove_file_button // this.remove_file_button.Location = new System.Drawing.Point (367, 352); this.remove_file_button.Name = "remove_file_button"; this.remove_file_button.Size = new System.Drawing.Size (116, 23); this.remove_file_button.TabIndex = 5; this.remove_file_button.Text = "Remove file"; this.remove_file_button.UseVisualStyleBackColor = true; this.remove_file_button.Click += new System.EventHandler (this.RemoveFileButtonClick); // // file_list_box // this.file_list_box.FormattingEnabled = true; this.file_list_box.HorizontalScrollbar = true; this.file_list_box.IntegralHeight = false; this.file_list_box.Location = new System.Drawing.Point (15, 48); this.file_list_box.Name = "file_list_box"; this.file_list_box.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; this.file_list_box.Size = new System.Drawing.Size (468, 301); this.file_list_box.TabIndex = 0; // // rules_tab_page // this.rules_tab_page.Controls.Add (this.rules_save_button); this.rules_tab_page.Controls.Add (this.browse_documentation_button); this.rules_tab_page.Controls.Add (this.rules_count_label); this.rules_tab_page.Controls.Add (this.label8); this.rules_tab_page.Controls.Add (this.label7); this.rules_tab_page.Controls.Add (this.rules_tree_view); this.rules_tab_page.Location = new System.Drawing.Point (4, 25); this.rules_tab_page.Name = "rules_tab_page"; this.rules_tab_page.Size = new System.Drawing.Size (493, 386); this.rules_tab_page.TabIndex = 2; this.rules_tab_page.Text = "Select Rules"; this.rules_tab_page.UseVisualStyleBackColor = true; // // rules_save_button // this.rules_save_button.Location = new System.Drawing.Point (327, 354); this.rules_save_button.Name = "rules_save_button"; this.rules_save_button.Size = new System.Drawing.Size (156, 23); this.rules_save_button.TabIndex = 32; this.rules_save_button.Text = "Save as default"; this.rules_save_button.UseVisualStyleBackColor = true; this.rules_save_button.Click += new System.EventHandler (this.SaveRulesButtonClick); // // browse_documentation_button // this.browse_documentation_button.Location = new System.Drawing.Point (165, 354); this.browse_documentation_button.Name = "browse_documentation_button"; this.browse_documentation_button.Size = new System.Drawing.Size (156, 23); this.browse_documentation_button.TabIndex = 5; this.browse_documentation_button.Text = "Documentation..."; this.browse_documentation_button.UseVisualStyleBackColor = true; this.browse_documentation_button.Click += new System.EventHandler (this.BrowseDocumentationButtonClick); // // rules_count_label // this.rules_count_label.AutoSize = true; this.rules_count_label.Location = new System.Drawing.Point (15, 357); this.rules_count_label.Name = "rules_count_label"; this.rules_count_label.Size = new System.Drawing.Size (112, 13); this.rules_count_label.TabIndex = 10; this.rules_count_label.Text = "{0} rules are available."; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point (28, 26); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size (308, 13); this.label8.TabIndex = 9; this.label8.Text = "Select the rules to be executed against the specified assemblies"; // // label7 // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); this.label7.Location = new System.Drawing.Point (15, 12); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size (79, 13); this.label7.TabIndex = 8; this.label7.Text = "Select Rules"; // // rules_tree_view // this.rules_tree_view.CheckBoxes = true; this.rules_tree_view.HideSelection = false; this.rules_tree_view.HotTracking = true; this.rules_tree_view.Location = new System.Drawing.Point (15, 47); this.rules_tree_view.Name = "rules_tree_view"; this.rules_tree_view.ShowNodeToolTips = true; this.rules_tree_view.Size = new System.Drawing.Size (468, 301); this.rules_tree_view.TabIndex = 0; this.rules_tree_view.AfterCheck += new System.Windows.Forms.TreeViewEventHandler (this.RulesTreeViewAfterCheck); // // options_tab_page // this.options_tab_page.Controls.Add (this.options_save_button); this.options_tab_page.Controls.Add (this.options_all_radiobutton); this.options_tab_page.Controls.Add (this.options_visible_radiobutton); this.options_tab_page.Controls.Add (this.label12); this.options_tab_page.Controls.Add (this.options_notvisible_radiobutton); this.options_tab_page.Controls.Add (this.options_severity_combobox); this.options_tab_page.Controls.Add (this.options_confidence_combobox); this.options_tab_page.Controls.Add (this.options_limit_updown); this.options_tab_page.Controls.Add (this.options_nolimit_checkbox); this.options_tab_page.Controls.Add (this.label11); this.options_tab_page.Controls.Add (this.label9); this.options_tab_page.Controls.Add (this.label4); this.options_tab_page.Controls.Add (this.label3); this.options_tab_page.Controls.Add (this.label2); this.options_tab_page.Location = new System.Drawing.Point (4, 25); this.options_tab_page.Name = "options_tab_page"; this.options_tab_page.Padding = new System.Windows.Forms.Padding (3); this.options_tab_page.Size = new System.Drawing.Size (493, 386); this.options_tab_page.TabIndex = 5; this.options_tab_page.Text = "Options"; this.options_tab_page.UseVisualStyleBackColor = true; // // options_save_button // this.options_save_button.Location = new System.Drawing.Point (327, 344); this.options_save_button.Name = "options_save_button"; this.options_save_button.Size = new System.Drawing.Size (156, 23); this.options_save_button.TabIndex = 31; this.options_save_button.Text = "Save as default"; this.options_save_button.UseVisualStyleBackColor = true; this.options_save_button.Click += new System.EventHandler (this.OnOptionsSaveClick); // // options_all_radiobutton // this.options_all_radiobutton.AutoSize = true; this.options_all_radiobutton.Location = new System.Drawing.Point (18, 290); this.options_all_radiobutton.Name = "options_all_radiobutton"; this.options_all_radiobutton.Size = new System.Drawing.Size (240, 17); this.options_all_radiobutton.TabIndex = 30; this.options_all_radiobutton.Text = "All code, visible or not, outside the assemblies"; this.options_all_radiobutton.UseVisualStyleBackColor = true; // // options_visible_radiobutton // this.options_visible_radiobutton.AutoSize = true; this.options_visible_radiobutton.Checked = true; this.options_visible_radiobutton.Location = new System.Drawing.Point (18, 267); this.options_visible_radiobutton.Name = "options_visible_radiobutton"; this.options_visible_radiobutton.Size = new System.Drawing.Size (210, 17); this.options_visible_radiobutton.TabIndex = 29; this.options_visible_radiobutton.TabStop = true; this.options_visible_radiobutton.Text = "All visible code (outside the assemblies)"; this.options_visible_radiobutton.UseVisualStyleBackColor = true; // // label12 // this.label12.AutoSize = true; this.label12.Location = new System.Drawing.Point (15, 251); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size (43, 13); this.label12.TabIndex = 28; this.label12.Text = "Visibility"; // // options_notvisible_radiobutton // this.options_notvisible_radiobutton.AutoSize = true; this.options_notvisible_radiobutton.Location = new System.Drawing.Point (18, 313); this.options_notvisible_radiobutton.Name = "options_notvisible_radiobutton"; this.options_notvisible_radiobutton.Size = new System.Drawing.Size (238, 17); this.options_notvisible_radiobutton.TabIndex = 27; this.options_notvisible_radiobutton.Text = "Only code not visible outside the assemnblies"; this.options_notvisible_radiobutton.UseVisualStyleBackColor = true; // // options_severity_combobox // this.options_severity_combobox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.options_severity_combobox.FormattingEnabled = true; this.options_severity_combobox.Items.AddRange (new object [] { "All - Include all defects, including audits", "Low - Include all defects, except audits", "Medium - Include most defects, except minor ones", "High - Only include defects that can have large effects", "Critical - Only include critical defects (few)"}); this.options_severity_combobox.Location = new System.Drawing.Point (18, 147); this.options_severity_combobox.Name = "options_severity_combobox"; this.options_severity_combobox.Size = new System.Drawing.Size (465, 21); this.options_severity_combobox.TabIndex = 25; // // options_confidence_combobox // this.options_confidence_combobox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.options_confidence_combobox.Items.AddRange (new object [] { "All - Include all defects", "Normal - Include all defects except if its confidence level is low", "High - Include only defects where it\'s likely that no false positives are present" + "", "Total - Include only defects where the confidence level is 100%"}); this.options_confidence_combobox.Location = new System.Drawing.Point (18, 204); this.options_confidence_combobox.Name = "options_confidence_combobox"; this.options_confidence_combobox.Size = new System.Drawing.Size (465, 21); this.options_confidence_combobox.TabIndex = 26; // // options_limit_updown // this.options_limit_updown.Increment = new decimal (new int [] { 100, 0, 0, 0}); this.options_limit_updown.Location = new System.Drawing.Point (18, 95); this.options_limit_updown.Maximum = new decimal (new int [] { 1000000, 0, 0, 0}); this.options_limit_updown.Minimum = new decimal (new int [] { 1, 0, 0, 0}); this.options_limit_updown.Name = "options_limit_updown"; this.options_limit_updown.Size = new System.Drawing.Size (136, 20); this.options_limit_updown.TabIndex = 18; this.options_limit_updown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.options_limit_updown.Value = global::Gendarme.Properties.Settings.Default.DefectsLimit; // // options_nolimit_checkbox // this.options_nolimit_checkbox.AutoSize = true; this.options_nolimit_checkbox.Location = new System.Drawing.Point (165, 98); this.options_nolimit_checkbox.Name = "options_nolimit_checkbox"; this.options_nolimit_checkbox.Size = new System.Drawing.Size (64, 17); this.options_nolimit_checkbox.TabIndex = 17; this.options_nolimit_checkbox.Text = "No Limit"; this.options_nolimit_checkbox.UseVisualStyleBackColor = true; this.options_nolimit_checkbox.CheckedChanged += new System.EventHandler (this.OptionsNoLimitCheckboxCheckedChanged); // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point (15, 188); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size (83, 13); this.label11.TabIndex = 15; this.label11.Text = "Confidence filter"; // // label9 // this.label9.AutoSize = true; this.label9.Location = new System.Drawing.Point (15, 131); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size (67, 13); this.label9.TabIndex = 14; this.label9.Text = "Severity filter"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point (28, 26); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size (255, 13); this.label4.TabIndex = 11; this.label4.Text = "Limit and/or filter the defects reported during analysis"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point (15, 77); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size (139, 13); this.label3.TabIndex = 10; this.label3.Text = "Maximum number of defects"; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); this.label2.Location = new System.Drawing.Point (15, 12); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size (50, 13); this.label2.TabIndex = 9; this.label2.Text = "Options"; // // analyze_tab_page // this.analyze_tab_page.Controls.Add (this.analyze_defect_label); this.analyze_tab_page.Controls.Add (this.analyze_title_label); this.analyze_tab_page.Controls.Add (this.analyze_status_label); this.analyze_tab_page.Controls.Add (this.analyze_assembly_label); this.analyze_tab_page.Controls.Add (this.progress_bar); this.analyze_tab_page.Location = new System.Drawing.Point (4, 25); this.analyze_tab_page.Name = "analyze_tab_page"; this.analyze_tab_page.Size = new System.Drawing.Size (493, 386); this.analyze_tab_page.TabIndex = 3; this.analyze_tab_page.Text = "Analyze"; this.analyze_tab_page.UseVisualStyleBackColor = true; // // analyze_defect_label // this.analyze_defect_label.AutoSize = true; this.analyze_defect_label.Location = new System.Drawing.Point (15, 105); this.analyze_defect_label.Name = "analyze_defect_label"; this.analyze_defect_label.Size = new System.Drawing.Size (89, 13); this.analyze_defect_label.TabIndex = 10; this.analyze_defect_label.Text = "Defects Found: 0"; // // analyze_title_label // this.analyze_title_label.AutoSize = true; this.analyze_title_label.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); this.analyze_title_label.Location = new System.Drawing.Point (15, 12); this.analyze_title_label.Name = "analyze_title_label"; this.analyze_title_label.Size = new System.Drawing.Size (131, 13); this.analyze_title_label.TabIndex = 9; this.analyze_title_label.Text = "Analysis in progress..."; // // analyze_status_label // this.analyze_status_label.AutoSize = true; this.analyze_status_label.Location = new System.Drawing.Point (15, 57); this.analyze_status_label.Name = "analyze_status_label"; this.analyze_status_label.Size = new System.Drawing.Size (135, 13); this.analyze_status_label.TabIndex = 2; this.analyze_status_label.Text = "Processing assembly 0 of 1"; // // analyze_assembly_label // this.analyze_assembly_label.AutoSize = true; this.analyze_assembly_label.Location = new System.Drawing.Point (15, 80); this.analyze_assembly_label.Name = "analyze_assembly_label"; this.analyze_assembly_label.Size = new System.Drawing.Size (57, 13); this.analyze_assembly_label.TabIndex = 1; this.analyze_assembly_label.Text = "Assembly: "; // // progress_bar // this.progress_bar.Location = new System.Drawing.Point (18, 133); this.progress_bar.Name = "progress_bar"; this.progress_bar.Size = new System.Drawing.Size (465, 23); this.progress_bar.TabIndex = 0; // // results_tab_page // this.results_tab_page.Controls.Add (this.bugzilla_linklabel); this.results_tab_page.Controls.Add (this.copy_paste_label); this.results_tab_page.Controls.Add (this.error_textbox); this.results_tab_page.Controls.Add (this.unexpected_error_label); this.results_tab_page.Controls.Add (this.view_report_button); this.results_tab_page.Controls.Add (this.save_report_button); this.results_tab_page.Controls.Add (this.results_title_label); this.results_tab_page.Controls.Add (this.report_subtitle_label); this.results_tab_page.Location = new System.Drawing.Point (4, 25); this.results_tab_page.Name = "results_tab_page"; this.results_tab_page.Size = new System.Drawing.Size (493, 386); this.results_tab_page.TabIndex = 4; this.results_tab_page.Text = "Results"; this.results_tab_page.UseVisualStyleBackColor = true; // // view_report_button // this.view_report_button.Location = new System.Drawing.Point (15, 126); this.view_report_button.Name = "view_report_button"; this.view_report_button.Size = new System.Drawing.Size (142, 23); this.view_report_button.TabIndex = 11; this.view_report_button.Text = "View Report..."; this.view_report_button.UseVisualStyleBackColor = true; this.view_report_button.Click += new System.EventHandler (this.ViewReportButtonClick); // // save_report_button // this.save_report_button.Location = new System.Drawing.Point (15, 97); this.save_report_button.Name = "save_report_button"; this.save_report_button.Size = new System.Drawing.Size (142, 23); this.save_report_button.TabIndex = 10; this.save_report_button.Text = "Save Report..."; this.save_report_button.UseVisualStyleBackColor = true; this.save_report_button.Click += new System.EventHandler (this.SaveReportButtonClick); // // results_title_label // this.results_title_label.AutoSize = true; this.results_title_label.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); this.results_title_label.Location = new System.Drawing.Point (15, 12); this.results_title_label.Name = "results_title_label"; this.results_title_label.Size = new System.Drawing.Size (99, 13); this.results_title_label.TabIndex = 9; this.results_title_label.Text = "Analysis Results"; // // report_subtitle_label // this.report_subtitle_label.AutoSize = true; this.report_subtitle_label.Location = new System.Drawing.Point (28, 26); this.report_subtitle_label.Name = "report_subtitle_label"; this.report_subtitle_label.Size = new System.Drawing.Size (236, 13); this.report_subtitle_label.TabIndex = 0; this.report_subtitle_label.Text = "Gendarme has found {0} defects during analysis."; // // help_button // this.help_button.Location = new System.Drawing.Point (545, 411); this.help_button.Name = "help_button"; this.help_button.Size = new System.Drawing.Size (75, 23); this.help_button.TabIndex = 4; this.help_button.Text = "Help"; this.help_button.UseVisualStyleBackColor = true; this.help_button.Click += new System.EventHandler (this.HelpButtonClick); // // cancel_button // this.cancel_button.Location = new System.Drawing.Point (464, 411); this.cancel_button.Name = "cancel_button"; this.cancel_button.Size = new System.Drawing.Size (75, 23); this.cancel_button.TabIndex = 3; this.cancel_button.Text = "Cancel"; this.cancel_button.UseVisualStyleBackColor = true; this.cancel_button.Click += new System.EventHandler (this.CancelButtonClick); // // next_button // this.next_button.Location = new System.Drawing.Point (383, 411); this.next_button.Name = "next_button"; this.next_button.Size = new System.Drawing.Size (75, 23); this.next_button.TabIndex = 2; this.next_button.Text = "Next >"; this.next_button.UseVisualStyleBackColor = true; this.next_button.Click += new System.EventHandler (this.NextButtonClick); // // back_button // this.back_button.Location = new System.Drawing.Point (302, 411); this.back_button.Name = "back_button"; this.back_button.Size = new System.Drawing.Size (75, 23); this.back_button.TabIndex = 1; this.back_button.Text = "< Back"; this.back_button.UseVisualStyleBackColor = true; this.back_button.Click += new System.EventHandler (this.BackButtonClick); // // open_file_dialog // this.open_file_dialog.Filter = "Assemblies (*.exe;*.dll)|*.exe;*.dll|All files (*.*)|*.*"; this.open_file_dialog.Multiselect = true; this.open_file_dialog.Title = "Add Assemblies..."; // // save_file_dialog // this.save_file_dialog.DefaultExt = "*.html"; this.save_file_dialog.Filter = "HTML report (*.html)|*.html|XML report (*.xml)|*.xml|Text report (*.txt)|*.txt"; this.save_file_dialog.Title = "Save Report To..."; // // pictureBox1 // this.pictureBox1.Image = global::Gendarme.Properties.Resources.gendarme; this.pictureBox1.Location = new System.Drawing.Point (12, 25); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size (128, 128); this.pictureBox1.TabIndex = 10; this.pictureBox1.TabStop = false; // // unexpected_error_label // this.unexpected_error_label.AutoSize = true; this.unexpected_error_label.Font = new System.Drawing.Font ("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte) (0))); this.unexpected_error_label.ForeColor = System.Drawing.Color.Red; this.unexpected_error_label.Location = new System.Drawing.Point (28, 49); this.unexpected_error_label.Name = "unexpected_error_label"; this.unexpected_error_label.Size = new System.Drawing.Size (298, 13); this.unexpected_error_label.TabIndex = 13; this.unexpected_error_label.Text = "Results are incomplete due to an unexpected error!"; this.unexpected_error_label.Visible = false; // // error_textbox // this.error_textbox.Anchor = ((System.Windows.Forms.AnchorStyles) ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.error_textbox.Location = new System.Drawing.Point (18, 207); this.error_textbox.Multiline = true; this.error_textbox.Name = "error_textbox"; this.error_textbox.ReadOnly = true; this.error_textbox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.error_textbox.Size = new System.Drawing.Size (465, 163); this.error_textbox.TabIndex = 14; this.error_textbox.Visible = false; // // copy_paste_label // this.copy_paste_label.AutoSize = true; this.copy_paste_label.Location = new System.Drawing.Point (15, 172); this.copy_paste_label.Name = "copy_paste_label"; this.copy_paste_label.Size = new System.Drawing.Size (300, 13); this.copy_paste_label.TabIndex = 15; this.copy_paste_label.Text = "Please copy-paste the following information on a bug report to:"; this.copy_paste_label.Visible = false; // // bugzilla_linklabel // this.bugzilla_linklabel.AutoSize = true; this.bugzilla_linklabel.Location = new System.Drawing.Point (15, 185); this.bugzilla_linklabel.Name = "bugzilla_linklabel"; this.bugzilla_linklabel.Size = new System.Drawing.Size (127, 13); this.bugzilla_linklabel.TabIndex = 16; this.bugzilla_linklabel.TabStop = true; this.bugzilla_linklabel.Text = "http://bugzilla.novell.com"; this.bugzilla_linklabel.Visible = false; this.bugzilla_linklabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler (this.BugzillaLinkClick); // // Wizard // this.AcceptButton = this.next_button; this.ClientSize = new System.Drawing.Size (634, 448); this.ControlBox = false; this.Controls.Add (this.pictureBox1); this.Controls.Add (this.back_button); this.Controls.Add (this.next_button); this.Controls.Add (this.cancel_button); this.Controls.Add (this.help_button); this.Controls.Add (this.wizard_tab_control); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon) (resources.GetObject ("$this.Icon"))); this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size (640, 480); this.MinimumSize = new System.Drawing.Size (640, 480); this.Name = "Wizard"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.Text = "Gendarme"; this.wizard_tab_control.ResumeLayout (false); this.welcome_tab_page.ResumeLayout (false); this.welcome_tab_page.PerformLayout (); this.addfiles_tab_page.ResumeLayout (false); this.addfiles_tab_page.PerformLayout (); this.rules_tab_page.ResumeLayout (false); this.rules_tab_page.PerformLayout (); this.options_tab_page.ResumeLayout (false); this.options_tab_page.PerformLayout (); ((System.ComponentModel.ISupportInitialize) (this.options_limit_updown)).EndInit (); this.analyze_tab_page.ResumeLayout (false); this.analyze_tab_page.PerformLayout (); this.results_tab_page.ResumeLayout (false); this.results_tab_page.PerformLayout (); ((System.ComponentModel.ISupportInitialize) (this.pictureBox1)).EndInit (); this.ResumeLayout (false); } #endregion private System.Windows.Forms.TabControl wizard_tab_control; private System.Windows.Forms.TabPage welcome_tab_page; private System.Windows.Forms.TabPage addfiles_tab_page; private System.Windows.Forms.Button help_button; private System.Windows.Forms.Button cancel_button; private System.Windows.Forms.LinkLabel welcome_link_label; private System.Windows.Forms.TabPage rules_tab_page; private System.Windows.Forms.TreeView rules_tree_view; private System.Windows.Forms.TabPage analyze_tab_page; private System.Windows.Forms.TabPage results_tab_page; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label welcome_gendarme_label; private System.Windows.Forms.Button next_button; private System.Windows.Forms.Button back_button; private System.Windows.Forms.Button add_files_button; private System.Windows.Forms.Button remove_file_button; private System.Windows.Forms.ListBox file_list_box; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label5; private System.Windows.Forms.OpenFileDialog open_file_dialog; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label rules_count_label; private System.Windows.Forms.Button browse_documentation_button; private System.Windows.Forms.Label report_subtitle_label; private System.Windows.Forms.SaveFileDialog save_file_dialog; private System.Windows.Forms.Label welcome_title_label; private System.Windows.Forms.Label label10; private System.Windows.Forms.Button view_report_button; private System.Windows.Forms.Button save_report_button; private System.Windows.Forms.Label results_title_label; private System.Windows.Forms.Label add_files_count_label; private System.Windows.Forms.Label analyze_title_label; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Label analyze_assembly_label; private System.Windows.Forms.ProgressBar progress_bar; private System.Windows.Forms.Label analyze_status_label; private System.Windows.Forms.Label analyze_defect_label; private System.Windows.Forms.TabPage options_tab_page; private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label11; private System.Windows.Forms.NumericUpDown options_limit_updown; private System.Windows.Forms.CheckBox options_nolimit_checkbox; private System.Windows.Forms.ComboBox options_confidence_combobox; private System.Windows.Forms.ComboBox options_severity_combobox; private System.Windows.Forms.RadioButton options_all_radiobutton; private System.Windows.Forms.RadioButton options_visible_radiobutton; private System.Windows.Forms.Label label12; private System.Windows.Forms.RadioButton options_notvisible_radiobutton; private System.Windows.Forms.Button options_save_button; private System.Windows.Forms.Button rules_save_button; private System.Windows.Forms.Label unexpected_error_label; private System.Windows.Forms.Label copy_paste_label; private System.Windows.Forms.TextBox error_textbox; private System.Windows.Forms.LinkLabel bugzilla_linklabel; } } mono-tools-4.2/gendarme/swf-wizard-runner/GuiRunner.cs0000664000175000017500000000771112413742070025150 0ustar00directhexdirecthex00000000000000// // GuiRunner.cs: A SWF-based Wizard Runner for Gendarme // // Authors: // Sebastien Pouliot // // Copyright (C) 2008-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.Generic; using System.Globalization; using System.IO; using System.Reflection; using System.Text; using Gendarme.Framework; using Gendarme.Framework.Engines; using Mono.Cecil; namespace Gendarme { [EngineDependency (typeof (SuppressMessageEngine))] public class GuiRunner : Runner { private Wizard wizard; private StringBuilder unexpected = new StringBuilder (); private StringBuilder warnings = new StringBuilder (); private static TypeFilter RuleTypeFilter = new TypeFilter (RuleFilter); public GuiRunner (Wizard form) { wizard = form; IgnoreList = new BasicIgnoreList (this); } public string Error { get { return unexpected.ToString (); } } public string Warnings { get { return warnings.ToString (); } } private static bool RuleFilter (Type type, object interfaceName) { return (type.ToString () == (interfaceName as string)); } private void LoadRulesFromAssembly (string assemblyName) { AssemblyName aname = AssemblyName.GetAssemblyName (Path.GetFullPath (assemblyName)); Assembly a = Assembly.Load (aname); foreach (Type t in a.GetTypes ()) { if (t.IsAbstract || t.IsInterface) continue; if (t.FindInterfaces (RuleTypeFilter, "Gendarme.Framework.IRule").Length > 0) { Rules.Add ((IRule) Activator.CreateInstance (t)); } } } public void LoadRules () { // load every dll to check for rules... string dir = Path.GetDirectoryName (typeof (IRule).Assembly.Location); FileInfo [] files = new DirectoryInfo (dir).GetFiles ("*.dll"); foreach (FileInfo info in files) { // except for a few, well known, ones switch (info.Name) { case "Mono.Cecil.dll": case "Mono.Cecil.Pdb.dll": case "Mono.Cecil.Mdb.dll": case "Gendarme.Framework.dll": continue; } LoadRulesFromAssembly (info.FullName); } } public void Execute () { try { unexpected.Length = 0; Initialize (); Run (); TearDown (); } catch (Exception e) { if (CurrentRule != null) unexpected.Append ("Rule:\t").Append (CurrentRule).AppendLine ().AppendLine (); if (CurrentTarget != null) unexpected.Append ("Target:\t").Append (CurrentTarget).AppendLine ().AppendLine (); unexpected.Append ("Stack trace: ").Append (e); } } protected override void OnAssembly (RunnerEventArgs e) { // update wizard UI on the main, i.e. UI, thread wizard.BeginInvoke ((Action) (() => wizard.PreAssemblyUpdate (e))); base.OnAssembly (e); } protected override void OnType (RunnerEventArgs e) { base.OnType (e); wizard.BeginInvoke ((Action) (() => wizard.PostTypeUpdate (e))); } public void Warn (string warning) { warnings.AppendLine (warning); } } } mono-tools-4.2/gendarme/swf-wizard-runner/Makefile.am0000664000175000017500000000516412642235713024744 0ustar00directhexdirecthex00000000000000wizarddir=$(prefix)/lib/gendarme wizard_SCRIPTS = ../bin/gendarme-wizard.exe desktopdir = $(datadir)/applications desktop_DATA = gendarme-wizard.desktop $(desktop_DATA): $(desktop_DATA).in sed -e "s|\@bindir\@|$(bindir)|" $< > $@ EXTRA_DIST = $(wizard_sources) $(wizard_sources_in) swf-wizard-runner.csproj Wizard.resx Properties/Resources.resx \ Resources/gendarme.png $(wizard_icon) $(desktop_DATA).in CLEANFILES = $(wizard_SCRIPTS) $(wizard_SCRIPTS).mdb Wizard.resources Resources.resources Properties/Resources.resources \ $(desktop_DATA) DISTCLEANFILES = Makefile.in wizard_sources_in = ../AssemblyInfo.cs.in wizard_generated_sources = $(wizard_sources_in:.in=) wizard_sources = \ ../AssemblyStaticInfo.cs \ ../console/Helpers.cs \ ../console/HtmlResultWriter.cs \ ../console/ResultWriter.cs \ ../console/TextResultWriter.cs \ ../console/XmlResultWriter.cs \ Gendarme.cs \ GuiRunner.cs \ Page.cs \ Properties/Resources.Designer.cs \ Properties/Settings.Designer.cs \ Wizard.cs \ Wizard.Designer.cs wizard_build_sources = $(addprefix $(srcdir)/, $(wizard_sources)) wizard_build_sources += $(wizard_generated_sources) wizard_resources = Wizard.resx wizard_build_resources = $(addprefix $(srcdir)/, $(wizard_resources)) Wizard.resources: $(wizard_build_resources) resgen2 /compile $(wizard_build_resources),Wizard.resources wizard_properties_resx = Properties/Resources.resx wizard_properties_prefix_resx = $(addprefix $(srcdir)/, $(wizard_properties_resx)) wizard_properties_resource = Properties wizard_properties_build_resource = $(addprefix $(srcdir)/, $(wizard_properties_resource)) Properties/Resources.resources: $(wizard_properties_prefix_resx) mkdir -p Properties; \ resgen2 -usesourcepath -compile $(wizard_properties_prefix_resx),Properties/Resources.resources; wizard_xsl = ../console/gendarme.xsl wizard_build_xsl = $(addprefix $(srcdir)/, $(wizard_xsl)) wizard_icon = Resources/gendarme.ico wizard_build_icon = $(addprefix $(srcdir)/, $(wizard_icon)) ../bin/gendarme-wizard.exe: $(wizard_build_sources) $(wizard_resources) Wizard.resources Properties/Resources.resources $(wizard_build_xsl) $(wizard_build_icon) $(MCS) -debug -target:winexe -r:$(CECIL_ASM) -r:../bin/Gendarme.Framework.dll \ -r:System.Core.dll -r:System.Xml.Linq.dll -r:System.Windows.Forms.dll -r:System.Drawing.dll -r:System.Xml.dll \ -resource:$(wizard_build_xsl) -resource:Wizard.resources,Gendarme.Wizard.resources \ -resource:Properties/Resources.resources,Gendarme.Properties.Resources.resources \ -win32icon:$(wizard_build_icon) -out:$@ $(wizard_build_sources) self-test: $(wizard_SCRIPTS) mono --debug ../bin/gendarme.exe $(wizard_SCRIPTS) mono-tools-4.2/gendarme/swf-wizard-runner/Page.cs0000664000175000017500000000256612413742070024111 0ustar00directhexdirecthex00000000000000// // Page.cs: Page enumaration // // Authors: // Sebastien Pouliot // // 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 Gendarme { [Serializable] public enum Page { Welcome, AddFiles, SelectRules, Options, // new in 2.1+ Analyze, Report } } mono-tools-4.2/gendarme/options.make0000664000175000017500000000043712413742070021627 0ustar00directhexdirecthex00000000000000# note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG -checked+,-optimize+) COMMON_OPTIONS += -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 mono-tools-4.2/gendarme/README0000664000175000017500000000166412413742070020160 0ustar00directhexdirecthex00000000000000Gendarme README User-level documentation is available from the Mono:: project wiki http://www.mono-project.com/Gendarme ROADMAP http://www.mono-project.com/Gendarme.Roadmap Mailing list http://groups.google.com/group/gendarme Newsgroup gateway to the mailing list nntp://news.gmane.org/gmane.comp.gnome.mono.gendarme Developer documentation http://groups.google.com/group/gendarme IMPORTANT NOTES * Gendarme "official" build system is based on the auto*/Makefile files and tested on MonkeyWrench. See mono-tools-trunk on http://build.mono-project.com/index.aspx?lane=mono-trunk (checking out gendarme without its parent dir 'mono-tools' is not supported) * Visual Studio solutions and projects files (usable by both MonoDevelop and Visual Studio .NET 2008) are NOT always up to date with Makefiles. This depends on the developer making changes and his personal access to the developing environments. (Please see the README.vsnet file.) mono-tools-4.2/gendarme/AssemblyInfo.cs0000664000175000017500000000035212642235734022223 0ustar00directhexdirecthex00000000000000// // AssemblyInfo.cs.in for Gendarme // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-2008 Novell, Inc (http://www.novell.com) // using System.Reflection; [assembly: AssemblyVersion ("4.2.0.0")] mono-tools-4.2/gendarme/NEWS0000664000175000017500000005502412413742070017776 0ustar00directhexdirecthex000000000000002011-01-10 Version 2.10 There were two major events in the last release cycle. The first was the release (and adoption) of Cecil/light. The second was Mono participation in "Google Code In 2010" where many Gendarme tasks were claimed (and completed) by students. Release highlights: * Gendarme now use cecil/light, the new version of Mono.Cecil [JB Evain] * A new tool, FxCopMapper, is also available to produce compatibility maps (documentation) between Gendarme and FxCop rules [Yuri Stuken] * Rules / projects templates for Visual Studio .NET [Nicholas Rioux] * '.ignore' files now support @filename entries, which allow you to include several .ignore files from a master .ignore file [Sebastien Pouliot] New rules includes: Gendarme.Rules.BadPractice * UseFileOpenOnlyWithFileAccessRule [Yuri Stuken] Gendarme.Rules.Design * EnumaratorsShouldBeStronglyTypedRule [Yuri Stuken] * ListsAreStronglyTypedRule [Yuri Stuken] * PreferUriOverStringRule [Nicholas Rioux] * StronglyTypeICollectionMembersRule [Yuri Stuken] Gendarme.Rules.Design.Generic * AvoidExcessiveParametersOnGenericTypesRule [Nicholas Rioux] * DoNotDeclareStaticMembersOnGenericTypesRule [Nicholas Rioux] * DoNotExposeGenericListsRule [Nicholas Rioux] Gendarme.Rules.Globalization (new in 2.10) * AvoidUnusedInternalResourceRule [Antoine Vandecreme] * SatelliteResourceMismatchRule [Antoine Vandecreme] Gendarme.Rules.Interoperability.Com (new in 2.10) * AutoLayoutTypesShouldNotBeComVisibleRule [Yuri Stuken] * AvoidInt64ArgumentsInComVisibleMethodsRule [Yuri Stuken] * AvoidNonPublicFieldsInComVisibleValueTypesRule [N Lum] * AvoidOverloadsInComVisibleInterfacesRule [N Lum] * AvoidStaticMembersInComVisibleTypesRule [Yuri Stuken] * ComVisibleShouldInheritFromComVisibleRule [N Lum] * ComVisibleTypesShouldBeCreatableRule [Nicholas Rioux] * DoNotUseAutoDualClassInterfaceTypeRule [Yuri Stuken] * MarkComSourceInterfacesAsIDispatchRule [Nicholas Rioux] * ReviewComRegistrationMethodsRule [Yuri Stuken] Gendarme.Rules.Performance * AvoidUnnecessaryOverridesRule [N Lum] * PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceRule [Julien Hoarau] Gendarme.Rules.Maintainability * ReviewMisleadingFieldNamesRule [N Lum] * VariableNamesShouldNotMatchFieldNamesRule [N Lum] Gendarme.Rules.Ui * AddMatchingArrangeMeasureOverrideRule [Nicholas Rioux] Gendarme.Rules.NUnit (new in 2.10) * ProvideMessageOnAssertCallsRule [Yuri Stuken] * MissingEngineDependencyRule [Yuri Stuken] * TestMethodsMustBePublicRule [Yuri Stuken] * UnitTestsMissingTestFixtureRule [Yuri Stuken] Gendarme.Rules.Gendarme (new in 2.10) * DefectsMustBeReportedRule [Yuri Stuken] * DoNotThrowExceptionRule [Yuri Stuken] * ReviewAttributesOnRulesRule [Yuri Stuken] * UseCorrectSuffixRule [Yuri Stuken] Most of the new assemblies (i.e. Gendarme.Rules.Interoperability.Com, Gendarme.Rules.NUnit and Gendarme.Rules.Gendarme) are "speciality rules" and, like Gendarme.Rules.Smells, are not part of the 'default' set of the console runner. Enable them (in rules.xml) if/when your projects requires them. Contributors for this release are: Andres G. Aragoneses, Antoine Vandecreme, JB Evain, Julien Hoarau, N Lum, Nicolas Rioux, Sebastien Pouliot and Yuri Stuken 2010-09-05 Version 2.8.0 First release in the 2.8.x serie which will lead to the 3.0 release. Many rules were enhanced and a lot of work was done to make Gendarme adhere to its own rules (self-test). This release also includes 10 new rules (221 rules total): Gendarme.Rules.BadPractice * PreferParamsArrayForVariableArgumentsRule [Sebastien Pouliot] * PreferTryParseRule [Sebastien Pouliot] Gendarme.Rules.Correctness * UseNoInliningWithGetCallingAssemblyRule [Sebastien Pouliot] Gendarme.Rules.Design * ProvideTryParseAlternativeRule [Sebastien Pouliot] Gendarme.Rules.Design.Generic * AvoidDeclaringCustomDelegatesRule [Sebastien Pouliot] Gendarme.Rules.Maintainability * RemoveDependenceOnObsoleteCodeRule [Sebastien Pouliot] Gendarme.Rules.Interoperability * CentralizePInvokesIntoNativeMethodsTypeRule [Sebastien Pouliot] Gendarme.Rules.Performance * AvoidConcatenatingCharsRule [Sebastien Pouliot] * AvoidLocalDataStoreSlotRule [Sebastien Pouliot] * AvoidRepetitiveCallsToPropertiesRule [Sebastien Pouliot] Contributors for this release are: Antoine Vandecreme, JB Evain, Rolf Bjarne Kvinge and Sebastien Pouliot. 2009-12-20 Version 2.6 Released just in time for xmas Gendarme 2.6 comes with a lot of enhancements and bug fixes. Rule documentation (wiki) and our MAN pages were also greatly enhanced by the work of Jesse Jones. In the ecosystem Daniel Nauck contributed Gendarme support for CC.NET and a new NAnt task with reduced dependencies. With this Gendarme should be easier than ever to use on your projects. This release includes 12 new rules (207 rules total): Gendarme.Rules.BadPractice * DoNotUseEnumIsAssignableFromRule [JB Evain] * OnlyUseDisposeForIDisposableTypesRule [Jesse Jones] * PreferSafeHandleRule [Jesse Jones] Gendarme.Rules.Concurrency * DoNotUseThreadStaticWithInstanceFieldsRule [Jesse Jones] Gendarme.Rules.Correctness * ProvideValidXmlStringRule [Cedric Vivier] * ProvideValidXPathExpressionRule [Cedric Vivier] Gendarme.Rules.Design * PreferXmlAbstractionsRule [Cedric Vivier] * UseCorrectDisposeSignaturesRule [Jesse Jones] * UseFlagsAttributeRule [Jesse Jones] Gendarme.Rules.Exceptions * UseObjectDisposedExceptionRule [Jesse Jones] Gendarme.Rules.Interoperability * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule [Rolf Bjarne Kvinge] Gendarme.Rules.Performance * ReviewLinqMethodRule [Jesse Jones] Contributors for this release are: Cedric Vivier, Daniel Nauck, JB Evain, Jesse Jones, Rolf Bjarne Kvinge and Sebastien Pouliot. 2009-01-20 Version 2.4 This release was the shortest (about 2 months) release cycle ever for Gendarme. Nevertheless it contains a lot of enhancements for rules builders (e.g. logging support, makefile helpers) provided by Jesse Jones. This release also includes 12 new rules (195 rules total): Gendarme.Rules.BadPractice * PreferEmptyInstanceOverNullRule [Cedric Vivier] Gendarme.Rules.Correctness * DoNotRecurseInEqualityRule [Jesse Jones] * EnsureLocalDisposalRule [Cedric Vivier] * ProvideCorrectRegexPatternRule [Cedric Vivier] * ReviewInconsistentIdentityRule [Jesse Jones] Gendarme.Rules.Design.Generic * DoNotExposeNestedGenericSignaturesRule [Sebastien Pouliot] Gendarme.Rules.Exceptions * DoNotThrowInUnexpectedLocationRule [Jesse Jones] Gendarme.Rules.Maintainability * AvoidAlwaysNullFieldRule [Jesse Jones] Gendarme.Rules.Naming * AvoidTypeInterfaceInconsistencyRule [Sebastien Pouliot] Gendarme.Rules.Performance * PreferCharOverloadRule [Sebastien Pouliot] Gendarme.Rules.Security * DoNotShortCircuitCertificateChecksRule [Sebastien Pouliot] Gendarme.Rules.Smells * AvoidSwitchStatementsRule [Nestor Salceda] Contributors for this release are: Andres G. Aragoneses, Cedric Vivier, JB Evain, Jesse Jones, Nestor Salceda, Sebastien Pouliot. 2008-11-10 Version 2.2 This release includes the development results of the last four months, including some major events like the Novell Hack Week 3 and the second half of GSoC 2008 work done by Nestor Salceda. Major highlights includes: * improvement to the framework by the addition of engines that can build extra information to extend the model Cecil gives us to work with. * New [FxCopCompatibility] attribute to match between Gendarme and FxCop rules. This will be used to support [SuppressMessage] inside assemblies in a future release. * New TearDown capability on rules and runners allow rules to defer the reporting of defects until the analysis is completed. * New "Audit" severity. This is used to denotate defects that, too often, can't be fixed (i.e. will always be reported) but needs to be audited (e.g. security items). * By default the console runner now reports only when both Severity > Low i.e. skipping Low and Audit severity defects Confidence > Low i.e. skipping Low confidence defects This is to help reduce false positives and get smaller reports with the most important defects. You can override both option, with lower or higher values, with new command switches. E.g. gendarme --severity=audit,critical ... gendarme --confidence=all ... * The wizard runner is now, by default, limited to 1000 defects on the visible API and will, like the console runner, report only defects when both Severity > Low and Confidence > Low. A new step in the wizard allow users to change those settings before the analysis (defaults can be modified and saved). * You can now save your rule selection as the new default in the wizard. The same set will be enable next time you restart the wizard. * Known issue: does not work under Mono, bug #439943 and a lot of new rules including: Gendarme.Rules.BadPractice * AvoidAssemblyVersionMismatchRule [Sebastien Pouliot] * DoNotUseGetInterfaceToCheckAssignabilityRule [Sebastien Pouliot] Gendarme.Rules.Concurrency * DoNotUseMethodImplOptionsSynchronizedRule [Sebastien Pouliot] * ReviewLockUsedOnlyForOperationsOnVariablesRule [Cedric Vivier] * ProtectCallToEventDelegatesRule [Sebastien Pouliot] Gendarme.Rules.Correctness * AttributeStringLiteralsShouldParseCorrectlyRule [Nestor Salceda] * CheckParametersNullityInVisibleMethodsRule [Sebastien Pouliot] * ProvideCorrectArgumentsToFormattingMethodsRule [Nestor Salceda] * ReviewCastOnIntegerDivisionRule [Sebastien Pouliot] * ReviewCastOnIntegerMultiplicationRule [Sebastien Pouliot] Gendarme.Rules.Design * AvoidSmallNamespaceRule [Sebastien Pouliot] * ConsiderAddingInterfaceRule [Cedric Vivier] * DeclareEventHandlersCorrectlyRule [Nestor Salceda] * DoNotDeclareVirtualMethodsInSealedTypeRule [Sebastien Pouliot] * InternalNamespacesShouldNotExposeTypesRule [Sebastien Pouliot] * MarkAssemblyWithAssemblyVersionRule [Sebastien Pouliot] * MarkAssemblyWithCLSCompliantRule [Sebastien Pouliot] * MarkAssemblyWithComVisibleRule [Sebastien Pouliot] Gendarme.Rules.Design.Generic * AvoidMethodWithUnusedGenericTypeRule [Sebastien Pouliot] * UseGenericEventHandlerRule [Sebastien Pouliot] * PreferGenericsOverRefObjectRule [Sebastien Pouliot] Gendarme.Rules.Design.Linq * AvoidExtensionMethodOnSystemObjectRule [Sebastien Pouliot] Gendarme.Rules.Exceptions * InstantiateArgumentExceptionCorrectlyRule [Nestor Salceda] Gendarme.Rules.Interoperability * MarshalBooleansInPInvokeDeclarationsRule [Sebastien Pouliot] Gendarme.Rules.Naming * AvoidDeepNamespaceHierarchyRule [Sebastien Pouliot] * AvoidRedundancyInMethodNameRule [Cedric Vivier] * AvoidRedundancyInTypeNameRule [Cedric Vivier] Gendarme.Rules.Performance * AvoidUnneededFieldInitializationRule [Sebastien Pouliot] * PreferLiteralOverInitOnlyFieldsRule [Sebastien Pouliot] Gendarme.Rules.Security.Cas * ReviewSuppressUnmanagedCodeSecurityUsageRule [Sebastien Pouliot] Gendarme.Rules.Serialization * MarkEnumerationsAsSerializableRule [Sebastien Pouliot] Gendarme.Rules.Smells * AvoidMessageChainsRule [Nestor Salceda] Lots of rules have been updated and, in a few cases, renamed or moved, to provide extended functionalities. Move/merge changes: * CAS-related Security rules were moved into Security.Cas * DisposableFieldsShouldBeDisposedRule was moved from Design into Correctness * EnumNotEndsWithEnumOrFlagsSuffixRule was merged with UseCorrectSuffixRule (Naming) * FinalizersShouldCallBaseClassFinalizerRule was moved from Design into Correctness * ImplementGenericCollectionInterfacesRule was moved from Design into Design.Generic Contributors for this release are: Peter Johanson, Nestor Salceda, Cedric Vivier, Jesse Jones, Alan McGovern, Sebastien Pouliot. 2008-07-14 Version 0.2.0.0 This release includes the development results of the last six months, including some major events like the Novell Hack Week (Winter 2008 edition), which changed much of the Gendarme framework, the first "Gendarme Rule Day" and the first part of GSoC 2008 work by Nestor Salceda. General highlights: * Performance enhancements, memory usage reduction (mostly inside Cecil but the gains are very visible in Gendarme) * MDB/PDB support: source files and line numbers are now provided with defects [Sebastien Pouliot] * New Windows installer: You can now easily enjoy Gendarme, and it's wizard, from Windows computers [Sebastien Pouliot] * .desktop file for the Wizard runner [Daniel Nauck] * Console runner now uses color when displaying on the console [Cedric Vivier] * Albeit a bit invisible to end users, we started using the new unit test helpers made during GHOP [Daniel Abramov] * Bug fixes: works continue, like previous releases, to remove false positives from existing rules; and a lot of new rules including: Gendarme.Rules.BadPractice * AvoidCallingProblematicMethodsRule [Nestor Salceda] * AvoidVisibleConstantFieldRule [Sebastien Pouliot] * DoNotForgetNotImplementedMethodsRule [Cedric Vivier] * DisableDebuggingCodeRule [Sebastien Pouliot] * ObsoleteMessagesShouldNotBeEmptyRule [Sebastien Pouliot] * ReplaceIncompleteOddnessCheckRule [Sebastien Pouliot] Gendarme.Rules.Concurrency * DoNotLockOnThisOrTypesRule [Sebastien Pouliot] * DoNotLockOnWeakIdentityObjectsRule [Sebastien Pouliot] * DoNotUseLockedRegionOutsideMethodRule [Andres G. Aragoneses] Gendarme.Rules.Correctness * DoNotRoundIntegersRule [Sebastien Pouliot] * ReviewDoubleAssignmentRule [Sebastien Pouliot] * ReviewSelfAssignmentRule [Sebastien Pouliot] * ReviewUselessControlFlow [Sebastien Pouliot] * ReviewUseOfInt64BitsToDoubleRule [Sebastien Pouliot] * ReviewUseOfModuloOneOnIntegersRule [Sebastien Pouliot] Gendarme.Rules.Design * AvoidMultidimensionalIndexerRule [Sebastien Pouliot] * AvoidRefAndOutParametersRule [Sebastien Pouliot] * AvoidVisibleNestedTypesRule [Sebastien Pouliot] * ConsiderConvertingFieldToNullableRule [Cedric Vivier] * ConsiderUsingStaticTypeRule.cs [Sebastien Pouliot] * ImplementGenericCollectionInterfacesRule [Daniel Abramov] * ImplementIComparableCorreclyRule [Sebastien Pouliot] * PreferIntegerOrStringForIndexersRule [Sebastien Pouliot] Gendarme.Rules.Exception * AvoidArgumentExceptionDefaultConstructorRule [Sebastien Pouliot] * AvoidThrowingBasicExceptionsRule [Daniel Abramov] * DoNotThrowReservedExceptionRule [Sebastien Pouliot] * ExceptionShouldBeVisibleRule [Sebastien Pouliot] * MissingExceptionConstructorsRule [Sebastien Pouliot] Gendarme.Rules.Interoperability * DoNotCastIntPtrToInt32Rule [Sebastien Pouliot] Gendarme.Rules.Maintainability (new) * AvoidComplexMethodsRule [Cedric Vivier] * AvoidDeepInheritanceTreeRule [Sebastien Pouliot] * AvoidLackOfCohesionOfMethodRule [Cedric Vivier] * ConsiderUsingStopwatchRule [Cedric Vivier] * PreferStringIsNullOrEmptyRule [Sebastien Pouliot] Gendarme.Rules.Naming * DoNotPrefixEventsWithAfterOrBeforeRule [Sebastien Pouliot] Gendarme.Rules.Performance * AvoidLargeNumberOfLocalVariablesRule [Sebastien Pouliot] * AvoidLargeStructureRule [Sebastien Pouliot] * AvoidRepetitiveCastsRule [Sebastien Pouliot] * AvoidTypeGetTypeWhenPossibleRule [Sebastien Pouliot] * AvoidUnusedPrivateFieldsRule [Sebastien Pouliot] * AvoidUnneededUnboxingRule [Sebastien Pouliot] * AvoidUnsealedUninheritedInternalClassesRule [Scott Peterson] * ImplementEqualsTypeRule [Sebastien Pouliot] * OverrideValueTypeDefaultsRule [Sebastien Pouliot] * RemoveUnusedLocalVariablesRule [Sebastien Pouliot] * UseIsOperatorRule [Seo Sanghyeon] * UseTypeEmptyTypesRule [JB Evain] Gendarme.Rules.Portability * DoNotHardcodePathsRule [Daniel Abramov] Gendarme.Rules.Serialization (new) * CallBaseMethodsOnISerializableTypesRule [Nestor Salceda] * DeserializeOptionalFieldRule [Sebastien Pouliot] * ImplementISerializableCorrectlyRule [Nestor Salceda] * MarkAllNonSerializableFieldsRule [Nestor Salceda] * MissingSerializableAttributeOnISerializableTypeRule [Sebastien Pouliot] * MissingSerializationConstructorRule [Sebastien Pouliot] * UseCorrectSignatureForSerializationMethodsRule [Sebastien Pouliot] Contributors for this release are: Andres G. Aragoneses, Cedric Vivier, Daniel Abramov, JB Evain, Nestor Salceda, Scott Peterson, Sebastien Pouliot, Seo Sanghyeon. 2008-01-31 Version 0.0.5 This time Google Highly Open Participation (GHOP) was the main source of new rules for Gendarme (Daniel Abramov, Andreas Noever, Adrian Tsai) and even a Gendarme logo (Steve P). Many thanks to all of them and to Google! Other news includes: * More rules: while GHOP added 40 rules, other contributors added 7 more rules. * Gendarme.Framework.Rocks: A new namespace, inside gendarme's framework, introduce several extensions methods to ease rule creation and avoid code duplication. * Updated rules to be more friendly toward C# 3 code (e.g. auto-implemented properties) * Enhancements to existing rules to reduce false-positives. Even with all the new rules the number of false-positives is lower than before and Gendarme's self-test looks even better! New rules by alphabetical order: Gendarme.Rules.BadPractice * CheckNewExceptionWithoutThrowingRule [Andreas Noever] * CheckNewThreadWithoutStartRule [Andreas Noever] * ConstructorShouldNotCallVirtualMethodsRule [Daniel Abramov] * GetEntryAssemblyMayReturnNullRule [Daniel Abramov] Gendarme.Rules.Concurrency * NonConstantStaticFieldsShouldNotBeVisible [Andreas Noever] Gendarme.Rules.Correctness * DontCompareWithNaNRule [Sebastien Pouliot] Gendarme.Rules.Design * AbstractTypesShouldNotHavePublicConstructorsRule [Sebastien Pouliot] * AttributeArgumentsShouldHaveAccessors [Daniel Abramov] * AvoidEmptyInterfaceRule [Sebastien Pouliot] * AvoidPropertiesWithoutGetAccessorRule [Sebastien Pouliot] * AvoidPublicInstanceFieldsRule [Adrian Tsai] * ConsiderConvertingMethodToPropertyRule [Adrian Tsai] * DisposableFieldsShouldBeDisposedRule [Andreas Noever] * DisposableTypesShouldHaveFinalizerRule [Andreas Noever] * EnsureSymmetryForOverloadedOperatorsRule [Andreas Noever] * EnumsShouldDefineAZeroValueRule [Sebastien Pouliot] * FinalizersShouldBeProtectedRule [Daniel Abramov] * FinalizersShouldCallBaseClassFinalizerRule [Daniel Abramov] * FlagsShouldNotDefineAZeroValueRule [Sebastien Pouliot] * MainShouldNotBePublicRule [Daniel Abramov] * MissingAttributeUsageOnCustomAttributeRule [Daniel Abramov] * OperatorEqualsShouldBeOverloadedRule [Andreas Noever] * OverrideEqualsMethodRule [Andreas Noever] * ProvideAlternativeNamesForOperatorOverloadsRule [Andreas Noever] * TypesShouldBeInsideNamespacesRule [Sebastien Pouliot] * TypesWithDisposableFieldsShouldBeDisposableRule [Andreas Noever] * TypesWithNativeFieldsShouldBeDisposableRule [Andreas Noever] Gendarme.Rules.Interoperability (new) * GetLastErrorMustBeCalledRightAfterPInvokeRule [Andreas Noever] * MarshalStringsInPInvokeDeclarationsRule [Daniel Abramov] * PInvokeShouldNotBeVisibleRule [Andreas Noever] * UseManagedAlternativesToPInvokeRule [Daniel Abramov] Gendarme.Rules.Naming * DoNotPrefixValuesWithEnumNameRule [Andreas Noever] * DoNotUseReservedInEnumValueNamesRule [Andreas Noever] * ParameterNamesShouldMatchOverridenMethodRule [Andreas Noever] * UseCorrectCasing [Daniel Abramov] * UseCorrectPrefixRule [Daniel Abramov] * UseCorrectSuffixRule [Daniel Abramov] * UsePreferredTermsRule [Daniel Abramov] Gendarme.Rules.Performance * AvoidReturningArraysOnPropertiesRule [Adrian Tsai] * AvoidUnsealedConcreteAttributesRule [Daniel Abramov] Gendarme.Rules.Portability * ExitCodeIsLimitedOnUnixRule [Daniel Abramov] * FeatureRequiresRootPrivilegeOnUnixRule [Andreas Noever] * MonoCompatibilityReviewRule [Andreas Noever] Gendarme.Rules.Security * ArrayFieldsShouldNotBeReadOnlyRule [Andreas Noever] * NativeFieldsShouldNotBeVisibleRule [Andreas Noever] * StaticConstructorsShouldBePrivateRule [Daniel Abramov] Gendarme.Rules.Ui * UseSTAThreadAttributeOnSWFEntryPointsRule [Daniel Abramov] 2007-12-20 Version 0.0.4 After a long time, many fixes, useful features (e.g. inclusion and exclusion) and hours trimming down false positives, we're proud to announce Gendarme 0.0.4! Many of the new rules were contributed during the Google Summer of Code 2007. Gendarme.Rules.BadPractice * CloneMethodShouldNotReturnNullRule [Nidhi Rawal] * EqualShouldHandleNullArgRule [Nidhi Rawal] * ImplementingEqualsButNotGetHashCodeAndViceVersaRule [Nidhi Rawal] * ToStringReturnsNullRule [Nidhi Rawal] Gendarme.Rules.Concurrency * WriteStaticFieldFromInstanceMethodRule [Sebastien Pouliot] Gendarme.Rules.Correcness * AvoidConstructorsInStaticTypesRule [Lukasz Knop] * CallingEqualsWithNullArgRule [Nidhi Rawal] * FloatComparisonRule [Lukasz Knop] * MethodCanBeMadeStaticRule [JB Evain] * UseValueInPropertySetterRule [Lukasz Knop] Gendarme.Rules.Design (new) * DontDeclareProtectedFieldsInSealedClassRule [Nidhi Rawal] * UsingCloneWithoutImplementingICloneableRule [Nidhi Rawal] Gendarme.Rules.Exceptions * DontSwallowErrorsCatchingNonspecificExceptionRule [Nestor Salceda] Gendarme.Rules.Naming (new) * AttributesEndsWithAttributeSuffixRule [Nestor Salceda] * DetectNonAlphaNumericsInTypeNamesRule [Nidhi Rawal] * EnumsNotEndsWIthEnumOrFlagsSuffixRule [Nestor Salceda] * UsePluralNameInEnumFlagsRule [Nestor Salceda] * UseSingularNameInEnumsUnlessAreFlagsRule [Nestor Salceda] Gendarme.Rules.Performance * AvoidToStringOnStringRule [Lukasz Knop] * AvoidUncalledPrivateCodeRule [Nidhi Rawal] * AvoidUninstantiatedInternalClassesRule [Nidhi Rawal] * AvoidUnusedParametersRule [Nestor Salceda] * DontIgnoreMethodResultRule [Lukasz Knop] Gendarme.Rules.Smells (new) * AvoidCodeDuplicatedInSameClassRule [Nestor Salceda] * AvoidCodeDuplicatedInSiblingClassesRule [Nestor Salceda] * AvoidLargeClassRule [Nestor Salceda] * AvoidLongMethodsRule [Nestor Salceda] * AvoidLongParameterListsRule [Nestor Salceda] * AvoidSpeculativeGeneralityRule [Nestor Salceda] Gendarme.Rules.Ui (new) * GtkSharpExecutableTargetRule [Sebastien Pouliot] * SystemWindowsFormsExecutableTargetRule [Sebastien Pouliot] A special thanks to Nestor Salceda for his continuing dedication to the project including a lot of "not so fun" (but so important) tasks, like merging, rule documentation & bug hunting. You rock! 2006-10-16 Version 0.0.3 * New rule for String.Empty [Sebastien Pouliot] * New XML and HTML (via XSL transform) output [Christian Birkl, Sebastien Pouliot] * Updated to latest Cecil API [JBEvain] 2006-06-19 Version 0.0.2 * Aaron Tomb added new rules for Concurrency and Correctness (based on his works in Google's Summer of Code 2005) and updated the framework; * Russell Morris added new rules for exceptions management. 2005-11-03 Version 0.0.1 * Initial version. Expect everything to change before 0.0.2 ;-) mono-tools-4.2/gendarme/tools/0000775000175000017500000000000012642235743020441 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/tools/Makefile.in0000664000175000017500000004545412642235732022520 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/tools ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in README 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = supported unsupported 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) --gnu gendarme/tools/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/tools/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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ 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-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/tools/unsupported/0000775000175000017500000000000012642235743023031 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/tools/unsupported/xmldoc2wiki/0000775000175000017500000000000012642235743025265 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/tools/unsupported/xmldoc2wiki/ChangeLog0000664000175000017500000000044112413742070027026 0ustar00directhexdirecthex000000000000002010-06-10 Sebastien Pouliot * xmldoc2wiki.csproj: New. VS.NET project file * Makefile.am: Add csproj file to the dist 2010-06-10 Sebastien Pouliot * xmldoc2wiki.cs: New. Produce mediawiki-like pages from the xmldoc of the rules. mono-tools-4.2/gendarme/tools/unsupported/xmldoc2wiki/Makefile.in0000664000175000017500000003162212642235732027334 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/tools/unsupported/xmldoc2wiki ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(xmldoc2wiki_sources) ChangeLog xmldoc2wiki.csproj xmldoc2wiki_sources = \ ../../../AssemblyStaticInfo.cs \ ../../../AssemblyInfo.cs \ xmldoc2wiki.cs 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) --gnu gendarme/tools/unsupported/xmldoc2wiki/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/tools/unsupported/xmldoc2wiki/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: ctags CTAGS: cscope cscopelist: 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: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean-am: clean-generic mostlyclean-am distclean: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile xmldoc2wiki.exe: $(xmldoc2wiki_sources) $(MCS) -debug $^ -out:$@ -r:System.Xml.Linq.dll clean: rm -f xmldoc2wiki.exe* all: xmldoc2wiki.exe # 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-tools-4.2/gendarme/tools/unsupported/xmldoc2wiki/README0000664000175000017500000000161212413742070026135 0ustar00directhexdirecthex00000000000000This tool converts xmldoc files to the Markdown files which are supported by the github's wiki. Usage: xmldoc2wiki filepattern [outputdir] filepattern: files that match this pattern will be processed. Wildcards '*' and '?' allowed. outputdir: directory, whereto output documentation files will be saved. Default value is '.' (current directory) Examples: xmldoc2wiki *Rules.xml xmldoc2wiki /home/user/mono-tools/gendarme/bin/*.xml /home/user/mono-tools/gendarme/doc xmldoc2wiki *Rules.xml doc xmldoc2wiki bin/*.xml 2-8-doc Local wiki access: a) Install gollum (https://github.com/github/gollum#readme). This requires Ruby. % gem install gollum b) Install rdiscount (http://daringfireball.net/projects/markdown/) for Markdown support % gem install rdiscount c) Install Pygments (http://pygments.org/) for syntax highlightning. This requires Python. % easy_install Pygments mono-tools-4.2/gendarme/tools/unsupported/xmldoc2wiki/Makefile.am0000664000175000017500000000047212413742070027314 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(xmldoc2wiki_sources) ChangeLog xmldoc2wiki.csproj xmldoc2wiki_sources = \ ../../../AssemblyStaticInfo.cs \ ../../../AssemblyInfo.cs \ xmldoc2wiki.cs xmldoc2wiki.exe: $(xmldoc2wiki_sources) $(MCS) -debug $^ -out:$@ -r:System.Xml.Linq.dll clean: rm -f xmldoc2wiki.exe* all: xmldoc2wiki.exe mono-tools-4.2/gendarme/tools/unsupported/xmldoc2wiki/xmldoc2wiki.cs0000664000175000017500000003072512413742070030047 0ustar00directhexdirecthex00000000000000// // Gendarme's xmldoc2wiki tool // // Authors: // Sebastien Pouliot // Yuri Stuken // // Copyright (C) 2010-2011 Novell, Inc (http://www.novell.com) // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 System.Linq; using System.Text; using System.Xml.Linq; using System.Text.RegularExpressions; static class Program { static HashSet assembliesIndex = new HashSet (); static string outputdir; static string version = "git"; static string CleanUp (this string s) { // escape special markdown characters return Regex.Replace (s, @"([\`\*])", @"\$1"); } static void AppendIndentedLine (StringBuilder sb, string line, int indentation) { for (int i = 0; i < indentation; i++) sb.Append (" "); sb.AppendLine (line); } static string ProcessCode (string code) { int indent = 0; StringBuilder sb = new StringBuilder (); StringReader reader = new StringReader (code); string line = reader.ReadLine (); while (line != null) { line = line.Trim (); if (line.EndsWith ("{")) { AppendIndentedLine (sb, line, indent++); } else if (line.EndsWith ("}")) { AppendIndentedLine (sb, line, --indent); } else { AppendIndentedLine (sb, line, indent); } line = reader.ReadLine (); } return sb.ToString (); } static string ProcessString (string s) { StringBuilder sb = new StringBuilder (s); return ProcessStringBuilder (sb); } static string ProcessStringBuilder (StringBuilder sb) { while (Char.IsWhiteSpace (sb [0])) sb.Remove (0, 1); while (Char.IsWhiteSpace (sb [sb.Length - 1])) sb.Remove (sb.Length - 1, 1); sb.Replace ("\r", String.Empty); sb.Replace ("\n", " "); // we don't start nor end with spaces for (int i = 1; i < sb.Length - 1; i++) { if (Char.IsWhiteSpace (sb [i])) { while (Char.IsWhiteSpace (sb [i + 1])) sb.Remove (i + 1, 1); } } return sb.ToString (); } static void WriteText (StringBuilder tw, string s) { // trim any space(s) at the start of the string int i = 0; while (Char.IsWhiteSpace (s [i]) && i < s.Length) i++; s = s.CleanUp (); for (; i < s.Length; i++) { char c = s [i]; if (c == '\r') continue; if (c == '\n') c = ' '; // compress spaces if (Char.IsWhiteSpace (c)) { if (i < (s.Length - 1)) { char c2 = s [i + 1]; if (Char.IsWhiteSpace (c2)) continue; } tw.Append (' '); } else { tw.Append (c); } } } static void ProcessText (StringBuilder tw, IEnumerable nodes) { bool insert_space = false; foreach (XNode node in nodes) { XText text = (node as XText); if (text != null) { string s = text.Value; if (insert_space) { if (s [0] == ' ') tw.Append (' '); insert_space = false; } WriteText (tw, s); continue; } XElement code = (node as XElement); if (code == null) continue; switch (code.Name.LocalName) { case "code": case "c": // bold tw.AppendFormat ("**{0}**", code.Value.CleanUp ()); insert_space = true; break; case "list": ProcessList (tw, code); break; default: WriteText (tw, code.ToString ()); break; } } } static void ProcessList (StringBuilder tw, XElement list) { tw.AppendLine (); foreach (XElement item in list.Elements ("item")) { tw.AppendLine (); tw.Append ("* "); XElement term = item.Element ("term"); if (term != null) { tw.Append ("**"); ProcessText (tw, term.Nodes ()); tw.Append ("** : "); } var description = item.Element ("description"); if (description != null) ProcessText (tw, description.Nodes ()); } tw.AppendLine (); tw.AppendLine (); // make sure the following text is not part of the last item on the list } static void ProcessRules (IEnumerable rules, string assembly) { SortedList properties = new SortedList (); HashSet rulesIndex = new HashSet (); foreach (var member in rules) { XElement item = member.Element ("summary"); if (item == null) continue; StringBuilder rsb = new StringBuilder (); string name = member.Attribute ("name").Value; if (name.StartsWith ("P:")) { StringBuilder sb; int pp = name.LastIndexOf ('.') + 1; int pr = name.LastIndexOf ('.', pp - 2) + 1; string property = name.Substring (pp); string rule = name.Substring (pr, pp - pr - 1); if (!properties.TryGetValue (rule, out sb)) { sb = new StringBuilder (); properties.Add (rule, sb); } else sb.AppendLine (); sb.AppendFormat ("#### {0} {1}{1}", property, Environment.NewLine); ProcessText (sb, item.Nodes ()); continue; } if (!name.StartsWith ("T:") || !name.EndsWith ("Rule")) continue; name = name.Substring (name.LastIndexOf ('.') + 1); rulesIndex.Add (name); string rule_file = String.Format ("{0}{1}{2}{1}{3}.{4}({2}).md", outputdir, Path.DirectorySeparatorChar, version, assembly, name); using (TextWriter writer = File.CreateText (rule_file)) { rsb.AppendFormat ("# {0}{1}{1}", name, Environment.NewLine); rsb.AppendFormat ("Assembly: **[[{0}|{0}({1})]]**
", assembly, version); rsb.AppendFormat ("Version: **{0}**{1}{1}", version, Environment.NewLine); rsb.AppendLine ("## Description"); // tw.WriteLine (ProcessSummary (item)); ProcessText (rsb, item.Nodes ()); rsb.AppendLine (); rsb.AppendLine (); var examples = member.Elements ("example"); if (examples != null) rsb.AppendLine ("## Examples"); foreach (XNode example in examples.Nodes ()) { XText node = (example as XText); if (node != null) { string text = example.ToString ().CleanUp ().Replace ("Bad", "**Bad**"); text = text.Replace ("Good", "**Good**"); rsb.AppendFormat ("{0}{1}{1}", text.Trim (), Environment.NewLine); continue; } XElement code = (example as XElement); if (code == null) continue; switch (code.Name.LocalName) { case "code": rsb.AppendFormat ("```csharp{1}{0}{1}```{1}{1}", ProcessCode (code.Value), Environment.NewLine); break; case "c": rsb.AppendFormat (" {0}{1}{1}", code.Value, Environment.NewLine); break; } } XElement container = member.Element ("remarks"); if (container != null) { IEnumerable remarks = container.Nodes (); if (remarks.Count () > 0) { rsb.AppendFormat ("## Notes{0}{0}", Environment.NewLine); rsb.Append ("* "); ProcessText (rsb, remarks); rsb.AppendLine (); } } StringBuilder psb; if (properties.TryGetValue (name, out psb)) { rsb.AppendFormat ("## Configuration{0}{0}", Environment.NewLine); rsb.AppendFormat ("Some elements of this rule can be customized to better fit your needs.{0}{0}", Environment.NewLine); rsb.Append (psb); rsb.AppendLine (); } writer.WriteLine (rsb); if (version == "git") { writer.WriteLine (); writer.WriteLine (@"## Source code You can browse the latest [[source code|https://github.com/mono/mono-tools/tree/master/gendarme/rules/{0}/{1}.cs]] of this rule on github.com", assembly, name); } } } var rulesList = from rule in rulesIndex orderby rule select rule; string assembly_index = String.Format ("{0}{1}{2}{1}{3}({2}).md", outputdir, Path.DirectorySeparatorChar, version, assembly); using (TextWriter writer = File.CreateText (assembly_index)) { writer.WriteLine ("# {0} Rules", assembly); writer.WriteLine (); writer.WriteLine ("The following ({0}) rules are available in version [[{1}|Gendarme.Rules({1})]] of {2}:", rulesList.Count (), version, assembly); writer.WriteLine (); foreach (var rule in rulesList) { writer.WriteLine ("* [[{0}|{1}.{0}({2})]] ", rule, assembly, version); } if (version == "git") { writer.WriteLine (); writer.WriteLine (@"## Source code You can browse the latest [[source code|https://github.com/mono/mono-tools/tree/master/gendarme/rules/{0}]] of this assembly on github.com", assembly); } writer.WriteLine (); } } static void ProcessFile (string filename) { XDocument doc = XDocument.Load (filename); IEnumerable members = from member in doc.Descendants ("member") orderby (string)member.Attribute ("name") ascending select member; string assembly = Path.GetFileName ( (from a in doc.Descendants ("assembly") select a.Element ("name").Value).FirstOrDefault ()); if (assembly == null || !assembly.StartsWith ("Gendarme")) return; assembliesIndex.Add (assembly); ProcessRules (members, assembly); } static void Main (string [] args) { string [] files; if (args.Length < 1) { Console.WriteLine ("Usage: xmldoc2wiki filepattern [--out outputdir] [--version version]"); return; } outputdir = "."; version = "git"; List filenames = new List (); for (int i = 0; i < args.Length; i++) { string arg = args [i]; switch (arg) { case "--version": version = args [++i]; break; case "--out": outputdir = args [++i]; break; default: int index = arg.LastIndexOfAny (new char [] { '/', '\\' }); string dir, pattern; if (index >= 0) { dir = arg.Substring (0, index); pattern = arg.Substring (index + 1); } else { dir = "."; pattern = arg; } files = Directory.GetFiles (dir, pattern); foreach (string file in files) { filenames.Add (file); } break; } } string subdir = Path.Combine (outputdir, version); if (!Directory.Exists (subdir)) Directory.CreateDirectory (subdir); foreach (string file in filenames) { Console.WriteLine ("processing {0}", file); ProcessFile (file); } CreateVersionIndex (); CreateFooterFile (); } static void CreateVersionIndex () { string rules_index = String.Format ("{0}{1}{2}{1}Gendarme.Rules({2}).md", outputdir, Path.DirectorySeparatorChar, version); using (TextWriter writer = File.CreateText (rules_index)) { writer.WriteLine ("# Gendarme Rules Documentation Index"); writer.WriteLine (); var assemblies = from assembly in assembliesIndex orderby assembly select assembly; writer.WriteLine ("The following ({0}) assemblies are available in version {1}:", assemblies.Count (), version); writer.WriteLine (); foreach (var assembly in assemblies) { writer.WriteLine ("* [[{0}|{0}({1})]] ", assembly, version); } if (version == "git") { writer.WriteLine (); writer.WriteLine (@"## Source code * Latest [[source code|https://github.com/mono/mono-tools/tree/master/gendarme/rules/]] for Gendarme's rules is available on github.com * Documentation is produced using gendarme's `xmldoc2wiki` (unsupported) tool which [[source code|https://github.com/mono/mono-tools/tree/master/gendarme/tools/unsupported/xmldoc2wiki]] is also available on github.com"); } writer.WriteLine (); } } static void CreateFooterFile () { string footer = String.Format ("{0}{1}{2}{1}_Footer.md", outputdir, Path.DirectorySeparatorChar, version); using (TextWriter writer = File.CreateText (footer)) { writer.WriteLine (@"## Feedback Note that this page was autogenerated ({0}) based on the `xmldoc` comments inside the rules source code and cannot be edited from this wiki. Please report any documentation errors, typos or suggestions to the [[Gendarme Google Group|http://groups.google.com/group/gendarme]]. Thanks!", DateTime.Now); } } } mono-tools-4.2/gendarme/tools/unsupported/xmldoc2wiki/xmldoc2wiki.csproj0000664000175000017500000001001512413742070030730 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {AF174688-A979-4B3C-BE21-1C1BE8A0358E} Exe Properties xmldoc2wiki xmldoc2wiki v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset 3.5 3.5 AssemblyStaticInfo.cs False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/tools/unsupported/Makefile.in0000664000175000017500000004551012642235732025101 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/tools/unsupported ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = typeref xmldoc2wiki mapper 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) --gnu gendarme/tools/unsupported/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/tools/unsupported/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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ 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-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/gendarme/tools/unsupported/mapper/0000775000175000017500000000000012642235743024315 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/tools/unsupported/mapper/fxcop.missing0000664000175000017500000002770112413742070027026 0ustar00directhexdirecthex00000000000000Microsoft.Design CA1025 Replace repetitive arguments with params array http://msdn.microsoft.com/en-us/library/ms182167.aspx CA1026 Default parameters should not be used http://msdn.microsoft.com/en-us/library/ms182135.aspx CA1033 Interface methods should be callable by child types http://msdn.microsoft.com/en-us/library/ms182153.aspx CA1046 Do not overload operator equals on reference types http://msdn.microsoft.com/en-us/library/ms182145.aspx CA1058 Types should not extend certain base types http://msdn.microsoft.com/en-us/library/ms182171.aspx CA1061 Do not hide base class methods http://msdn.microsoft.com/en-us/library/ms182143.aspx CA1063 Implement IDisposable correctly http://msdn.microsoft.com/en-us/library/ms244737.aspx CA2210 Assemblies should have valid strong names http://msdn.microsoft.com/en-us/library/ms182127.aspx Microsoft.Globalization CA1300 Specify MessageBoxOptions http://msdn.microsoft.com/en-us/library/ms182191.aspx CA1301 Avoid duplicate accelerators http://msdn.microsoft.com/en-us/library/ms182185.aspx CA1302 Do not hardcode locale specific strings http://msdn.microsoft.com/en-us/library/ms182186.aspx CA1303 Do not pass literals as localized parameters http://msdn.microsoft.com/en-us/library/ms182187.aspx CA1306 Set locale for data types http://msdn.microsoft.com/en-us/library/ms182188.aspx CA1308 Normalize strings to uppercase http://msdn.microsoft.com/en-us/library/bb386042.aspx CA1309 Use ordinal StringComparison http://msdn.microsoft.com/en-us/library/bb385972.aspx Microsoft.Maintainability CA1505 Avoid unmaintainable code http://msdn.microsoft.com/en-us/library/bb386043.aspx CA1506 Avoid excessive class coupling http://msdn.microsoft.com/en-us/library/bb397994.aspx Microsoft.Mobility CA1600 Do not use idle process priority http://msdn.microsoft.com/en-us/library/ms182219.aspx CA1601 Do not use timers that prevent power state changes http://msdn.microsoft.com/en-us/library/ms182230.aspx Microsoft.Naming CA1701 Resource string compound words should be cased correctly http://msdn.microsoft.com/en-us/library/bb264481.aspx CA1702 Compound words should be cased correctly http://msdn.microsoft.com/en-us/library/bb264474.aspx CA1703 Resource strings should be spelled correctly http://msdn.microsoft.com/en-us/library/bb264483.aspx CA1704 Identifiers should be spelled correctly http://msdn.microsoft.com/en-us/library/bb264492.aspx CA1708 Identifiers should differ by more than case http://msdn.microsoft.com/en-us/library/ms182242.aspx CA1716 Identifiers should not match keywords http://msdn.microsoft.com/en-us/library/ms182248.aspx CA1717 Only FlagsAttribute enums should have plural names http://msdn.microsoft.com/en-us/library/bb264487.aspx CA1719 Parameter names should not match member names http://msdn.microsoft.com/en-us/library/ms182252.aspx CA1720 Identifiers should not contain type names http://msdn.microsoft.com/en-us/library/bb531486.aspx CA1721 Property names should not match get methods http://msdn.microsoft.com/en-us/library/ms182253.aspx Microsoft.Performance CA1810 Initialize reference type static fields inline http://msdn.microsoft.com/en-us/library/ms182275.aspx CA1814 Prefer jagged arrays over multidimensional http://msdn.microsoft.com/en-us/library/ms182277.aspx CA1824 Mark assemblies with NeutralResourcesLanguageAttribute http://msdn.microsoft.com/en-us/library/bb385967.aspx Microsoft.Portability CA1900 Value type fields should be portable http://msdn.microsoft.com/en-us/library/ms182285.aspx CA1903 Use only API from targeted framework http://msdn.microsoft.com/en-us/library/cc667408.aspx Microsoft.Reliability CA2003 Do not treat fibers as threads http://msdn.microsoft.com/en-us/library/ms182291.aspx Microsoft.Security CA2100 Review SQL queries for security vulnerabilities http://msdn.microsoft.com/en-us/library/ms182310.aspx CA2103 Review imperative security http://msdn.microsoft.com/en-us/library/ms182309.aspx CA2104 Do not declare read only mutable reference types http://msdn.microsoft.com/en-us/library/ms182302.aspx CA2106 Secure asserts http://msdn.microsoft.com/en-us/library/ms182314.aspx CA2107 Review deny and permit only usage http://msdn.microsoft.com/en-us/library/ms182308.aspx CA2108 Review declarative security on value types http://msdn.microsoft.com/en-us/library/ms182307.aspx CA2109 Review visible event handlers http://msdn.microsoft.com/en-us/library/ms182312.aspx CA2116 APTCA methods should only call APTCA methods http://msdn.microsoft.com/en-us/library/ms182297.aspx CA2117 APTCA types should only extend APTCA base types http://msdn.microsoft.com/en-us/library/ms182298.aspx CA2119 Seal methods that satisfy private interfaces http://msdn.microsoft.com/en-us/library/ms182313.aspx CA2120 Secure serialization constructors http://msdn.microsoft.com/en-us/library/ms182317.aspx CA2123 Override link demands should be identical to base http://msdn.microsoft.com/en-us/library/ms182305.aspx CA2124 Wrap vulnerable finally clauses in outer try http://msdn.microsoft.com/en-us/library/ms182322.aspx CA2136 Members should not have conflicting transparency annotations http://msdn.microsoft.com/en-us/library/bb264493.aspx CA2147 Transparent methods may not use security asserts http://msdn.microsoft.com/en-us/library/bb264482.aspx CA2140 Transparent code must not reference security critical items http://msdn.microsoft.com/en-us/library/bb264475.aspx CA2130 Security critical constants should be transparent http://msdn.microsoft.com/en-us/library/dd997446.aspx CA2131 Security critical types may not participate in type equivalence http://msdn.microsoft.com/en-us/library/dd997564.aspx CA2132 Default constructors must be at least as critical as base type default constructors http://msdn.microsoft.com/en-us/library/dd983956.aspx CA2133 Delegates must bind to methods with consistent transparency http://msdn.microsoft.com/en-us/library/dd997710.aspx CA2134 Methods must keep consistent transparency when overriding base methods http://msdn.microsoft.com/en-us/library/dd997447.aspx CA2135 Level 2 assemblies should not contain LinkDemands http://msdn.microsoft.com/en-us/library/dd997569.aspx CA2136 Members should not have conflicting transparency annotations http://msdn.microsoft.com/en-us/library/bb264493.aspx CA2137 Transparent methods must contain only verifiable IL http://msdn.microsoft.com/en-us/library/dd983954.aspx CA2138 Transparent methods must not call methods with the SuppressUnmanagedCodeSecurity attribute http://msdn.microsoft.com/en-us/library/dd997711.aspx CA2139 Transparent methods may not use the HandleProcessCorruptingExceptions attribute http://msdn.microsoft.com/en-us/library/dd997565.aspx CA2140 Transparent code must not reference security critical items http://msdn.microsoft.com/en-us/library/bb264475.aspx CA2142 Transparent code should not be protected with LinkDemands http://msdn.microsoft.com/en-us/library/dd997567.aspx CA2143 Transparent methods should not use security demands http://msdn.microsoft.com/en-us/library/dd997566.aspx CA2144 Transparent code should not load assemblies from byte arrays http://msdn.microsoft.com/en-us/library/dd997568.aspx CA2145 Transparent methods should not be decorated with the SuppressUnmanagedCodeSecurityAttribute http://msdn.microsoft.com/en-us/library/dd997570.aspx CA2146 Types must be at least as critical as their base types and interfaces http://msdn.microsoft.com/en-us/library/dd997443.aspx CA2147 Transparent methods may not use security asserts http://msdn.microsoft.com/en-us/library/bb264482.aspx CA2149 Transparent methods must not call into native code http://msdn.microsoft.com/en-us/library/ee155709.aspx Microsoft.Usage CA2202 Do not dispose objects multiple times http://msdn.microsoft.com/en-us/library/ms182334.aspx CA2204 Literals should be spelled correctly http://msdn.microsoft.com/en-us/library/bb264488.aspx CA2207 Initialize value type static fields inline http://msdn.microsoft.com/en-us/library/ms182346.aspx CA2212 Do not mark serviced components with WebMethod http://msdn.microsoft.com/en-us/library/ms182336.aspx CA2215 Dispose methods should call base class dispose http://msdn.microsoft.com/en-us/library/ms182330.aspx CA2217 Do not mark enums with FlagsAttribute http://msdn.microsoft.com/en-us/library/ms182335.aspx CA2223 Members should differ by more than return type http://msdn.microsoft.com/en-us/library/ms182352.aspx CA2228 Do not ship unreleased resource formats http://msdn.microsoft.com/en-us/library/ms182339.aspx CA2233 Operations should not overflow http://msdn.microsoft.com/en-us/library/ms182354.aspx mono-tools-4.2/gendarme/tools/unsupported/mapper/Makefile.in0000664000175000017500000003156112642235732026366 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/tools/unsupported/mapper ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(mapper_sources) fxcop.missing mapper_sources = \ ../../../AssemblyStaticInfo.cs \ ../../../AssemblyInfo.cs \ FxCopMapBuilder.cs \ FxCopRule.cs 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) --gnu gendarme/tools/unsupported/mapper/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/tools/unsupported/mapper/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: ctags CTAGS: cscope cscopelist: 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: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean-am: clean-generic mostlyclean-am distclean: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile mapper.exe: $(mapper_sources) $(MCS) -debug $^ -out:$@ -r:System.Xml.Linq.dll -r:$(CECIL_ASM) clean: rm -f mapper.exe* all: mapper.exe # 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-tools-4.2/gendarme/tools/unsupported/mapper/README0000664000175000017500000000232412413742070025166 0ustar00directhexdirecthex00000000000000This tool generates two XML files which contain map from FxCop/Gendarme rules to the Gendarme/FxCop rules. Usage: fxcopmapbuilder [dirname] [/target] [fxcopmapfile] [gendarmemapfile] [/I] dirname is a name of a directory which contains Gendarme.Rules.*.dll files. Default value is '.' (current directory) target argument specifies output file format: either "xml" or "wiki". If not specified, xml is used. fxcopmapfile is a name of an output file for a FxCop -> Gendarme map. Default value is FxCopToGendarme (extension is added depending on output file format). gendarmemapfile is a name of an output file for a Gendarme -> FxCop map. Default value is GendarmeToFxCop (extension is added depending on output file format). /I is a flag, setting this will include Gendarme rules which were not mapped with any FxCop rules to the second output file (gendarmemapfile) Examples: fxcopmapbuilder fxcopmapbuilder gendarme /target:xml out1.xml out2.xml fxcopmapbuilder "C:\gendarme" /target:xml fxCopToGendarme.xml gendarmeToFxCop.xml /I fxcopmapbuilder gendarme /target:wiki Notes: You can add header and footer to the output wiki files using cat command. Example: cat header FxCopToGendarme.md footer > FxCopToGendarme.md mono-tools-4.2/gendarme/tools/unsupported/mapper/FxCopRule.cs0000664000175000017500000000467612413742070026520 0ustar00directhexdirecthex00000000000000// // FxCopRule.cs // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 FxCopMapBuilder { sealed class FxCopRule : IEquatable { public string Category { get; internal set; } public string Id { get; internal set; } public string Name { get; internal set; } public FxCopRule (string category, string id) { Category = category; // Splits a string like CA1034:NestedTypesShouldNotBeVisible to // the Id (CA1034) and Name (NestedTypesShouldNotBeVisible) if (id.Contains(".")) { string [] ruleInfo = id.Split (':'); Id = ruleInfo [0]; Name = ruleInfo [1]; } else { Id = id; } } public override string ToString () { string returnValue = Category + "." + Id; if (!String.IsNullOrEmpty (Name)) returnValue += ":" + Name; return returnValue; } public override bool Equals (object obj) { FxCopRule rule = obj as FxCopRule; return Equals (rule); } public bool Equals (FxCopRule other) { bool isEqual = (Category == other.Category) && (Id == other.Id); // sets the rule name from another reference to the same rule if (isEqual && String.IsNullOrEmpty (Name) && !String.IsNullOrEmpty (other.Name)) Name = other.Name; return isEqual; } public override int GetHashCode () { return Category.GetHashCode () ^ Id.GetHashCode (); } } } mono-tools-4.2/gendarme/tools/unsupported/mapper/FxCopMapBuilder.cs0000664000175000017500000002015612413742070027624 0ustar00directhexdirecthex00000000000000// // FxCopMapBuilder.cs // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Reflection; using System.Runtime.InteropServices; using System.Xml.Linq; using System.Linq; using Mono.Cecil; using System.Text; namespace FxCopMapBuilder { static class FxCopMapBuilder { static Dictionary> FxCopToGendarme = new Dictionary> (); static Dictionary> GendarmeToFxCop = new Dictionary> (); static void Main (string [] args) { string dirname = ".", fxCopFile = "FxCopToGendarme", gendarmeFile = "GendarmeToFxCop"; bool error = false, include = false, xmloutput = true; try { dirname = args [0]; xmloutput = !(args [1] == "/target:wiki"); fxCopFile = args [2]; gendarmeFile = args [3]; include = (args [4] == "/I"); } catch (IndexOutOfRangeException e) { // nothing to do } string ext = (xmloutput) ? "xml" : "md"; fxCopFile = Path.ChangeExtension (fxCopFile, ext); gendarmeFile = Path.ChangeExtension (gendarmeFile, ext); if (!Directory.Exists (dirname)) error = true; if (error) { Console.WriteLine ("Usage: fxcopmapbuilder [dirname] [/target:wiki] [fxcopmapfile] [gendarmemapfile] [/I]"); Console.WriteLine (); Console.WriteLine ("\t/I\tIncludes Gendarme rules which were not mapped to any of FxCop rules to the output"); } else { BuildMap (dirname, include); BuildXml (fxCopFile, gendarmeFile, xmloutput); } } private static void BuildMap (string dirname, bool include) { string [] files = Directory.GetFiles (dirname, Path.GetFileName ("Gendarme.Rules.*.dll")); if (files.Length == 0) Console.WriteLine ("Unable to find any matching assemblies in a specified directory"); foreach (string file in files) { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (file); foreach (TypeDefinition type in assembly.MainModule.Types) { // we do not need to proceed with such types if (!type.HasCustomAttributes || type.IsAbstract || type.IsInterface) continue; // check if Gendarme.Framework.Rule exists in inheritance chain // checks only for two levels, is there something like isSubclassOf? if (type.BaseType == null || (type.BaseType.FullName != "Gendarme.Framework.Rule")) { TypeDefinition t = type.BaseType.Resolve (); if (t.BaseType == null || (t.BaseType.FullName != "Gendarme.Framework.Rule")) continue; } foreach (var attribute in type.CustomAttributes) { if (attribute.AttributeType.FullName != "Gendarme.Framework.FxCopCompatibilityAttribute") continue; if (!attribute.HasConstructorArguments) continue; FxCopRule rule = new FxCopRule ( attribute.ConstructorArguments [0].Value.ToString (), attribute.ConstructorArguments [1].Value.ToString ()); if (FxCopToGendarme.ContainsKey (rule)) FxCopToGendarme [rule].Add (type.FullName); else FxCopToGendarme.Add (rule, new List { type.FullName }); if (GendarmeToFxCop.ContainsKey (type.FullName)) GendarmeToFxCop [type.FullName].Add (rule); else GendarmeToFxCop.Add (type.FullName, new List { rule }); } // add gendarme rule to the dictionary even if it // was not mapped with any fxcop rule if (include && !GendarmeToFxCop.ContainsKey (type.FullName)) GendarmeToFxCop.Add (type.FullName, new List ()); } } } private static void BuildXml (string fxCopToGendarmeFilename, string gendarmeToFxCopFilename, bool xmloutput) { // Writing FxCop to Gendarme rules map XElement root = new XElement ("rules"); foreach (var pair in FxCopToGendarme) { XElement rule = new XElement ("rule", new XAttribute ("type", "fxcop"), new XAttribute ("category", pair.Key.Category), new XAttribute ("id", (!String.IsNullOrEmpty (pair.Key.Name)) ? pair.Key.Id + ":" + pair.Key.Name : pair.Key.Id)); foreach (var grule in pair.Value) { string category = grule.Substring (0, grule.LastIndexOf ('.')); string id = grule.Substring (grule.LastIndexOf ('.') + 1); rule.Add (new XElement ("rule", new XAttribute ("type", "gendarme"), new XAttribute ("category", category), new XAttribute ("id", id))); } root.Add (rule); } SortXml (root); if (xmloutput) new XDocument (root).Save (fxCopToGendarmeFilename); else using (StreamWriter output = new StreamWriter (fxCopToGendarmeFilename)) output.Write (BuildWikiTextFromXml(root)); // Writing Gendarme to FxCop rules map root = new XElement ("rules"); foreach (var pair in GendarmeToFxCop) { string category = pair.Key.Substring (0, pair.Key.LastIndexOf ('.')); string id = pair.Key.Substring (pair.Key.LastIndexOf ('.') + 1); XElement rule = new XElement ("rule", new XAttribute ("type", "gendarme"), new XAttribute ("category", category), new XAttribute ("id", id)); foreach (var fxcrule in pair.Value) { rule.Add (new XElement ("rule", new XAttribute ("type", "fxcop"), new XAttribute ("category", fxcrule.Category), new XAttribute ("id", (!String.IsNullOrEmpty (fxcrule.Name)) ? fxcrule.Id + ":" + fxcrule.Name : fxcrule.Id))); } root.Add (rule); } SortXml (root); if (xmloutput) new XDocument (root).Save (gendarmeToFxCopFilename); else using (StreamWriter output = new StreamWriter (gendarmeToFxCopFilename)) output.Write (BuildWikiTextFromXml (root)); } private static XElement SortXml (XElement node) { node.ReplaceNodes ( from element in node.Elements () orderby element.Attribute ("category").Value, element.Attribute ("id").Value select SortXml(element)); return node; } private static StringBuilder BuildWikiTextFromXml (XElement rootNode) { StringBuilder sb = new StringBuilder (); string category = String.Empty; foreach (var element in rootNode.Elements ()) { if (element.Attribute ("category").Value != category) { category = element.Attribute ("category").Value; sb.AppendLine(String.Format("## {0}", category)); } sb.AppendLine (String.Format ("### {0}", BuildWikiLink(element))); foreach (var rule in element.Elements ()) sb.AppendLine(String.Format("* {0}", BuildWikiLink(rule))); sb.AppendLine (); } return sb; } private static string BuildWikiLink (XElement rule) { if (rule.Attribute ("type").Value == "fxcop") { string [] idName = rule.Attribute ("id").Value.Split (':'); return String.Format ( "[[{0}: {1}|http://social.msdn.microsoft.com/Search/en-US?query={2} {0} {1}]]", idName [0], idName [1], rule.Attribute ("category").Value); } if (rule.Attribute ("type").Value == "gendarme") { return String.Format ("[[{1}|{0}.{1}{2}]]", rule.Attribute ("category").Value, rule.Attribute ("id").Value, "(2.10)"); } return String.Empty; } } } mono-tools-4.2/gendarme/tools/unsupported/mapper/Makefile.am0000664000175000017500000000046212413742070026343 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(mapper_sources) fxcop.missing mapper_sources = \ ../../../AssemblyStaticInfo.cs \ ../../../AssemblyInfo.cs \ FxCopMapBuilder.cs \ FxCopRule.cs mapper.exe: $(mapper_sources) $(MCS) -debug $^ -out:$@ -r:System.Xml.Linq.dll -r:$(CECIL_ASM) clean: rm -f mapper.exe* all: mapper.exe mono-tools-4.2/gendarme/tools/unsupported/typeref/0000775000175000017500000000000012642235743024507 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/tools/unsupported/typeref/typeref.cs0000664000175000017500000000226712413742070026513 0ustar00directhexdirecthex00000000000000using System; using System.Collections.Generic; using System.Linq; using System.Text; using Mono.Cecil; namespace Gendarme.Tools { class TypeRef { static List Assemblies = new List (); static List TypeNames = new List (); static void Main (string [] args) { TypeNames.AddRange (args [0].Split (',')); for (int i = 1; i < args.Length; i++) { Assemblies.Add (AssemblyDefinition.ReadAssembly (args [i])); } if (TypeNames.Count == 1) { Console.WriteLine ("Looking for type: {0}", TypeNames [0]); } else { Console.WriteLine ("Looking for types:"); foreach (string name in TypeNames) Console.WriteLine ("\t{0}", name); } Console.WriteLine (); int inside = 0; int total = 0; foreach (AssemblyDefinition assembly in Assemblies) { foreach (ModuleDefinition module in assembly.Modules) { bool all = TypeNames.All (name => (module.HasTypeReference (name))); if (all) inside++; total++; Console.WriteLine ("{0} : {1}", all ? "[YES]" : "[no] ", assembly.Name.FullName); } } Console.WriteLine ("TOTAL : {0} out of {1} assemblies", inside, total); } } } mono-tools-4.2/gendarme/tools/unsupported/typeref/ChangeLog0000664000175000017500000000057212413742070026255 0ustar00directhexdirecthex000000000000002010-06-10 Sebastien Pouliot * typeref.csproj: New. VS.NET project file * Makefile.am: Add csproj file to the dist 2010-06-10 Sebastien Pouliot * typeref.cs: New. Quick tool to look for type references inside assemblies. Useful to add "turn off" optimizations to rules when it is known to be impossible to find defects mono-tools-4.2/gendarme/tools/unsupported/typeref/typeref.csproj0000664000175000017500000001007712413742070027404 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {2262381F-297D-4AC7-8509-91DBF2429EB9} Exe Properties typeref typeref v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/tools/unsupported/typeref/Makefile.in0000664000175000017500000003153112642235732026555 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/tools/unsupported/typeref ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(typeref_sources) ChangeLog typeref.csproj typeref_sources = \ ../../../AssemblyStaticInfo.cs \ ../../../AssemblyInfo.cs \ typeref.cs 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) --gnu gendarme/tools/unsupported/typeref/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/tools/unsupported/typeref/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: ctags CTAGS: cscope cscopelist: 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: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean-am: clean-generic mostlyclean-am distclean: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile typeref.exe: $(typeref_sources) $(MCS) -debug $^ -out:$@ -r:$(CECIL_ASM) clean: rm -f typeref.exe* all: typeref.exe # 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-tools-4.2/gendarme/tools/unsupported/typeref/Makefile.am0000664000175000017500000000042412413742070026533 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(typeref_sources) ChangeLog typeref.csproj typeref_sources = \ ../../../AssemblyStaticInfo.cs \ ../../../AssemblyInfo.cs \ typeref.cs typeref.exe: $(typeref_sources) $(MCS) -debug $^ -out:$@ -r:$(CECIL_ASM) clean: rm -f typeref.exe* all: typeref.exe mono-tools-4.2/gendarme/tools/unsupported/Makefile.am0000664000175000017500000000004612413742070025055 0ustar00directhexdirecthex00000000000000SUBDIRS = typeref xmldoc2wiki mapper mono-tools-4.2/gendarme/tools/README0000664000175000017500000000043412413742070021312 0ustar00directhexdirecthex00000000000000Extra tools for Gendarme The source repository contains two kind of tools. * Supported tools: packaged with Gendarme, they are meant to be useful to Gendarme users. * Unsupported tools: not packaged with Gendarme, they are meant to be useful for contributors or the maintainer. mono-tools-4.2/gendarme/tools/Makefile.am0000664000175000017500000000004712413742070022466 0ustar00directhexdirecthex00000000000000SUBDIRS = supported unsupported all: mono-tools-4.2/gendarme/tools/supported/0000775000175000017500000000000012642235743022466 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/tools/supported/Makefile.in0000664000175000017500000004546612642235732024550 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/tools/supported ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = gd2i templates 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) --gnu gendarme/tools/supported/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/tools/supported/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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ 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-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/gendarme/tools/supported/gd2i/0000775000175000017500000000000012642235743023313 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/tools/supported/gd2i/ChangeLog0000664000175000017500000000101312413742070025050 0ustar00directhexdirecthex000000000000002010-06-13 Sebastien Pouliot * gd2i.cs: Remove extra "R: " on rules * Makefile.am: Fix self-update 2010-06-10 Sebastien Pouliot * Makefile.am: Include project file in dist 2010-06-07 Sebastien Pouliot * gd2i.cs: New. A bit crude but functional tool to convert an XML file with defects into ignore entries * self-test.ignore: Defects to be ignored on this tool * Makefile.am: Build, clean, update Gendarme's ignore file and self-test mono-tools-4.2/gendarme/tools/supported/gd2i/Makefile.in0000664000175000017500000004043312642235732025362 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/tools/supported/gd2i ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(gd2idir)" SCRIPTS = $(gd2i_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(gd2i_sources) gd2i.csproj gd2idir = $(prefix)/lib/gendarme gd2i_SCRIPTS = ../../../bin/gd2i.exe CLEANFILES = $(gd2i_SCRIPTS) $(gd2i_SCRIPTS).mdb DISTCLEANFILES = Makefile.in gd2i_sources = \ ../../../AssemblyStaticInfo.cs \ ../../../AssemblyInfo.cs \ ../../../console/Options.cs \ gd2i.cs 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) --gnu gendarme/tools/supported/gd2i/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/tools/supported/gd2i/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): install-gd2iSCRIPTS: $(gd2i_SCRIPTS) @$(NORMAL_INSTALL) @list='$(gd2i_SCRIPTS)'; test -n "$(gd2idir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(gd2idir)'"; \ $(MKDIR_P) "$(DESTDIR)$(gd2idir)" || 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)$(gd2idir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(gd2idir)$$dir" || exit $$?; \ } \ ; done uninstall-gd2iSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(gd2i_SCRIPTS)'; test -n "$(gd2idir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(gd2idir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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) installdirs: for dir in "$(DESTDIR)$(gd2idir)"; 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-gd2iSCRIPTS 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: uninstall-gd2iSCRIPTS .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-gd2iSCRIPTS 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 tags-am uninstall \ uninstall-am uninstall-gd2iSCRIPTS .PRECIOUS: Makefile $(gd2i_SCRIPTS): $(gd2i_sources) $(MCS) -d:CODE_ANALYSIS -debug $^ -out:$@ update: $(gd2i_SCRIPTS) mono --debug $(gd2i_SCRIPTS) ../../../bin/self-test.xml ../../../self-test.ignore self-test: all mono --debug ../../../bin/gendarme.exe --config ../../../rules/rules.xml --set self-test --xml self-test.xml --html self-test.html \ --ignore=../../../mono-options.ignore --severity=all --confidence=all $(gd2i_SCRIPTS) clean: rm -f $(CLEANFILES) self-test.xml self-test.html all: $(gd2i_SCRIPTS) # 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-tools-4.2/gendarme/tools/supported/gd2i/gd2i.cs0000664000175000017500000002175612413742070024472 0ustar00directhexdirecthex00000000000000// // gd2i - Gendarme's Defects To Ignore List // // Authors: // Sebastien Pouliot // // Copyright (C) 2010-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.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Reflection; using System.Text; using System.Xml; using NDesk.Options; namespace Gendarme.Tools { [SuppressMessage ("Gendarme.Rules.Maintainability", "AvoidLackOfCohesionOfMethodsRule", Justification = "kiss")] sealed class DefectsToIgnoreList { Dictionary> entries = new Dictionary> (); [SuppressMessage ("Gendarme.Rules.Smells", "AvoidSwitchStatementsRule", Justification = "kiss")] [SuppressMessage ("Gendarme.Rules.Performance", "AvoidRepetitiveCallsToPropertiesRule", Justification = "reader.Name and Has Attributes are called very often (on purpose) inside loops")] void ReadDefects (string filename) { using (XmlTextReader reader = new XmlTextReader (filename)) { Dictionary full_names = new Dictionary (); // look for 'gendarme-output/rules/rule/' while (reader.Read () && (reader.Name != "rule")); do { full_names.Add (reader ["Uri"], "R: " + reader.ReadInnerXml ()); } while (reader.Read () && reader.HasAttributes); // look for 'gendarme-output/results/ while (reader.Read () && (reader.Name != "results")); HashSet targets = null; while (reader.Read ()) { if (!reader.HasAttributes) continue; switch (reader.Name) { case "rule": targets = new HashSet (); entries.Add (full_names [reader ["Uri"]], targets); break; case "target": string target = reader ["Name"]; if (target.IndexOf (' ') != -1) { targets.Add ((IsTargetAssembly (target) ? "A: " : "M: ") + target); } else { targets.Add ((IsAllAssembly (reader ["Assembly"]) ? "N: " : "T: ") + target); } break; } } } } static bool IsTargetAssembly (string target) { return (target.Contains (", Version=") && target.Contains (", Culture") && target.Contains (", PublicKeyToken=")); } static bool IsAllAssembly (string assembly) { return (assembly == "[across all assemblies analyzed]"); } [SuppressMessage ("Gendarme.Rules.Smells", "AvoidSwitchStatementsRule", Justification = "kiss")] void ReadIgnoreList (string filename) { HashSet entries_for_rule = null; int line_no = 0; string rule = String.Empty; using (StreamReader sr = new StreamReader (filename)) { while (!sr.EndOfStream) { string line = sr.ReadLine (); line_no++; if (String.IsNullOrEmpty (line)) continue; char type = line [0]; switch (type) { case 'R': // rule rule = line.Trim (); if (!entries.TryGetValue (rule, out entries_for_rule)) { entries_for_rule = new HashSet (); entries.Add (rule, entries_for_rule); } break; case '#': // comment - ignore break; case 'A': case 'T': case 'M': case 'N': if (rule.Length == 0) { if (syntax_errors_warnings) { Console.Error.WriteLine ("line #{0}: Entry '{1}' has no rule previously defined.", line_no, line); } break; } string metadata = line.Trim (); // metadata - remove from list if (!entries_for_rule.Remove (metadata) && extra_defects_warnings) { Console.Error.WriteLine ("line #{0}: Entry '{1}' for rule {2}' was not reported as a defect.", line_no, line, rule); } break; default: // unknown - report if warn is true if (syntax_errors_warnings) { Console.Error.WriteLine ("line #{0}: Invalid syntax for '{0}'.", line_no, line); } break; } } } } string BuildIgnoreData () { if (entries.Count == 0) return String.Empty; StringBuilder ignore_data = new StringBuilder (); foreach (KeyValuePair> entry in entries) { if (entry.Value.Count == 0) continue; ignore_data.AppendLine (entry.Key); foreach (string metadata in entry.Value) { ignore_data.AppendLine (metadata); } ignore_data.AppendLine (); } return ignore_data.ToString (); } void WriteIgnoreList (string filename) { string data = BuildIgnoreData (); if (data.Length == 0) return; using (StreamWriter sw = File.CreateText (filename)) { sw.Write (data); } } void AppendToIgnoreList (string filename) { string data = BuildIgnoreData (); if (data.Length == 0) return; using (StreamWriter sw = File.AppendText (filename)) { sw.WriteLine ("# begin extra entries generated from defects (added on {0})", DateTime.Now); sw.WriteLine (); sw.Write (data); sw.WriteLine ("# end extra entries generated from defects"); } } bool extra_defects_warnings; bool syntax_errors_warnings; bool help; bool version; bool quiet; string defects; string ignores; static void Header () { Assembly a = Assembly.GetExecutingAssembly (); Version v = a.GetName ().Version; if (v.ToString () != "0.0.0.0") { Console.WriteLine ("gd2i v{0}", v); } else { Console.WriteLine ("gd2i - Development Snapshot"); } object [] attr = a.GetCustomAttributes (typeof (AssemblyCopyrightAttribute), false); if (attr.Length > 0) Console.WriteLine (((AssemblyCopyrightAttribute) attr [0]).Copyright); Console.WriteLine (); } static void Help () { Console.WriteLine ("Usage: gd2i defects.xml list.ignore [--extra-defects-warnings] [--syntax-check] [--quiet] [--version] [--help]"); Console.WriteLine ("Where"); Console.WriteLine (" defects.xml\tThe list of defects (XML) produced by Gendarme on your project."); Console.WriteLine (" list.ignore\tThe file listing ignored defects entries for your project."); Console.WriteLine (" --extra-check\t[optional] Report ignore entries not in the defect list."); Console.WriteLine (" --syntax-check\t[optional] Report syntax error found in 'list.ignore' file."); Console.WriteLine (" --quiet\t[optional] Minimize output tro stdout."); Console.WriteLine (" --version\tDisplay the tool's version number."); Console.WriteLine (" --help\t\tShow help about the command-line options."); Console.WriteLine (); } byte Parse (string [] args) { var p = new OptionSet () { { "syntax-check", v => syntax_errors_warnings = v != null }, { "extra-check", v => extra_defects_warnings = v != null }, { "quiet", v => quiet = v != null }, { "version", v => version = v != null }, { "h|?|help", v => help = v != null }, }; List files = p.Parse (args); if (files.Count != 2) return (byte) 1; defects = files [0]; ignores = files [1]; return (byte) 0; } [SuppressMessage ("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "single reporting point for all failures inside the tool")] byte Execute (string [] args) { byte result = 1; try { result = Parse (args); bool parsed = (result == 0); if (!quiet || !parsed) Header (); if (!parsed) { Console.WriteLine ("Invalid command-line parameters"); Console.WriteLine (); } if (help || !parsed) Help (); if (parsed && !help && !version) { // read defects XML file and build an ignore list from it ReadDefects (defects); if (File.Exists (ignores)) { // read existing 'ignore-list' and remove them from the ignore list ReadIgnoreList (ignores); // don't touch the original (sort, comment...) but append new ignore entries AppendToIgnoreList (ignores); } else { WriteIgnoreList (ignores); } } } catch (Exception e) { Console.WriteLine ("Unhandled exception caught: {0}", e); result = 2; } return result; } static int Main (string [] args) { return new DefectsToIgnoreList ().Execute (args); } } } mono-tools-4.2/gendarme/tools/supported/gd2i/gd2i.csproj0000664000175000017500000000775712413742070025372 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {627AA224-D043-4CF4-A783-72546E6ACFDD} Exe Properties gd2i gd2i v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ TRACE;DEBUG;CODE_ANALYSIS prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset 3.5 AssemblyStaticInfo.cs Options.cs False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/tools/supported/gd2i/Makefile.am0000664000175000017500000000145612413742070025345 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(gd2i_sources) gd2i.csproj gd2idir=$(prefix)/lib/gendarme gd2i_SCRIPTS = ../../../bin/gd2i.exe CLEANFILES = $(gd2i_SCRIPTS) $(gd2i_SCRIPTS).mdb DISTCLEANFILES = Makefile.in gd2i_sources = \ ../../../AssemblyStaticInfo.cs \ ../../../AssemblyInfo.cs \ ../../../console/Options.cs \ gd2i.cs $(gd2i_SCRIPTS): $(gd2i_sources) $(MCS) -d:CODE_ANALYSIS -debug $^ -out:$@ update: $(gd2i_SCRIPTS) mono --debug $(gd2i_SCRIPTS) ../../../bin/self-test.xml ../../../self-test.ignore self-test: all mono --debug ../../../bin/gendarme.exe --config ../../../rules/rules.xml --set self-test --xml self-test.xml --html self-test.html \ --ignore=../../../mono-options.ignore --severity=all --confidence=all $(gd2i_SCRIPTS) clean: rm -f $(CLEANFILES) self-test.xml self-test.html all: $(gd2i_SCRIPTS) mono-tools-4.2/gendarme/tools/supported/templates/0000775000175000017500000000000012642235743024464 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/tools/supported/templates/MethodRule.vstemplate0000664000175000017500000000153412413742070030635 0ustar00directhexdirecthex00000000000000 Method Rule.cs Method Rule A gendarme rule that checks a method. CSharp 10 __TemplateIcon.ico Mono.Cecil Gendarme.Framework System.Core MethodRule.cs mono-tools-4.2/gendarme/tools/supported/templates/TypeRule.vstemplate0000664000175000017500000000152412413742070030335 0ustar00directhexdirecthex00000000000000 Type Rule.cs Type Rule A gendarme rule that checks a type. CSharp 10 __TemplateIcon.ico Mono.Cecil Gendarme.Framework System.Core TypeRule.cs mono-tools-4.2/gendarme/tools/supported/templates/MethodTest.vstemplate0000664000175000017500000000167012413742070030646 0ustar00directhexdirecthex00000000000000 Method Rule Test.cs Method Rule Test A unit test for a gendarme method rule. CSharp 10 __TemplateIcon.ico Mono.Cecil Gendarme.Framework Test.Rules System.Core MethodTest.cs mono-tools-4.2/gendarme/tools/supported/templates/Makefile.in0000664000175000017500000004044312642235732026534 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/tools/supported/templates ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = README README.vsnet \ AssemblyRule.cs AssemblyRule.vstemplate \ AssemblyTest.cs AssemblyTest.vstemplate \ TypeRule.cs TypeRule.vstemplate \ TypeTest.cs TypeTest.vstemplate \ MethodRule.cs MethodRule.vstemplate \ MethodTest.cs MethodTest.vstemplate \ Templates.RuleProject.csproj Templates.RuleProject.vstemplate \ Templates.TestProject.csproj Templates.TestProject.vstemplate GENDARME_ICON = ../../../swf-wizard-runner/Resources/gendarme.ico 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) --gnu gendarme/tools/supported/templates/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/tools/supported/templates/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: ctags CTAGS: cscope cscopelist: 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: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean-am: clean-generic mostlyclean-am distclean: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile vsnet-item-assembly-rule: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp AssemblyRule.cs temp/AssemblyRule.cs cp AssemblyRule.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Assembly Rule.zip" temp/* rm -rf temp/* vsnet-item-assembly-test: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp AssemblyTest.cs temp/AssemblyTest.cs cp AssemblyTest.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Assembly Rule Test.zip" temp/* rm -rf temp/* vsnet-item-method-rule: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp MethodRule.cs temp/MethodRule.cs cp MethodRule.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Method Rule.zip" temp/* rm -rf temp/* vsnet-item-method-test: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp MethodTest.cs temp/MethodTest.cs cp MethodTest.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Method Rule Test.zip" temp/* rm -rf temp/* vsnet-item-type-rule: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp TypeRule.cs temp/TypeRule.cs cp TypeRule.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Type Rule.zip" temp/* rm -rf temp/* vsnet-item-type-test: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp TypeTest.cs temp/TypeTest.cs cp TypeTest.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Type Rule Test.zip" temp/* rm -rf temp/* vsnet-item-templates: vsnet-item-assembly-rule vsnet-item-assembly-test \ vsnet-item-method-rule vsnet-item-method-test \ vsnet-item-type-rule vsnet-item-type-test vsnet-project-rules: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp Templates.RuleProject.csproj temp/Templates.RuleProject.csproj cp Templates.RuleProject.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ProjectTemplates\Visual C#\Gendarme Projects\Rule Assembly.zip" temp/* rm -rf temp/* vsnet-project-tests: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp Templates.TestProject.csproj temp/Templates.TestProject.csproj cp Templates.TestProject.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ProjectTemplates\Visual C#\Gendarme Projects\Rule Test Assembly.zip" temp/* rm -rf temp/* vsnet-project-templates: vsnet-project-rules vsnet-project-tests vsnet: vsnet-item-templates vsnet-project-templates zip gendarme-vsnet-templates.zip README.vsnet \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Assembly Rule.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Assembly Rule Test.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Method Rule.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Method Rule Test.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Type Rule.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Type Rule Test.zip" \ "Templates\ProjectTemplates\Visual C#\Gendarme Projects\Rule Assembly.zip" \ "Templates\ProjectTemplates\Visual C#\Gendarme Projects\Rule Test Assembly.zip" rmdir temp gendarme-vsnet-templates.zip: vsnet all: gendarme-vsnet-templates.zip clean: rm -f *.zip rm -rf temp # 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-tools-4.2/gendarme/tools/supported/templates/TypeTest.vstemplate0000664000175000017500000000166012413742070030346 0ustar00directhexdirecthex00000000000000 Type Rule Test.cs Type Rule Test A unit test for a gendarme type rule. CSharp 10 __TemplateIcon.ico Mono.Cecil Gendarme.Framework Test.Rules System.Core TypeTest.cs mono-tools-4.2/gendarme/tools/supported/templates/TypeRule.cs0000664000175000017500000000365012413742070026560 0ustar00directhexdirecthex00000000000000// // $rootnamespace$.$safeitemname$ // // Authors: // $name$ <$email$> // // Copyright (C) $year$ $name$ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace $rootnamespace$ { /// /// TODO: Add a summary of the rule. /// /// /// Bad example: /// /// TODO: Add an example where the rule would fail. /// /// /// /// Good example: /// /// TODO: Show how to fix the bad example. /// /// // TODO: Describe the problem and solution [Problem ("")] [Solution ("")] public class $safeitemname$ : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // TODO: Write the rule. return RuleResult.Success; } } } mono-tools-4.2/gendarme/tools/supported/templates/AssemblyTest.cs0000664000175000017500000000362412413742070027427 0ustar00directhexdirecthex00000000000000// // $rootnamespace$.$safeitemname$ // // Authors: // $name$ <$email$> // // Copyright (C) $year$ $name$ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; // TODO: Add using for the project of the rule being tested. // using Gendarme.Rules. ; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace $rootnamespace$ { [TestFixture] public class $safeitemname$ : AssemblyRuleTestFixture { [Test] public void DoesNotApply () { // TODO: Write tests that don't apply. // AssertRuleDoesNotApply (assembly); } [Test] public void Good () { // TODO: Write tests that should succeed. // AssertRuleSuccess (assembly); } [Test] public void Bad () { // TODO: Write tests that should fail. // AssertRuleFailure (assembly); } } } mono-tools-4.2/gendarme/tools/supported/templates/AssemblyTest.vstemplate0000664000175000017500000000170012413742070031177 0ustar00directhexdirecthex00000000000000 Assembly Rule Test.cs Assembly Rule Test A unit test for a gendarme assembly rule. CSharp 10 __TemplateIcon.ico Mono.Cecil Gendarme.Framework Test.Rules System.Core AssemblyTest.cs mono-tools-4.2/gendarme/tools/supported/templates/Templates.TestProject.vstemplate0000664000175000017500000000152412413742070032767 0ustar00directhexdirecthex00000000000000 Rule Test Assembly An assembly of unit tests for gendarme rules. CSharp 1000 true Rule Test Assembly true Enabled true __TemplateIcon.ico mono-tools-4.2/gendarme/tools/supported/templates/README0000664000175000017500000000034612413742070025337 0ustar00directhexdirecthex00000000000000Here are uncompressed C# templates for Gendarme rules, tests and projects. To build the compressed templates required by VS.NET (2008/2010) just issue a: % make vsnet and read the README.vsnet file (also part of the archive). mono-tools-4.2/gendarme/tools/supported/templates/Templates.RuleProject.csproj0000664000175000017500000000466112413742070032100 0ustar00directhexdirecthex00000000000000 Debug x86 8.0.30703 2.0 {BDADA65A-2C52-42C3-A7E4-A824FCDF4C9D} Exe Properties $safeprojectname$ $safeprojectname$ v4.0 Client 512 x86 true full false bin\Debug\ DEBUG;TRACE prompt 4 x86 pdbonly true bin\Release\ TRACE prompt 4 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework mono-tools-4.2/gendarme/tools/supported/templates/Templates.RuleProject.vstemplate0000664000175000017500000000150312413742070032754 0ustar00directhexdirecthex00000000000000 Rule Assembly An assembly containing gendarme rules. CSharp 1000 true Rule Assembly true Enabled true __TemplateIcon.ico mono-tools-4.2/gendarme/tools/supported/templates/Templates.TestProject.csproj0000664000175000017500000000540112413742070032101 0ustar00directhexdirecthex00000000000000 Debug x86 8.0.30703 2.0 {0B35C07C-19E8-40D0-8634-FE3929DBB8C7} Exe Properties $safeprojectname$ $safeprojectname$ v4.0 Client 512 x86 true full false bin\Debug\ DEBUG;TRACE prompt 4 x86 pdbonly true bin\Release\ TRACE prompt 4 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules mono-tools-4.2/gendarme/tools/supported/templates/MethodTest.cs0000664000175000017500000000361412413742070027067 0ustar00directhexdirecthex00000000000000// // $rootnamespace$.$safeitemname$ // // Authors: // $name$ <$email$> // // Copyright (C) $year$ $name$ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; // TODO: Add using for the project of the rule being tested. // using Gendarme.Rules. ; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace $rootnamespace$ { [TestFixture] public class $safeitemname$ : MethodRuleTestFixture { [Test] public void DoesNotApply () { // TODO: Write tests that don't apply. // AssertRuleDoesNotApply (method); } [Test] public void Good () { // TODO: Write tests that should succeed. // AssertRuleSuccess (method); } [Test] public void Bad () { // TODO: Write tests that should fail. // AssertRuleFailure (method); } } } mono-tools-4.2/gendarme/tools/supported/templates/AssemblyRule.vstemplate0000664000175000017500000000154512413742070031176 0ustar00directhexdirecthex00000000000000 Assembly Rule.cs Assembly Rule A gendarme rule that checks an assembly. CSharp 10 __TemplateIcon.ico Mono.Cecil Gendarme.Framework System.Core AssemblyRule.cs mono-tools-4.2/gendarme/tools/supported/templates/MethodRule.cs0000664000175000017500000000366012413742070027060 0ustar00directhexdirecthex00000000000000// // $rootnamespace$.$safeitemname$ // // Authors: // $name$ <$email$> // // Copyright (C) $year$ $name$ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace $rootnamespace$ { /// /// TODO: Add a summary of the rule. /// /// /// Bad example: /// /// TODO: Add an example where the rule would fail. /// /// /// /// Good example: /// /// TODO: Show how to fix the bad example. /// /// // TODO: Describe the problem and solution [Problem ("")] [Solution ("")] public class $safeitemname$ : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // TODO: Write the rule. return RuleResult.Success; } } } mono-tools-4.2/gendarme/tools/supported/templates/AssemblyRule.cs0000664000175000017500000000367012413742070027420 0ustar00directhexdirecthex00000000000000// // $rootnamespace$.$safeitemname$ // // Authors: // $name$ <$email$> // // Copyright (C) $year$ $name$ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace $rootnamespace$ { /// /// TODO: Add a summary of the rule. /// /// /// Bad example: /// /// TODO: Add an example where the rule would fail. /// /// /// /// Good example: /// /// TODO: Show how to fix the bad example. /// /// // TODO: Describe the problem and solution [Problem ("")] [Solution ("")] public class $safeitemname$ : Rule, IAssemblyRule { public RuleResult CheckAssembly (AssemblyDefinition assembly) { // TODO: Write the rule. return RuleResult.Success; } } } mono-tools-4.2/gendarme/tools/supported/templates/Makefile.am0000664000175000017500000000734012413742070026514 0ustar00directhexdirecthex00000000000000EXTRA_DIST = README README.vsnet \ AssemblyRule.cs AssemblyRule.vstemplate \ AssemblyTest.cs AssemblyTest.vstemplate \ TypeRule.cs TypeRule.vstemplate \ TypeTest.cs TypeTest.vstemplate \ MethodRule.cs MethodRule.vstemplate \ MethodTest.cs MethodTest.vstemplate \ Templates.RuleProject.csproj Templates.RuleProject.vstemplate \ Templates.TestProject.csproj Templates.TestProject.vstemplate GENDARME_ICON = ../../../swf-wizard-runner/Resources/gendarme.ico vsnet-item-assembly-rule: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp AssemblyRule.cs temp/AssemblyRule.cs cp AssemblyRule.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Assembly Rule.zip" temp/* rm -rf temp/* vsnet-item-assembly-test: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp AssemblyTest.cs temp/AssemblyTest.cs cp AssemblyTest.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Assembly Rule Test.zip" temp/* rm -rf temp/* vsnet-item-method-rule: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp MethodRule.cs temp/MethodRule.cs cp MethodRule.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Method Rule.zip" temp/* rm -rf temp/* vsnet-item-method-test: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp MethodTest.cs temp/MethodTest.cs cp MethodTest.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Method Rule Test.zip" temp/* rm -rf temp/* vsnet-item-type-rule: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp TypeRule.cs temp/TypeRule.cs cp TypeRule.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Type Rule.zip" temp/* rm -rf temp/* vsnet-item-type-test: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp TypeTest.cs temp/TypeTest.cs cp TypeTest.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ItemTemplates\Visual C#\Gendarme Items\Type Rule Test.zip" temp/* rm -rf temp/* vsnet-item-templates: vsnet-item-assembly-rule vsnet-item-assembly-test \ vsnet-item-method-rule vsnet-item-method-test \ vsnet-item-type-rule vsnet-item-type-test vsnet-project-rules: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp Templates.RuleProject.csproj temp/Templates.RuleProject.csproj cp Templates.RuleProject.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ProjectTemplates\Visual C#\Gendarme Projects\Rule Assembly.zip" temp/* rm -rf temp/* vsnet-project-tests: mkdir -p temp cp $(GENDARME_ICON) temp/__TemplateIcon.ico cp Templates.TestProject.csproj temp/Templates.TestProject.csproj cp Templates.TestProject.vstemplate temp/MyTemplate.vstemplate zip -j "Templates\ProjectTemplates\Visual C#\Gendarme Projects\Rule Test Assembly.zip" temp/* rm -rf temp/* vsnet-project-templates: vsnet-project-rules vsnet-project-tests vsnet: vsnet-item-templates vsnet-project-templates zip gendarme-vsnet-templates.zip README.vsnet \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Assembly Rule.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Assembly Rule Test.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Method Rule.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Method Rule Test.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Type Rule.zip" \ "Templates\ItemTemplates\Visual C#\Gendarme Items\Type Rule Test.zip" \ "Templates\ProjectTemplates\Visual C#\Gendarme Projects\Rule Assembly.zip" \ "Templates\ProjectTemplates\Visual C#\Gendarme Projects\Rule Test Assembly.zip" rmdir temp gendarme-vsnet-templates.zip: vsnet all: gendarme-vsnet-templates.zip clean: rm -f *.zip rm -rf temp mono-tools-4.2/gendarme/tools/supported/templates/README.vsnet0000664000175000017500000000102012413742070026463 0ustar00directhexdirecthex00000000000000Gendarme Item/Project Templates for Visual Studio To Install: - Extract this file to your My Documents\Visual Studio 20x folder. - Optionally, open the .vstemplate file in each item template. In the section, add the following: This will allow your name and e-mail address to be automatically entered into rules and tests you create.mono-tools-4.2/gendarme/tools/supported/templates/TypeTest.cs0000664000175000017500000000361212413742070026566 0ustar00directhexdirecthex00000000000000// // $rootnamespace$.$safeitemname$ // // Authors: // $name$ <$email$> // // Copyright (C) $year$ $name$ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; // TODO: Add using for the project of the rule being tested. // using Gendarme.Rules. ; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace $rootnamespace$ { [TestFixture] public class $safeitemname$ : TypeRuleTestFixture { [Test] public void DoesNotApply () { // TODO: Write tests that don't apply. // AssertRuleDoesNotApply (); } [Test] public void Good () { // TODO: Write tests that should succeed. // AssertRuleSuccess (); } [Test] public void Bad () { // TODO: Write tests that should fail. // AssertRuleFailure (); } } } mono-tools-4.2/gendarme/tools/supported/Makefile.am0000664000175000017500000000003212413742070024505 0ustar00directhexdirecthex00000000000000SUBDIRS = gd2i templates mono-tools-4.2/gendarme/framework/0000775000175000017500000000000012642235741021274 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/ChangeLog0000664000175000017500000002731412413742070023047 0ustar00directhexdirecthex000000000000002010-05-23 Sebastien Pouliot * Makefile.am: Add new engine and tests to the build 2010-01-01 Sebastien Pouliot * Makefile.am: Add ParameterRocks.cs and its unit tests to the build 2009-07-09 Jesse Jones * Makefile.am, ThreadModelAttribute.cs: Added new file allowing threading semantics of gendarme to be specified. 2009-07-08 Sebastien Pouliot * Makefile.am: Add a 'touch hack' so we only rebuild documentation when the framework assembly is changed. 2009-04-30 Jesse Jones * Makefile.am: Added VariableDefinitionRocks files. 2009-01-27 Jonathan Pryor * Makefile.am ($(framework_doc_source)): Change the .source file contents so that framework docs are placed under the 'Gendarme Framework' node. 2008-11-28 Sebastien Pouliot * Makefile.am: Use -noshadow on nunit-console2 so the "new" 2.4, now used inside mono, works properly. 2008-11-27 Sebastien Pouliot * Makefile.am: Include the framework unit tests in the dist. 2008-11-23 Sebastien Pouliot * Makefile.am: Avoid re-building documentation needlessly. This fix the case where a make install, under su, would fail to locate mdoc. 2008-11-17 Jesse Jones * Makefile.am: Added new Log.cs file. 2008-11-14 Jesse Jones * Makefile.am: Uses new options.make 2008-11-13 Sebastien Pouliot * Makefile.am: Add MethodPrinter to the build. Patch by Jesse Jones 2008-11-09 Sebastien Pouliot * Makefile.am: Add Test to SUBDIRS to fix make checkdist 2008-11-08 Alan McGovern * Makefile.am: * Gendarme.Framework.csproj: Enable Makefile integration of Gendarme.Framework.csproj 2008-11-07 Alan McGovern * Gendarme.Framework.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-02 Sebastien Pouliot * Makefile.am: Regenerate documentation if the .doc file has changed * ChangeLog: Remove duplicate entry (from another dir) 2008-10-30 Jesse Jones * Makefile.am: Added FRAMEWORK_OPTIONS and TESTS_OPTIONS. These define DEBUG/TRACE, enable all warnings, make warnings errors. (small changes by Sebastien Pouliot for things we'll enable only later) 2008-10-26 Sebastien Pouliot * framework.mdp: Add PrimitiveReferences helpers to the MD project 2008-10-22 Néstor Salceda * Makefile.am: Generate the documentation when we compile the framework and put it available for distribute, using the same way we are using for the rules documentation. 2008-10-19 Sebastien Pouliot * Makefile.am: Add NamespaceEngine and Namespace MD project file. 2008-10-17 Sebastien Pouliot * Makefile.am: Add NamespaceEngine and Namespace helper to the build. 2008-10-11 Sebastien Pouliot * Makefile.am: Add PrimitiveReferences to the build. 2008-09-06 Sebastien Pouliot * Makefile.am: Add new files to the build. 2008-08-28 Sebastien Pouliot * Makefile.am: Add Gendarme.Framework.Helpers/OpCodeBitmask.cs to the build 2008-08-26 Sebastien Pouliot * Makefile.am: Add Gendarme.Framework/Bitmask.cs and it's unit tests to the build. * framework.mdp: Add FxCopCompatibilityAttribute and Bitmask to the MD project file. 2008-08-25 Sebastien Pouliot * Makefile.am: Add Gendarme.Framework/FxCopCompatibilityAttribute.cs to the build. 2008-07-11 Sebastien Pouliot * Makefile.am: Fix Makefile.am not to compile the framework everytime. 2008-07-09 Jb Evain * AssemblyResolver.cs: use a Dictionary<,> instead of a SortedList for caching assemblies. 2008-06-14 Sebastien Pouliot * Makefile.am: Add InstructionRocks[Test].cs to the build. * framework.mdp: Add InstructionRocks.cs to the MD project file. 2008-06-08 Sebastien Pouliot * Makefile.am: Add StackEntryUsageResult.cs to the build. * framework.mdp: Add StackEntryUsageResult.cs to the MD project file. 2008-06-02 Nestor Salceda * Makefile.am: Add the ApplicabilityScope.cs to the framework build. * ApplicabilityScope.cs: New, the enum for codify the different applicability behaviours. * IRule.cs: Added a getter and setter to the rule. * Rule.cs: Added the getter and setter bodies. * Runner.cs: According their applicability scope, the runner runs or not runs the check against a target. 2008-05-17 Andres G. Aragoneses * framework.mdp: Fix build. 2008-05-17 Sebastien Pouliot * Makefile.am: Add Gendarme.Framework.Rocks.ModuleRocks to the build. 2008-05-10 Andres G. Aragoneses * framework.mdp: Update to fix build. 2008-05-10 Sebastien Pouliot * Makefile.am: Remove Gendarme.Framework.TestRunner from the build. 2008-05-04 Sebastien Pouliot * Makefile.am: Add Gendarme.Framework.Symbols to the build. 2008-02-17 Sebastien Pouliot * framework.mdp: Update MonoDevelop project file. * Makefile.am: Update build file. 2008-02-16 Nestor Salceda * Makefile.am: Generate the xml file for the documentation when the code are compiled. 2008-02-14 Sebastien Pouliot * Makefile.am: Adjust makefile with recent changes. *.cs: Remove old fx classes. 2008-02-14 Sebastien Pouliot * Makefile.am: Add AssemblyResolver to the build. 2008-02-09 Nestor Salceda * Makefile.am: Added the documentation automatic generation when compiling the framework. 2008-01-30 Sebastien Pouliot * Makefile.am: Added CommonRocks and StackEntryAnalysis[Test] to the build. 2008-01-21 Sebastien Pouliot * Makefile.am: Added new test file to the build. 2008-01-18 Sebastien Pouliot * Makefile.am: Added new files and tests to the build. 2008-01-12 Sebastien Pouliot * Location.cs: Remove all string-based constructors. 2008-01-11 Sebastien Pouliot * Location.cs: Add a ctor for FieldDefinition. 2008-01-05 Sebastien Pouliot * framework.mdp: Added FieldRocks to MD project file * Makefile.am: Added FieldRocks class and tests to the build. 2008-01-04 Sebastien Pouliot * framework.mdp: Added AssemblyRocks to MD project file * Makefile.am: Added AssemblyRocks class and tests to the build. 2008-01-03 Sebastien Pouliot * Runner.cs: renamed Violation[s|Collection] and change some methods to static (fix warnings) * Violation.cs: Don't expose public fields (fix warning) * Violations.cs: Rename class to ViolationCollection (fix warning) 2008-01-02 Sebastien Pouliot * Location.cs: Store the offset (not a constant) 2007-12-29 Sebastien Pouliot * Location.cs: Add new constructor that accept a MethodDefinition and an IL offset. 2007-12-26 Sebastien Pouliot * Makefile.am: Add rocks to the build, switch compiler to linq * framework.mdp: Add rocks to the MonoDevelop project file, switch compiler to linq. * Location.cs: Add new constructors that accept a [Method|Type]Definition to simplify rules. 2007-12-16 Sebastien Pouliot * AssemblyManager.cs: Make class static since we're now targetting the 2.0 framework. 2007-11-29 Sebastien Pouliot * Location.cs: Use StringBuilder in ToString. Add a new ctor that doesn't requires an offset (as it doesn't apply to many rules). Source now conforms to Mono source style. 2007-11-29 Sebastien Pouliot * RuleInformation.cs: Remove ReadOnly property. * RuleInformationManager.cs: Remove usage for ReadOnly. 2007-10-09 Nestor Salceda * Makefile.am: Put parenthesis and dollar in correct order for avoid the make self-test fail. 2007-10-07 Sebastien Pouliot * framework.mdp: Now built with 2.0 rutime. 2007-09-25 Nestor Salceda * Runner.cs: Implemented the inclusion and exclusion of rules. 2007-09-14 Nestor Salceda * gendarme-framework.pc.in: The framework will be installed in ${prefix}/lib/gendarme not in ${prefix}/lib/Gendarme.Framework. It works correctly now. 2007-09-03 Nestor Salceda * RuleCollection.cs: Removed the indexer with name as parameter. 2007-08-31 Nestor Salceda * gendarme-framework.pc.in, Makefile.am: Install Gendarme.Framework to be reusable (pkg-config) with other runners. 2007-03-12 Jb Evain * IRule.cs, Runner.cs: Simplify the rules interface. 2007-03-01 Jb Evain * Runner.cs: Do some refactoring. 2006-11-23 Sebastien Pouliot * Runner.cs: I forgot that constructors were kept apart from methods. Rules will now be executed against all type's constructors as well. 2006-11-06 Sebastien Pouliot * framework.mdp: Update to add new file. * Gendarme.Framework.csproj: Update to add new file. * Makefile.am: Update to add new file. * Message.cs: Reformat source to follow Mono source style. Ensure that ToString works if a Location is null (e.g. rules on assemblies and modules may not have a location). * MessageCollection.cs: Add new ctor that accept a Message. Easier to use when returning a collection with a single message. * MessageType.cs: New file. Moved enum from Message.cs. * Runner.cs: Don't try to create abstract rules. 2006-10-09 Sebastien Pouliot * Runner.cs: Remove Violations.Reset(); from Process as it's reset the list and breaks the console runner when processing more than one assembly (e.g. *.dll). 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. Add new MessageCollection class to the build. 2006-09-28 Christian Birkl * Gendarme.Framework.csproj: Included ChangeLog * MessageCollection.cs, Gendarme.Framework.csproj, framework.mdp: Added new class to replace the untyped IList interface for holding Message objects. * IRule.cs: Changed all interfaces to return the new typed MessageCollection class instead of IList. 2006-09-17 Sebastien Pouliot * Violation.cs: Added a new Assembly property deduced from the violator object. 2006-09-17 Christian Birkl * Runner.cs: Reset the violation list when processing a new assembly. * Violations.cs: Implement IEnumerable. 2006-08-28 Sebastien Pouliot * framework.mdp: Rename the output assembly to Gendarme.Framework.dll like it is built when using the Makefile (instead of framework.dll). Found by Christian Birkl. 2006-08-21 Sebastien Pouliot * Location.cs: Apply self compliance (UseStringEmptyRule). 2006-07-31 Sebastien Pouliot * framework.mdp: New. Project file for MonoDevelop. 2006-06-13 Sebastien Pouliot * Makefile.am: Added self-test to promote compliance ;-) mono-tools-4.2/gendarme/framework/Gendarme.Framework.Engines/0000775000175000017500000000000012642235741026341 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Gendarme.Framework.Engines/SuppressMessageEngine.cs0000664000175000017500000001724512413742070033152 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Engines.SuppressMessageEngine // // Authors: // Sebastien Pouliot // // Copyright (C) 2010-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; using System.Collections.Generic; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework.Engines { public class SuppressMessageEngine : Engine { const string SuppressMessage = "System.Diagnostics.CodeAnalysis.SuppressMessageAttribute"; static Type fxCopCompatibility = typeof (FxCopCompatibilityAttribute); private Dictionary> mapper; Dictionary> targets; public override void Initialize (EngineController controller) { base.Initialize (controller); controller.BuildingAssembly += new EventHandler (OnAssembly); mapper = new Dictionary> (); foreach (IRule rule in Controller.Runner.Rules) { Type type = rule.GetType (); object [] attrs = type.GetCustomAttributes (fxCopCompatibility, true); if (attrs.Length == 0) continue; // one Gendarme rule can be mapped to several FxCop rules // one FxCop rules can be split across several Gendarme rules foreach (FxCopCompatibilityAttribute attr in attrs) { HashSet grules = null; if (!mapper.TryGetValue (attr.CheckId, out grules)) { grules = new HashSet (); mapper.Add (attr.CheckId, grules); } grules.Add (rule.FullName); } } } void OnAssembly (object sender, EngineEventArgs e) { // we only need to check the custom attributes if [SuppressMessage] is referenced (note: won't work for mscorlib) AssemblyDefinition assembly = (sender as AssemblyDefinition); if (assembly.MainModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Diagnostics.CodeAnalysis", "SuppressMessageAttribute"); })) { Controller.BuildingCustomAttributes += new EventHandler (OnCustomAttributes); } else { Controller.BuildingCustomAttributes -= new EventHandler (OnCustomAttributes); } } static string GetPropertyString (ICustomAttribute attribute, string name) { if (!attribute.HasProperties) return String.Empty; foreach (var namedArg in attribute.Properties) { if (namedArg.Name == name) { return (namedArg.Argument.Value as string); } } return String.Empty; } void OnCustomAttributes (object sender, EngineEventArgs e) { ICustomAttributeProvider cap = (sender as ICustomAttributeProvider); if (!cap.HasCustomAttributes) return; // deal with Target only for global (asembly-level) attributes bool global = (sender is AssemblyDefinition); foreach (CustomAttribute ca in cap.CustomAttributes) { if (!ca.HasConstructorArguments) continue; if (!ca.AttributeType.IsNamed ("System.Diagnostics.CodeAnalysis", "SuppressMessageAttribute")) continue; var arguments = ca.ConstructorArguments; string category = (string) arguments [0].Value; string checkId = (string) arguments [1].Value; if (String.IsNullOrEmpty (category) || String.IsNullOrEmpty (checkId)) continue; IMetadataTokenProvider token = (sender as IMetadataTokenProvider); // map from FxCop - otherwise keep the Gendarme syntax HashSet mapped_names = null; if (!mapper.TryGetValue (checkId, out mapped_names)) { mapped_names = new HashSet (); mapped_names.Add (category + "." + checkId); } // FIXME: Scope ? "member", "resource", "module", "type", "method", or "namespace" string target = global ? GetPropertyString (ca, "Target") : null; if (String.IsNullOrEmpty (target)) { AddIgnore (token, mapped_names); // continue loop - [SuppressMessage] has AllowMultiple == true continue; } else { // we do not want to look for each target individually since we do not know // what they represent. Running the "big" loop one time is more than enough AddTargets (target, mapped_names); } } ResolveTargets (); } private void AddIgnore (IMetadataTokenProvider token, IEnumerable mapped_names) { IIgnoreList ignore = Controller.Runner.IgnoreList; switch (token.MetadataToken.TokenType) { case TokenType.Property: PropertyDefinition pd = (token as PropertyDefinition); foreach (string name in mapped_names) { ignore.Add (name, pd.GetMethod); ignore.Add (name, pd.SetMethod); } break; case TokenType.Event: EventDefinition ed = (token as EventDefinition); foreach (string name in mapped_names) { ignore.Add (name, ed.AddMethod); ignore.Add (name, ed.RemoveMethod); ignore.Add (name, ed.InvokeMethod); if (ed.HasOtherMethods) { foreach (MethodDefinition md in ed.OtherMethods) { ignore.Add (name, md); } } } break; } // the 'token' itself is always added (i.e. for properties and events too) foreach (string name in mapped_names) ignore.Add (name, token); } private void AddTargets (string target, IEnumerable mapped_names) { if (targets == null) targets = new Dictionary> (); // inner types syntax fix target = target.Replace ('+', '/'); // method/member syntax fix target = target.Replace (".#", "::"); HashSet list = null; if (!targets.TryGetValue (target, out list)) { list = new HashSet (); targets.Add (target, list); } foreach (string name in mapped_names) list.AddIfNew (name); } // scan the analysis code a single time looking for targets private void ResolveTargets () { if (targets == null || targets.Count == 0) return; HashSet rules; // scan all code and look for targets foreach (AssemblyDefinition assembly in Controller.Runner.Assemblies) { // TODO ... foreach (ModuleDefinition module in assembly.Modules) { // TODO ... foreach (TypeDefinition type in module.GetAllTypes ()) { if (targets.TryGetValue (type.GetFullName (), out rules)) Add (type, rules); if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) ResolveMethod (method); } } } } targets.Clear (); } private void ResolveMethod (MemberReference method) { HashSet rules; string m = method.GetFullName (); m = m.Substring (m.IndexOf (' ') + 1); if (targets.TryGetValue (m, out rules)) Add (method, rules); } private void Add (IMetadataTokenProvider metadata, IEnumerable rules) { foreach (string rule in rules) { Controller.Runner.IgnoreList.Add (rule, metadata); } } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Engines/NamespaceEngine.cs0000664000175000017500000001057312413742070031712 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Engines.NamespaceEngine // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework.Engines { public class NamespaceEngine : Engine { static Dictionary> assemblies = new Dictionary> (); static Dictionary> namespaces = new Dictionary> (); public override void Initialize (EngineController controller) { base.Initialize (controller); controller.BuildingType += new EventHandler (OnType); assemblies.Clear (); namespaces.Clear (); } void OnType (object sender, EngineEventArgs e) { TypeDefinition type = (sender as TypeDefinition); string nspace = type.Namespace; // we keep track of namespaces per assemblies AssemblyDefinition assembly = type.Module.Assembly; HashSet ns; if (assemblies.TryGetValue (assembly, out ns)) { ns.AddIfNew (nspace); } else { ns = new HashSet (); ns.Add (nspace); assemblies.Add (assembly, ns); } // and types per namespaces HashSet td; if (!namespaces.TryGetValue (nspace, out td)) { td = new HashSet (); namespaces.Add (nspace, td); } td.Add (type); } /// /// Return all namespaces from all assemblies being analyzed. /// /// All namespaces defined in the assembly set public static IEnumerable AllNamespaces () { foreach (string ns in namespaces.Keys) { yield return ns; } } /// /// Return if a namespace exist inside the assembly set /// /// Namespace to confirm existance /// True if the namespace exists, False otherwise public static bool Exists (string nameSpace) { if (nameSpace == null) throw new ArgumentNullException ("nameSpace"); return namespaces.ContainsKey (nameSpace); } /// /// Return all namespaces defined inside the specified assembly. /// /// Assembly to search into /// All namespaces defined in the specified assembly public static IEnumerable NamespacesInside (AssemblyDefinition assembly) { if (assembly == null) throw new ArgumentNullException ("assembly"); HashSet namespaces = null; if (!assemblies.TryGetValue (assembly, out namespaces)) yield return null; foreach (string ns in namespaces) { yield return ns; } } /// /// Return all types defined inside a namespace across all assemblies. /// /// Namespace to search into /// All TypeDefinition defined the the specified namespace public static IEnumerable TypesInside (string nameSpace) { if (nameSpace == null) throw new ArgumentNullException ("nameSpace"); HashSet types = null; if (!namespaces.TryGetValue (nameSpace, out types)) yield return null; foreach (TypeDefinition type in types) { yield return type; } } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Engines/OpCodeEngine.cs0000664000175000017500000000541112413742070031162 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Engines.OpCodeEngine // // Authors: // Sebastien Pouliot // // 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; using System.Collections; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework.Helpers; namespace Gendarme.Framework.Engines { /// /// Build an OpCodeBitmask for each MethodBody. By using the extra data gathered /// by this engine it is possible to short-circuit rule logic early by ensuring /// it does what the rule expects (e.g. check for [call|callvirt] instructions). /// public class OpCodeEngine : Engine { static Dictionary bitmasks = new Dictionary (); public OpCodeEngine () { } public override void Initialize (EngineController controller) { base.Initialize (controller); controller.BuildingMethodBody += new EventHandler (OnMethodBody); } void OnMethodBody (object sender, EngineEventArgs e) { MethodBody body = (sender as MethodBody); MethodDefinition method = body.Method; // some runners, like the wizard, can run this engine several times // and, in this case, the result won't change if (bitmasks.ContainsKey (method)) return; OpCodeBitmask mask = new OpCodeBitmask (); foreach (Instruction ins in body.Instructions) { mask.Set (ins.OpCode.Code); } bitmasks.Add (method, mask); } // service offered by the engine public static OpCodeBitmask GetBitmask (MethodDefinition method) { OpCodeBitmask result; if (!bitmasks.TryGetValue (method, out result)) return OpCodeBitmask.All; return result; } } } mono-tools-4.2/gendarme/framework/Makefile.in0000664000175000017500000007434312642235731023353 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/framework ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = gendarme-framework.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)$(frameworkdir)" \ "$(DESTDIR)$(framework_documentationdir)" \ "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(framework_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(framework_documentation_DATA) $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../options.make $(srcdir)/Makefile.in \ $(srcdir)/gendarme-framework.pc.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test frameworkdir = $(prefix)/lib/gendarme framework_SCRIPTS = ../bin/Gendarme.Framework.dll EXTRA_DIST = $(framework_sources) $(framework_sources_in) $(framework_test_build_sources) \ Gendarme.Framework.csproj gendarme-framework.pc.in CLEANFILES = $(framework_SCRIPTS) $(framework_SCRIPTS).mdb Test.Framework.dll $(framework_SCRIPTS).doc $(framework_doc) DISTCLEANFILES = ../AssemblyInfo.cs Makefile.in gendarme-framework.pc pkgconfig_in_files = gendarme-framework.pc.in pkgconfigdir = $(prefix)/lib/pkgconfig pkgconfig_DATA = $(pkgconfig_in_files:.pc.in=.pc) framework_doc_source = doc/Gendarme.Framework.source framework_doc_tree = doc/Gendarme.Framework.tree framework_doc_zip = doc/Gendarme.Framework.zip framework_documentationdir = $(prefix)/lib/monodoc/sources framework_documentation_DATA = $(framework_doc) framework_doc = $(framework_doc_zip) $(framework_doc_source) $(framework_doc_tree) generated_doc = doc/generated/index.xml framework_sources_in = ../AssemblyInfo.cs.in framework_generated_sources = $(framework_sources_in:.in=) framework_sources = \ ../AssemblyStaticInfo.cs \ Gendarme.Framework.Engines/NamespaceEngine.cs \ Gendarme.Framework.Engines/OpCodeEngine.cs \ Gendarme.Framework.Engines/SuppressMessageEngine.cs \ Gendarme.Framework.Helpers/Log.cs \ Gendarme.Framework.Helpers/MethodPrinter.cs \ Gendarme.Framework.Helpers/MethodSignature.cs \ Gendarme.Framework.Helpers/MethodSignatures.cs \ Gendarme.Framework.Helpers/Namespace.cs \ Gendarme.Framework.Helpers/OpCodeBitmask.cs \ Gendarme.Framework.Helpers/PrimitiveReferences.cs \ Gendarme.Framework.Helpers/StackEntryAnalysis.cs \ Gendarme.Framework.Helpers/StackEntryUsageResult.cs \ Gendarme.Framework.Helpers/StreamLineReader.cs \ Gendarme.Framework.Rocks/AssemblyRocks.cs \ Gendarme.Framework.Rocks/CecilRocks.cs \ Gendarme.Framework.Rocks/CommonRocks.cs \ Gendarme.Framework.Rocks/CustomAttributeRocks.cs \ Gendarme.Framework.Rocks/FieldRocks.cs \ Gendarme.Framework.Rocks/InstructionRocks.cs \ Gendarme.Framework.Rocks/MethodRocks.cs \ Gendarme.Framework.Rocks/ModuleRocks.cs \ Gendarme.Framework.Rocks/ParameterRocks.cs \ Gendarme.Framework.Rocks/PropertyRocks.cs \ Gendarme.Framework.Rocks/TypeRocks.cs \ Gendarme.Framework.Rocks/VariableDefinitionRocks.cs \ Gendarme.Framework/ApplicabilityScope.cs \ Gendarme.Framework/AssemblyResolver.cs \ Gendarme.Framework/BasicIgnoreList.cs \ Gendarme.Framework/Bitmask.cs \ Gendarme.Framework/Confidence.cs \ Gendarme.Framework/Defect.cs \ Gendarme.Framework/DocumentationUriAttribute.cs \ Gendarme.Framework/Engine.cs \ Gendarme.Framework/EngineController.cs \ Gendarme.Framework/EngineDependencyAttribute.cs \ Gendarme.Framework/EngineEventArgs.cs \ Gendarme.Framework/FxCopCompatibilityAttribute.cs \ Gendarme.Framework/HierarchicalEventArgs.cs \ Gendarme.Framework/IAssemblyRule.cs \ Gendarme.Framework/IIgnoreList.cs \ Gendarme.Framework/IMethodRule.cs \ Gendarme.Framework/IRule.cs \ Gendarme.Framework/IRunner.cs \ Gendarme.Framework/ITypeRule.cs \ Gendarme.Framework/ProblemAttribute.cs \ Gendarme.Framework/Rule.cs \ Gendarme.Framework/RuleResult.cs \ Gendarme.Framework/Runner.cs \ Gendarme.Framework/RunnerEventArgs.cs \ Gendarme.Framework/Severity.cs \ Gendarme.Framework/SolutionAttribute.cs \ Gendarme.Framework/Symbols.cs \ Gendarme.Framework/ThreadModelAttribute.cs framework_build_sources = $(addprefix $(srcdir)/, \ $(framework_sources)) $(framework_generated_sources) framework_test_sources = \ GlobalSuppressions.cs \ Gendarme.Framework/BitmaskTest.cs \ Gendarme.Framework/ThreadModelAttributeTest.cs \ Gendarme.Framework.Engines/SuppressMessageAttributeTest.cs \ Gendarme.Framework.Helpers/MethodSignatureTest.cs \ Gendarme.Framework.Helpers/StackEntryAnalysisTest.cs \ Gendarme.Framework.Rocks/RocksTest.cs \ Gendarme.Framework.Rocks/AssemblyRocksTest.cs \ Gendarme.Framework.Rocks/CustomAttributeRocksTest.cs \ Gendarme.Framework.Rocks/InstructionRocksTest.cs \ Gendarme.Framework.Rocks/MethodRocksTest.cs \ Gendarme.Framework.Rocks/ParameterRocksTest.cs \ Gendarme.Framework.Rocks/TypeRocksTest.cs \ Gendarme.Framework.Rocks/VariableDefinitionRocksTest.cs \ Gendarme.Framework.Rocks/FieldRocksTest.cs framework_test_build_sources = $(addprefix $(srcdir)/Test/, $(framework_test_sources)) all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../options.make $(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) --gnu gendarme/framework/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/framework/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; $(srcdir)/../options.make $(am__empty): $(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): gendarme-framework.pc: $(top_builddir)/config.status $(srcdir)/gendarme-framework.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-frameworkSCRIPTS: $(framework_SCRIPTS) @$(NORMAL_INSTALL) @list='$(framework_SCRIPTS)'; test -n "$(frameworkdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(frameworkdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(frameworkdir)" || 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)$(frameworkdir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(frameworkdir)$$dir" || exit $$?; \ } \ ; done uninstall-frameworkSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(framework_SCRIPTS)'; test -n "$(frameworkdir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(frameworkdir)'; $(am__uninstall_files_from_dir) install-framework_documentationDATA: $(framework_documentation_DATA) @$(NORMAL_INSTALL) @list='$(framework_documentation_DATA)'; test -n "$(framework_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(framework_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(framework_documentationdir)" || 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)$(framework_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(framework_documentationdir)" || exit $$?; \ done uninstall-framework_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(framework_documentation_DATA)'; test -n "$(framework_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(framework_documentationdir)'; $(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) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(frameworkdir)" "$(DESTDIR)$(framework_documentationdir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-frameworkSCRIPTS \ install-framework_documentationDATA install-pkgconfigDATA 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: uninstall-frameworkSCRIPTS \ uninstall-framework_documentationDATA uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-frameworkSCRIPTS \ install-framework_documentationDATA 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-frameworkSCRIPTS \ uninstall-framework_documentationDATA uninstall-pkgconfigDATA .PRECIOUS: Makefile ../bin/Gendarme.Framework.dll: $(framework_build_sources) $(CECIL_ASM) test -d ../bin || mkdir ../bin $(MCS) $(GENDARME_OPTIONS) -target:library -doc:$(framework_SCRIPTS).doc -r:$(CECIL_ASM) \ -out:$@ $(framework_build_sources) Test.Framework.dll: $(framework_test_build_sources) $(framework_rules_SCRIPTS) ../bin/Gendarme.Framework.dll $(CECIL_ASM) $(MCS) $(TESTS_OPTIONS) -target:library -d:CODE_ANALYSIS -pkg:mono-nunit \ -r:$(CECIL_ASM) -r:../bin/Gendarme.Framework.dll -r:../rules/Test.Rules/Test.Rules.dll \ -out:$@ $(framework_test_build_sources) test: Test.Framework.dll run-test: test MONO_PATH=../bin/:../rules/Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe Test.Framework.dll self-test: $(framework_SCRIPTS) mono --debug ../bin/gendarme.exe $(framework_SCRIPTS) $(generated_doc): $(framework_SCRIPTS) mkdir -p doc mdoc update -i $(framework_SCRIPTS).doc -o doc/generated $(framework_SCRIPTS) touch $(generated_doc) $(framework_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/Gendarme.Framework doc/generated $(framework_doc_tree): $(generated_doc) $(framework_doc_source): echo -e "\n\n\t\n\t\n" > $(framework_doc_source) clean-local: rm -fr doc/ # 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-tools-4.2/gendarme/framework/Gendarme.Framework/0000775000175000017500000000000012642235741024752 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Gendarme.Framework/Engine.cs0000664000175000017500000000353312413742070026504 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Engine // // Authors: // Sebastien Pouliot // // 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. // namespace Gendarme.Framework { // FIXME: do a IEngine interface once this is stable abstract public class Engine { protected Engine () { } protected EngineController Controller { get; private set; } /// /// Override to attach to some of the controller events /// /// public virtual void Initialize (EngineController controller) { Controller = controller; } /// /// Note: TearDown can be called without a call to Engine.Register or /// Engine.Initialize /// public virtual void TearDown () { Controller = null; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/ITypeRule.cs0000664000175000017500000000256512413742070027165 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.ITypeRule interface // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; namespace Gendarme.Framework { public interface ITypeRule : IRule { RuleResult CheckType (TypeDefinition type); } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/RunnerEventArgs.cs0000664000175000017500000000266112413742070030370 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.RunnerEventArgs // // Authors: // Sebastien Pouliot // // 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. namespace Gendarme.Framework { public class RunnerEventArgs : HierarchicalEventArgs { public RunnerEventArgs (IRunner runner) { Runner = runner; } public IRunner Runner { get; private set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/ProblemAttribute.cs0000664000175000017500000000300612413742070030556 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.ProblemAttribute class // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework { [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class ProblemAttribute : Attribute { public ProblemAttribute (string problem) { Problem = problem; } public string Problem { get; private set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/IAssemblyRule.cs0000664000175000017500000000261112413742070030013 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.IAssemblyRule interface // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; namespace Gendarme.Framework { public interface IAssemblyRule : IRule { RuleResult CheckAssembly (AssemblyDefinition assembly); } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/ApplicabilityScope.cs0000664000175000017500000000252312413742070031055 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.ApplicabilityScope class // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework { [Serializable] public enum ApplicabilityScope { Visible = 0, NonVisible, All } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/Severity.cs0000664000175000017500000000427012413742070027110 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Severity // // Authors: // Sebastien Pouliot // // 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 Gendarme.Framework { /// /// How severe is a defect found by the rule. /// [Serializable] public enum Severity { /// /// The code can not work as expected. /// Critical, /// /// The code may work or fails depending on values, configuration... /// High, /// /// The code will work most of the time or on the default, or most, common configuration /// Medium, /// /// The actual code works, fixing the defect doesn't have a big impact. /// By default some runners won't display such low severity issues to keep the number of defects to a reasonable level. /// Low, /// /// The actual code works but should be reviewed for potential problems. /// Often the code cannot be changed to satisfy the rule logic, /// i.e. the rule will always report it unless the rule or defect is ignored. /// Audit } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/BasicIgnoreList.cs0000664000175000017500000001743112413742070030322 0ustar00directhexdirecthex00000000000000// // BasicIgnoreList // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Metadata; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Framework { /// /// Basic ignore list implementation. /// public class BasicIgnoreList : IIgnoreList { private Dictionary> ignore; // note: we should keep statistics here // e.g. # of times a rule is ignored because it's inactive // e.g. # of times a rule is ignored because of users directives public BasicIgnoreList (IRunner runner) { Runner = runner; ignore = new Dictionary> (); } public IRunner Runner { get; private set; } public void Add (string rule, IMetadataTokenProvider metadata) { HashSet list; if (!ignore.TryGetValue (rule, out list)) { list = new HashSet (); ignore.Add (rule, list); } list.Add (metadata); } // AssemblyDefinition AttributeTargets.Assembly // ModuleDefinition AttributeTargets.Module // TypeDefinition AttributeTargets.Class | Delegate | Enum | Interface | Struct // EventDefinition AttributeTargets.Event // FieldDefinition AttributeTargets.Field // GenericParameterDefinition AttributeTargets.GenericParameter // PropertyDefinition AttributeTargets.Property // MethodDefinition AttributeTargets.Constructor | Method // GenericParameterDefinition AttributeTargets.GenericParameter // ParameterDefinition AttributeTargets.Parameter // MethodReturnType AttributeTargets.ReturnValue // NamespaceDefinition special case public bool IsIgnored (IRule rule, IMetadataTokenProvider metadata) { // Note that the Runner tearing_down code may call us with nulls. if (metadata == null) return false; if ((rule == null) || !rule.Active) return true; HashSet list; if (!ignore.TryGetValue (rule.FullName, out list)) return false; // nothing is ignored for this rule return IsIgnored (list, metadata); } static bool IsIgnored (ICollection list, IMetadataTokenProvider metadata) { MetadataToken token = metadata.MetadataToken; switch (token.TokenType) { case TokenType.Assembly: // NamespaceDefinition is a Gendarme "extention", i.e. not real metadata, but we can ignore defects on them case NamespaceDefinition.NamespaceTokenType: // no parent to check return list.Contains (metadata); case TokenType.Module: // Module == 0, so we need to handle MetadataToken.Zero here if (token.RID == 0) { // if we don't have a valid token then we take the slow path return IsIgnoredUsingCasts (list, metadata); } else { return IsIgnored (list, metadata as ModuleDefinition); } case TokenType.GenericParam: return IsIgnored (list, metadata as GenericParameter); case TokenType.TypeRef: case TokenType.TypeDef: return IsIgnored (list, metadata as TypeReference); case TokenType.Method: return IsIgnored (list, metadata as MethodReference); case TokenType.Event: return IsIgnored (list, metadata as EventDefinition); case TokenType.Field: return IsIgnored (list, metadata as FieldDefinition); case TokenType.Property: return IsIgnored (list, metadata as PropertyDefinition); case TokenType.Param: ParameterDefinition parameter = metadata as ParameterDefinition; if (parameter == null) // return type return IsIgnoredUsingCasts (list, metadata); return IsIgnored (list, parameter); default: return IsIgnoredUsingCasts (list, metadata); } } static bool IsIgnoredUsingCasts (ICollection list, IMetadataTokenProvider metadata) { MethodReturnType mrt = (metadata as MethodReturnType); if (mrt != null) return IsIgnored (list, mrt); // well-known types... AssemblyDefinition ad = (metadata as AssemblyDefinition); if (ad != null) return list.Contains (metadata); ModuleDefinition md = (metadata as ModuleDefinition); if (md != null) return IsIgnored (list, md); GenericParameter gp = (metadata as GenericParameter); // needs to be before TypeReference if (gp != null) return IsIgnored (list, gp); TypeReference tr = (metadata as TypeReference); if (tr != null) return IsIgnored (list, tr); MethodReference mr = (metadata as MethodReference); if (mr != null) return IsIgnored (list, mr); EventDefinition ed = (metadata as EventDefinition); if (ed != null) return IsIgnored (list, ed); FieldDefinition fd = (metadata as FieldDefinition); if (fd != null) return IsIgnored (list, fd); PropertyDefinition pd = (metadata as PropertyDefinition); if (pd != null) return IsIgnored (list, pd); ParameterDefinition paramd = (metadata as ParameterDefinition); if (paramd != null) return IsIgnored (list, paramd); return false; } static bool IsIgnored (ICollection list, ModuleDefinition module) { return (list.Contains (module) || IsIgnored (list, module.Assembly)); } static bool IsIgnored (ICollection list, TypeReference type) { return (list.Contains (type) || IsIgnored (list, type.Module) || IsIgnored (list, NamespaceDefinition.GetDefinition (type.Namespace))); } static bool IsIgnored (ICollection list, EventDefinition evnt) { return (list.Contains (evnt) || IsIgnored (list, evnt.DeclaringType)); } static bool IsIgnored (ICollection list, FieldDefinition field) { return (list.Contains (field) || IsIgnored (list, field.DeclaringType)); } static bool IsIgnored (ICollection list, PropertyDefinition property) { return (list.Contains (property) || IsIgnored (list, property.DeclaringType)); } static bool IsIgnored (ICollection list, MemberReference member) { return (list.Contains (member) || IsIgnored (list, member.DeclaringType)); } static bool IsIgnored (ICollection list, ParameterDefinition parameter) { return (list.Contains (parameter) || IsIgnored (list, parameter.Method)); } static bool IsIgnored (ICollection list, GenericParameter parameter) { return (list.Contains (parameter) || IsIgnored (list, parameter.Owner)); } static bool IsIgnored (ICollection list, MethodReturnType returnType) { return (list.Contains (returnType) || IsIgnored (list, returnType.Method)); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/SolutionAttribute.cs0000664000175000017500000000301512413742070030772 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.SolutionAttribute class // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework { [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class SolutionAttribute : Attribute { public SolutionAttribute (string solution) { Solution = solution; } public string Solution { get; private set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/DocumentationUriAttribute.cs0000664000175000017500000000311512413742070032450 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.DocumentationUriAttribute class // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework { [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public sealed class DocumentationUriAttribute : Attribute { public DocumentationUriAttribute (string documentationUri) { DocumentationUri = new Uri (documentationUri); } public Uri DocumentationUri { get; private set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/Symbols.cs0000664000175000017500000001543512413742070026733 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Symbols // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework { public static class Symbols { // http://blogs.msdn.com/jmstall/archive/2005/06/19/FeeFee_SequencePoints.aspx private const int PdbHiddenLine = 0xFEEFEE; private const string AlmostEqualTo = "\u2248"; private static Instruction ExtractFirst (TypeDefinition type) { if (type == null) return null; foreach (MethodDefinition method in type.Methods) { Instruction ins = ExtractFirst (method); if (ins != null) return ins; } return null; } private static Instruction ExtractFirst (MethodDefinition method) { if ((method == null) || !method.HasBody || method.Body.Instructions.Count == 0) return null; Instruction ins = method.Body.Instructions [0]; // note that the first instruction often does not have a sequence point while (ins != null && ins.SequencePoint == null) ins = ins.Next; return (ins != null && ins.SequencePoint != null) ? ins : null; } private static TypeDefinition FindTypeFromLocation (IMetadataTokenProvider location) { MethodDefinition method = (location as MethodDefinition); if (method != null) return method.DeclaringType; FieldDefinition field = (location as FieldDefinition); if (field != null) return field.DeclaringType; ParameterDefinition parameter = (location as ParameterDefinition); if (parameter != null) return FindTypeFromLocation (parameter.Method); return (location as TypeDefinition); } private static MethodDefinition FindMethodFromLocation (IMetadataTokenProvider location) { ParameterDefinition parameter = (location as ParameterDefinition); if (parameter != null) return (parameter.Method as MethodDefinition); MethodReturnType return_type = (location as MethodReturnType); if (return_type != null) return (return_type.Method as MethodDefinition); return (location as MethodDefinition); } private static string FormatSequencePoint (SequencePoint sp, bool exact) { return FormatSequencePoint (sp.Document.Url, sp.StartLine, sp.StartColumn, exact); } // It would probably be a good idea to move this formatting into // the reporting layer. The XML formatter would ideally not do // any formatting at all so that tools could extract the line // and column information without complex parsing. // // We might also want to allow some sort of customization of the // formatting used by the text reporter. For example, most editors // on the Mac have direct support for paths like foo/bar.cs:10 // which include line numbers and foo/bar.cs:10:5 for paths which // include line and column. private static string FormatSequencePoint (string document, int line, int column, bool exact) { string sline = (line == PdbHiddenLine) ? "unavailable" : line.ToString (CultureInfo.InvariantCulture); // MDB (mono symbols) does not provide any column information (so we don't show any) // there's also no point in showing a column number if we're not totally sure about the line if (exact && (column > 0)) return String.Format (CultureInfo.InvariantCulture, "{0}({1},{2})", document, sline, column); return String.Format (CultureInfo.InvariantCulture, "{0}({2}{1})", document, sline, exact ? String.Empty : AlmostEqualTo); } private static string GetSource (Instruction ins) { // try to find the closed sequence point for this instruction Instruction search = ins; bool feefee = false; while (search != null) { // find the first entry, going backward, with a SequencePoint if (search.SequencePoint != null) { // skip entries that are hidden (0xFEEFEE) if (search.SequencePoint.StartLine != PdbHiddenLine) return FormatSequencePoint (search.SequencePoint, feefee); // but from here on we're not 100% sure about line numbers feefee = true; } search = search.Previous; } // no details, we only have the IL offset to report return String.Format (CultureInfo.InvariantCulture, "debugging symbols unavailable, IL offset 0x{0:x4}", ins.Offset); } static private string FormatSource (Instruction candidate) { int line = candidate.SequencePoint.StartLine; // we approximate (line - 1, no column) to get (closer) to the definition // unless we have the special 0xFEEFEE value (used in PDB for hidden source code) if (line != PdbHiddenLine) line--; return FormatSequencePoint (candidate.SequencePoint.Document.Url, line, 0, false); } static public string GetSource (Defect defect) { if (defect == null) return String.Empty; if (defect.Instruction != null) return GetSource (defect.Instruction); // rule didn't provide an Instruction but we do our best to // find something since this is our only link to the source code Instruction candidate; TypeDefinition type = null; // MethodDefinition, ParameterDefinition // return the method source file with (approximate) line number MethodDefinition method = FindMethodFromLocation (defect.Location); if (method != null) { candidate = ExtractFirst (method); if (candidate != null) return FormatSource (candidate); // we may still be lucky to find the (a) source file for the type itself type = method.DeclaringType; } // TypeDefinition, FieldDefinition // return the type source file (based on the first ctor) if (type == null) type = FindTypeFromLocation (defect.Location); candidate = ExtractFirst (type); if (candidate != null) return FormatSource (candidate); return String.Empty; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/IRunner.cs0000664000175000017500000000642212413742070026661 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.IRunner interface // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Collections.ObjectModel; using System.Runtime.InteropServices; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Framework { /// /// Rules will have access to the runner thru this interface. /// This makes it possible, to anyone, to make it's own runner without using /// the provided base class. /// [ComVisible (false)] public interface IRunner { /// /// This expose the list of rules, so rules can also act on them. /// E.g. Rule X is a superset of rule Y so Y disable itself is X is present /// Collection Rules { get; } /// /// This expose the list of assemblies so rules can act on them as "a set". /// E.g. applying a rule based on data outside the current assembly /// Collection Assemblies { get; } IIgnoreList IgnoreList { get; set; } Collection Defects { get; } int DefectsLimit { get; } Bitmask SeverityBitmask { get; } Bitmask ConfidenceBitmask { get; } int VerbosityLevel { get; } EngineController Engines { get; } /// /// Helper property to avoid each rule having it's own state/logic about /// the result (RuleResult.Success or RuleResult.Failure) of its analysis /// RuleResult CurrentRuleResult { get; } event EventHandler AnalyzeAssembly; // ??? ProcessAssembly ??? event EventHandler AnalyzeModule; event EventHandler AnalyzeType; event EventHandler AnalyzeMethod; void Initialize (); void Report (Defect defect); void Report (IMetadataTokenProvider metadata, Severity severity, Confidence confidence); void Report (IMetadataTokenProvider metadata, Severity severity, Confidence confidence, string message); void Report (MethodDefinition method, Instruction ins, Severity severity, Confidence confidence); void Report (MethodDefinition method, Instruction ins, Severity severity, Confidence confidence, string message); void TearDown (); } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/Bitmask.cs0000664000175000017500000001223312413742070026666 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Bitmask class // // Authors: // Sebastien Pouliot // // 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; using System.Text; namespace Gendarme.Framework { /// /// Provide a bitmask, up to 64 bits, based on an enum or integral value /// (sadly this can't be restricted to enums/integral types using 'where'). /// /// Type on which the bitmask is based. public class Bitmask : IEquatable> where T : struct, IConvertible { ulong mask; /// /// Construct a bitmask will all bits clear. /// public Bitmask () { } /// /// Construct a bitmask will all bits set (true) or clear (false) /// /// public Bitmask (bool initialValues) { if (initialValues) mask = UInt64.MaxValue; } // note: the GetHashCode works because both enums and integral // types values are identical to their hash code /// /// Clear the bit represent by the parameter. /// /// Value to clear in the bitmask public void Clear (T bit) { unchecked { mask &= ~((ulong) 1 << bit.ToInt32 (null)); } } /// /// Clear all bits /// public void ClearAll () { mask = 0; } public int Count () { if (mask == 0) return 0; int count = 0; for (int i = 0; i < 64; i++) { if (((mask >> i) & 1) == 1) count++; } return count; } /// /// Get the bit represented by the parameter /// /// Value to get in the bitmask /// True if the bit is set, false otherwise. public bool Get (T bit) { return (((mask >> bit.ToInt32 (null)) & 1) == 1); } /// /// Set the bit represented by the parameter /// /// Value to set in the bitmask public void Set (T bit) { mask |= ((ulong) 1 << bit.ToInt32 (null)); } /// /// Set all bits /// public void SetAll () { mask = UInt64.MaxValue; } private void SetRange (int start, int end) { while (start < end) { mask |= ((ulong) 1 << start++); } } /// /// Set all bits, from 'value' down to 0. /// /// public void SetDown (T bit) { SetRange (0, bit.ToInt32 (null) + 1); } /// /// Set all bits, from 'value' up to the maximum. /// /// public void SetUp (T bit) { SetRange (bit.ToInt32 (null), 64); } /// /// Does this bitmask intersects with the specified bitmask. /// /// Bitmask to compare /// True if the bitmask intersects with the specified bitmask, False otherwise. public bool Intersect (Bitmask bitmask) { if (bitmask == null) return (mask == 0); return ((mask & bitmask.mask) != 0); } /// /// Is this bitmask a subset of the specified bitmask. /// /// Bitmask to compare (potential superset) /// True if the bitmask is a subset of the specified bitmask, False otherwise. public bool IsSubsetOf (Bitmask bitmask) { if (bitmask == null) return false; return ((mask & bitmask.mask) == mask); } public override bool Equals (object obj) { Bitmask other = (obj as Bitmask); return Equals (other); } public bool Equals (Bitmask other) { if (other == null) return false; return (mask == other.mask); } public override int GetHashCode () { return unchecked ((int) (mask ^ (mask >> 32))); } public override string ToString () { if (mask == 0) return "0"; StringBuilder sb = new StringBuilder (); bool value = false; for (int i = 63; i >= 0; i--) { if (((mask >> i) & 1) == 1) { sb.Append ("1"); value = true; } else if (value) { sb.Append ("0"); } } return sb.ToString (); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/IMethodRule.cs0000664000175000017500000000257712413742070027467 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.IMethodRule interface // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; namespace Gendarme.Framework { public interface IMethodRule : IRule { RuleResult CheckMethod (MethodDefinition method); } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/Defect.cs0000664000175000017500000000630712413742070026473 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Defect // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework { public class Defect { private string source; public Defect (IRule rule, IMetadataTokenProvider target, IMetadataTokenProvider location, Severity severity, Confidence confidence, string text) { if (rule == null) throw new ArgumentNullException ("rule"); if (target == null) throw new ArgumentNullException ("target"); if (location == null) throw new ArgumentNullException ("location"); Rule = rule; Target = target; Location = location; Confidence = confidence; Severity = severity; Text = text; } public Defect (IRule rule, IMetadataTokenProvider target, IMetadataTokenProvider location, Severity severity, Confidence confidence) : this (rule, target, location, severity, confidence, String.Empty) { } public Defect (IRule rule, IMetadataTokenProvider target, MethodDefinition location, Instruction ins, Severity severity, Confidence confidence, string text) : this (rule, target, location, severity, confidence, text) { Instruction = ins; } public Defect (IRule rule, IMetadataTokenProvider target, MethodDefinition location, Instruction ins, Severity severity, Confidence confidence) : this (rule, target, location, ins, severity, confidence, String.Empty) { } public AssemblyDefinition Assembly { get { return Target.GetAssembly (); } } public Confidence Confidence { get; private set; } public Instruction Instruction { get; private set; } public IMetadataTokenProvider Location { get; private set; } public IRule Rule { get; private set; } public Severity Severity { get; private set; } public string Source { get { if (source == null) source = Symbols.GetSource (this); return source; } } public IMetadataTokenProvider Target { get; private set; } public string Text { get; private set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/IIgnoreList.cs0000664000175000017500000000305012413742070027461 0ustar00directhexdirecthex00000000000000// // IIgnoreList interface // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using Mono.Cecil; namespace Gendarme.Framework { /// /// This interface defines how to query the ignore list /// public interface IIgnoreList { IRunner Runner { get; } void Add (string rule, IMetadataTokenProvider metadata); bool IsIgnored (IRule rule, IMetadataTokenProvider metadata); } }mono-tools-4.2/gendarme/framework/Gendarme.Framework/Runner.cs0000664000175000017500000003062012413742070026545 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Runner // // Authors: // Sebastien Pouliot // // Copyright (C) 2008-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.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Runtime.InteropServices; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Framework { abstract public class Runner : IRunner { private Collection defect_list = new Collection (); private int defects_limit = Int32.MaxValue; private Bitmask severity_bitmask = new Bitmask (true); private Bitmask confidence_bitmask = new Bitmask (true); private Collection rules = new Collection (); private Collection assemblies = new Collection (); private int verbose_level; private IEnumerable assembly_rules; private IEnumerable type_rules; private IEnumerable method_rules; private IRule currentRule; private IMetadataTokenProvider currentTarget; private IIgnoreList ignoreList; private int defectCountBeforeCheck; private object [] engine_dependencies; public event EventHandler AnalyzeAssembly; public event EventHandler AnalyzeModule; public event EventHandler AnalyzeType; public event EventHandler AnalyzeMethod; protected IRule CurrentRule { get { return currentRule; } set { currentRule = value; } } protected IMetadataTokenProvider CurrentTarget { get { return currentTarget; } set { currentTarget = value; } } public IIgnoreList IgnoreList { get { if (ignoreList == null) throw new InvalidOperationException ("No IgnoreList has been set for this runner."); return ignoreList; } set { ignoreList = value; } } public Collection Rules { get { return rules; } } public Collection Assemblies { get { return assemblies; } } public Collection Defects { get { return defect_list; } } public int DefectsLimit { get { return defects_limit; } set { if (value < 0) throw new ArgumentException ("Cannot be negative", "DefectsLimit"); defects_limit = value; } } public Bitmask SeverityBitmask { get { return severity_bitmask; } } public Bitmask ConfidenceBitmask { get { return confidence_bitmask; } } public int VerbosityLevel { get { return verbose_level; } set { verbose_level = value; } } private EngineController ec; public EngineController Engines { get { if (ec == null) ec = new EngineController (this); return ec; } } // once every assembly are loaded *and* all the rules are known -> we initialized all rules. // this ensure that the list of assemblies is available at rule initialization time // which allows caching information and treating the assemblies as "a set" public virtual void Initialize () { AnalyzeAssembly = null; AnalyzeModule = null; AnalyzeType = null; AnalyzeMethod = null; AssemblyResolver resolver = AssemblyResolver.Resolver; resolver.AssemblyCache.Clear (); foreach (AssemblyDefinition assembly in assemblies) { assembly.MainModule.LoadDebuggingSymbols (); resolver.CacheAssembly (assembly); } foreach (Rule rule in rules) { try { // don't initialize rules that *we*, the runner, don't want // to execute later (this also avoids the rule logic to reset // the Active property during optimizations) if (rule.Active) rule.Initialize (this); } catch (Exception e) { // if something goes wrong in initialization we desactivate the rule if (VerbosityLevel > 0) Console.Error.WriteLine (e); rule.Active = false; } } engine_dependencies = GetType ().GetCustomAttributes (typeof (EngineDependencyAttribute), true); if (engine_dependencies.Length > 0) { // subscribe to each engine the rule depends on foreach (EngineDependencyAttribute eda in engine_dependencies) { Engines.Subscribe (eda.EngineType); } } Engines.Build (assemblies); assembly_rules = rules.OfType (); type_rules = rules.OfType (); method_rules = rules.OfType (); } private bool Filter (Severity severity, Confidence confidence, IMetadataTokenProvider location) { if (!SeverityBitmask.Get (severity) || !ConfidenceBitmask.Get (confidence)) return false; // for Assembly | Type | Methods we can ignore before executing the rule // but for others (e.g. Parameters, Fields...) we can only ignore the results return !IgnoreList.IsIgnored (currentRule, location); } public virtual void Report (Defect defect) { if (defect == null) throw new ArgumentNullException ("defect"); if (!Filter (defect.Severity, defect.Confidence, defect.Location)) return; if (IgnoreList.IsIgnored (defect.Rule, defect.Target)) return; defect_list.Add (defect); } public void Report (IMetadataTokenProvider metadata, Severity severity, Confidence confidence) { // check here to avoid creating the Defect object if (!Filter (severity, confidence, metadata)) return; Defect defect = new Defect (currentRule, currentTarget, metadata, severity, confidence); Report (defect); } public void Report (IMetadataTokenProvider metadata, Severity severity, Confidence confidence, string message) { // check here to avoid creating the Defect object if (!Filter (severity, confidence, metadata)) return; Defect defect = new Defect (currentRule, currentTarget, metadata, severity, confidence, message); Report (defect); } public void Report (MethodDefinition method, Instruction ins, Severity severity, Confidence confidence) { // check here to avoid creating the Defect object if (!Filter (severity, confidence, method)) return; Defect defect = new Defect (currentRule, currentTarget, method, ins, severity, confidence); Report (defect); } public void Report (MethodDefinition method, Instruction ins, Severity severity, Confidence confidence, string message) { // check here to avoid creating the Defect object if (!Filter (severity, confidence, method)) return; Defect defect = new Defect (currentRule, currentTarget, method, ins, severity, confidence, message); Report (defect); } public void Reset () { defectCountBeforeCheck = 0; Defects.Clear (); SeverityBitmask.SetAll (); ConfidenceBitmask.SetAll (); } private void OnEvent (EventHandler handler, RunnerEventArgs e) { if (handler != null) handler (this, e); } static bool VisibilityCheck (ApplicabilityScope scope, bool visible) { switch (scope) { case ApplicabilityScope.Visible: return visible; case ApplicabilityScope.NonVisible: return !visible; default: return true; } } // protected since a higher-level (e.g. GUI) runner might want to override // them to update it's user interface protected virtual void OnAssembly (RunnerEventArgs e) { OnEvent (AnalyzeAssembly, e); foreach (IAssemblyRule rule in assembly_rules) { defectCountBeforeCheck = Defects.Count; // stop if we reach the user defined defect limit if (defectCountBeforeCheck >= DefectsLimit) break; // ignore the rule on some user defined assemblies if (IgnoreList.IsIgnored (rule, e.CurrentAssembly)) continue; currentRule = rule; rule.CheckAssembly (e.CurrentAssembly); } } protected virtual void OnModule (RunnerEventArgs e) { OnEvent (AnalyzeModule, e); // Since it has never been used in the previous years // this version of the Gendarme framework doesn't // support IModuleRule. Nor do we support ignore on // modules. } protected virtual void OnType (RunnerEventArgs e) { OnEvent (AnalyzeType, e); foreach (ITypeRule rule in type_rules) { defectCountBeforeCheck = Defects.Count; // stop if we reach the user defined defect limit if (defectCountBeforeCheck >= DefectsLimit) break; // ignore if the visibility does not match user selection ApplicabilityScope scope = rule.ApplicabilityScope; if ((scope != ApplicabilityScope.All) && !VisibilityCheck (scope, e.CurrentType.IsVisible ())) continue; // ignore the rule on some user defined types if (IgnoreList.IsIgnored (rule, e.CurrentType)) continue; currentRule = rule; rule.CheckType (e.CurrentType); } } protected virtual void OnMethod (RunnerEventArgs e) { OnEvent (AnalyzeMethod, e); foreach (IMethodRule rule in method_rules) { defectCountBeforeCheck = Defects.Count; // stop if we reach the user defined defect limit if (defectCountBeforeCheck >= DefectsLimit) break; // ignore if the visibility does not match user selection ApplicabilityScope scope = rule.ApplicabilityScope; if ((scope != ApplicabilityScope.All) && !VisibilityCheck (scope, e.CurrentMethod.IsVisible ())) continue; // ignore the rule on some user defined methods if (IgnoreList.IsIgnored (rule, e.CurrentMethod)) continue; currentRule = rule; rule.CheckMethod (e.CurrentMethod); } } /// /// /// /// Return RuleResult.Failure is the number of defects has grown since /// the rule Check* method was called or RuleResult.Success otherwise public RuleResult CurrentRuleResult { get { return (Defects.Count > defectCountBeforeCheck) ? RuleResult.Failure : RuleResult.Success; } } /// /// For all assemblies, every modules in each assembly, every /// type in each module, every methods in each type call all /// applicable rules. /// public virtual void Run () { RunnerEventArgs runner_args = new RunnerEventArgs (this); foreach (AssemblyDefinition assembly in assemblies) { currentTarget = (IMetadataTokenProvider) assembly; runner_args.CurrentAssembly = assembly; OnAssembly (runner_args); foreach (ModuleDefinition module in assembly.Modules) { currentTarget = (IMetadataTokenProvider) module; runner_args.CurrentModule = module; OnModule (runner_args); foreach (TypeDefinition type in module.GetAllTypes ()) { currentTarget = (IMetadataTokenProvider) type; runner_args.CurrentType = type; OnType (runner_args); foreach (MethodDefinition method in type.Methods) { currentTarget = (IMetadataTokenProvider) method; runner_args.CurrentMethod = method; OnMethod (runner_args); } } } } // don't report them if we hit an exception after analysis is completed (e.g. in reporting) currentRule = null; currentTarget = null; } public virtual void TearDown () { // last chance to report defects foreach (Rule rule in rules) { currentRule = rule; rule.TearDown (); } currentRule = null; if ((engine_dependencies != null) && (engine_dependencies.Length >= 0)) { foreach (EngineDependencyAttribute eda in engine_dependencies) ec.Unsubscribe (eda.EngineType); } ec.TearDown (); } // This is for unit tests. public virtual void TearDown (IRule rule) { currentRule = rule; rule.TearDown (); currentRule = null; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/FxCopCompatibilityAttribute.cs0000664000175000017500000000460012413742070032730 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.FxCopCompatibilityAttribute class // // Authors: // Sebastien Pouliot // // 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 Gendarme.Framework { /// /// Attribute to map Gendarme rules with their (quasi)equivalent in FxCop. /// It's possible for a Gendarme rule to implement several FxCop rules. /// [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public sealed class FxCopCompatibilityAttribute : Attribute { /// /// Create an mapping between the Gendarme rule and a FxCop rule /// /// FxCop rule category /// FxCop rule identifier (2 letters, 4 numbers) public FxCopCompatibilityAttribute (string category, string checkId) { Category = category; CheckId = checkId; } /// /// Rule category. /// e.g. "Microsoft.Usage" /// public string Category { get; internal set; } /// /// Rule identifier. The identifier is not guaranteed to be unique without it's category. /// e.g. "CA2232:MarkWindowsFormsEntryPointsWithStaThread" (recommanded) or /// or simply "CA2232" (harder to maintain) /// public string CheckId { get; internal set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/IRule.cs0000664000175000017500000000654712413742070026327 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.IRule interface // // Authors: // Sebastien Pouliot // // 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 Gendarme.Framework { /// /// Most basic way to manipulate a rule. To create a new rule you should consider /// to inherit from Rule and implement IAssemblyRule, ITypeRule and/or IMethodRule. /// public interface IRule { /// /// Turn on or off the rule. The runner won't call a Check* method on rules /// where Active is false. This is useful when used with the runner's events /// to turn off a rule if we know it's useless (e.g. for an assembly). /// bool Active { get; set; } /// /// Return the instance of the current runner. /// IRunner Runner { get; } /// /// Short name for the rule. /// string Name { get; } /// /// Unique name for the rule. /// string FullName { get; } /// /// URI to the rule documentation. /// Uri Uri { get; } /// /// Short abstract of the problem that the rule is looking for. /// For a complete description end-users should read the documentation URI. /// string Problem { get; } /// /// Short abstract of the solution to this problem. For a complete solution /// with examples (both good and bad) end-users should read the documentation URI. /// string Solution { get; } /// /// The runner will initialize each rule before starting analyzing any assembly. /// /// Runner that will execute the rule during analysis. void Initialize (IRunner runner); /// /// The runner will call TearDown on every rule once the analysis is over. /// This is the last chance to report defects to the runner and the best place to clean up /// any temporary data (that is not required for reporting). /// This will be called even if Initialize was not called on the rule (e.g. an unused rule). /// void TearDown (); /// /// Defines the how the rule are going to be applied to a /// target according its visibility modifier. /// ApplicabilityScope ApplicabilityScope {get; set;} } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/Rule.cs0000664000175000017500000001325012413742070026203 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rule base class // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; namespace Gendarme.Framework { /// /// Most rules should be able to inherit from Rule and implement one of the /// IAssemblyRule, ITypeRule or IMethodRule and override /// the Check[Assembly|Type|Method] method. /// abstract public class Rule : IRule { private bool active = true; private string name; private string full_name; private string problem; private string solution; private Uri uri; private Type type; private ApplicabilityScope applicability_scope = ApplicabilityScope.All; private object [] engine_dependencies = null; /// /// Return true if the rule is currently active, false otherwise. /// public virtual bool Active { get { return active; } set { active = value; } } /// /// Return the runner executing the rule. This is helpful to get information /// outside the rule, like the list of assemblies being analyzed. /// public IRunner Runner { get; private set; } /// /// Return the short name of the rule. /// By default this returns the name of the current class. /// public virtual string Name { get { if (name == null) name = Type.Name; return name; } } /// /// Return the full name of the rule. /// By default this returns the full name of the current class. /// public virtual string FullName { get { if (full_name == null) full_name = Type.FullName; return full_name; } } private Type Type { get { if (type == null) type = GetType (); return type; } } private object GetCustomAttribute (Type t) { object [] attributes = Type.GetCustomAttributes (t, true); if (attributes.Length == 0) return null; return attributes [0]; } public virtual string Problem { get { if (problem == null) { object obj = GetCustomAttribute (typeof (ProblemAttribute)); if (obj == null) problem = "Missing [Problem] attribute on rule."; else problem = (obj as ProblemAttribute).Problem; } return problem; } } public virtual string Solution { get { if (solution == null) { object obj = GetCustomAttribute (typeof (SolutionAttribute)); if (obj == null) solution = "Missing [Solution] attribute on rule."; else solution = (obj as SolutionAttribute).Solution; } return solution; } } /// /// Return an Uri instance to the rule documentation. /// By default, if no [DocumentationUri] attribute is used on the rule, this returns: /// http://www.mono-project.com/{rule name space}#{rule name} /// public virtual Uri Uri { get { if (uri == null) { object [] attributes = Type.GetCustomAttributes (typeof (DocumentationUriAttribute), true); if (attributes.Length == 0) { string url = String.Format (CultureInfo.InvariantCulture, "https://github.com/spouliot/gendarme/wiki/{0}.{1}({2})", type.Namespace, Name, "2.10"); uri = new Uri (url); } else { uri = (attributes [0] as DocumentationUriAttribute).DocumentationUri; } } return uri; } } /// /// Initialize the rule. This is where rule can do it's heavy initialization /// since the assemblies to be analyzed are already known (and accessible thru /// the runner parameter). /// /// The runner that will execute this rule. public virtual void Initialize (IRunner runner) { if (runner == null) throw new ArgumentNullException ("runner"); Runner = runner; // read attribute only once (e.g. the wizard can initialize multiple times) if (engine_dependencies == null) engine_dependencies = Type.GetCustomAttributes (typeof (EngineDependencyAttribute), true); if (engine_dependencies.Length == 0) return; // subscribe to each engine the rule depends on foreach (EngineDependencyAttribute eda in engine_dependencies) { runner.Engines.Subscribe (eda.EngineType); } } public virtual void TearDown () { if ((engine_dependencies == null) || (engine_dependencies.Length == 0)) return; foreach (EngineDependencyAttribute eda in engine_dependencies) { Runner.Engines.Unsubscribe (eda.EngineType); } } public ApplicabilityScope ApplicabilityScope { get { return applicability_scope; } set { applicability_scope = value; } } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/HierarchicalEventArgs.cs0000664000175000017500000000415612413742070031476 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.HierarchicalEventArgs // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; namespace Gendarme.Framework { abstract public class HierarchicalEventArgs : EventArgs { private AssemblyDefinition assembly; private ModuleDefinition module; private TypeDefinition type; private MethodDefinition method; public AssemblyDefinition CurrentAssembly { get { return assembly; } set { if (value != assembly) { assembly = value; module = null; type = null; method = null; } } } public ModuleDefinition CurrentModule { get { return module; } set { if (value != module) { module = value; type = null; method = null; } } } public TypeDefinition CurrentType { get { return type; } set { if (value != type) { type = value; method = null; } } } public MethodDefinition CurrentMethod { get { return method; } set { method = value; } } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/AssemblyResolver.cs0000664000175000017500000000524012413742070030575 0ustar00directhexdirecthex00000000000000// // AssemblyResolver.cs // // Author: // Jb Evain (jbevain@novell.com) // Sebastien Pouliot // // Copyright (C) 2007-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; using System.Collections; using System.Collections.Generic; using System.IO; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework { public class AssemblyResolver : BaseAssemblyResolver { Dictionary assemblies; private AssemblyResolver () { assemblies = new Dictionary (); } public IDictionary AssemblyCache { get { return assemblies; } } public override AssemblyDefinition Resolve (AssemblyNameReference name) { if (name == null) throw new ArgumentNullException ("name"); string aname = name.Name; AssemblyDefinition asm = null; if (!assemblies.TryGetValue (aname, out asm)) { try { asm = base.Resolve (name); } catch (FileNotFoundException) { // note: analysis will be incomplete } assemblies.Add (aname, asm); } return asm; } public void CacheAssembly (AssemblyDefinition assembly) { if (assembly == null) throw new ArgumentNullException ("assembly"); assemblies.Add (assembly.Name.Name, assembly); string location = Path.GetDirectoryName (assembly.MainModule.FullyQualifiedName); AddSearchDirectory (location); } static private AssemblyResolver resolver; static public AssemblyResolver Resolver { get { if (resolver == null) resolver = new AssemblyResolver (); return resolver; } } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/EngineDependencyAttribute.cs0000664000175000017500000000403512413742070032365 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.EngineDependencyAttribute // // Authors: // Sebastien Pouliot // // 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 Gendarme.Framework { /// /// This attribute is needed to declare that a rule depends on an a engine. /// This guarantee that the engine will have done it's job prior to the /// Runner calls into the rules Check* methods /// [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public sealed class EngineDependencyAttribute : Attribute { public EngineDependencyAttribute (Type engineType) { if (engineType == null) throw new ArgumentNullException ("engineType"); EngineType = engineType.FullName; } public EngineDependencyAttribute (string engineType) { if (engineType == null) throw new ArgumentNullException ("engineType"); EngineType = engineType; } public string EngineType { get; internal set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/Confidence.cs0000664000175000017500000000426012413742070027332 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Confidence // // Authors: // Sebastien Pouliot // // 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 Gendarme.Framework { /// /// The level of confidence about the rule results. The more /// confidence the less likely the rule will return false positives. /// [Serializable] public enum Confidence { /// /// The rule is 100% certain of its result. /// There should never be false positives for Total. /// Total, /// /// The rule is near 100% certain of its result. /// A few false-positives are possible. /// High, /// /// The rule has found a potential defect but cannot be certain of the result. /// Some false positive are to be expected in the results. /// Normal, /// /// The rule doesn't have enough information to be certain about the defect. /// Many of the results are likely to be false positives. /// By default some runners wont display results if the confidence on the defect is low. /// Low } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/RuleResult.cs0000664000175000017500000000371712413742070027411 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.RuleResult enumeration // // Authors: // Sebastien Pouliot // // 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 Gendarme.Framework { [Serializable] public enum RuleResult { /// /// Rules returns this if the required conditions to execute /// are not matched. This is useful to make rules more /// readable (it's not a real success) and for statistics. /// DoesNotApply, /// /// Rules returns this if it has executed its logic and has /// not found any defect. /// Success, /// /// Rules returns this if it has executed its logic and has /// found one or more defects. /// Failure, /// /// Rules should never report this. The framework will use /// this value to track errors in rule execution. /// Abort } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/ThreadModelAttribute.cs0000664000175000017500000001071212413742070031350 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.ThreadModelAttribute class // // Authors: // Jesse Jones // // (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; // Note that these types are extended version of what we recommend // that users use. See DecorateThreadsRule documentation for a smaller version namespace Gendarme.Framework { /// Used with . [Serializable] public enum ThreadModel { /// The code may run safely only under the main thread. /// This is the default for code in the assemblies being checked. MainThread = 0x0000, /// The code may run under a single arbitrary thread. SingleThread = 0x0001, /// The code may run under multiple threads, but only if the /// execution is serialized (e.g. by user level locking). Serializable = 0x0002, /// The code may run under multiple threads concurrently without user /// locking. /// This is the default for code in the System/Mono namespaces. Concurrent = 0x0003, /// Or this with the above for the rare cases where the code cannot be /// shown to be correct using a static analysis. AllowEveryCaller = 0x0008, } /// Used to precisely specify the threading semantics of code. [Serializable] [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate | AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] public sealed class ThreadModelAttribute : Attribute, IEquatable { public ThreadModelAttribute (ThreadModel model) { ThreadModel value = model & ~ThreadModel.AllowEveryCaller; if ((value < ThreadModel.MainThread) || (value > ThreadModel.Concurrent)) throw new ArgumentException (model.ToString () + " is not a valid ThreadModel value."); Model = model & (ThreadModel) 0x0007; AllowsEveryCaller = (model & ThreadModel.AllowEveryCaller) != 0; } public ThreadModel Model { get; set; } public bool AllowsEveryCaller { get; set; } #region Overrides and Operators public override string ToString () { if (AllowsEveryCaller) return String.Format (CultureInfo.InvariantCulture, "{0} | AllowEveryCaller", Model); return Model.ToString (); } public override bool Equals (object obj) { if (obj == null) return false; ThreadModelAttribute rhs = obj as ThreadModelAttribute; return this == rhs; } public bool Equals (ThreadModelAttribute other) { return this == other; } public static bool operator== (ThreadModelAttribute lhs, ThreadModelAttribute rhs) { if (object.ReferenceEquals (lhs, rhs)) return true; if ((object) lhs == null || (object) rhs == null) return false; if (lhs.Model != rhs.Model) return false; if (lhs.AllowsEveryCaller != rhs.AllowsEveryCaller) return false; return true; } public static bool operator!= (ThreadModelAttribute lhs, ThreadModelAttribute rhs) { return !(lhs == rhs); } public override int GetHashCode () { int hash = 0; unchecked { hash += Model.GetHashCode (); hash += AllowsEveryCaller.GetHashCode (); } return hash; } #endregion } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/EngineController.cs0000664000175000017500000001407512413742070030553 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.EngineController // // Authors: // Sebastien Pouliot // // Copyright (C) 2008-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.Generic; using Mono.Cecil; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; namespace Gendarme.Framework { public class EngineController { private Dictionary engines; public EngineController (IRunner runner) { Runner = runner; engines = new Dictionary (); } public IRunner Runner { get; private set; } public void Subscribe (string engineName) { Engine engine; if (!engines.TryGetValue (engineName, out engine)) { Type type = Type.GetType (engineName); engine = (Engine) Activator.CreateInstance (type); engines.Add (type.FullName, engine); } engine.Initialize (this); } public void Unsubscribe (string engineName) { Engine engine; if (engines.TryGetValue (engineName, out engine)) { engine.TearDown (); engines.Remove (engineName); } } public event EventHandler BuildingCustomAttributes; public event EventHandler BuildingMethodBody; public event EventHandler BuildingType; public event EventHandler BuildingModule; public event EventHandler BuildingAssembly; public void Build (IList list) { if (list == null) throw new ArgumentNullException ("list"); EngineEventArgs e = new EngineEventArgs (this); foreach (AssemblyDefinition assembly in list) { Build (assembly, e); foreach (ModuleDefinition module in assembly.Modules) { Build (module, e); foreach (TypeDefinition type in module.GetAllTypes ()) { Build (type, e); if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) Build (method, e); } } } } } private void BuildCustomAttributes (ICustomAttributeProvider custom, EngineEventArgs e) { if (custom.HasCustomAttributes) { EventHandler handler = BuildingCustomAttributes; if (handler != null) handler (custom, e); } } private void Build (MethodDefinition method, EngineEventArgs e) { e.CurrentMethod = method; BuildCustomAttributes (method, e); if (method.HasGenericParameters) { // TODO: incomplete - only covers custom attributes foreach (GenericParameter gp in method.GenericParameters) BuildCustomAttributes (gp, e); } if (method.HasParameters) { // TODO: incomplete - only covers custom attributes foreach (ParameterDefinition parameter in method.Parameters) BuildCustomAttributes (parameter, e); } // TODO: incomplete - only covers custom attributes BuildCustomAttributes (method.MethodReturnType, e); if (method.HasBody) { EventHandler handler = BuildingMethodBody; if (handler != null) handler (method.Body, e); } } private void Build (TypeDefinition type, EngineEventArgs e) { e.CurrentType = type; EventHandler handler = BuildingType; if (handler != null) handler (type, e); BuildCustomAttributes (type, e); if (type.HasEvents) { // TODO: incomplete - only covers custom attributes foreach (EventDefinition evnt in type.Events) BuildCustomAttributes (evnt, e); } if (type.HasFields) { // TODO: incomplete - only covers custom attributes foreach (FieldDefinition field in type.Fields) BuildCustomAttributes (field, e); } if (type.HasGenericParameters) { // TODO: incomplete - only covers custom attributes foreach (GenericParameter gp in type.GenericParameters) BuildCustomAttributes (gp, e); } if (type.HasProperties) { // TODO: incomplete - only covers custom attributes foreach (PropertyDefinition prop in type.Properties) BuildCustomAttributes (prop, e); } } private void Build (ModuleDefinition module, EngineEventArgs e) { e.CurrentModule = module; EventHandler handler = BuildingModule; if (handler != null) handler (module, e); BuildCustomAttributes (module, e); } private void Build (AssemblyDefinition assembly, EngineEventArgs e) { e.CurrentAssembly = assembly; EventHandler handler = BuildingAssembly; if (handler != null) handler (assembly, e); BuildCustomAttributes (assembly, e); } public void TearDown () { BuildingCustomAttributes = null; BuildingMethodBody = null; BuildingType = null; BuildingModule = null; BuildingAssembly = null; foreach (Engine engine in engines.Values) { engine.TearDown (); } } public Engine this [string name] { get { Engine engine = null; engines.TryGetValue (name, out engine); return engine; } } // shortcuts to well known engines // this avoid casting inside the rules public OpCodeEngine OpCode { get { return (OpCodeEngine) this ["Gendarme.Framework.OpCodeEngine"]; } } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework/EngineEventArgs.cs0000664000175000017500000000272312413742070030323 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.EngineEventArgs // // Authors: // Sebastien Pouliot // // 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. namespace Gendarme.Framework { public class EngineEventArgs : HierarchicalEventArgs { public EngineEventArgs (EngineController controller) { Controller = controller; } public EngineController Controller { get; private set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/0000775000175000017500000000000012642235741026032 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/FieldRocks.cs0000664000175000017500000000523612413742070030406 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.FieldRocks // // Authors: // Sebastien Pouliot // Andreas Noever // // Copyright (C) 2008, 2010 Novell, Inc (http://www.novell.com) // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; namespace Gendarme.Framework.Rocks { public static class FieldRocks { /// /// Check if the field was generated by the compiler or a tool (i.e. not by the developer). /// This can occurs (compiler) with auto-implemented properties (C# 3) /// /// The FieldReference on which the extension method can be called. /// True if the field was not added directly by the developer, False otherwise public static bool IsGeneratedCode (this FieldReference self) { if (self == null) return false; FieldDefinition field = self.Resolve (); if (field == null) return false; if (field.HasAnyGeneratedCodeAttribute ()) return true; return field.DeclaringType.IsGeneratedCode (); } /// /// Check if the field is visible outside of the assembly. /// /// The FieldReference on which the extension method can be called. /// True if the field can be used from outside of the assembly, false otherwise. public static bool IsVisible (this FieldReference self) { if (self == null) return false; FieldDefinition field = self.Resolve (); if ((field == null) || field.IsPrivate || field.IsAssembly) return false; return field.DeclaringType.Resolve ().IsVisible (); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/CecilRocks.cs0000664000175000017500000001556412413742070030407 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.CecilRocks // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Metadata; using Gendarme.Framework.Helpers; namespace Gendarme.Framework.Rocks { // Here we keep general, Cecil related, rocks public static class MetadataTokenProviderRock { /// /// Return the AssemblyDefinition that correspond to the IMetadataTokenProvider /// based object. /// /// The IMetadataTokenProvider instance where the method is applied. /// The AssemblyDefinition associated with the IMetadataTokenProvider or null /// if none can be found public static AssemblyDefinition GetAssembly (this IMetadataTokenProvider self) { if (self == null) return null; MetadataToken token = self.MetadataToken; switch (token.TokenType) { case TokenType.Assembly: return (self as AssemblyDefinition); case TokenType.Module: // Module == 0, so we need to handle MetadataToken.Zero here if (token.RID == 0) { // if we don't have a valid token then we take the slow path return GetAssemblyUsingCasts (self); } else { return (self as ModuleDefinition).Assembly; } case TokenType.GenericParam: return GetAssembly ((self as GenericParameter).DeclaringType); case TokenType.TypeRef: case TokenType.TypeDef: return GetAssembly (self as TypeReference); case TokenType.Method: return GetAssembly (self as MethodReference); case TokenType.Event: return GetAssembly ((self as EventDefinition).DeclaringType); case TokenType.Field: return GetAssembly ((self as FieldDefinition).DeclaringType); case TokenType.Property: return GetAssembly ((self as PropertyDefinition).DeclaringType); case TokenType.Param: return GetAssembly ((self as ParameterDefinition).Method); // NamespaceDefinition is a Gendarme "extention", i.e. not real metadata, and does not belong in a single assembly case NamespaceDefinition.NamespaceTokenType: return null; default: return GetAssemblyUsingCasts (self); } } static AssemblyDefinition GetAssemblyUsingCasts (IMetadataTokenProvider metadata) { AssemblyDefinition ad = (metadata as AssemblyDefinition); if (ad != null) return ad; ModuleDefinition md = (metadata as ModuleDefinition); if (md != null) return md.Assembly; GenericParameter gp = (metadata as GenericParameter); // needs to be before TypeReference if (gp != null) return GetAssembly (gp.DeclaringType); TypeReference tr = (metadata as TypeReference); if (tr != null) return GetAssembly (tr); MethodReference mr = (metadata as MethodReference); if (mr != null) return GetAssembly (mr); EventDefinition ed = (metadata as EventDefinition); if (ed != null) return GetAssembly (ed.DeclaringType); FieldDefinition fd = (metadata as FieldDefinition); if (fd != null) return GetAssembly (fd.DeclaringType); PropertyDefinition pd = (metadata as PropertyDefinition); if (pd != null) return GetAssembly (pd.DeclaringType); ParameterDefinition paramd = (metadata as ParameterDefinition); if (paramd != null) return GetAssembly (paramd.Method); MethodReturnType mrt = (metadata as MethodReturnType); if (mrt != null) return GetAssembly (mrt.Method); return null; } static AssemblyDefinition GetAssembly (MemberReference method) { return method.Module.Assembly; } /// /// Compare IMetadataTokenProvider instances based on their metadata token and their /// assembly. /// /// The IMetadataTokenProvider instance where the method is applied. /// The IMetadataTokenProvider instance to compare to /// True if the metadata tokens and assembly are identical, False otherwise public static bool Equals (this IMetadataTokenProvider self, IMetadataTokenProvider other) { if (self == other) return true; if (other == null) return (self == null); MetadataToken token = self.MetadataToken; if (!token.Equals (other.MetadataToken)) return false; // metadata token is unique per assembly AssemblyDefinition self_assembly = GetAssembly (self); if (self_assembly == null) { // special case for Namespace (where GetAssembly would return null) if (token.TokenType == NamespaceDefinition.NamespaceTokenType) return (self as NamespaceDefinition).Name == (other as NamespaceDefinition).Name; else return false; } AssemblyDefinition other_assembly = GetAssembly (other); // compare assemblies tokens (but do not recurse) return other == null ? false : self_assembly.MetadataToken.Equals (other_assembly.MetadataToken); } static Dictionary full_name_cache = new Dictionary (); /// /// Get the string value of the MemberReference FullName property without the cost /// of allocating a new string for each (or most) calls. /// /// The MemberReference instance where the method is applied. /// The cached FullName property of the MemberReference /// Cecil needs to rebuild most of the FullName properties on each call in order to /// be able to write assemblies. However this is a waste of memory when an application, like /// Gendarme, use it for read-only purposes. public static string GetFullName (this MemberReference self) { if (self == null) return String.Empty; string full_name; if (!full_name_cache.TryGetValue (self, out full_name)) { full_name = self.FullName; full_name_cache.Add (self, full_name); } return full_name; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/InstructionRocks.cs0000664000175000017500000004454612413742070031713 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.InstructionRocks // // Authors: // Sebastien Pouliot // Andreas Noever // // Copyright (C) 2008 Novell, Inc (http://www.novell.com) // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework.Helpers; namespace Gendarme.Framework.Rocks { // add Instruction extensions methods here // only if: // * you supply minimal documentation for them (xml) // * you supply unit tests for them // * they are required somewhere to simplify, even indirectly, the rules // (i.e. don't bloat the framework in case of x, y or z in the future) /// /// InstructionRocks contains extensions methods for Instruction /// and the related collection classes. /// public static class InstructionRocks { /// /// Get the FieldDefinition associated with the Instruction. /// /// The Instruction on which the extension method can be called. /// The FieldDefinition associated with the instruction /// or null if the instruction does apply to fields. public static FieldDefinition GetField (this Instruction self) { if (self == null) return null; if (self.OpCode.OperandType == OperandType.InlineField) return (self.Operand as FieldReference).Resolve (); return null; } /// /// Get the MethodReference or MethodDefinition (but not a CallSite) associated with the Instruction /// /// The Instruction on which the extension method can be called. /// /// Older (pre 0.9) Cecil CallSite did not inherit from MethodReference so this was not an issue public static MethodReference GetMethod (this Instruction self) { if ((self == null) || (self.OpCode.FlowControl != FlowControl.Call)) return null; // we want to avoid InlineSig which is a CallSite (inheriting from MethodReference) // but without a DeclaringType if (self.OpCode.OperandType != OperandType.InlineMethod) return null; return (self.Operand as MethodReference); } /// /// Return the operand of the Instruction. For macro instruction the operand is constructed. /// /// The Instruction on which the extension method can be called. /// The method inside which the instruction comes from. /// Return the operand that the non-macro version of this Instruction would have. public static object GetOperand (this Instruction self, MethodDefinition method) { if ((self == null) || (method == null)) return null; Code code = self.OpCode.Code; switch (code) { case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: case Code.Ldarg: case Code.Ldarg_S: case Code.Ldarga: case Code.Ldarga_S: case Code.Starg: case Code.Starg_S: ParameterDefinition p = self.GetParameter (method); // handle 'this' for instance methods if (p == null) return method.DeclaringType; return p; case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: case Code.Stloc_0: case Code.Stloc_1: case Code.Stloc_2: case Code.Stloc_3: return self.GetVariable (method); case Code.Ldc_I4_M1: case Code.Ldc_I4_0: case Code.Ldc_I4_1: case Code.Ldc_I4_2: case Code.Ldc_I4_3: case Code.Ldc_I4_4: case Code.Ldc_I4_5: case Code.Ldc_I4_6: case Code.Ldc_I4_7: case Code.Ldc_I4_8: return (code - Code.Ldc_I4_0); case Code.Ldc_I4_S: return (int) (sbyte) self.Operand; default: return self.Operand; } } /// /// Return the type associated with the instruction's operand (INCOMPLETE). /// /// The Instruction on which the extension method can be called. /// The method inside which the instruction comes from. /// Return a TypeReference compatible with the instruction operand or null. public static TypeReference GetOperandType (this Instruction self, MethodDefinition method) { if ((self == null) || (method == null)) return null; Code code = self.OpCode.Code; switch (code) { case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: case Code.Ldarg: case Code.Ldarg_S: case Code.Ldarga: case Code.Ldarga_S: case Code.Starg: case Code.Starg_S: ParameterDefinition pd = self.GetParameter (method); // special case for 'this' return pd == null ? method.DeclaringType : pd.ParameterType; case Code.Conv_R4: case Code.Ldc_R4: case Code.Ldelem_R4: case Code.Ldind_R4: case Code.Stelem_R4: case Code.Stind_R4: return PrimitiveReferences.GetSingle (method); case Code.Conv_R8: case Code.Ldc_R8: case Code.Ldelem_R8: case Code.Ldind_R8: case Code.Stelem_R8: return PrimitiveReferences.GetDouble (method); case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: case Code.Ldloc: case Code.Ldloc_S: case Code.Ldloca: case Code.Ldloca_S: case Code.Stloc_0: case Code.Stloc_1: case Code.Stloc_2: case Code.Stloc_3: case Code.Stloc: case Code.Stloc_S: return self.GetVariable (method).VariableType; case Code.Ldfld: case Code.Ldflda: case Code.Ldsfld: case Code.Ldsflda: case Code.Stfld: case Code.Stsfld: return (self.Operand as FieldReference).FieldType; case Code.Call: case Code.Callvirt: case Code.Newobj: return (self.Operand as MethodReference).ReturnType; default: return null; } } /// /// Get the ParameterDefinition associated with the Instruction. /// /// The Instruction on which the extension method can be called. /// The method inside which the instruction comes from. /// Needed for the macro instruction where only the variable index is available. /// The ParameterDefinition associated with the instruction /// or null if the instruction does apply to arguments. public static ParameterDefinition GetParameter (this Instruction self, MethodDefinition method) { if ((self == null) || (method == null)) return null; int index; switch (self.OpCode.Code) { case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: index = self.OpCode.Code - Code.Ldarg_0; if (!method.IsStatic) { index--; if (index < 0) return null; } // will not be reached if no parameters exists (hence it won't allocate empty collections) return method.Parameters [index]; case Code.Ldarg: case Code.Ldarg_S: case Code.Ldarga: case Code.Ldarga_S: case Code.Starg: case Code.Starg_S: return (self.Operand as ParameterDefinition); default: return null; } } /// /// Get the number of values removed on the stack for this instruction. /// /// The Instruction on which the extension method can be called. /// The method inside which the instruction comes from /// (needed for StackBehaviour.Varpop). /// The number of value removed (pop) from the stack for this instruction. public static int GetPopCount (this Instruction self, IMethodSignature method) { if (self == null) throw new ArgumentException ("self"); if (method == null) throw new ArgumentException ("method"); switch (self.OpCode.StackBehaviourPop) { case StackBehaviour.Pop0: return 0; case StackBehaviour.Pop1: case StackBehaviour.Popi: case StackBehaviour.Popref: return 1; case StackBehaviour.Pop1_pop1: case StackBehaviour.Popi_pop1: case StackBehaviour.Popi_popi8: case StackBehaviour.Popi_popr4: case StackBehaviour.Popi_popr8: case StackBehaviour.Popref_pop1: case StackBehaviour.Popref_popi: case StackBehaviour.Popi_popi: return 2; 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: return 3; case StackBehaviour.Varpop: switch (self.OpCode.FlowControl) { case FlowControl.Return: return method.ReturnType.IsNamed ("System", "Void") ? 0 : 1; case FlowControl.Call: IMethodSignature calledMethod = (IMethodSignature) self.Operand; // avoid allocating empty ParameterDefinitionCollection int n = calledMethod.HasParameters ? calledMethod.Parameters.Count : 0; if (self.OpCode.Code != Code.Newobj) { if (calledMethod.HasThis) n++; } return n; default: throw new NotImplementedException ("Varpop not supported for this Instruction."); } case StackBehaviour.PopAll: return -1; default: string unknown = String.Format (CultureInfo.InvariantCulture, "'{0}' is not a valid value for instruction '{1}'.", self.OpCode.StackBehaviourPush, self.OpCode); throw new InvalidOperationException (unknown); } } /// /// Get the number of values placed on the stack by this instruction. /// /// The Instruction on which the extension method can be called. /// The number of value added (push) to the stack by this instruction. public static int GetPushCount (this Instruction self) { if (self == null) throw new ArgumentException ("self"); switch (self.OpCode.StackBehaviourPush) { case StackBehaviour.Push0: return 0; case StackBehaviour.Push1: case StackBehaviour.Pushi: case StackBehaviour.Pushi8: case StackBehaviour.Pushr4: case StackBehaviour.Pushr8: case StackBehaviour.Pushref: return 1; case StackBehaviour.Push1_push1: return 2; case StackBehaviour.Varpush: IMethodSignature calledMethod = (IMethodSignature) self.Operand; if (calledMethod != null) return calledMethod.ReturnType.IsNamed ("System", "Void") ? 0 : 1; throw new NotImplementedException ("Varpush not supported for this Instruction."); default: string unknown = String.Format (CultureInfo.InvariantCulture, "'{0}' is not a valid value for instruction '{1}'.", self.OpCode.StackBehaviourPush, self.OpCode); throw new InvalidOperationException (unknown); } } /// /// Get the VariableDefinition associated with the Instruction. /// /// The Instruction on which the extension method can be called. /// The method inside which the instruction comes from. /// Needed for the macro instruction where only the variable index is available. /// The VariableDefinition associated with the instruction /// or null if the instruction does apply to local variables. public static VariableDefinition GetVariable (this Instruction self, MethodDefinition method) { if ((self == null) || (method == null) || !method.HasBody) return null; int index; switch (self.OpCode.Code) { case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: index = self.OpCode.Code - Code.Ldloc_0; break; case Code.Stloc_0: case Code.Stloc_1: case Code.Stloc_2: case Code.Stloc_3: index = self.OpCode.Code - Code.Stloc_0; break; case Code.Ldloc: case Code.Ldloc_S: case Code.Ldloca: case Code.Ldloca_S: case Code.Stloc: case Code.Stloc_S: return (self.Operand as VariableDefinition); default: return null; } return method.Body.Variables [index]; } /// /// Helper method to avoid patterns like "ins.Previous != null && ins.Previous.OpCode.Code == Code.Newobj" /// and replace it with a shorter "ins.Previous.Is (Code.Newobj)". /// /// The Instruction on which the extension method can be called. /// The Code to compare to. /// True if the instruction's code match the specified argument, False otherwise public static bool Is (this Instruction self, Code code) { if (self == null) return false; return (self.OpCode.Code == code); } /// /// Return if the Instruction is a load of an argument (ldarg* family). /// /// The Instruction on which the extension method can be called. /// True if the instruction is a load argument/parameter, False otherwise public static bool IsLoadArgument (this Instruction self) { if (self == null) return false; return OpCodeBitmask.LoadArgument.Get (self.OpCode.Code); } /// /// Return if the Instruction is the load of an element (ldelem* family) /// /// The Instruction on which the extension method can be called. /// True if the instruction is a load element, False otherwise public static bool IsLoadElement (this Instruction self) { if (self == null) return false; return OpCodeBitmask.LoadElement.Get (self.OpCode.Code); } /// /// Return if the Instruction is a load indirect (ldind* family) /// /// The Instruction on which the extension method can be called. /// True if the instruction is a load indirect, False otherwise public static bool IsLoadIndirect (this Instruction self) { if (self == null) return false; return OpCodeBitmask.LoadIndirect.Get (self.OpCode.Code); } /// /// Return if the Instruction is a load of a local variable (ldloc* family). /// /// The Instruction on which the extension method can be called. /// True if the instruction is a load local variable, False otherwise public static bool IsLoadLocal (this Instruction self) { if (self == null) return false; return OpCodeBitmask.LoadLocal.Get (self.OpCode.Code); } /// /// Determine if the instruction operand contains the constant zero (0). /// /// The Instruction on which the extension method can be called. /// True if the operand contains the constant zero (0), False otherwise public static bool IsOperandZero (this Instruction self) { if (self == null) return false; switch (self.OpCode.Code) { case Code.Ldc_I4: return ((int) self.Operand == 0); case Code.Ldc_I4_S: return ((sbyte) self.Operand == 0); case Code.Ldc_I4_0: return true; default: return false; } } /// /// Return if the Instruction is a store of an argument (starg* family). /// /// The Instruction on which the extension method can be called. /// True if the instruction is a store of a parameter, False otherwise public static bool IsStoreArgument (this Instruction self) { if (self == null) return false; return OpCodeBitmask.StoreArgument.Get (self.OpCode.Code); } /// /// Return if the Instruction is a store of a local variable (stloc* family). /// /// The Instruction on which the extension method can be called. /// True if the instruction is a store local variable, False otherwise public static bool IsStoreLocal (this Instruction self) { if (self == null) return false; return OpCodeBitmask.StoreLocal.Get (self.OpCode.Code); } /// /// Return the instruction that match the current instruction. This is computed by /// substracting push and adding pop counts until the total becomes zero. /// /// The Instruction on which the extension method can be called. /// The method from which the instruction was extracted. /// The instruction that match the current instruction. public static Instruction TraceBack (this Instruction self, IMethodSignature method) { return TraceBack (self, method, 0); } /// /// Return the instruction that match the current instruction. This is computed by /// substracting push and adding pop counts until the total becomes zero. /// /// The Instruction on which the extension method can be called. /// The method from which the instruction was extracted. /// Offset to add the the Pop count. Useful to track several parameters to a method. /// The instruction that match the current instruction. public static Instruction TraceBack (this Instruction self, IMethodSignature method, int offset) { int n = offset + self.GetPopCount (method); while (n > 0 && self.Previous != null) { self = self.Previous; // we cannot "simply" trace backward over a unconditional branch if (self.OpCode.FlowControl == FlowControl.Branch) return null; n -= self.GetPushCount (); if (n == 0) return self; int pop = self.GetPopCount (method); if (pop == -1) return null; // PopAll n += pop; } return null; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/ParameterRocks.cs0000664000175000017500000000342712413742070031303 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.ParameterRocks // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; namespace Gendarme.Framework.Rocks { public static class ParameterRocks { /// /// Check if the parameter represents a list of parameters (params keyword in C#) /// /// The ParameterDefinition on which the extension method can be called. /// True if the parameter represents a list of parameters, false otherwise. public static bool IsParams (this ParameterDefinition self) { return self.HasAttribute ("System", "ParamArrayAttribute"); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/MethodRocks.cs0000664000175000017500000002564712413742070030613 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.MethodRocks // // Authors: // Sebastien Pouliot // Adrian Tsai // Daniel Abramov // Andreas Noever // Cedric Vivier // // Copyright (C) 2007-2008 Novell, Inc (http://www.novell.com) // Copyright (c) 2007 Adrian Tsai // Copyright (C) 2008 Daniel Abramov // (C) 2008 Andreas Noever // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; namespace Gendarme.Framework.Rocks { // add Method[Reference|Definition][Collection] extensions methods here // only if: // * you supply minimal documentation for them (xml) // * you supply unit tests for them // * they are required somewhere to simplify, even indirectly, the rules // (i.e. don't bloat the framework in case of x, y or z in the future) /// /// MethodRocks contains extensions methods for Method[Definition|Reference] /// and the related collection classes. /// /// Note: whenever possible try to use MethodReference since it's extend the /// reach/usability of the code. /// public static class MethodRocks { public static bool IsNamed (this MemberReference self, string nameSpace, string typeName, string methodName) { if (methodName == null) throw new ArgumentNullException ("methodName"); if (self == null) return false; return ((self.Name == methodName) && self.DeclaringType.IsNamed (nameSpace, typeName)); } /// /// Check if the MethodReference is defined as the entry point of it's assembly. /// /// The MethodReference on which the extension method can be called. /// True if the method is defined as the entry point of it's assembly, False otherwise public static bool IsEntryPoint (this MethodReference self) { return ((self != null) && (self == self.Module.Assembly.EntryPoint)); } /// /// Check if the MethodReference is a finalizer. /// /// The MethodReference on which the extension method can be called. /// True if the method is a finalizer, False otherwise. public static bool IsFinalizer (this MethodReference self) { if (self == null) return false; return (self.HasThis && !self.HasParameters && (self.Name == "Finalize") && self.ReturnType.IsNamed ("System", "Void")); } /// /// Check if the method, or it's declaring type, was generated by the compiler or a tool (i.e. not by the developer). /// /// The MethodReference on which the extension method can be called. /// True if the code is not generated directly by the developer, /// False otherwise (e.g. compiler or tool generated) public static bool IsGeneratedCode (this MethodReference self) { if (self == null) return false; MethodDefinition method = self.Resolve (); if (method.HasAnyGeneratedCodeAttribute ()) return true; return self.DeclaringType.IsGeneratedCode (); } /// /// Check if the signature of a method is consitent for it's use as a Main method. /// Note: it doesn't check that the method is the EntryPoint of it's assembly. /// /// static [void|int] Main () /// static [void|int] Main (string[] args) /// /// gre /// The MethodReference on which the extension method can be called. /// True if the method is a valid Main, False otherwise. public static bool IsMain (this MethodReference self) { if (self == null) return false; MethodDefinition method = self.Resolve (); // Main must be static if (!method.IsStatic) return false; if (method.Name != "Main") return false; // Main must return void or int switch (method.ReturnType.Name) { case "Void": case "Int32": // ok, continue checks break; default: return false; } // Main (void) if (!method.HasParameters) return true; IList pdc = method.Parameters; if (pdc.Count != 1) return false; // Main (string[] args) return (pdc [0].ParameterType.Name == "String[]"); } /// /// Check if a method is an override to a virtual method of a base type. /// /// The MethodReference on which the extension method can be called. /// True if the method is an override to a virtual method, False otherwise public static bool IsOverride (this MethodReference self) { if (self == null) return false; MethodDefinition method = self.Resolve (); if ((method == null) || !method.IsVirtual) return false; TypeDefinition declaring = method.DeclaringType; TypeDefinition parent = declaring.BaseType != null ? declaring.BaseType.Resolve () : null; while (parent != null) { string name = method.Name; foreach (MethodDefinition md in parent.Methods) { if (name != md.Name) continue; if (!method.CompareSignature (md)) continue; return md.IsVirtual; } parent = parent.BaseType != null ? parent.BaseType.Resolve () : null; } return false; } /// /// Check if the method corresponds to the get or set operation on a property. /// /// The MethodReference on which the extension method can be called. /// True if the method is a getter or a setter, False otherwise public static bool IsProperty (this MethodReference self) { if (self == null) return false; MethodDefinition method = self.Resolve (); if (method == null) return false; return ((method.SemanticsAttributes & (MethodSemanticsAttributes.Getter | MethodSemanticsAttributes.Setter)) != 0); } /// /// Check if the method is visible outside of the assembly. /// /// The MethodReference on which the extension method can be called. /// True if the method can be used from outside of the assembly, false otherwise. public static bool IsVisible (this MethodReference self) { if (self == null) return false; MethodDefinition method = self.Resolve (); if ((method == null) || method.IsPrivate || method.IsAssembly) return false; return self.DeclaringType.Resolve ().IsVisible (); } /// /// Check if the method has the signature of an Event callback. /// They are usually of the form: void Method (object sender, EventArgs ea), where /// the second parameters is either EventArgs or a subclass of it /// /// The MethodReference on which the extension method can be called. /// True if the method has the signature of an event callback. public static bool IsEventCallback (this MethodReference self) { if (self == null) return false; MethodDefinition method = self.Resolve (); if ((method == null) || !method.HasParameters) return false; IList parameters = method.Parameters; if (parameters.Count != 2) return false; TypeReference type = parameters [1].ParameterType; GenericParameter gp = (type as GenericParameter); if (gp == null) return type.Inherits ("System", "EventArgs"); if (gp.HasConstraints) { IList cc = gp.Constraints; return ((cc.Count == 1) && cc [0].IsNamed ("System", "EventArgs")); } return false; } /// /// Returns a property using supplied MethodReference of /// a property accessor method (getter or setter). /// /// The MethodReference on which the extension method can be called. /// PropertyDefinition which corresponds to the supplied MethodReference. public static PropertyDefinition GetPropertyByAccessor (this MethodReference self) { if (self == null) return null; MethodDefinition method = self.Resolve (); if (method == null || !method.DeclaringType.HasProperties || !method.IsProperty ()) return null; string mname = method.Name; foreach (PropertyDefinition property in method.DeclaringType.Properties) { // set_ and get_ both have a length equal to 4 string pname = property.Name; if (String.CompareOrdinal (pname, 0, mname, 4, pname.Length) == 0) return property; } return null; } private static bool AreSameElementTypes (TypeReference a, TypeReference b) { return a.IsGenericParameter || b.IsGenericParameter || b.IsNamed (a.Namespace, a.Name); } /// /// Compare the IMethodSignature members with the one being specified. /// /// >The IMethodSignature on which the extension method can be called. /// The IMethodSignature which is being compared. /// True if the IMethodSignature members are identical, false otherwise public static bool CompareSignature (this IMethodSignature self, IMethodSignature signature) { if (self == null) return (signature == null); if (self.HasThis != signature.HasThis) return false; if (self.ExplicitThis != signature.ExplicitThis) return false; if (self.CallingConvention != signature.CallingConvention) return false; if (!AreSameElementTypes (self.ReturnType, signature.ReturnType)) return false; bool h1 = self.HasParameters; bool h2 = signature.HasParameters; if (h1 != h2) return false; if (!h1 && !h2) return true; IList pdc1 = self.Parameters; IList pdc2 = signature.Parameters; int count = pdc1.Count; if (count != pdc2.Count) return false; for (int i = 0; i < count; ++i) { if (!AreSameElementTypes (pdc1 [i].ParameterType, pdc2 [i].ParameterType)) return false; } return true; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/ModuleRocks.cs0000664000175000017500000002034612413742070030607 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.ModuleRocks // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework.Helpers; namespace Gendarme.Framework.Rocks { // add ModuleDefinition extensions methods here // only if: // * you supply minimal documentation for them (xml) // * you supply unit tests for them // * they are required somewhere to simplify, even indirectly, the rules // (i.e. don't bloat the framework in case of x, y or z in the future) /// /// ModuleRocks contains extensions methods for ModuleDefinition /// and the related collection classes. /// public static class ModuleRocks { static bool running_on_mono; static ModuleRocks () { running_on_mono = typeof (object).Assembly.GetType ("System.MonoType", false) != null; } static bool RunningOnMono { get { return running_on_mono; } } /// /// Load, if available, the debugging symbols associated with the module. This first /// try to load a MDB file (symbols from the Mono:: runtime) and then, if not present /// and running on MS.NET, try to load a PDB file (symbols from MS runtime). /// /// public static void LoadDebuggingSymbols (this ModuleDefinition self) { if (self == null) return; // don't create a new reader if the symbols are already loaded if (self.HasSymbols) return; string image_name = self.FullyQualifiedName; string symbol_name = image_name + ".mdb"; Type reader_type = null; // we can always load Mono symbols (whatever the runtime we're using) // so we start by looking for it's debugging symbol file if (File.Exists (symbol_name)) { // "always" if we can find Mono.Cecil.Mdb reader_type = Type.GetType ("Mono.Cecil.Mdb.MdbReaderProvider, Mono.Cecil.Mdb, Version=0.9.4.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"); // load the assembly from the current folder if // it is here, or fallback to the gac } // if we could not load Mono's symbols then we try, if not running on Mono, // to load MS symbols (PDB files) if ((reader_type == null) && !RunningOnMono) { // assume we're running on MS.NET symbol_name = Path.ChangeExtension (image_name, ".pdb"); if (File.Exists (symbol_name)) { reader_type = Type.GetType ("Mono.Cecil.Pdb.PdbReaderProvider, Mono.Cecil.Pdb"); } } // no symbols are available to load if (reader_type == null) return; ISymbolReaderProvider provider = (ISymbolReaderProvider) Activator.CreateInstance (reader_type); try { self.ReadSymbols (provider.GetSymbolReader (self, image_name)); } catch (FileNotFoundException) { // this happens if a MDB file is missing } catch (TypeLoadException) { // this happens if a Mono.Cecil.Mdb.dll is not found } catch (COMException) { // this happens if a PDB file is missing } catch (FormatException) { // Mono.Cecil.Mdb wrap MonoSymbolFileException inside a FormatException // This makes it possible to catch such exception without a reference to the // Mono.CompilerServices.SymbolWriter.dll assembly } catch (InvalidOperationException) { // this happens if the PDB is out of sync with the actual DLL (w/new PdbCciReader) } // in any case (of failure to load symbols) Gendarme can continue its analysis (but some rules // can be affected). The HasDebuggingInformation extension method let them adjust themselves } static TypeDefinition[] Empty = new TypeDefinition [0]; /// /// Return an IEnumerable that allows a single loop (like a foreach) to /// traverse all types that are defined in a module. /// /// The ModuleDefinition on which the extension method can be called. /// An IEnumerable to traverse every types of the module public static IEnumerable GetAllTypes (this ModuleDefinition self) { if (self == null) return Empty; return self.Types.SelectMany (t => t.GetAllTypes ()); } static IEnumerable GetAllTypes (this TypeDefinition self) { yield return self; if (!self.HasNestedTypes) yield break; foreach (var type in self.NestedTypes.SelectMany (t => t.GetAllTypes ())) yield return type; } static Dictionary> member_ref_cache = new Dictionary> (); /// /// Check if any MemberReference, referenced by the current ModuleDefinition, satisfies the /// specified predicate. /// /// The ModuleDefinition on which the extension method can be called. /// The condition to execute on a provided MemberReference /// True if 'predicate' returns true for any MemberReference in the module's referenced types. /// Cecil's GetMemberReferences method will allocate a new array each time it is called. /// This extension method will cache the IEnumerable, on the first use, to reduce memory consumption. public static bool AnyMemberReference (this ModuleDefinition self, Func predicate) { if (self == null) return false; // since ModuleDefinition.GetMemberReferences allocates an array (always identical if the // assembly is opened "read-only", like Gendarme does) we'll cache and retrieve the array IEnumerable refs; if (!member_ref_cache.TryGetValue (self, out refs)) { refs = self.GetMemberReferences (); member_ref_cache.Add (self, refs); } return refs.Any (predicate); } static Dictionary> type_ref_cache = new Dictionary> (); /// /// Check if any TypeReference, referenced by the current ModuleDefinition, satisfies the /// specified predicate. /// /// The ModuleDefinition on which the extension method can be called. /// The condition to execute on a provided TypeReference /// True if 'predicate' returns true for any TypeReference in the module's referenced types. /// Cecil's GetTypeReferences method will allocate a new array each time it is called. /// This extension method will cache the IEnumerable, on the first use, to reduce memory consumption. public static bool AnyTypeReference (this ModuleDefinition self, Func predicate) { if (self == null) return false; // since ModuleDefinition.GetTypeReferences allocates an array (always identical if the // assembly is opened "read-only", like Gendarme does) we'll cache and retrieve the array IEnumerable refs; if (!type_ref_cache.TryGetValue (self, out refs)) { refs = self.GetTypeReferences (); type_ref_cache.Add (self, refs); } return refs.Any (predicate); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/CustomAttributeRocks.cs0000664000175000017500000000651712413742070032524 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.CustomAttributeRocks // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using System.Collections.Generic; using Mono.Cecil; namespace Gendarme.Framework.Rocks { // add CustomAttribute[Collection], ICustomAttributeProvider extensions // methods here only if: // * you supply minimal documentation for them (xml) // * you supply unit tests for them // * they are required somewhere to simplify, even indirectly, the rules // (i.e. don't bloat the framework in case of x, y or z in the future) /// /// CustomAttributeRocks contains extensions methods for CustomAttribute /// and the related collection classes. /// public static class CustomAttributeRocks { internal static bool HasAnyGeneratedCodeAttribute (this ICustomAttributeProvider self) { if ((self == null) || !self.HasCustomAttributes) return false; foreach (CustomAttribute ca in self.CustomAttributes) { TypeReference cat = ca.AttributeType; if (cat.IsNamed ("System.CodeDom.Compiler", "GeneratedCodeAttribute") || cat.IsNamed ("System.Runtime.CompilerServices", "CompilerGeneratedAttribute")) { return true; } } return false; } /// /// Check if the type contains an attribute of a specified type. /// /// The ICustomAttributeProvider (e.g. AssemblyDefinition, TypeReference, MethodReference, /// FieldReference...) on which the extension method can be called. /// The namespace of the attribute to be matched /// The name of the attribute to be matched /// True if the provider contains an attribute of the same name, /// False otherwise. public static bool HasAttribute (this ICustomAttributeProvider self, string nameSpace, string name) { if (nameSpace == null) throw new ArgumentNullException ("nameSpace"); if (name == null) throw new ArgumentNullException ("name"); if ((self == null) || !self.HasCustomAttributes) return false; foreach (CustomAttribute ca in self.CustomAttributes) { if (ca.AttributeType.IsNamed (nameSpace, name)) return true; } return false; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/CommonRocks.cs0000664000175000017500000000513012413742070030604 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.CommonRocks // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework.Rocks { // Here we keep non-Gendarme/Cecil related rocks public static class CollectionRocks { /// /// Checks if the list does not contain the item. If so the item is added. /// /// /// The list. /// The item to add. public static void AddIfNew (this ICollection self, T item) { if (self == null) throw new ArgumentNullException ("self"); if (item == null) throw new ArgumentNullException ("item"); if (!self.Contains (item)) self.Add (item); } public static void AddRangeIfNew (this ICollection self, IEnumerable items) { if (self == null) throw new ArgumentNullException ("self"); if (items == null) throw new ArgumentNullException ("items"); foreach (T item in items) { if (!self.Contains (item)) self.Add (item); } } } public static class SystemRocks { /// /// Check if a Version is empty (all zeros). /// /// The Version to check /// True if empty, False otherwise. public static bool IsEmpty (this Version self) { if (self == null) return true; return ((self.Major == 0) && (self.Minor == 0) && (self.Build <= 0) && (self.Revision <= 0)); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/TypeRocks.cs0000664000175000017500000005112112413742070030276 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.TypeRocks // // Authors: // Sebastien Pouliot // Daniel Abramov // Adrian Tsai // Andreas Noever // // Copyright (C) 2007-2008 Novell, Inc (http://www.novell.com) // (C) 2007 Daniel Abramov // Copyright (c) 2007 Adrian Tsai // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Framework.Helpers; namespace Gendarme.Framework.Rocks { // add Type[Definition|Reference] extensions methods here // only if: // * you supply minimal documentation for them (xml) // * you supply unit tests for them // * they are required somewhere to simplify, even indirectly, the rules // (i.e. don't bloat the framework in case of x, y or z in the future) /// /// TypeRocks contains extensions methods for Type[Definition|Reference] /// and the related collection classes. /// /// Note: whenever possible try to use TypeReference since it's extend the /// reach/usability of the code. /// public static class TypeRocks { /// /// Returns an IEnumerable that allows a single loop (like a foreach) to /// traverse all base classes and interfaces inherited by the type. /// /// The TypeReference on which the extension method can be called. /// An IEnumerable to traverse all base classes and interfaces. public static IEnumerable AllSuperTypes (this TypeReference self) { var types = new List (); types.Add (self); int i = 0; while (i < types.Count) { TypeDefinition type = types [i++].Resolve (); if (type != null) { yield return type; foreach (TypeReference super in type.Interfaces) { types.AddIfNew (super); } if (type.BaseType != null) types.AddIfNew (type.BaseType); } } } /// /// Returns the first MethodDefinition that satisfies a given MethodSignature. /// /// The TypeReference on which the extension method can be called. /// The MethodSignature to match. /// The first MethodDefinition for wich signature.Matches returns true. /// /// Do not allocate a MethodSignature for only one call. Use one of the other GetMethod overloads instead. /// public static MethodDefinition GetMethod (this TypeReference self, MethodSignature signature) { if (signature == null) throw new ArgumentNullException ("signature"); if (self == null) return null; TypeDefinition type = self.Resolve (); if (type == null) return null; if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) { if (signature.Matches (method)) return method; } } return null; } /// /// Searches for a method. /// /// The TypeReference on which the extension method can be called. /// An attribute mask matched against the attributes of the method. /// The name of the method to match. Ignored if null. /// The full name (Namespace.Type) of the return type. Ignored if null. /// An array of full names (Namespace.Type) of parameter types. Ignored if null. Null entries act as wildcards. /// A custom condition that is called for each MethodDefinition that satisfies all other conditions. Ignored if null. /// The first MethodDefinition that satisfies all conditions. public static MethodDefinition GetMethod (this TypeReference self, MethodAttributes attributes, string name, string returnType, string [] parameters, Func customCondition) { if (self == null) return null; foreach (MethodDefinition method in self.Resolve ().Methods) { if (name != null && method.Name != name) continue; if ((method.Attributes & attributes) != attributes) continue; if (returnType != null && !method.ReturnType.IsNamed (returnType)) continue; if (parameters != null) { if (method.HasParameters) { IList pdc = method.Parameters; if (parameters.Length != pdc.Count) continue; bool parameterError = false; for (int i = 0; i < parameters.Length; i++) { if (parameters [i] == null) continue;//ignore parameter if (!pdc [i].ParameterType.GetElementType ().IsNamed (parameters [i])) { parameterError = true; break; } } if (parameterError) continue; // there could be an overload with the "right" parameters } else if (parameters.Length > 0) { continue; } } if (customCondition != null && !customCondition (method)) continue; return method; } return null; } /// /// Searches for a method by name, returnType, parameters and attributes. /// /// The TypeReference on which the extension method can be called. /// An attribute mask matched against the attributes of the method. /// The name of the method to match. Ignored if null. /// The full name (Namespace.Type) of the return type. Ignored if null. /// An array of full names (Namespace.Type) of parameter types. Ignored if null. Null entries act as wildcard. /// The first MethodDefinition that satisfies all conditions. public static MethodDefinition GetMethod (this TypeReference self, MethodAttributes attributes, string name, string returnType, string [] parameters) { return self.GetMethod (attributes, name, returnType, parameters, null); } /// /// Searches for a method by attributes and by name. /// /// The TypeReference on which the extension method can be called. /// An attribute mask matched against the attributes of the method. /// The name of the method to match. Ignored if null. /// The first MethodDefinition that satisfies all conditions. public static MethodDefinition GetMethod (this TypeReference self, MethodAttributes attributes, string name) { return self.GetMethod (attributes, name, null, null, null); } /// /// Searches for a method by name, returnType and parameters. /// /// The TypeReference on which the extension method can be called. /// The name of the method to match. Ignored if null. /// The full name (Namespace.Type) of the return type. Ignored if null. /// An array of full names (Namespace.Type) of parameter types. Ignored if null. Null entries act as wildcards. /// The first MethodDefinition that satisfies all conditions. public static MethodDefinition GetMethod (this TypeReference self, string name, string returnType, string [] parameters) { return self.GetMethod (0, name, returnType, parameters, null); } /// /// Searches for a method with a specific name. /// /// The TypeReference on which the extension method can be called. /// The name of the method to match. /// The first MethodDefinition with a specifiy name. public static MethodDefinition GetMethod (this TypeReference self, string name) { return self.GetMethod (0, name, null, null, null); } /// /// Searches for a method using a custom condition. /// /// The TypeReference on which the extension method can be called. /// A custom condition that is called for each MethodDefinition. /// The first MethodDefinition that satisfies the customCondition. public static MethodDefinition GetMethod (this TypeReference self, Func customCondition) { return self.GetMethod (0, null, null, null, customCondition); } /// /// Checks if at least one Method satisfies a given MethodSignature. /// /// The TypeReference on which the extension method can be called. /// The MethodSignature to match. /// True if at least one method matches the signature. Otherwise false. public static bool HasMethod (this TypeReference self, MethodSignature signature) { return ((self != null) && self.GetMethod (signature) != null); } /// /// Recursively check if the type implemented a specified interface. Note that it is possible /// that we might now be able to know everything that a type implements since the assembly /// where the information resides could be unavailable. False is returned in this case. /// /// The TypeDefinition on which the extension method can be called. /// The namespace of the interface to be matched /// The name of the interface to be matched /// True if we found that the type implements the interface, False otherwise (either it /// does not implement it, or we could not find where it does). public static bool Implements (this TypeReference self, string nameSpace, string name) { if (nameSpace == null) throw new ArgumentNullException ("nameSpace"); if (name == null) throw new ArgumentNullException ("name"); if (self == null) return false; TypeDefinition type = self.Resolve (); if (type == null) return false; // not enough information available // special case, check if we implement ourselves if (type.IsInterface && type.IsNamed (nameSpace, name)) return true; return Implements (type, nameSpace, name); } private static bool Implements (TypeDefinition type, string nameSpace, string iname) { while (type != null) { // does the type implements it itself if (type.HasInterfaces) { foreach (TypeReference iface in type.Interfaces) { if (iface.IsNamed (nameSpace, iname)) return true; //if not, then maybe one of its parent interfaces does if (Implements (iface.Resolve (), nameSpace, iname)) return true; } } type = type.BaseType != null ? type.BaseType.Resolve () : null; } return false; } /// /// Check if the type inherits from the specified type. Note that it is possible that /// we might not be able to know the complete inheritance chain since the assembly /// where the information resides could be unavailable. /// /// The TypeReference on which the extension method can be called. /// The namespace of the base class to be matched /// The name of the base class to be matched /// True if the type inherits from specified class, False otherwise public static bool Inherits (this TypeReference self, string nameSpace, string name) { if (nameSpace == null) throw new ArgumentNullException ("nameSpace"); if (name == null) throw new ArgumentNullException ("name"); if (self == null) return false; TypeReference current = self.Resolve (); while (current != null) { if (current.IsNamed (nameSpace, name)) return true; if (current.IsNamed ("System", "Object")) return false; TypeDefinition td = current.Resolve (); if (td == null) return false; // could not resolve type current = td.BaseType; } return false; } /// /// Check if the type and its namespace are named like the provided parameters. /// This is preferred to checking the FullName property since the later can allocate (string) memory. /// /// The TypeReference on which the extension method can be called. /// The namespace to be matched /// The type name to be matched /// True if the type is namespace and name match the arguments, False otherwise public static bool IsNamed (this TypeReference self, string nameSpace, string name) { if (nameSpace == null) throw new ArgumentNullException ("nameSpace"); if (name == null) throw new ArgumentNullException ("name"); if (self == null) return false; if (self.IsNested) { int spos = name.LastIndexOf ('/'); if (spos == -1) return false; // GetFullName could be optimized away but it's a fairly uncommon case return (nameSpace + "." + name == self.GetFullName ()); } return ((self.Namespace == nameSpace) && (self.Name == name)); } /// /// Check if the type full name match the provided parameter. /// Note: prefer the overload where the namespace and type name can be supplied individually /// /// The TypeReference on which the extension method can be called. /// The full name to be matched /// True if the type is namespace and name match the arguments, False otherwise public static bool IsNamed (this TypeReference self, string fullName) { if (fullName == null) throw new ArgumentNullException ("fullName"); if (self == null) return false; if (self.IsNested) { int spos = fullName.LastIndexOf ('/'); if (spos == -1) return false; // FIXME: GetFullName could be optimized away but it's a fairly uncommon case return (fullName == self.GetFullName ()); } int dpos = fullName.LastIndexOf ('.'); string nspace = self.Namespace; if (dpos != nspace.Length) return false; if (String.CompareOrdinal (nspace, 0, fullName, 0, dpos) != 0) return false; string name = self.Name; if (fullName.Length - dpos - 1 != name.Length) return false; return (String.CompareOrdinal (name, 0, fullName, dpos + 1, fullName.Length - dpos - 1) == 0); } /// /// Checks if type is attribute. Note that it is possible that /// we might now be able to know all inheritance since the assembly where /// the information resides could be unavailable. /// /// The TypeReference on which the extension method can be called. /// True if the type inherits from System.Attribute, /// False otherwise. public static bool IsAttribute (this TypeReference self) { if (self == null) return false; return self.Inherits ("System", "Attribute"); } /// /// Check if the type is a delegate. /// /// The TypeReference on which the extension method can be called. /// True if the type is a delegate, False otherwise. public static bool IsDelegate (this TypeReference self) { if (self == null) return false; TypeDefinition type = self.Resolve (); // e.g. this occurs for or GenericParameter if (null == type || type.BaseType == null) return false; if (type.BaseType.Namespace != "System") return false; string name = type.BaseType.Name; return ((name == "Delegate") || (name == "MulticastDelegate")); } /// /// Check if the type is a enumeration flags. /// /// The TypeReference on which the extension method can be called. /// True if the type as the [Flags] attribute, false otherwise. public static bool IsFlags (this TypeReference self) { if (self == null) return false; TypeDefinition type = self.Resolve (); if ((type == null) || !type.IsEnum || !type.HasCustomAttributes) return false; return type.HasAttribute ("System", "FlagsAttribute"); } /// /// Check if the type represent a floating-point type. /// /// The TypeReference on which the extension method can be called. /// True if the type is System.Single (C# float) or System.Double (C3 double), False otherwise. public static bool IsFloatingPoint (this TypeReference self) { if (self == null) return false; if (self.Namespace != "System") return false; string name = self.Name; return ((name == "Single") || (name == "Double")); } /// /// Check if the type is generated code, either by the compiler or by a tool. /// /// The TypeReference on which the extension method can be called. /// True if the code is not generated directly by the developer, /// False otherwise (e.g. compiler or tool generated) public static bool IsGeneratedCode (this TypeReference self) { if (self == null) return false; if (self.IsDefinition) { TypeDefinition type = self.Resolve (); // both helpful attributes only exists in 2.0 and more recent frameworks if (type.Module.Runtime >= TargetRuntime.Net_2_0) { if (type.HasAnyGeneratedCodeAttribute ()) return true; } } // sadly still shows up for 2.0, so the 1.x logic still applies switch (self.Name [0]) { case '<': // e.g. , case '$': // e.g. $ArrayType$1 nested inside return true; } // the type could be nested (inside a generated one) and not marked itself if (self.IsNested) return self.DeclaringType.IsGeneratedCode (); return false; } /// /// Check if the type refers to native code. /// /// The TypeReference on which the extension method can be called. /// True if the type refers to native code, False otherwise public static bool IsNative (this TypeReference self) { if (self == null) return false; if (self.Namespace == "System") { string name = self.Name; return ((name == "IntPtr") || (name == "UIntPtr")); } return self.IsNamed ("System.Runtime.InteropServices", "HandleRef"); } /// /// Check if the type is static (2.0+) /// /// The TypeReference on which the extension method can be called. /// True if the type is static, false otherwise. public static bool IsStatic (this TypeReference self) { if (self == null) return false; TypeDefinition type = self.Resolve (); if (type == null) return false; return (type.IsSealed && type.IsAbstract); } /// /// Check if the type is visible outside of the assembly. /// /// The TypeReference on which the extension method can be called. /// True if the type can be used from outside of the assembly, false otherwise. public static bool IsVisible (this TypeReference self) { if (self == null) return false; TypeDefinition type = self.Resolve (); if (type == null) return true; // it's probably visible since we have a reference to it while (type.IsNested) { if (type.IsNestedPrivate || type.IsNestedAssembly) return false; // Nested classes are always inside the same assembly, so the cast is ok type = type.DeclaringType.Resolve (); } return type.IsPublic; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/VariableDefinitionRocks.cs0000664000175000017500000000434112413742070033115 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.VariableDefinitionRocks // // Authors: // Jesse Jones // // (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil.Cil; namespace Gendarme.Framework.Rocks { public static class VariableDefinitionRocks { /// /// Check if the local variable has a name which was generated by the compiler. /// Note that this will return true for all variables if debugging information is not present. /// /// The VariableReference on which the extension method can be called. /// True if the field name was generated by the compiler, False otherwise public static bool IsGeneratedName (this VariableReference self) { if (self == null) return false; string name = self.Name; if (String.IsNullOrEmpty (name)) return true; return ((name [0] == '<') || (name.IndexOf ('$') != -1)); } public static string GetName (this VariableReference self) { if (self == null) return String.Empty; return !string.IsNullOrEmpty (self.Name) ? self.Name : "V_" + self.Index.ToString (CultureInfo.InvariantCulture); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/AssemblyRocks.cs0000664000175000017500000000415012413742070031134 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.AssemblyRocks // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; namespace Gendarme.Framework.Rocks { public static class AssemblyRocks { /// /// Check if the AssemblyName is reference by the assembly. /// /// The AssemblyDefinition on which the extension method can be called. /// AssemblyName of the reference /// True if any of the assembly's modules reference the assembly name, false otherwise. public static bool References (this AssemblyDefinition self, string assemblyName) { if (assemblyName == null) throw new ArgumentNullException ("assemblyName"); if (self == null) return false; foreach (ModuleDefinition module in self.Modules) { foreach (AssemblyNameReference r in module.AssemblyReferences) { if (r.Name == assemblyName) return true; } } return false; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Rocks/PropertyRocks.cs0000664000175000017500000000544412413742070031210 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Rocks.PropertyRocks // // Authors: // Sebastien Pouliot // // 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.Generic; using Mono.Cecil; namespace Gendarme.Framework.Rocks { // add Property[Reference|Definition][Collection] extensions methods here // only if: // * you supply minimal documentation for them (xml) // * you supply unit tests for them // * they are required somewhere to simplify, even indirectly, the rules // (i.e. don't bloat the framework in case of x, y or z in the future) /// /// PropertyRocks contains extensions methods for Property[Definition|Reference] /// and the related collection classes. /// public static class PropertyRocks { /// /// Check if the property, or it's declaring type, was generated by the compiler or a tool (i.e. not by the /// developer). This is especially important since automatic properties getter and setter methods are marked /// as generated code (because the compiler generates them with a backing field) while the property itself is /// not (because it comes from the developer source code). /// /// The PropertyDefinition on which the extension method can be called. /// True if the code is not generated directly by the developer, /// False otherwise (e.g. compiler or tool generated) public static bool IsGeneratedCode (this PropertyDefinition self) { // note: unlike other Cecil types there is no Resolve in PropertyReference if (self == null) return false; if (self.HasAnyGeneratedCodeAttribute ()) return true; return self.DeclaringType.IsGeneratedCode (); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/0000775000175000017500000000000012642235741026353 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/StackEntryAnalysis.cs0000664000175000017500000005112112413742070032467 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.StackEntryAnalysis // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework.Helpers { /// /// This class can be used to find all usages of a reference on the stack. /// Currently used for: /// Gendarme.Rules.BadPractice.CheckNewExceptionWithoutThrowRule /// Gendarme.Rules.BadPractice.CheckNewThreadWithoutStartRule /// Gendarme.Rules.Interoperability.GetLastErrorMustBeCalledRightAfterPInvokeRule /// public class StackEntryAnalysis { [Serializable] enum StoreType { None, Local, Argument, Field, StaticField, Out, } /// /// Saves information about a local variable slot (argument or local variable). /// Used to keep track of assignments. /// struct StoreSlot : IEquatable { public readonly StoreType Type; public readonly int Slot; public StoreSlot (StoreType type, int slot) { this.Type = type; this.Slot = slot; } /// /// Use this to check if an instruction accesses a StoreSlot. True if this is not a StoreSlot. /// public bool IsNone { get { return this.Type == StoreType.None; } } public static bool operator == (StoreSlot a, StoreSlot b) { return a.Slot == b.Slot && a.Type == b.Type; } public static bool operator != (StoreSlot a, StoreSlot b) { return a.Slot != b.Slot || a.Type != b.Type; } public override bool Equals (object obj) { if (obj == null) return false; if (!(obj is StoreSlot)) return false; StoreSlot other = (StoreSlot) obj; return this == other; } public bool Equals (StoreSlot other) { return this == other; } public override int GetHashCode () { return Slot.GetHashCode () ^ Type.GetHashCode (); } } /// /// Wraps an instruction and a stack of leave statements used to get to this instruction. /// Needed to do correct analysis in finally blocks. /// struct InstructionWithLeave : IEquatable { public static readonly InstructionWithLeave Empty = new InstructionWithLeave (); public readonly Instruction Instruction; public readonly Instruction [] LeaveStack; public InstructionWithLeave (Instruction instruction) { this.Instruction = instruction; this.LeaveStack = null; } private InstructionWithLeave (Instruction instruction, Instruction [] leaveStack) { this.Instruction = instruction; this.LeaveStack = leaveStack; } /// /// Returns a new InstructionWithLeave with leave pushed onto the stack. /// /// The new instruction. /// The leave instruction to push onto the stack. /// A new InstructionWithLeave public InstructionWithLeave Push (Instruction instruction, Instruction leave) { Instruction [] newStack; if (this.LeaveStack != null) { newStack = new Instruction [LeaveStack.Length + 1]; Array.Copy (LeaveStack, newStack, LeaveStack.Length); newStack [LeaveStack.Length] = leave; } else { newStack = new Instruction [] { leave }; } return new InstructionWithLeave (instruction, newStack); } /// /// Returns a new InstructionWithLeave with the same LeaveStack and another instruction. /// /// The new instruction. /// a new InstructionWithLeave public InstructionWithLeave Copy (Instruction instruction) { return new InstructionWithLeave (instruction, this.LeaveStack); } /// /// Returns a new InstructionWithLeave with the one leave statement popped and instruction set to the operand of the popped leave statement. /// /// a new InstructionWithLeave public InstructionWithLeave Pop () { Instruction [] newStack = null; if (LeaveStack == null) return new InstructionWithLeave (); if (LeaveStack.Length != 1) { newStack = new Instruction [LeaveStack.Length - 1]; Array.Copy (LeaveStack, newStack, newStack.Length); } return new InstructionWithLeave ((Instruction) this.LeaveStack [this.LeaveStack.Length - 1].Operand, newStack); } public override bool Equals (object obj) { if (obj is InstructionWithLeave) return Equals ((InstructionWithLeave) obj); return false; } public bool Equals (InstructionWithLeave other) { return (Instruction == other.Instruction); } public override int GetHashCode () { return Instruction.GetHashCode (); } public static bool operator == (InstructionWithLeave left, InstructionWithLeave right) { return left.Equals (right); } public static bool operator != (InstructionWithLeave left, InstructionWithLeave right) { return !left.Equals (right); } } public MethodDefinition Method { get; private set; } private MethodBody Body { get { return Method.Body; } } public StackEntryAnalysis (MethodDefinition method) { this.Method = method; } //static lists to save allocations. private static List> UsedBy = new List> (); private static List> AlternativePaths = new List> (); /// /// Searches a method for usage of the value pushed onto the stack by the specified instruction. /// /// The instruction. /// An array of UsageResults containing the instructions that use the value and the stack offset of the entry at that instruction. A StackOffset of 0 means right on top of the stack. public StackEntryUsageResult [] GetStackEntryUsage (Instruction ins) { if (ins == null) throw new ArgumentNullException ("ins"); /* In the main loop we search for all usages of a StackEntry. * Then we check each usage for a store (to a local variable or an argument), search for corrosponding loads and search for usages of the new Stackentry. * This continues until no stores are found. */ UsedBy.Clear (); AlternativePaths.Clear (); AlternativePaths.Add (new KeyValuePair (new InstructionWithLeave (ins.Next), 0)); int lastAlternativesCount = 0; int lastUsedByCount = 0; while (lastAlternativesCount != AlternativePaths.Count) { //continue until no more alternatives have been found (by CheckUsedBy) for (int i = lastAlternativesCount; i < AlternativePaths.Count; i++) { //find the instruction that pops the value and follow all branches var result = FollowStackEntry (AlternativePaths [i].Key, AlternativePaths [i].Value); if (result.Key.Instruction != null) UsedBy.AddIfNew (result); //add to usedby list } lastAlternativesCount = AlternativePaths.Count; //check each path only once. CheckUsedBy (lastUsedByCount); lastUsedByCount = UsedBy.Count; } //build return value StackEntryUsageResult [] results = new StackEntryUsageResult [UsedBy.Count]; for (int i = 0; i < results.Length; i++) results [i] = new StackEntryUsageResult (UsedBy [i].Key.Instruction, UsedBy [i].Value); return results; } /// /// Iterates over all Instructions inside UsedBy and spawns a new alternative if necessary. /// /// The first index to progress. private void CheckUsedBy (int start) { for (int ii = start; ii < UsedBy.Count; ii++) { InstructionWithLeave use = UsedBy [ii].Key; StoreSlot slot = GetStoreSlot (use.Instruction); //check if this is a store instruction bool removeFromUseBy = false; //ignore the use if (use.Instruction.OpCode.Code == Code.Castclass) { removeFromUseBy = true; AlternativePaths.AddIfNew (new KeyValuePair (use.Copy (use.Instruction.Next), 0)); } else if (use.Instruction.OpCode.Code == Code.Pop) {//pop is not a valid usage removeFromUseBy = true; } else if (!slot.IsNone) { if (slot.Type == StoreType.Argument || slot.Type == StoreType.Local) removeFromUseBy = true; //temporary save foreach (var ld in this.FindLoad (use.Copy (use.Instruction.Next), slot)) { //start searching at the next instruction AlternativePaths.AddIfNew (new KeyValuePair (ld.Copy (ld.Instruction.Next), 0)); } } if (removeFromUseBy) { UsedBy.RemoveAt (ii); ii--; } } } /// /// Follows the instructions until the specified stack entry is accessed. /// /// The first instruction. /// The distance of the stack entry from the top of the stack. 0 means right on top. /// The instruction that pops the stackEntry and the distance of the entry to the top of the stack. If no valid instruction if found the method returns InstructionWithLeave.Empty. private KeyValuePair FollowStackEntry (InstructionWithLeave startInstruction, int stackEntryDistance) { Instruction ins = startInstruction.Instruction; while (true) { int pop = ins.GetPopCount (this.Method); int push = ins.GetPushCount (); if (pop > stackEntryDistance) //does this instruction pop the stack entry return new KeyValuePair (startInstruction.Copy (ins), stackEntryDistance); stackEntryDistance -= pop; stackEntryDistance += push; //fetch ne next instruction object alternativeNext; Instruction nextInstruction = GetNextInstruction (ins, out alternativeNext); if (nextInstruction == null) return new KeyValuePair (); //return / throw / endfinally if (nextInstruction.OpCode.Code == Code.Leave || nextInstruction.OpCode.Code == Code.Leave_S) return new KeyValuePair (); //leave clears the stack, the entry is gone. if (alternativeNext != null) { //branch / switch Instruction oneTarget = alternativeNext as Instruction; if (oneTarget != null) { //branch AlternativePaths.AddIfNew (new KeyValuePair (startInstruction.Copy (oneTarget), stackEntryDistance)); } else { //switch foreach (Instruction switchTarget in (Instruction []) alternativeNext) AlternativePaths.AddIfNew (new KeyValuePair (startInstruction.Copy (switchTarget), stackEntryDistance)); } } if (nextInstruction.OpCode.FlowControl == FlowControl.Branch || nextInstruction.OpCode.FlowControl == FlowControl.Cond_Branch) { AlternativePaths.AddIfNew (new KeyValuePair (startInstruction.Copy (nextInstruction), stackEntryDistance)); return new KeyValuePair (); //end of block } ins = nextInstruction; } } //static lists to save allocations. private static List LoadAlternatives = new List (); private static List LoadResults = new List (); /// /// Follows the codeflow starting at a given instruction and finds all loads for a given slot. /// Continues and follows all branches until the slot is overwritten or the method returns / throws. /// /// The first instruction to start the search at. /// The slot to search. /// An array of instructions that load from the slot. private List FindLoad (InstructionWithLeave insWithLeave, StoreSlot slot) { LoadAlternatives.Clear (); LoadResults.Clear (); LoadAlternatives.Add (insWithLeave); for (int i = 0; i < LoadAlternatives.Count; i++) { //loop over all branches, more will get added inside the loop insWithLeave = LoadAlternatives [i]; //the first instruction of the block (contains the leave stack) Instruction ins = insWithLeave.Instruction; //the current instruction while (ins != null) { if (GetStoreSlot (ins) == slot) //check if the slot gets overwritten break; if (slot == GetLoadSlot (ins)) LoadResults.AddIfNew (insWithLeave.Copy (ins)); //continue, might be loaded again //we simply branch to every possible catch block. IList ehc = null; if (Body.HasExceptionHandlers) { ehc = Body.ExceptionHandlers; foreach (ExceptionHandler handler in ehc) { if (handler.HandlerType != ExceptionHandlerType.Catch) continue; if (ins.Offset < handler.TryStart.Offset || ins.Offset >= handler.TryEnd.Offset) continue; LoadAlternatives.AddIfNew (insWithLeave.Copy (handler.HandlerStart)); } } //Code.Leave leaves a try/catch block. Search for the finally block. if (ins.OpCode.Code == Code.Leave || ins.OpCode.Code == Code.Leave_S) { bool handlerFound = false; if (ehc != null) { foreach (ExceptionHandler handler in ehc) { if (handler.HandlerType != ExceptionHandlerType.Finally) continue; if (handler.TryStart.Offset > ins.Offset || handler.TryEnd.Offset <= ins.Offset) continue; LoadAlternatives.AddIfNew (insWithLeave.Push (handler.HandlerStart, ins)); //push the leave instruction onto the leave stack handlerFound = true; break; } } if (!handlerFound) //no finally found (try/catch without finally) LoadAlternatives.AddIfNew (insWithLeave.Copy ((Instruction) ins.Operand)); break; } if (ins.OpCode.Code == Code.Endfinally) { //pop the last leave instruction and branch to it LoadAlternatives.AddIfNew (insWithLeave.Pop ()); break; } //fetch the next instruction (s) object alternativeNext; ins = GetNextInstruction (ins, out alternativeNext); if (ins == null) break; if (alternativeNext != null) { Instruction oneTarget = alternativeNext as Instruction; if (oneTarget != null) { //normal branch LoadAlternatives.AddIfNew (insWithLeave.Copy (oneTarget)); } else { //switch statement foreach (Instruction switchTarget in (Instruction []) alternativeNext) LoadAlternatives.AddIfNew (insWithLeave.Copy (switchTarget)); } } if (ins.OpCode.FlowControl == FlowControl.Branch || ins.OpCode.FlowControl == FlowControl.Cond_Branch) { if (ins.OpCode.Code != Code.Leave && ins.OpCode.Code != Code.Leave_S) { LoadAlternatives.AddIfNew (insWithLeave.Copy (ins)); //add if new, avoid infinity loop break; } } } } return LoadResults; } /// /// Helper method that returns the next Instruction. /// /// The instruction /// If the instruction is a branch, the branch target is returned. For a switch statemant an array of targets is returned. /// The next instruction that would be executed by the runtime. public static Instruction GetNextInstruction (Instruction ins, out object alternative) { if (ins == null) throw new ArgumentNullException ("ins"); alternative = null; switch (ins.OpCode.FlowControl) { case FlowControl.Branch: return (Instruction) ins.Operand; case FlowControl.Cond_Branch: alternative = ins.Operand; return ins.Next; case FlowControl.Call: case FlowControl.Next: case FlowControl.Meta: case FlowControl.Break: //debugging breakpoint return ins.Next; case FlowControl.Return: case FlowControl.Throw: return null; default: throw new NotImplementedException ("FlowControl: " + ins.OpCode.FlowControl.ToString () + " is not supported."); } } /// /// Checks if an instruction is a load and returns the slot it loads from. /// /// The instruction /// If the instruction is a load returns the slot to load. Check slot.IsNone() to see if this instruction is a load. private StoreSlot GetLoadSlot (Instruction ins) { switch (ins.OpCode.Code) { case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: return new StoreSlot (StoreType.Local, ins.OpCode.Code - Code.Ldloc_0); case Code.Ldloc_S: case Code.Ldloc: return new StoreSlot (StoreType.Local, ((VariableDefinition) ins.Operand).Index); case Code.Ldfld: //TODO: we do not check what instance is on the stack return new StoreSlot (StoreType.Field, ((FieldReference) ins.Operand).MetadataToken.ToInt32 ()); case Code.Ldsfld: return new StoreSlot (StoreType.StaticField, ((FieldReference) ins.Operand).MetadataToken.ToInt32 ()); case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: return new StoreSlot (StoreType.Argument, ins.OpCode.Code - Code.Ldarg_0); case Code.Ldarg_S: case Code.Ldarg: { int sequence = ((ParameterDefinition) ins.Operand).Index + 1; if (!this.Method.HasThis) sequence--; return new StoreSlot (StoreType.Argument, sequence); } case Code.Ldind_I: case Code.Ldind_I1: case Code.Ldind_I2: case Code.Ldind_I4: case Code.Ldind_I8: case Code.Ldind_R4: case Code.Ldind_R8: case Code.Ldind_Ref: case Code.Ldind_U1: case Code.Ldind_U2: case Code.Ldind_U4: //TODO: improve stack check while (ins.Previous != null) { //quick fix for out parameters. ins = ins.Previous; StoreSlot last = GetLoadSlot (ins); if (last.Type == StoreType.Argument) return new StoreSlot (StoreType.Out, last.Slot); } goto default; default: return new StoreSlot (StoreType.None, -1); } } /// /// Checks if an instruction is a store and returns the slot. /// /// The instruction /// If the instruction is a store returns the slot to store. Check slot.IsNone() to see if this instruction is a store. private StoreSlot GetStoreSlot (Instruction ins) { switch (ins.OpCode.Code) { case Code.Stloc_0: case Code.Stloc_1: case Code.Stloc_2: case Code.Stloc_3: return new StoreSlot (StoreType.Local, ins.OpCode.Code - Code.Stloc_0); case Code.Stloc_S: case Code.Stloc: return new StoreSlot (StoreType.Local, ((VariableDefinition) ins.Operand).Index); case Code.Stfld: //TODO: we do not check what instance is on the stack return new StoreSlot (StoreType.Field, ((FieldReference) ins.Operand).MetadataToken.ToInt32 ()); case Code.Stsfld: return new StoreSlot (StoreType.StaticField, ((FieldReference) ins.Operand).MetadataToken.ToInt32 ()); case Code.Starg_S: //store arg (not ref / out etc) case Code.Starg: { int sequence = ((ParameterDefinition) ins.Operand).Index + 1; if (!this.Method.HasThis) sequence--; return new StoreSlot (StoreType.Argument, sequence); } case Code.Stind_I: case Code.Stind_I1: case Code.Stind_I2: case Code.Stind_I4: case Code.Stind_I8: case Code.Stind_R4: case Code.Stind_R8: case Code.Stind_Ref: //TODO: improve stack check while (ins.Previous != null) { //quick fix for out parameters. ins = ins.Previous; StoreSlot last = GetLoadSlot (ins); if (last.Type == StoreType.Argument) return new StoreSlot (StoreType.Out, last.Slot); } goto default; default: return new StoreSlot (StoreType.None, -1); } } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/Log.cs0000664000175000017500000001022512413742070027415 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Helpers.Log // // Authors: // Jesse Jones // // Copyright (C) 2008 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Diagnostics; using System.Collections.Generic; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework.Helpers { /// /// Wrapper around System.Diagnostics.Debug. /// /// /// Instead of adding temporary Console.WriteLines to your rules use this /// class instead. This way we can leave the debugging code in the rule /// and enable it on a rule by rule basis (using the bin/gendarme.exe.config /// file). Usage is like this: /// /// /// Log.WriteLine (this, "value: {0}", value); // this will normally be a rule instance /// Log.WriteLine ("DefineAZeroValueRule", "hey"); // should rarely be used /// Log.WriteLine ("DefineAZeroValueRule.Details", "hey"); // convention for additional output /// /// /// public static class Log { private static Dictionary enabled = new Dictionary (); #if false // Write (T) [Conditional ("DEBUG")] public static void Write (T category, string format, params object[] args) { string name = typeof (T).Name; if (IsEnabled (name)) Debug.Write (string.Format (format, args)); } // Write (string) [Conditional ("DEBUG")] public static void Write (string category, string format, params object[] args) { if (IsEnabled (category)) Debug.Write (string.Format (format, args)); } #endif // WriteLine (T) [Conditional ("DEBUG")] public static void WriteLine (T category) { WriteLine (typeof (T).Name); } [Conditional ("DEBUG")] public static void WriteLine (T category, string format, params object[] args) { WriteLine (typeof (T).Name, format, args); } [Conditional ("DEBUG")] public static void WriteLine (T category, MemberReference member) { WriteLine (typeof (T).Name, member); } // WriteLine (string) [Conditional ("DEBUG")] public static void WriteLine (string category) { if (IsEnabled (category)) Debug.WriteLine (string.Empty); } [Conditional ("DEBUG")] public static void WriteLine (string category, string format, params object[] args) { if (IsEnabled (category)) Debug.WriteLine (string.Format (format, args)); } [Conditional ("DEBUG")] public static void WriteLine (string category, MemberReference member) { if (IsEnabled (category)) { MethodDefinition md = (member as MethodDefinition); if (md != null) Debug.WriteLine (new MethodPrinter (md).ToString ()); else Debug.WriteLine (member.GetFullName ()); } } // Misc [Conditional ("DEBUG")] public static void Indent () { Debug.Indent (); } [Conditional ("DEBUG")] public static void Unindent () { Debug.Unindent (); } public static bool IsEnabled (string category) { bool enable; if (!enabled.TryGetValue (category, out enable)) { enable = new BooleanSwitch (category, string.Empty).Enabled; enabled.Add (category, enable); } return enable; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/MethodPrinter.cs0000664000175000017500000001435112413742070031464 0ustar00directhexdirecthex00000000000000/* * Extracted from CFG.cs * * Authors: * Aaron Tomb * * Copyright (c) 2005 Aaron Tomb and the contributors listed * in the ChangeLog. * * This is free software, distributed under the MIT/X11 license. * See the included LICENSE.MIT file for details. **********************************************************************/ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Text; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Framework.Helpers { public sealed class MethodPrinter { private IList instructions; private MethodDefinition method; private IDictionary branchTable; public MethodPrinter (MethodDefinition m) { if (m == null) throw new ArgumentNullException ("m"); method = m; if (method.HasBody) instructions = method.Body.Instructions; if (instructions != null) InitBranchTable (); } public override string ToString () { Instruction prevInstr = null; StringBuilder buffer = new StringBuilder (); if (method != null) buffer.AppendLine (method.ToString ()); if (instructions != null) { foreach (Instruction instr in instructions) { if (StartsTryRegion (instr) != null) buffer.AppendLine ("Try {"); if (StartsHandlerRegion (instr) != null) buffer.AppendLine ("Handle {"); if (IsLeader (instr, prevInstr)) buffer.Append ("* "); else buffer.Append (" "); buffer.Append (" "); buffer.Append (instr.Offset.ToString ("X4", CultureInfo.InvariantCulture)); buffer.Append (": "); buffer.Append (instr.OpCode.Name); int[] targets = BranchTargets (instr); if (targets != null) { foreach (int target in targets) { buffer.Append (' '); buffer.Append (target.ToString ("X4", CultureInfo.InvariantCulture)); } } else if (instr.Operand is string) { buffer.Append (" \""); buffer.Append (instr.Operand); buffer.Append ('"'); } else if (instr.Operand != null) { buffer.Append (" "); buffer.Append (instr.Operand); } buffer.AppendLine (); prevInstr = instr; if (EndsTryRegion (instr) != null) buffer.AppendLine ("} (Try)"); if (EndsHandlerRegion (instr) != null) buffer.AppendLine ("} (Handle)"); } } return buffer.ToString ().Trim (); } #region Helpers (used by CFG) public static int[] BranchTargets (Instruction instruction) { if (instruction == null) throw new ArgumentNullException ("instruction"); int[] result = null; switch (instruction.OpCode.OperandType) { case OperandType.InlineSwitch: Instruction[] targets = (Instruction[])instruction.Operand; result = new int[targets.Length]; int i = 0; foreach (Instruction target in targets) { result [i] = target.Offset; i++; } break; case OperandType.InlineBrTarget: result = new int[1]; result [0] = ((Instruction)instruction.Operand).Offset; break; case OperandType.ShortInlineBrTarget: result = new int[1]; result [0] = ((Instruction)instruction.Operand).Offset; break; } return result; } public bool IsLeader (Instruction instruction, Instruction previous) { if (instruction == null) throw new ArgumentNullException ("instruction"); /* First instruction in the method */ if (previous == null) return true; /* Target of a branch */ if (branchTable.Contains (instruction.Offset)) return true; /* Follows a control flow instruction */ if (IsBranch (instruction.Previous)) return true; /* Is the beginning of a try region */ if (StartsTryRegion (instruction) != null) return true; /* Is the beginning of a handler region */ if (StartsHandlerRegion (instruction) != null) return true; return false; } public ExceptionHandler StartsHandlerRegion (Instruction instruction) { foreach (ExceptionHandler handler in method.Body.ExceptionHandlers) { if (OffsetsEqual (instruction, handler.HandlerStart)) return handler; } return null; } public ExceptionHandler EndsTryRegion (Instruction instruction) { foreach (ExceptionHandler handler in method.Body.ExceptionHandlers) { if (instruction != null) if (OffsetsEqual (instruction.Next, handler.TryEnd)) return handler; } return null; } public ExceptionHandler EndsHandlerRegion (Instruction instruction) { foreach (ExceptionHandler handler in method.Body.ExceptionHandlers) { if (instruction != null) if (OffsetsEqual (instruction.Next, handler.HandlerEnd)) return handler; } return null; } #endregion #region Private Methods private static bool IsBranch (Instruction instruction) { if (instruction == null) return false; switch (instruction.OpCode.FlowControl) { case FlowControl.Branch: case FlowControl.Cond_Branch: case FlowControl.Return: /* Throw creates a new basic block, but it has no target, * because the object to be thrown is taken from the stack. * Thus, its type is not known before runtime, and we can't * know which catch block will recieve it. */ case FlowControl.Throw: return true; } return false; } private static bool OffsetsEqual (Instruction insn1, Instruction insn2) { if (insn1 == insn2) return true; if (insn1 == null) return false; if (insn2 == null) return false; return (insn1.Offset == insn2.Offset); } private ExceptionHandler StartsTryRegion (Instruction instruction) { foreach (ExceptionHandler handler in method.Body.ExceptionHandlers) { if (OffsetsEqual (instruction, handler.TryStart)) return handler; } return null; } private void InitBranchTable () { branchTable = new Hashtable (); foreach (Instruction instr in instructions) { int[] targets = BranchTargets (instr); if (targets != null) { foreach (int target in targets) { if (!branchTable.Contains (target)) { IList sources = new ArrayList (); sources.Add (target); branchTable.Add (target, sources); } else { IList sources = (IList)branchTable [target]; sources.Add (target); } } } } } #endregion } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/PrimitiveReferences.cs0000664000175000017500000000511212413742070032645 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Helpers.PrimitiveReferences // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework.Helpers { /// /// Provide an easy way to get TypeReference to primitive types without having /// direct access to the mscorlib.dll assembly (any ModuleDefinition will do). /// public static class PrimitiveReferences { // To avoid memory allocations this is done in three stages // 1. the references are cached at the first call and reused afterward (very cheap) // 2. we look if the module already have the TypeReference (cheap) // 3. at last we go thru the full Import (costly) // TODO - extend to all primivites static TypeReference single_ref; static TypeReference double_ref; static TypeReference GetReference (Type type, IMetadataTokenProvider metadata) { ModuleDefinition module = metadata.GetAssembly ().MainModule; TypeReference tr; if (!module.TryGetTypeReference (type.FullName, out tr)) tr = module.Import (type); return tr; } static public TypeReference GetDouble (IMetadataTokenProvider metadata) { if (double_ref == null) double_ref = GetReference (typeof (double), metadata); return double_ref; } static public TypeReference GetSingle (IMetadataTokenProvider metadata) { if (single_ref == null) single_ref = GetReference (typeof (float), metadata); return single_ref; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/StreamLineReader.cs0000664000175000017500000000620212413742070032062 0ustar00directhexdirecthex00000000000000// // StreamLineReader - A StringReader-like class that avoid creating string // // Authors: // Sebastien Pouliot // // 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; namespace Gendarme.Framework.Helpers { // note: inheriting from StreamReader was not possible since we cannot // override EndOfStream and ensure integrity with other Read ops public class StreamLineReader : IDisposable { StreamReader sr; char [] buff; int n; int max; public StreamLineReader (string fileName) { sr = new StreamReader (fileName); Initialize (); } public StreamLineReader (Stream stream) { sr = new StreamReader (stream); Initialize (); } void Initialize () { buff = new char [4096]; max = n = buff.Length; } public bool EndOfStream { get { return (n == max || max == 0) && sr.EndOfStream; } } public int ReadLine (char [] buffer, int index, int count) { if (Disposed) throw new ObjectDisposedException ("StreamLineReader"); if (buffer == null) throw new ArgumentNullException ("buffer"); if (index < 0) throw new ArgumentOutOfRangeException ("index", "< 0"); if (count < 0) throw new ArgumentOutOfRangeException ("count", "< 0"); // ordered to avoid possible integer overflow if (index > buffer.Length - count) throw new ArgumentException ("index + count > buffer.Length"); int len = 0; while (len < count) { if (n == max) { max = sr.ReadBlock (buff, 0, buff.Length); if (max == 0) break; n = 0; } char c = buff [n++]; switch (c) { case '\r': continue; case '\n': Array.Clear (buffer, len, buffer.Length - len); return len; default: buffer [index++] = c; len++; break; } } return len; } public void Dispose () { Dispose (true); GC.SuppressFinalize (this); } protected virtual void Dispose (bool disposing) { try { if (!Disposed) sr.Dispose (); } finally { Disposed = true; } } protected bool Disposed { get; private set; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/Namespace.cs0000664000175000017500000000712112413742070030571 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Helpers.NamespaceDefinition // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Metadata; namespace Gendarme.Framework.Helpers { /// /// Namespaces do not really exists in the CLR, at least not like other first level citizens. /// Since we want to report defects against them we need something to fill this void. /// public class NamespaceDefinition : IMetadataTokenProvider { internal const TokenType NamespaceTokenType = (TokenType) 0xFF000000; private string ns; private NamespaceDefinition (string name) { ns = name; MetadataToken = new MetadataToken (NamespaceTokenType, (uint) name.GetHashCode ()); } public string Name { get { return ns; } } /// /// This is not a true, CLR-wise, metadata object but it /// returns a fake token so other API, like rocks, can use it /// like any real IMetadataTokenProvider /// public MetadataToken MetadataToken { get; set; } public override string ToString () { return ns; } static string [] Specializations = { ".Design", ".Interop", ".Permissions" }; /// /// Check if the specified namespace is a 'specialized' namespace, i.e. a /// namespace that the framework suggest you to use. /// /// Namespace to be verified. /// True if the namespace is a specialized namespace. static public bool IsSpecialized (string name) { if (name == null) throw new ArgumentNullException ("name"); foreach (string s in Specializations) { if (name.EndsWith (s, StringComparison.Ordinal)) return true; } return false; } static Dictionary cache = new Dictionary (); /// /// Get the NamespaceDefinition that correspond to the specified namespace. /// /// Name of the namespace /// A global NamespaceDefinition corresponding to the specified namespace static public NamespaceDefinition GetDefinition (string name) { if (name == null) throw new ArgumentNullException ("name"); // note: "" (empty) is a valid namespace NamespaceDefinition nd; if (!cache.TryGetValue (name, out nd)) { nd = new NamespaceDefinition (name); cache.Add (name, nd); } return nd; } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/MethodSignatures.cs0000664000175000017500000002135512413742070032167 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.MethodSignatures // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // Copyright (C) 2008, 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; using System.Collections.Generic; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework.Helpers { /// /// Defines commonly used MethodSignatures /// // public static class MethodSignatures { private static readonly string [] NoParameter = new string [0]; private static bool CheckAttributes (MethodReference method, MethodAttributes attrs) { MethodDefinition md = method.Resolve (); return ((md == null) || ((md.Attributes & attrs) == attrs)); } // System.Object public static readonly new MethodSignature Equals = new MethodSignature ("Equals", "System.Boolean", new string [] { "System.Object" }, (method) => (CheckAttributes (method, MethodAttributes.Public))); public static readonly MethodSignature Finalize = new MethodSignature ("Finalize", "System.Void", NoParameter, (method) => (CheckAttributes (method, MethodAttributes.Family))); public static readonly new MethodSignature GetHashCode = new MethodSignature ("GetHashCode", "System.Int32", NoParameter, (method) => (CheckAttributes (method, MethodAttributes.Public | MethodAttributes.Virtual))); public static readonly new MethodSignature ToString = new MethodSignature ("ToString", "System.String", NoParameter, (method) => (CheckAttributes (method, MethodAttributes.Public | MethodAttributes.Virtual))); // IClonable public static readonly MethodSignature Clone = new MethodSignature ("Clone", null, NoParameter); // IDisposable public static readonly MethodSignature Dispose = new MethodSignature ("Dispose", "System.Void", NoParameter); public static readonly MethodSignature DisposeExplicit = new MethodSignature ("System.IDisposable.Dispose", "System.Void", NoParameter); // ISerialization private static string [] SerializationParameters = new string [] { "System.Runtime.Serialization.SerializationInfo", "System.Runtime.Serialization.StreamingContext" }; public static readonly MethodSignature SerializationConstructor = new MethodSignature (".ctor", "System.Void", SerializationParameters); public static readonly MethodSignature GetObjectData = new MethodSignature ("GetObjectData", "System.Void", SerializationParameters); public static readonly MethodSignature SerializationEventHandler = new MethodSignature (null, "System.Void", new string [] { "System.Runtime.Serialization.StreamingContext" }, (method) => (CheckAttributes (method, MethodAttributes.Private))); // operators private static bool IsOperator (MethodReference method, int parameters) { if (!method.HasParameters || (method.Parameters.Count != parameters)) return false; return CheckAttributes (method, MethodAttributes.Static | MethodAttributes.SpecialName); } // unary public static readonly MethodSignature op_UnaryPlus = new MethodSignature ("op_UnaryPlus", (method) => IsOperator (method, 1)); // +5 public static readonly MethodSignature op_UnaryNegation = new MethodSignature ("op_UnaryNegation", (method) => IsOperator (method, 1)); // -5 public static readonly MethodSignature op_LogicalNot = new MethodSignature ("op_LogicalNot", (method) => IsOperator (method, 1)); // !true public static readonly MethodSignature op_OnesComplement = new MethodSignature ("op_OnesComplement", (method) => IsOperator (method, 1)); // ~5 public static readonly MethodSignature op_Increment = new MethodSignature ("op_Increment", (method) => IsOperator (method, 1)); // 5++ public static readonly MethodSignature op_Decrement = new MethodSignature ("op_Decrement", (method) => IsOperator (method, 1)); // 5-- public static readonly MethodSignature op_True = new MethodSignature ("op_True", "System.Boolean", (method) => IsOperator (method, 1)); // if (object) public static readonly MethodSignature op_False = new MethodSignature ("op_False", "System.Boolean", (method) => IsOperator (method, 1)); // if (object) // binary public static readonly MethodSignature op_Addition = new MethodSignature ("op_Addition", (method) => IsOperator (method, 2)); // 5 + 5 public static readonly MethodSignature op_Subtraction = new MethodSignature ("op_Subtraction", (method) => IsOperator (method, 2)); // 5 - 5 public static readonly MethodSignature op_Multiply = new MethodSignature ("op_Multiply", (method) => IsOperator (method, 2)); // 5 * 5 public static readonly MethodSignature op_Division = new MethodSignature ("op_Division", (method) => IsOperator (method, 2)); // 5 / 5 public static readonly MethodSignature op_Modulus = new MethodSignature ("op_Modulus", (method) => IsOperator (method, 2)); // 5 % 5 public static readonly MethodSignature op_BitwiseAnd = new MethodSignature ("op_BitwiseAnd", (method) => IsOperator (method, 2)); // 5 & 5 public static readonly MethodSignature op_BitwiseOr = new MethodSignature ("op_BitwiseOr", (method) => IsOperator (method, 2)); // 5 | 5 public static readonly MethodSignature op_ExclusiveOr = new MethodSignature ("op_ExclusiveOr", (method) => IsOperator (method, 2)); // 5 ^ 5 public static readonly MethodSignature op_LeftShift = new MethodSignature ("op_LeftShift", (method) => IsOperator (method, 2)); // 5 << 5 public static readonly MethodSignature op_RightShift = new MethodSignature ("op_RightShift", (method) => IsOperator (method, 2)); // 5 >> 5 // comparison public static readonly MethodSignature op_Equality = new MethodSignature ("op_Equality", (method) => IsOperator (method, 2)); // 5 == 5 public static readonly MethodSignature op_Inequality = new MethodSignature ("op_Inequality", (method) => IsOperator (method, 2)); // 5 != 5 public static readonly MethodSignature op_GreaterThan = new MethodSignature ("op_GreaterThan", (method) => IsOperator (method, 2)); // 5 > 5 public static readonly MethodSignature op_LessThan = new MethodSignature ("op_LessThan", (method) => IsOperator (method, 2)); // 5 < 5 public static readonly MethodSignature op_GreaterThanOrEqual = new MethodSignature ("op_GreaterThanOrEqual", (method) => IsOperator (method, 2)); // 5 >= 5 public static readonly MethodSignature op_LessThanOrEqual = new MethodSignature ("op_LessThanOrEqual", (method) => IsOperator (method, 2)); // 5 <= 5 // Invoke public static readonly MethodSignature Invoke = new MethodSignature ("Invoke"); // TryParse public static readonly MethodSignature TryParse = new MethodSignature ("TryParse", delegate (MethodReference method) { if (!method.ReturnType.IsNamed ("System", "Boolean")) return false; IList pdc = method.Parameters; if (!pdc [0].ParameterType.IsNamed ("System", "String")) return false; TypeReference last = pdc [pdc.Count - 1].ParameterType; if (!last.IsByReference) return false; TypeReference mtype = method.DeclaringType; if (last.Namespace != mtype.Namespace) return false; string pt_name = last.Name; return (String.Compare (pt_name, 0, mtype.Name, 0, pt_name.Length - 1, StringComparison.Ordinal) == 0); } ); // Parse - first parameter (required) is a string, return the same type as the declraring type public static readonly MethodSignature Parse = new MethodSignature ("Parse", delegate (MethodReference method) { if (!method.HasParameters) return false; if (!method.ReturnType.IsNamed (method.DeclaringType.Namespace, method.DeclaringType.Name)) return false; return method.Parameters [0].ParameterType.IsNamed ("System", "String"); } ); } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/OpCodeBitmask.cs0000664000175000017500000002704312413742070031366 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.Helpers.OpCodeBitmask // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using System.Text; using Mono.Cecil.Cil; namespace Gendarme.Framework.Helpers { /// /// This is a specialized Bitmask class for the Code enumeration. /// Bitmask`1 can't be used since there are more than 64 opcodes defined. /// public sealed class OpCodeBitmask : IEquatable { ulong [] mask = new ulong [4]; /// /// Create a new, empty, OpCode bitmask /// public OpCodeBitmask () { } public OpCodeBitmask (OpCodeBitmask bitmask) { if (bitmask == null) throw new ArgumentNullException ("bitmask"); mask [0] = bitmask.mask [0]; mask [1] = bitmask.mask [1]; mask [2] = bitmask.mask [2]; mask [3] = bitmask.mask [3]; } public OpCodeBitmask (ulong a, ulong b, ulong c, ulong d) { mask [0] = a; mask [1] = b; mask [2] = c; mask [3] = d; } public void Clear (Code code) { int index = (int) code; mask [index >> 6] &= ~((ulong) 1 << (index & 63)); } public void ClearAll () { mask [0] = mask [1] = mask [2] = mask [3] = 0; } public bool Get (Code code) { int index = (int) code; return ((mask [index >> 6] & ((ulong) 1 << (index & 63))) != 0); } public void Set (Code code) { int index = (int) code; mask [index >> 6] |= ((ulong) 1 << (index & 63)); } public void SetAll () { mask [0] = mask [1] = mask [2] = mask [3] = UInt64.MaxValue; } public void UnionWith (OpCodeBitmask bitmask) { if (bitmask == null) throw new ArgumentNullException ("bitmask"); mask [0] |= bitmask.mask [0]; mask [1] |= bitmask.mask [1]; mask [2] |= bitmask.mask [2]; mask [3] |= bitmask.mask [3]; } /// /// Compute if an intersection exists between the bitmasks /// /// Note: a null value is interpreted as a full (set) mask. /// True if there is an intersection (for any opcode) between the masks, False otherwise public bool Intersect (OpCodeBitmask bitmask) { if (bitmask == null) return true; if ((mask [0] & bitmask.mask [0]) != 0) return true; if ((mask [1] & bitmask.mask [1]) != 0) return true; if ((mask [2] & bitmask.mask [2]) != 0) return true; return ((mask [3] & bitmask.mask [3]) != 0); } public bool IsSubsetOf (OpCodeBitmask bitmask) { if (bitmask == null) return true; if ((mask [0] & bitmask.mask [0]) != mask [0]) return false; if ((mask [1] & bitmask.mask [1]) != mask [1]) return false; if ((mask [2] & bitmask.mask [2]) != mask [2]) return false; return ((mask [3] & bitmask.mask [3]) == mask [3]); } public override bool Equals (object obj) { return Equals (obj as OpCodeBitmask); } public bool Equals (OpCodeBitmask other) { if (other == null) return false; return ((mask [0] == other.mask [0]) || (mask [1] == other.mask [1]) || (mask [2] == other.mask [2]) || (mask [3] == other.mask [3])); } public override int GetHashCode () { return (mask [0] ^ mask [1] ^ mask [2] ^ mask [3]).GetHashCode (); } public override string ToString () { return String.Format (CultureInfo.InvariantCulture, "0x{0:X}:0x{1:X}:0x{2:X}:0x{3:X}", mask [0], mask [1], mask [2], mask [3]); } // Common masks private static OpCodeBitmask all; private static OpCodeBitmask calls; private static OpCodeBitmask conversion; private static OpCodeBitmask load_argument; private static OpCodeBitmask load_element; private static OpCodeBitmask load_indirect; private static OpCodeBitmask load_local; private static OpCodeBitmask store_argument; private static OpCodeBitmask store_local; private static OpCodeBitmask flow_control_branch; private static OpCodeBitmask flow_control_return; /// /// Mask with all bits sets so it includes all opcodes (and more) /// static public OpCodeBitmask All { get { if (all == null) all = new OpCodeBitmask (Int64.MaxValue, Int64.MaxValue, Int64.MaxValue, Int64.MaxValue); return all; } } /// /// Mask that includes Call and Callvirt. /// Does not include Calli since it's operand is an InlineSig (not InlineMethod) /// static public OpCodeBitmask Calls { get { if (calls == null) { #if true calls = new OpCodeBitmask (0x8000000000, 0x400000000000, 0x0, 0x0); #else calls = new OpCodeBitmask (); calls.Set (Code.Call); calls.Set (Code.Callvirt); #endif } return calls; } } /// /// Mask that includes Conv_* instructions /// static public OpCodeBitmask Conversion { get { if (conversion == null) { #if false conversion = new OpCodeBitmask (0x0, 0x80203FC000000000, 0x400F87F8000001FF, 0x0); #else conversion = new OpCodeBitmask (); conversion.Set (Code.Conv_I); conversion.Set (Code.Conv_I1); conversion.Set (Code.Conv_I2); conversion.Set (Code.Conv_I4); conversion.Set (Code.Conv_I8); conversion.Set (Code.Conv_Ovf_I); conversion.Set (Code.Conv_Ovf_I_Un); conversion.Set (Code.Conv_Ovf_I1); conversion.Set (Code.Conv_Ovf_I1_Un); conversion.Set (Code.Conv_Ovf_I2); conversion.Set (Code.Conv_Ovf_I2_Un); conversion.Set (Code.Conv_Ovf_I4); conversion.Set (Code.Conv_Ovf_I4_Un); conversion.Set (Code.Conv_Ovf_I8); conversion.Set (Code.Conv_Ovf_I8_Un); conversion.Set (Code.Conv_Ovf_U); conversion.Set (Code.Conv_Ovf_U_Un); conversion.Set (Code.Conv_Ovf_U1); conversion.Set (Code.Conv_Ovf_U1_Un); conversion.Set (Code.Conv_Ovf_U2); conversion.Set (Code.Conv_Ovf_U2_Un); conversion.Set (Code.Conv_Ovf_U4); conversion.Set (Code.Conv_Ovf_U4_Un); conversion.Set (Code.Conv_Ovf_U8); conversion.Set (Code.Conv_Ovf_U8_Un); conversion.Set (Code.Conv_R_Un); conversion.Set (Code.Conv_R4); conversion.Set (Code.Conv_R8); conversion.Set (Code.Conv_U); conversion.Set (Code.Conv_U1); conversion.Set (Code.Conv_U2); conversion.Set (Code.Conv_U4); conversion.Set (Code.Conv_U8); #endif } return conversion; } } static public OpCodeBitmask LoadArgument { get { if (load_argument == null) { #if true load_argument = new OpCodeBitmask (0xC03C, 0x0, 0x0, 0x180); #else load_argument = new OpCodeBitmask (); load_argument.Set (Code.Ldarg_0); load_argument.Set (Code.Ldarg_1); load_argument.Set (Code.Ldarg_2); load_argument.Set (Code.Ldarg_3); load_argument.Set (Code.Ldarg); load_argument.Set (Code.Ldarg_S); load_argument.Set (Code.Ldarga); load_argument.Set (Code.Ldarga_S); #endif } return load_argument; } } static public OpCodeBitmask LoadElement { get { if (load_element == null) { #if true load_element = new OpCodeBitmask (0x0, 0x0, 0x100FFF000, 0x0); #else load_element = new OpCodeBitmask (); load_element.Set (Code.Ldelem_Any); load_element.Set (Code.Ldelem_I); load_element.Set (Code.Ldelem_I1); load_element.Set (Code.Ldelem_I2); load_element.Set (Code.Ldelem_I4); load_element.Set (Code.Ldelem_I8); load_element.Set (Code.Ldelem_R4); load_element.Set (Code.Ldelem_R8); load_element.Set (Code.Ldelem_Ref); load_element.Set (Code.Ldelem_U1); load_element.Set (Code.Ldelem_U2); load_element.Set (Code.Ldelem_U4); load_element.Set (Code.Ldelema); #endif } return load_element; } } static public OpCodeBitmask LoadIndirect { get { if (load_indirect == null) { #if true load_indirect = new OpCodeBitmask (0x0, 0xFFE0, 0x0, 0x0); #else load_indirect = new OpCodeBitmask (); load_indirect.Set (Code.Ldind_I); load_indirect.Set (Code.Ldind_I1); load_indirect.Set (Code.Ldind_I2); load_indirect.Set (Code.Ldind_I4); load_indirect.Set (Code.Ldind_I8); load_indirect.Set (Code.Ldind_R4); load_indirect.Set (Code.Ldind_R8); load_indirect.Set (Code.Ldind_Ref); load_indirect.Set (Code.Ldind_U1); load_indirect.Set (Code.Ldind_U2); load_indirect.Set (Code.Ldind_U4); #endif } return load_indirect; } } static public OpCodeBitmask LoadLocal { get { if (load_local == null) { #if true load_local = new OpCodeBitmask (0x603C0, 0x0, 0x0, 0xC00); #else load_local = new OpCodeBitmask (); load_local.Set (Code.Ldloc_0); load_local.Set (Code.Ldloc_1); load_local.Set (Code.Ldloc_2); load_local.Set (Code.Ldloc_3); load_local.Set (Code.Ldloc); load_local.Set (Code.Ldloc_S); load_local.Set (Code.Ldloca); load_local.Set (Code.Ldloca_S); #endif } return load_local; } } static public OpCodeBitmask StoreArgument { get { if (store_argument == null) { #if true store_argument = new OpCodeBitmask (0x10000, 0x0, 0x0, 0x200); #else store_argument = new OpCodeBitmask (); store_argument.Set (Code.Starg); store_argument.Set (Code.Starg_S); #endif } return store_argument; } } static public OpCodeBitmask StoreLocal { get { if (store_local == null) { #if true store_local = new OpCodeBitmask (0x83C00, 0x0, 0x0, 0x1000); #else store_local = new OpCodeBitmask (); store_local.Set (Code.Stloc_0); store_local.Set (Code.Stloc_1); store_local.Set (Code.Stloc_2); store_local.Set (Code.Stloc_3); store_local.Set (Code.Stloc); store_local.Set (Code.Stloc_S); #endif } return store_local; } } static public OpCodeBitmask FlowControlBranch { get { if (flow_control_branch == null) { #if true flow_control_branch = new OpCodeBitmask (0x80040000000000, 0x0, 0x1800000000000000, 0x1000); #else flow_control_branch = new OpCodeBitmask (); flow_control_branch.Set (Code.Br); flow_control_branch.Set (Code.Br_S); flow_control_branch.Set (Code.Leave); flow_control_branch.Set (Code.Leave_S); #endif } return flow_control_branch; } } static public OpCodeBitmask FlowControlReturn { get { if (flow_control_return == null) { #if true flow_control_return = new OpCodeBitmask (0x20000000000, 0x0, 0x400000000000000, 0x4000); #else flow_control_return = new OpCodeBitmask (); flow_control_return.Set (Code.Ret); flow_control_return.Set (Code.Endfinally); flow_control_return.Set (Code.Endfilter); #endif } return flow_control_return; } } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/StackEntryUsageResult.cs0000664000175000017500000000476212413742070033160 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.StackEntryUsageResult // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; namespace Gendarme.Framework.Helpers { /// /// Represents a usage of a StackEntry /// public struct StackEntryUsageResult : IEquatable { /// /// The instruction that uses the StackEntry /// public readonly Instruction Instruction; /// /// The positive offset of the StackEntry before the instruction executes. 0 means right on top. /// public readonly int StackOffset; public StackEntryUsageResult (Instruction ins, int offset) { this.Instruction = ins; this.StackOffset = offset; } public override bool Equals (object obj) { if (obj is StackEntryUsageResult) return Equals ((StackEntryUsageResult) obj); return false; } public bool Equals (StackEntryUsageResult other) { return (Instruction == other.Instruction) && (StackOffset == other.StackOffset); } public override int GetHashCode () { return Instruction.GetHashCode () ^ StackOffset; } public static bool operator == (StackEntryUsageResult left, StackEntryUsageResult right) { return left.Equals (right); } public static bool operator != (StackEntryUsageResult left, StackEntryUsageResult right) { return !left.Equals (right); } } } mono-tools-4.2/gendarme/framework/Gendarme.Framework.Helpers/MethodSignature.cs0000664000175000017500000001220712413742070032000 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.MethodSignature // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // Copyright (C) 2008, 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; using System.Collections.ObjectModel; using System.Collections.Generic; using System.Text; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Framework.Helpers { /// /// Used to match methods. Properties that are set to null are ignored /// /// /// /// MethodDefinition method = ... /// MethodSignature sig = new MethodSignature ("Dispose"); /// if (sig.Match (method)) { /// //matches any method named "Dispose" with any (or no) return value and any number of parameters /// } /// /// /// public class MethodSignature { /// /// The name of the method to match. Ignored if null. /// public string Name { get; private set; } /// /// The FullName (Namespace.Type) of the return type. Ignored if null. /// public string ReturnType { get; private set; } /// /// An array of FullNames (Namespace.Type) of parameter types. Ignored if null. Null entries act as wildcards. /// public ReadOnlyCollection Parameters { get; private set; } private Func extra_match_logic; public MethodSignature () { } public MethodSignature (string name) : this (name, null, null, null) { } public MethodSignature (string name, Func extraMatchingLogic) : this (name, null, null, extraMatchingLogic) { } public MethodSignature (string name, string returnType) : this (name, returnType, null, null) { } public MethodSignature (string name, string returnType, Func extraMatchingLogic) : this (name, returnType, null, extraMatchingLogic) { } public MethodSignature (string name, string returnType, string [] parameters) : this (name, returnType, parameters, null) { } public MethodSignature (string name, string returnType, string [] parameters, Func extraMatchingLogic) { Name = name; ReturnType = returnType; if (parameters != null) Parameters = new ReadOnlyCollection (new List (parameters)); extra_match_logic = extraMatchingLogic; } /// /// Checks if a MethodReference match the signature. /// /// The method to check. /// True if the MethodReference matches all aspects of the MethodSignature. public bool Matches (MethodReference method) { if (method == null) return false; if (Name != null && method.Name != Name) return false; if (ReturnType != null && !method.ReturnType.IsNamed (ReturnType)) return false; if (Parameters != null) { if (method.HasParameters) { IList pdc = method.Parameters; if (Parameters.Count != pdc.Count) return false; for (int i = 0; i < Parameters.Count; i++) { if (Parameters [i] == null) continue;//ignore parameter if (!pdc [i].ParameterType.IsNamed (Parameters [i])) { return false; } } } else if (Parameters.Count > 0) { return false; } } return (extra_match_logic == null) ? true : extra_match_logic (method); } /// /// /// /// public override string ToString () { // if we do not have enough useful information return an empty string if (Name == null) return String.Empty; StringBuilder sb = new StringBuilder (); if (ReturnType != null) { sb.Append (ReturnType); sb.Append (' '); } sb.Append (Name); sb.Append ('('); if (Parameters != null) { for (int i = 0; i < Parameters.Count; i++) { sb.Append (Parameters [i]); if (i < Parameters.Count - 1) sb.Append (','); } } sb.Append (')'); return sb.ToString (); } } } mono-tools-4.2/gendarme/framework/Test/0000775000175000017500000000000012642235741022213 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Test/ChangeLog0000664000175000017500000000163312413742070023762 0ustar00directhexdirecthex000000000000002010-05-23 Sebastien Pouliot * GlobalSuppressions.cs: New. FxCop-style global suppressions for testing 2008-11-07 Alan McGovern * Tests.Framework.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-08-28 Sebastien Pouliot * Test.Framework.mdp: Add BitmaskTest to MD project file 2008-06-14 Sebastien Pouliot * Test.Framework.mdp: Add InstructionRocksTest to MD project file 2008-01-05 Sebastien Pouliot * Test.Framework.mdp: Add FieldRocksTest to MD project file 2008-01-04 Sebastien Pouliot * Test.Framework.mdp: Add AssemblyRocksTest to MD project file 2007-12-26 Sebastien Pouliot * Test.Framework.mdp: MonoDevelop project file for unit tests mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Engines/0000775000175000017500000000000012642235741027260 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Engines/SuppressMessageAttributeTest.cs0000664000175000017500000003104712413742070035463 0ustar00directhexdirecthex00000000000000// // Unit tests for SuppressMessageAttribute // // Authors: // Sebastien Pouliot // // Copyright (C) 2010, 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.Diagnostics.CodeAnalysis; using System.Reflection; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Engines; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; [assembly: SuppressMessage ("Test.Framework", "SuppressAssemblyRule")] // test on module using a FxCop-like rule syntax (which gets remapped to Gendarme) [module: SuppressMessage ("Unit.Test", "CA9999:TestingMapping")] namespace Test.Framework { public class SuppressAssemblyRule : Rule, IAssemblyRule { public RuleResult CheckAssembly (AssemblyDefinition assembly) { return RuleResult.Success; } } [TestFixture] public class SuppressMessageAttribute_AssemblyTest : AssemblyRuleTestFixture { [TestFixtureSetUp] public void FixtureSetUp () { Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } [Test] // cover AttributeTargets.Assembly public void Assemblies () { string unit = Assembly.GetExecutingAssembly ().Location; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (unit); // see [assembly: SuppressMessage ...] for test case // since the rule is NOT executed, the target (assembly) being ignored, the result is DoesNotApply AssertRuleDoesNotApply (assembly); unit = typeof (Rule).Assembly.Location; assembly = AssemblyDefinition.ReadAssembly (unit); AssertRuleSuccess (assembly); } } // we need to be able to distinguish between Assembly and Module [FxCopCompatibility ("Unit.Test", "CA9999:TestingMapping")] public class SuppressModuleRule : Rule, IAssemblyRule { public RuleResult CheckAssembly (AssemblyDefinition assembly) { Runner.Report (assembly.MainModule, Severity.Audit, Confidence.Low); return Runner.CurrentRuleResult; } } [TestFixture] public class SuppressMessageAttribute_ModuleTest : AssemblyRuleTestFixture { [TestFixtureSetUp] public void FixtureSetUp () { Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } [Test] // cover AttributeTargets.Module public void Modules () { string unit = Assembly.GetExecutingAssembly ().Location; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (unit); // see [module: SuppressMessage ...] for test case // since the rule is executed, then the defect ignored, the result is Success AssertRuleSuccess (assembly); unit = typeof (Rule).Assembly.Location; assembly = AssemblyDefinition.ReadAssembly (unit); AssertRuleFailure (assembly); } } public class SuppressTypeRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.HasEvents) { Runner.Report (type.Events [0], Severity.Critical, Confidence.Total); return Runner.CurrentRuleResult; } if (type.HasProperties) { Runner.Report (type.Properties [0], Severity.Critical, Confidence.Total); return Runner.CurrentRuleResult; } if (type.HasFields) { Runner.Report (type.Fields [0], Severity.Critical, Confidence.Total); return Runner.CurrentRuleResult; } if (type.HasGenericParameters) { Runner.Report (type.GenericParameters [0], Severity.Critical, Confidence.Total); return Runner.CurrentRuleResult; } return RuleResult.Success; } } [TestFixture] public class SuppressMessageAttribute_TypeTest : TypeRuleTestFixture { [TestFixtureSetUp] public void FixtureSetUp () { Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } [SuppressMessage ("Test.Framework", "SuppressTypeRule")] class ClassDirectlySuppressed { } // see GlobalSuppressions.cs class ClassIndirectlySuppressed { } class ClassNotSuppressed { } [Test] // cover AttributeTargets.Class public void Classes () { // since the rule is NOT executed, the target (class) being ignored, the result is DoesNotApply AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleSuccess (); } [SuppressMessage ("Test.Framework", "SuppressTypeRule")] delegate void DelegateDirectlySuppressed (int x); delegate void DelegateNotSuppressed (); [Test] // cover AttributeTargets.Delegate public void Delegates () { // since the rule is NOT executed, the target (delegate) being ignored, the result is DoesNotApply AssertRuleDoesNotApply (); AssertRuleSuccess (); } [SuppressMessage ("Test.Framework", "SuppressTypeRule")] enum EnumDirectlySuppressed { } enum EnumNotSuppressed { } [Test] // cover AttributeTargets.Enum public void Enums () { // since the rule is NOT executed, the target (enum) being ignored, the result is DoesNotApply AssertRuleDoesNotApply (); AssertRuleFailure (); } class EventDirectlySuppressed { [SuppressMessage ("Test.Framework", "SuppressTypeRule")] event EventHandler Event; } class EventNotSuppressed { event EventHandler Event; } [Test] // cover AttributeTargets.Event public void Events () { // since the rule is executed, then the defect ignored, the result is Success AssertRuleSuccess (); AssertRuleFailure (); } class FieldDirectlySuppressed { [SuppressMessage ("Test.Framework", "SuppressTypeRule")] public int Field; } class FieldNotSuppressed { public int Field; } [Test] // cover AttributeTargets.Field public void Fields () { // since the rule is executed, then the defect ignored, the result is Success AssertRuleSuccess (); AssertRuleFailure (); } class GenericParameterDirectlySuppressed<[SuppressMessage ("Test.Framework", "SuppressTypeRule")] T> { } class GenericParameterNotSuppressed { } [Test] // cover (part of) AttributeTargets.GenericParameter (see Method) public void GenericParameters () { // since the rule is executed, then the defect ignored, the result is Success AssertRuleSuccess> (); AssertRuleFailure> (); } [SuppressMessage ("Test.Framework", "SuppressTypeRule")] interface InterfaceDirectlySuppressed { } interface InterfaceNotSuppressed { } [Test] // cover AttributeTargets.Interface public void Interfaces () { // since the rule is NOT executed, the target (interface) being ignored, the result is DoesNotApply AssertRuleDoesNotApply (); AssertRuleSuccess (); } class PropertyDirectlySuppressed { [SuppressMessage ("Test.Framework", "SuppressTypeRule")] public int Property { get; set; } } class PropertyNotSuppressed { public int Property { get; set; } } [Test] // AttributeTargets.Property public void Properties () { // since the rule is executed, then the defect ignored, the result is Success AssertRuleSuccess (); AssertRuleFailure (); } [SuppressMessage ("Test.Framework", "SuppressTypeRule")] struct StructDirectlySuppressed { } struct StructNotSuppressed { } [Test] // AttributeTargets.Struct public void Structs () { // since the rule is NOT executed, the target (struct) being ignored, the result is DoesNotApply AssertRuleDoesNotApply (); AssertRuleSuccess (); } } public class SuppressMethodRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (method.HasGenericParameters) { Runner.Report (method.GenericParameters [0], Severity.Critical, Confidence.Total); return Runner.CurrentRuleResult; } if (method.HasParameters) { Runner.Report (method.Parameters [0], Severity.Critical, Confidence.Total); return Runner.CurrentRuleResult; } if (method.ReturnType.FullName != "System.Void") { Runner.Report (method.MethodReturnType, Severity.Critical, Confidence.Total); return Runner.CurrentRuleResult; } return RuleResult.Failure; } } [TestFixture] public class SuppressMessageAttribute_MethodTest : MethodRuleTestFixture { [TestFixtureSetUp] public void FixtureSetUp () { Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } class TestCases { [SuppressMessage ("Test.Framework", "SuppressMethodRule")] static TestCases () { } public TestCases (int i) { } [SuppressMessage ("Test.Framework", "SuppressMethodRule")] public void MethodDirectlySuppressed () { } public void MethodNotSuppressed () { } public void GenericParameterDirectlySuppressed<[SuppressMessage ("Test.Framework", "SuppressMethodRule")] T> () { } public void GenericParameterNotSuppressed () { } public void ParameterDirectlySuppressed ([SuppressMessage ("Test.Framework", "SuppressMethodRule")] int x) { } public void ParameterNotSuppressed (int x) { } [return: SuppressMessage ("Test.Framework", "SuppressMethodRule")] public object ReturnValueDirectlySuppressed () { return null; } public object ReturnValueNotSuppressed (int x) { return null; } [SuppressMessage ("Test.Framework", "SuppressMethodRule")] public int PropertySuppressed { get; set; } public int PropertyNotSuppressed { get; set; } } [Test] // cover AttributeTargets.Constructor public void Constructors () { // since the rule is NOT executed, the target (struct) being ignored, the result is DoesNotApply AssertRuleDoesNotApply (".cctor"); AssertRuleFailure (".ctor"); } [Test] // cover (part of) AttributeTargets.GenericParameter (see Type) public void GenericParameters () { // since the rule is executed, then the defect ignored, the result is Success AssertRuleSuccess ("GenericParameterDirectlySuppressed"); AssertRuleFailure ("GenericParameterNotSuppressed"); } [Test] // cover AttributeTargets.Parameter public void Parameters () { // since the rule is executed, then the defect ignored, the result is Success AssertRuleSuccess ("ParameterDirectlySuppressed"); AssertRuleFailure ("ParameterNotSuppressed"); } [Test] // cover AttributeTargets.Method public void Methods () { // since the rule is NOT executed, the target (struct) being ignored, the result is DoesNotApply AssertRuleDoesNotApply ("MethodDirectlySuppressed"); AssertRuleFailure ("MethodNotSuppressed"); } [Test] // cover AttributeTargets.ReturnValue public void ReturnValues () { // since the rule is executed, then the defect ignored, the result is Success AssertRuleSuccess ("ReturnValueDirectlySuppressed"); AssertRuleFailure ("ReturnValueNotSuppressed"); } [Test] // AttributeTargets.Property public void Properties () { // suppressing on the properties also means ignoring getters and setters AssertRuleDoesNotApply ("get_PropertySuppressed"); AssertRuleDoesNotApply ("set_PropertySuppressed"); AssertRuleFailure ("get_PropertyNotSuppressed", 1); AssertRuleFailure ("set_PropertyNotSuppressed", 1); } } } mono-tools-4.2/gendarme/framework/Test/Makefile.in0000664000175000017500000003122412642235731024261 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/framework/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ DISTCLEANFILES = Makefile.in 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) --gnu gendarme/framework/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/framework/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/framework/Test/Gendarme.Framework/0000775000175000017500000000000012642235741025671 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework/ThreadModelAttributeTest.cs0000664000175000017500000000755612413742070033143 0ustar00directhexdirecthex00000000000000// // Unit tests for ThreadModelAttribute // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Framework; using NUnit.Framework; namespace Test.Framework { [TestFixture] public class ThreadModelAttributeTest { private ThreadModelAttribute BasicCheck (ThreadModel model, bool every) { string name = model.ToString (); ThreadModelAttribute tma = new ThreadModelAttribute (model); Assert.AreEqual (model & ~ThreadModel.AllowEveryCaller, tma.Model, name); Assert.AreEqual (every, tma.AllowsEveryCaller, name + ".AllowsEveryCaller"); Assert.AreEqual (every, tma.ToString ().Contains ("AllowEveryCaller"), "ToString()"); int code = tma.GetHashCode (); tma.AllowsEveryCaller = !tma.AllowsEveryCaller; Assert.AreNotEqual (code, tma.GetHashCode (), name + "!HashCode"); tma.AllowsEveryCaller = !tma.AllowsEveryCaller; return tma; } [Test] public void MainThread () { ThreadModelAttribute tma = BasicCheck (ThreadModel.MainThread, false); Assert.IsTrue (tma.Equals (tma), "Equals"); Assert.IsTrue (tma == new ThreadModelAttribute (ThreadModel.MainThread), "=="); ThreadModelAttribute tmae = BasicCheck (ThreadModel.MainThread | ThreadModel.AllowEveryCaller, true); Assert.IsFalse (tmae.Equals (tma), "!Equals"); Assert.IsTrue (tma != tmae, "!="); } [Test] public void SingleThread () { ThreadModelAttribute tma = BasicCheck (ThreadModel.SingleThread, false); Assert.IsTrue (tma.Equals ((object) tma), "Equals"); Assert.IsFalse (tma == new ThreadModelAttribute (ThreadModel.MainThread), "=="); ThreadModelAttribute tmae = BasicCheck (ThreadModel.SingleThread | ThreadModel.AllowEveryCaller, true); Assert.IsFalse (tmae.Equals ((object) null), "!Equals"); Assert.IsFalse (tma == tmae, "=="); } [Test] public void Serializable () { ThreadModelAttribute tma = BasicCheck (ThreadModel.Serializable, false); Assert.IsTrue (tma.Equals ((object) tma), "Equals"); ThreadModelAttribute tmae = BasicCheck (ThreadModel.Serializable | ThreadModel.AllowEveryCaller, true); Assert.IsFalse (tmae.Equals ((ThreadModelAttribute) null), "!Equals"); Assert.IsTrue (tma != null, "!= null"); Assert.IsTrue (null != tmae, "null !="); } [Test] public void Concurrent () { ThreadModelAttribute tma = BasicCheck (ThreadModel.Concurrent, false); Assert.IsTrue (tma.Equals (tma), "Equals"); ThreadModelAttribute tmae = BasicCheck (ThreadModel.Concurrent | ThreadModel.AllowEveryCaller, true); Assert.IsFalse (tmae.Equals ((ThreadModelAttribute) null), "!Equals"); Assert.IsFalse (tma == tmae, "=="); } [Test] [ExpectedException (typeof (ArgumentException))] public void Invalid () { new ThreadModelAttribute ((ThreadModel) Int32.MinValue); } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework/BitmaskTest.cs0000664000175000017500000001113512413742070030445 0ustar00directhexdirecthex00000000000000// // Unit tests for Bitmask // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Framework; using NUnit.Framework; namespace Test.Framework { [TestFixture] public class BitmaskTest { [Test] public void BitmaskSeverity () { Bitmask x = new Bitmask (); Assert.IsFalse (x.Get (Severity.Audit), "Empty/Audit"); Assert.AreEqual (0, x.GetHashCode (), "Empty/GetHashCode"); Assert.AreEqual ("0", x.ToString (), "Empty/ToString"); x.Set (Severity.Audit); Assert.IsTrue (x.Get (Severity.Audit), "Set/Audit"); Assert.AreEqual (16, x.GetHashCode (), "GetHashCode"); Assert.AreEqual ("10000", x.ToString (), "ToString"); Assert.IsTrue (x.Equals (x), "Equals(self)"); Assert.IsTrue (x.Equals ((object) x), "Equals((object)self)"); Assert.IsFalse (x.Equals (Severity.Audit), "Equals"); x.Clear (Severity.Audit); Assert.IsFalse (x.Get (Severity.Audit), "Clear/Audit"); } [Test] public void Count () { Bitmask x = new Bitmask (); Assert.AreEqual (0, x.Count (), "0"); x.SetAll (); Assert.AreEqual (64, x.Count (), "64"); for (int i = 63; i >= 0; i--) { x.Clear (i); Assert.AreEqual (i, x.Count (), i.ToString ()); } } [Test] public void Intersect () { Bitmask x = new Bitmask (); Assert.IsTrue (x.Intersect (null), "null"); // special case since they are equals Assert.IsFalse (x.Intersect (x), "self"); Bitmask all = new Bitmask (); all.SetAll (); Assert.IsFalse (x.Intersect (all), "x N all"); Assert.IsFalse (all.Intersect (x), "all N x"); x.Set (0); Assert.IsTrue (x.Intersect (all), "1 N all"); Assert.IsTrue (all.Intersect (x), "all N 1"); Assert.IsTrue (x.Intersect (x), "self 1"); } [Test] public void IsSubsetOf () { Bitmask x = new Bitmask (); Assert.IsFalse (x.IsSubsetOf (null), "null"); Assert.IsTrue (x.IsSubsetOf (x), "self"); Bitmask all = new Bitmask (); all.SetAll (); Assert.IsTrue (x.IsSubsetOf (all), "x < all"); Assert.IsFalse (all.IsSubsetOf (x), "all < x"); x.Set (0); Assert.IsTrue (x.IsSubsetOf (all), "1 < all"); Assert.IsFalse (all.IsSubsetOf (x), "all < 1"); Assert.IsTrue (x.IsSubsetOf (x), "self 1"); } [Test] public void SetClearAll () { Bitmask x = new Bitmask (); for (int i = 0; i < 64; i++) { Assert.IsFalse (x.Get (i), "Default#" + i.ToString ()); } x.SetAll (); for (int i = 0; i < 64; i++) { Assert.IsTrue (x.Get (i), "SetAll#" + i.ToString ()); } x.ClearAll (); for (int i = 0; i < 64; i++) { Assert.IsFalse (x.Get (i), "ClearAll#" + i.ToString ()); } } [Test] public void SetUp () { Bitmask x = new Bitmask (true); for (int i = 0; i < 64; i++) { Assert.IsTrue (x.Get (i), "true#" + i.ToString ()); } x.ClearAll (); x.SetUp (16); for (int i = 0; i < 16; i++) { Assert.IsFalse (x.Get (i), "SetUp#" + i.ToString ()); } for (int i = 16; i < 64; i++) { Assert.IsTrue (x.Get (i), "SetUp#" + i.ToString ()); } } [Test] public void SetDown () { Bitmask x = new Bitmask (false); for (int i = 0; i < 64; i++) { Assert.IsFalse (x.Get (i), "false#" + i.ToString ()); } x.SetDown (48); for (int i = 0; i <= 48; i++) { Assert.IsTrue (x.Get (i), "SetDown#" + i.ToString ()); } for (int i = 49; i < 64; i++) { Assert.IsFalse (x.Get (i), "SetDown#" + i.ToString ()); } } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/0000775000175000017500000000000012642235741026751 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/CustomAttributeRocksTest.cs0000664000175000017500000000516512413742070034301 0ustar00directhexdirecthex00000000000000// // Unit tests for CustomAttributeRocks // // Authors: // Sebastien Pouliot // // Copyright (C) 2007, 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; using System.Reflection; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Collections.Generic; using NUnit.Framework; namespace Test.Framework.Rocks { [TestFixture] public class CustomAttributeRocksTest { private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Namespace_Null () { TypeDefinition type = assembly.MainModule.GetType ("Test.Framework.Rocks.CustomAttributeRocksTest"); type.HasAttribute (null, "a"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Name_Null () { TypeDefinition type = assembly.MainModule.GetType ("Test.Framework.Rocks.CustomAttributeRocksTest"); type.HasAttribute ("a", null); } [Test] public void HasAttribute () { TypeDefinition type = null; Assert.IsFalse (type.HasAttribute ("NUnit.Framework", "TestFixtureAttribute"), "null-type"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.CustomAttributeRocksTest"); Assert.IsTrue (type.HasAttribute ("NUnit.Framework", "TestFixtureAttribute"), "true"); Assert.IsFalse (type.HasAttribute ("NUnit.Framework", "TestAttribute"), "false"); } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/FieldRocksTest.cs0000664000175000017500000001273112413742070032163 0ustar00directhexdirecthex00000000000000// // Unit tests for FieldRocks // // Authors: // Sebastien Pouliot // Andreas Noever // // Copyright (C) 2008 Novell, Inc (http://www.novell.com) // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Reflection; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; using NUnit.Framework; namespace Test.Framework.Rocks { [TestFixture] public class FieldRocksTest { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] private static int cga = 1; [System.CodeDom.Compiler.GeneratedCodeAttribute ("unit test", "1.0")] protected double gca = 1.0; internal IntPtr ptr = IntPtr.Zero; private AssemblyDefinition assembly; private TypeDefinition type; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Framework.Rocks.FieldRocksTest"); } private FieldDefinition GetField (string fieldName) { foreach (FieldDefinition field in type.Fields) { if (field.Name == fieldName) return field; } Assert.Fail ("Field {0} was not found.", fieldName); return null; } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Namespace_Null () { GetField ("assembly").HasAttribute (null, "a"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Name_Null () { GetField ("assembly").HasAttribute ("a", null); } [Test] public void HasAttribute () { Assert.IsTrue (GetField ("cga").HasAttribute ("System.Runtime.CompilerServices", "CompilerGeneratedAttribute"), "CompilerGeneratedAttribute"); Assert.IsFalse (GetField ("cga").HasAttribute ("NUnit.Framework", "TestFixtureAttribute"), "TestFixtureAttribute"); } [Test] public void IsGeneratedCode_CompilerGenerated () { Assert.IsTrue (GetField ("cga").IsGeneratedCode (), "IsCompilerGenerated"); Assert.IsFalse (GetField ("assembly").IsGeneratedCode (), "FixtureSetUp"); } [Test] public void IsGeneratedCode_GeneratedCode () { Assert.IsTrue (GetField ("gca").IsGeneratedCode (), "IsCompilerGenerated"); Assert.IsFalse (GetField ("assembly").IsGeneratedCode (), "FixtureSetUp"); } static FieldDefinition GetField (TypeDefinition type, string name) { foreach (FieldDefinition field in type.Fields) { if (field.Name == name) return field; } Assert.Fail ("Field '{0}' not found!", name); return null; } [Test] public void IsVisible () { TypeDefinition type = assembly.MainModule.GetType ("Test.Framework.Rocks.PublicType"); Assert.IsTrue (GetField (type, "PublicField").IsVisible (), "PublicType.PublicField"); Assert.IsTrue (GetField (type, "ProtectedField").IsVisible (), "PublicType.ProtectedField"); Assert.IsFalse (GetField (type, "InternalField").IsVisible (), "PublicType.InternalField"); Assert.IsFalse (GetField (type, "PrivateField").IsVisible (), "PublicType.PrivateField"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.PublicType/NestedPublicType"); Assert.IsTrue (GetField (type, "PublicField").IsVisible (), "NestedPublicType.PublicField"); Assert.IsTrue (GetField (type, "ProtectedField").IsVisible (), "NestedPublicType.ProtectedField"); Assert.IsFalse (GetField (type, "PrivateField").IsVisible (), "NestedPublicType.PrivateField"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.PublicType/NestedProtectedType"); Assert.IsTrue (GetField (type, "PublicField").IsVisible (), "NestedProtectedType.PublicField"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.PublicType/NestedPrivateType"); Assert.IsFalse (GetField (type, "PublicField").IsVisible (), "NestedPrivateType.PublicField"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.InternalType"); Assert.IsFalse (GetField (type, "PublicField").IsVisible (), "InternalType.PublicField"); } [Test] public void Resolve () { foreach (Instruction ins in type.Methods [0].Body.Instructions) { FieldReference field = (ins.Operand as FieldReference); if ((field != null) && !(field is FieldDefinition)) { FieldDefinition fd = field.Resolve (); Assert.AreEqual (field.Name, fd.Name, "Name"); Assert.AreEqual (field.FieldType.FullName, fd.FieldType.FullName, "FieldType"); } } } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/TypeRocksTest.cs0000664000175000017500000003350312413742070032061 0ustar00directhexdirecthex00000000000000// // Unit tests for TypeRocks // // Authors: // Sebastien Pouliot // Daniel Abramov // Andreas Noever // // Copyright (C) 2007-2008 Novell, Inc (http://www.novell.com) // (C) 2007 Daniel Abramov // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using NUnit.Framework; namespace Test.Framework.Rocks { [TestFixture] public class TypeRocksTest { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] public class TypeCompilerGenerated { } [System.CodeDom.Compiler.GeneratedCodeAttribute ("unit test", "1.0")] public class TypeGeneratedCode { } public enum Enum { Value } [Flags] public enum Flags { Mask } interface IDeepCloneable : ICloneable { } class Deep : IDeepCloneable { public object Clone () { throw new NotImplementedException (); } } interface IInterface1 { } interface IInterface2 : IDeepCloneable { } interface IMixinInterface : IInterface1, IInterface2 { } class Mixin : IMixinInterface { public object Clone () { throw new NotImplementedException (); } } class NotAttribute { } class AnAttribute : Attribute { } class ClassInheritsNotAttribute : NotAttribute { } class AttributeInheritsAnAttribute : AnAttribute { } class AttributeInheritsOuterAttribute : ContextStaticAttribute { } class AttributeInheritsOuterAttributeDerivingAttribute : AttributeInheritsOuterAttribute { } private byte [] array_of_bytes; private Enum [] array_of_enum; private Flags [] array_of_flags; private string [] array_of_strings; private Deep [] array_of_classes; private ICloneable [] array_of_interfaces; private float SingleValue; private double DoubleValue; private IntPtr IntPtrValue; private UIntPtr UIntPtrValue; private HandleRef HandleRefValue; public void MethodA (bool parameter) { } private AssemblyDefinition assembly; private TypeDefinition type; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Framework.Rocks.TypeRocksTest"); } private TypeDefinition GetType (string name) { return assembly.MainModule.GetType ("Test.Framework.Rocks.TypeRocksTest" + name); } private TypeReference GetFieldType (string name) { TypeDefinition type = assembly.MainModule.GetType ("Test.Framework.Rocks.TypeRocksTest"); foreach (FieldDefinition field in type.Fields) { if (name == field.Name) return field.FieldType; } Assert.Fail (name); return null; } private MethodDefinition GetMethod (string name) { foreach (MethodDefinition method in type.Methods) if (method.Name == name) return method; Assert.Fail (name); return null; } [Test] public void GetMethod () { Assert.AreSame (GetMethod ("MethodA"), type.GetMethod (new MethodSignature ("MethodA")), "a1"); Assert.AreSame (GetMethod ("MethodA"), type.GetMethod ("MethodA"), "a2"); Assert.AreSame (GetMethod ("MethodA"), type.GetMethod (x => x.Name == "MethodA"), "a3"); Assert.AreSame (GetMethod ("MethodA"), type.GetMethod (MethodAttributes.Public, "MethodA"), "a4"); Assert.AreSame (GetMethod ("MethodA"), type.GetMethod ("MethodA", "System.Void", new string [1]), "a5"); Assert.AreSame (GetMethod ("MethodA"), type.GetMethod (MethodAttributes.Public, "MethodA", "System.Void", new string [1]), "a6"); Assert.AreSame (GetMethod ("MethodA"), type.GetMethod (MethodAttributes.Public, "MethodA", "System.Void", new string [1] { "System.Boolean" }, x => x.HasBody), "a7"); Assert.IsNull (type.GetMethod ("MethodB"), "b1"); Assert.IsNull (type.GetMethod (new MethodSignature ("MethodB")), "b2"); Assert.IsNull (type.GetMethod (MethodAttributes.Static, "MethodA"), "b3"); Assert.IsNull (type.GetMethod ("MethodA", null, new string [0]), "b4"); Assert.IsNull (type.GetMethod ("MethodA", "System.Int32", null), "b5"); Assert.IsNull (type.GetMethod ("MethodA", null, new string [1] { "System.Int32" }), "b6"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Namespace_Null () { GetType (String.Empty).HasAttribute (null, "a"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Name_Null () { GetType (String.Empty).HasAttribute ("a", null); } [Test] public void HasAttribute () { Assert.IsTrue (GetType (String.Empty).HasAttribute ("NUnit.Framework", "TestFixtureAttribute"), "TypeRocksTest"); Assert.IsFalse (GetType ("/Enum").HasAttribute ("System", "FlagsAttribute"), "Enum/System.FlagsAttribute"); Assert.IsTrue (GetType ("/Flags").HasAttribute ("System", "FlagsAttribute"), "Flags/System.FlagsAttribute"); // fullname is required Assert.IsFalse (GetType ("/Flags").HasAttribute ("System", "Flags"), "Flags/System.Flags"); Assert.IsFalse (GetType ("/Flags").HasAttribute ("", "FlagsAttribute"), "Flags/FlagsAttribute"); } [Test] public void HasMethod () { Assert.IsTrue (type.HasMethod (new MethodSignature ("MethodA")), "A"); Assert.IsFalse (type.HasMethod (new MethodSignature ("MethodB")), "B"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void Implements_Namespace_Null () { GetType (String.Empty).Implements (null, "a"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void Implements_Name_Null () { GetType (String.Empty).Implements ("a", null); } [Test] public void Implements () { Assert.IsFalse (GetType (String.Empty).Implements ("System", "ICloneable"), "ICloneable"); Assert.IsTrue (GetType ("/IDeepCloneable").Implements ("Test.Framework.Rocks", "TypeRocksTest/IDeepCloneable"), "itself"); Assert.IsTrue (GetType ("/IDeepCloneable").Implements ("System", "ICloneable"), "interface inheritance"); Assert.IsTrue (GetType ("/Deep").Implements ("Test.Framework.Rocks", "TypeRocksTest/IDeepCloneable"), "IDeepCloneable"); Assert.IsTrue (GetType ("/Deep").Implements ("System", "ICloneable"), "second-level ICloneable"); Assert.IsTrue (GetType ("/Mixin").Implements ("Test.Framework.Rocks", "TypeRocksTest/IDeepCloneable"), "parent interface inheritance"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void Inherits_Namespace_Null () { GetType (String.Empty).Inherits (null, "a"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void Inherits_Name_Null () { GetType (String.Empty).Inherits ("a", null); } [Test] public void Inherits () { Assert.IsFalse (GetType ("/NotAttribute").Inherits ("System", "Attribute"), "NotAttribute"); Assert.IsTrue (GetType ("/AnAttribute").Inherits ("System", "Attribute"), "AnAttribute"); Assert.IsFalse (GetType ("/ClassInheritsNotAttribute").Inherits ("System", "Attribute"), "ClassInheritsNotAttribute"); Assert.IsTrue (GetType ("/AttributeInheritsAnAttribute").Inherits ("System", "Attribute"), "AttributeInheritsAnAttribute"); } [Test] public void Inherits_FromAnotherAssembly () { // we can't be sure here so to avoid false positives return false Assert.IsTrue (GetType ("/AttributeInheritsOuterAttribute").Inherits ("System", "Attribute"), "AttributeInheritsOuterAttribute"); Assert.IsTrue (GetType ("/AttributeInheritsOuterAttributeDerivingAttribute").Inherits ("System", "Attribute"), "AttributeInheritsOuterAttributeDerivingAttribute"); } [Test] public void Inherits_Itself () { TypeDefinition type = GetType (String.Empty); Assert.IsTrue (type.Inherits (type.Namespace, type.Name), "itself"); } [Test] public void IsAttribute () { Assert.IsFalse (GetType ("/NotAttribute").IsAttribute (), "NotAttribute"); Assert.IsTrue (GetType ("/AnAttribute").IsAttribute (), "AnAttribute"); Assert.IsFalse (GetType ("/ClassInheritsNotAttribute").IsAttribute (), "ClassInheritsNotAttribute"); Assert.IsTrue (GetType ("/AttributeInheritsAnAttribute").IsAttribute (), "AttributeInheritsAnAttribute"); } [Test] public void IsAttribute_InheritsFromAnotherAssembly () { // we can't be sure here so to avoid false positives return false Assert.IsTrue (GetType ("/AttributeInheritsOuterAttribute").IsAttribute (), "AttributeInheritsOuterAttribute"); Assert.IsTrue (GetType ("/AttributeInheritsOuterAttributeDerivingAttribute").IsAttribute (), "AttributeInheritsOuterAttributeDerivingAttribute"); } [Test] public void IsFlags () { Assert.IsFalse (GetType (String.Empty).IsFlags (), "Type.IsFlags"); Assert.IsFalse (GetType ("/Enum").IsFlags (), "Enum.IsFlags"); Assert.IsTrue (GetType ("/Flags").IsFlags (), "Flags.IsFlags"); } [Test] public void IsFloatingPoint () { TypeDefinition type = GetType (String.Empty); Assert.IsFalse (type.IsFloatingPoint (), "Type.IsFloatingPoint"); foreach (FieldDefinition field in type.Fields) { switch (field.Name) { case "SingleValue": case "DoubleValue": Assert.IsTrue (field.FieldType.IsFloatingPoint (), field.Name); break; } } } [Test] public void IsGeneratedCode_CompilerGenerated () { Assert.IsTrue (GetType ("/TypeCompilerGenerated").IsGeneratedCode (), "IsCompilerGenerated"); Assert.IsFalse (GetType (String.Empty).IsGeneratedCode (), "TypeRocksTest"); } [Test] public void IsGeneratedCode_GeneratedCode () { Assert.IsTrue (GetType ("/TypeGeneratedCode").IsGeneratedCode (), "IsCompilerGenerated"); Assert.IsFalse (GetType (String.Empty).IsGeneratedCode (), "TypeRocksTest"); } [Test] public void IsNative () { TypeDefinition type = GetType (String.Empty); Assert.IsFalse (type.IsNative (), "Type.IsNative"); foreach (FieldDefinition field in type.Fields) { switch (field.Name) { case "IntPtrValue": case "UIntPtrValue": case "HandleRefValue": Assert.IsTrue (field.FieldType.IsNative (), field.Name); break; } } } [Test] public void IsNamed () { string name = "Test.Framework.Rocks.PublicType"; TypeDefinition type = assembly.MainModule.GetType (name); Assert.IsTrue (type.IsNamed ( "Test.Framework.Rocks.PublicType")); Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks.P"));//Missing Text Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks.PublicTypeExtraText")); Assert.IsTrue (type.IsNamed ("Test.Framework.Rocks", "PublicType")); Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks", "P"));//Missing Text Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks", "PublicTypeExtraText")); } [Test] public void IsNamedNestedType () { string name = "Test.Framework.Rocks.PublicType/NestedPublicType"; TypeDefinition type = assembly.MainModule.GetType (name); Assert.IsTrue (type.IsNamed ("Test.Framework.Rocks.PublicType/NestedPublicType")); Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks.PublicType/N"));//Missing Text Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks.PublicType/NestedPublicTypeExtaStuff")); Assert.IsTrue (type.IsNamed ("Test.Framework.Rocks", "PublicType/NestedPublicType")); Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks", "PublicType/N"));//Missing Text Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks", "PublicType/NestedPublicTypeExtraText")); Assert.IsFalse (type.IsNamed ("Test.Framework.Rocks", "NestedPublicType")); Assert.IsFalse (type.IsNamed ("", "NestedPublicType")); } [Test] public void IsNamedDoubleNestedType () { string name = "Test.Framework.Rocks.PublicType/NestedPublicType/NestedNestedPublicType"; TypeDefinition type = assembly.MainModule.GetType (name); Assert.IsTrue (type.IsNamed ("Test.Framework.Rocks.PublicType/NestedPublicType/NestedNestedPublicType")); Assert.IsTrue (type.IsNamed ("Test.Framework.Rocks", "PublicType/NestedPublicType/NestedNestedPublicType")); } [Test] public void IsVisible () { string name = "Test.Framework.Rocks.PublicType"; TypeDefinition type = assembly.MainModule.GetType (name); Assert.IsTrue (type.IsVisible (), name); name = "Test.Framework.Rocks.PublicType/NestedPublicType"; Assert.IsTrue (assembly.MainModule.GetType (name).IsVisible (), name); name = "Test.Framework.Rocks.PublicType/NestedProtectedType"; Assert.IsTrue (assembly.MainModule.GetType (name).IsVisible (), name); name = "Test.Framework.Rocks.PublicType/NestedPrivateType"; Assert.IsFalse (assembly.MainModule.GetType (name).IsVisible (), name); name = "Test.Framework.Rocks.PublicType/NestedInternalType"; Assert.IsFalse (assembly.MainModule.GetType (name).IsVisible (), name); name = "Test.Framework.Rocks.InternalType"; Assert.IsFalse (assembly.MainModule.GetType (name).IsVisible (), name); } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/InstructionRocksTest.cs0000664000175000017500000002056512413742070033465 0ustar00directhexdirecthex00000000000000// // Unit tests for InstructionRocks // // Authors: // Sebastien Pouliot // // 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; using SR = System.Reflection; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; using NUnit.Framework; namespace Test.Framework.Rocks { [TestFixture] public class InstructionRocksTest { private TypeDefinition type_def; private MethodBody body; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; type_def = AssemblyDefinition.ReadAssembly (unit).MainModule.GetType ("Test.Framework.Rocks.InstructionRocksTest"); body = type_def.GetMethod ("Fields").Body; } static int static_field; long instance_field; void Fields () { static_field = 21; instance_field = static_field; Console.WriteLine (instance_field + static_field); } [Test] public void GetField () { Instruction nins = null; // that's a funny thing we can do with extention methods and null Assert.IsNull (nins.GetField (), "null"); foreach (Instruction ins in body.Instructions) { switch (ins.OpCode.Code) { case Code.Ldfld: case Code.Ldflda: case Code.Stfld: Assert.AreEqual ("instance_field", ins.GetField ().Name, ins.OpCode.ToString ()); break; case Code.Ldsfld: case Code.Ldsflda: case Code.Stsfld: Assert.AreEqual ("static_field", ins.GetField ().Name, ins.OpCode.ToString ()); break; default: Assert.IsNull (ins.GetField (), ins.OpCode.ToString ()); break; } } } void Variables () { int a = 0; long b = 1; byte c = 2; short d = 3; uint e = 4; ulong f = 5; sbyte g = 6; ushort h = 7; Console.WriteLine ((ulong)(a + b + c + d + e) + f + (ulong)(g + h)); } [Test] public void GetVariable () { Instruction nins = null; // that's a funny thing we can do with extention methods and null Assert.IsNull (nins.GetVariable (null), "all-null"); MethodDefinition method = type_def.GetMethod ("Variables"); Assert.IsNull (nins.GetVariable (method), "ins-null"); foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: case Code.Ldloc: case Code.Ldloc_S: case Code.Ldloca: case Code.Ldloca_S: case Code.Stloc_0: case Code.Stloc_1: case Code.Stloc_2: case Code.Stloc_3: case Code.Stloc: case Code.Stloc_S: Assert.IsNotNull (ins.GetVariable (method), ins.OpCode.ToString ()); break; default: Assert.IsNull (ins.GetVariable (method), ins.OpCode.ToString ()); break; } } } static OpCode GetOpCode (Code code) { return (OpCode) typeof (OpCodes).GetField ( code.ToString (), SR.BindingFlags.Public | SR.BindingFlags.Static).GetValue (null); } [Test] public void IsLoadArgument () { Instruction ins = null; // that's a funny thing we can do with extention methods and null Assert.IsFalse (ins.IsLoadArgument (), "null"); // work around Cecil validations ins = Instruction.Create (OpCodes.Nop); foreach (Code code in Enum.GetValues (typeof (Code))) { ins.OpCode = GetOpCode (code); switch (code) { case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: case Code.Ldarg: case Code.Ldarg_S: case Code.Ldarga: case Code.Ldarga_S: Assert.IsTrue (ins.IsLoadArgument (), code.ToString ()); break; default: Assert.IsFalse (ins.IsLoadArgument (), code.ToString ()); break; } } } [Test] public void IsLoadElement () { Instruction ins = null; // that's a funny thing we can do with extention methods and null Assert.IsFalse (ins.IsLoadElement (), "null"); // work around Cecil validations ins = Instruction.Create (OpCodes.Nop); foreach (Code code in Enum.GetValues (typeof (Code))) { ins.OpCode = GetOpCode (code); switch (code) { case Code.Ldelem_Any: case Code.Ldelem_I: case Code.Ldelem_I1: case Code.Ldelem_I2: case Code.Ldelem_I4: case Code.Ldelem_I8: case Code.Ldelem_R4: case Code.Ldelem_R8: case Code.Ldelem_Ref: case Code.Ldelem_U1: case Code.Ldelem_U2: case Code.Ldelem_U4: case Code.Ldelema: Assert.IsTrue (ins.IsLoadElement (), code.ToString ()); break; default: Assert.IsFalse (ins.IsLoadElement (), code.ToString ()); break; } } } [Test] public void IsLoadIndirect () { Instruction ins = null; // that's a funny thing we can do with extention methods and null Assert.IsFalse (ins.IsLoadIndirect (), "null"); // work around Cecil validations ins = Instruction.Create (OpCodes.Nop); foreach (Code code in Enum.GetValues (typeof (Code))) { ins.OpCode = GetOpCode (code); switch (code) { case Code.Ldind_I: case Code.Ldind_I1: case Code.Ldind_I2: case Code.Ldind_I4: case Code.Ldind_I8: case Code.Ldind_R4: case Code.Ldind_R8: case Code.Ldind_Ref: case Code.Ldind_U1: case Code.Ldind_U2: case Code.Ldind_U4: Assert.IsTrue (ins.IsLoadIndirect (), code.ToString ()); break; default: Assert.IsFalse (ins.IsLoadIndirect (), code.ToString ()); break; } } } [Test] public void IsLoadLocal () { Instruction ins = null; // that's a funny thing we can do with extention methods and null Assert.IsFalse (ins.IsLoadLocal (), "null"); // work around Cecil validations ins = Instruction.Create (OpCodes.Nop); foreach (Code code in Enum.GetValues (typeof (Code))) { ins.OpCode = GetOpCode (code); switch (code) { case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: case Code.Ldloc: case Code.Ldloc_S: case Code.Ldloca: case Code.Ldloca_S: Assert.IsTrue (ins.IsLoadLocal (), code.ToString ()); break; default: Assert.IsFalse (ins.IsLoadLocal (), code.ToString ()); break; } } } [Test] public void IsStoreArgument () { Instruction ins = null; // that's a funny thing we can do with extention methods and null Assert.IsFalse (ins.IsStoreArgument (), "null"); // work around Cecil validations ins = Instruction.Create (OpCodes.Nop); foreach (Code code in Enum.GetValues (typeof (Code))) { ins.OpCode = GetOpCode (code); switch (code) { case Code.Starg: case Code.Starg_S: Assert.IsTrue (ins.IsStoreArgument (), code.ToString ()); break; default: Assert.IsFalse (ins.IsStoreArgument (), code.ToString ()); break; } } } [Test] public void IsStoreLocal () { Instruction ins = null; // that's a funny thing we can do with extention methods and null Assert.IsFalse (ins.IsStoreLocal (), "null"); // work around Cecil validations ins = Instruction.Create (OpCodes.Nop); foreach (Code code in Enum.GetValues (typeof (Code))) { ins.OpCode = GetOpCode (code); switch (code) { case Code.Stloc_0: case Code.Stloc_1: case Code.Stloc_2: case Code.Stloc_3: case Code.Stloc: case Code.Stloc_S: Assert.IsTrue (ins.IsStoreLocal (), code.ToString ()); break; default: Assert.IsFalse (ins.IsStoreLocal (), code.ToString ()); break; } } } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/AssemblyRocksTest.cs0000664000175000017500000000441612413742070032720 0ustar00directhexdirecthex00000000000000// // Unit tests for AssemblyRocks // // Authors: // Sebastien Pouliot // // 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; using System.Reflection; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; using NUnit.Framework; namespace Test.Framework.Rocks { [TestFixture] public class AssemblyRocksTest { private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Namespace_Null () { assembly.HasAttribute (null, "a"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Name_Null () { assembly.HasAttribute ("a", null); } [Test] public void HasAttribute () { Assert.IsTrue (assembly.HasAttribute ("System.Runtime.CompilerServices", "RuntimeCompatibilityAttribute"), "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute"); Assert.IsFalse (assembly.HasAttribute ("NUnit.Framework", "TestFixtureAttribute"), "TestFixtureAttribute"); } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/VariableDefinitionRocksTest.cs0000664000175000017500000001032712413742070034675 0ustar00directhexdirecthex00000000000000// // Unit tests for VariableDefinitionRocks // // Authors: // Sebastien Pouliot // // 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 Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; using NUnit.Framework; using System; using System.IO; using System.Linq; using System.Text; namespace Test.Framework.Rocks { [TestFixture] public class VariableDefinitionRocksTest { private TypeDefinition type_def; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (unit); assembly.MainModule.LoadDebuggingSymbols (); type_def = assembly.MainModule.GetType ("Test.Framework.Rocks.VariableDefinitionRocksTest"); } public string path; public string host; public string cachedLocalPath; public string AbsolutePath; private string Unescape (string s) { return s; } // This has one compiler generated local with gmcs. private string Big () { if (cachedLocalPath != null) return cachedLocalPath; bool windows = (path.Length > 3 && path [1] == ':' && (path [2] == '\\' || path [2] == '/')); if (cachedLocalPath != null) { string p = Unescape (path); bool replace = windows; if (replace) cachedLocalPath = p.Replace ('/', '\\'); else cachedLocalPath = p; } else { if (path.Length > 1 && path [1] == ':') cachedLocalPath = Unescape (path.Replace (Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)); else if (System.IO.Path.DirectorySeparatorChar == '\\') { string h = host; if (path.Length > 0) { if ((path.Length > 1) || (path [0] != '/')) { h += path.Replace ('/', '\\'); } } cachedLocalPath = "\\\\" + Unescape (h); } else cachedLocalPath = Unescape (path); } if (cachedLocalPath.Length == 0) cachedLocalPath = Path.DirectorySeparatorChar.ToString (); return cachedLocalPath; } [Test] public void BigTest () { MethodDefinition method = type_def.GetMethod ("Big"); DoTest (method, "windows", "p", "replace", "h"); } // This has two compiler generated locals with gmcs. private void ForEach (string [] names) { foreach (string name in names) { Console.WriteLine (name); } } [Test] public void ForEachTest () { MethodDefinition method = type_def.GetMethod ("ForEach"); DoTest (method, "name"); } private void DoTest (MethodDefinition method, params string [] userNames) { int count = 0; foreach (Instruction ins in method.Body.Instructions) { VariableDefinition v = ins.GetVariable (method); if (v != null) { bool userName = userNames.Any (n => n == v.Name); if (userName) { Assert.IsFalse (v.IsGeneratedName (), "{0} was reported as a generated name", v.Name); } else { ++count; Assert.IsTrue (v.IsGeneratedName (), "{0} was not reported as a generated name", v.Name); } } } if (count == 0) Assert.Fail ("Didn't find any generated locals for VariableDefinitionRocksTest::{0}", method.Name); } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/RocksTest.cs0000664000175000017500000000455712413742070031226 0ustar00directhexdirecthex00000000000000// // Shared test code / declarations for rocks // // Authors: // Sebastien Pouliot // Andreas Noever // // (C) 2008 Andreas Noever // 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 Test.Framework.Rocks { public abstract class PublicType { public int PublicField; protected int ProtectedField; internal int InternalField; private int PrivateField; public abstract void PublicMethod (); protected abstract void ProtectedMethod (); internal abstract void InternalMethod (); private void PrivateMethod () { } public abstract class NestedPublicType { public int PublicField; protected int ProtectedField; private int PrivateField; public abstract void PublicMethod (); protected abstract void ProtectedMethod (); private void PrivateMethod () { } public abstract class NestedNestedPublicType { } } protected abstract class NestedProtectedType { public int PublicField; public abstract void PublicMethod (); } private abstract class NestedPrivateType { public int PublicField; public abstract void PublicMethod (); } internal abstract class NestedInternalType { } } internal abstract class InternalType { public int PublicField; public abstract void PublicMethod (); } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/ParameterRocksTest.cs0000664000175000017500000000411112413742070033051 0ustar00directhexdirecthex00000000000000// // Unit tests for ParameterRocksTest // // Authors: // Sebastien Pouliot // // 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; using System.Reflection; using Gendarme.Framework.Rocks; using Mono.Cecil; using NUnit.Framework; namespace Test.Framework.Rocks { [TestFixture] public class ParameterRocksTest { private AssemblyDefinition assembly; private TypeDefinition type; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Framework.Rocks.ParameterRocksTest"); } public void UseParams (int a, params int [] args) { } [Test] public void IsParams () { ParameterDefinition pd = null; Assert.IsFalse (pd.IsParams (), "null"); MethodDefinition md = type.GetMethod ("UseParams"); Assert.IsFalse (md.Parameters [0].IsParams (), "0"); Assert.IsTrue (md.Parameters [1].IsParams (), "1"); } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Rocks/MethodRocksTest.cs0000664000175000017500000001704512413742070032363 0ustar00directhexdirecthex00000000000000// // Unit tests for MethodRocks // // Authors: // Sebastien Pouliot // Andreas Noever // // Copyright (C) 2007-2008 Novell, Inc (http://www.novell.com) // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; using NUnit.Framework; namespace Test.Framework.Rocks { [TestFixture] public class MethodRocksTest { class MainClassVoidVoid { static void Main () { } } class MainClassIntVoid { static int Main () { return 42; } } class MainClassVoidStrings { static void Main (string[] args) { } } class MainClassIntStrings { static int Main (string [] args) { return 42; } ~MainClassIntStrings () { } } public int Value { get { return 42; } set { throw new NotSupportedException (); } } protected void EventCallback (object sender, EventArgs ea) { } public class FooEventArgs : EventArgs {} protected void FooEventCallback (object sender, FooEventArgs fea) { } private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } private MethodDefinition GetMethod (string typeName, string methodName) { TypeDefinition type = assembly.MainModule.GetType (typeName); foreach (MethodDefinition method in type.Methods) { if (method.Name == methodName) return method; } Assert.Fail ("Method {0} was not found.", methodName); return null; } private MethodDefinition GetMethod (string name) { return GetMethod ("Test.Framework.Rocks.MethodRocksTest", name); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Namespace_Null () { MethodDefinition method = GetMethod ("FixtureSetUp"); method.HasAttribute (null, "a"); } [Test] [ExpectedException (typeof (ArgumentNullException))] public void HasAttribute_Name_Null () { MethodDefinition method = GetMethod ("FixtureSetUp"); method.HasAttribute ("a", null); } [Test] public void HasAttribute () { MethodDefinition method = GetMethod ("FixtureSetUp"); Assert.IsTrue (method.HasAttribute ("NUnit.Framework", "TestFixtureSetUpAttribute"), "NUnit.Framework.TestFixtureSetUpAttribute"); Assert.IsFalse (method.HasAttribute ("NUnit.Framework", "TestFixtureSetUp"), "NUnit.Framework.TestFixtureSetUp"); } [Test] public void IsEntryPoint () { Assert.IsFalse (GetMethod ("FixtureSetUp").IsEntryPoint (), "FixtureSetUp"); } [Test] public void IsFinalizer () { Assert.IsFalse (GetMethod ("FixtureSetUp").IsFinalizer (), "FixtureSetUp"); Assert.IsTrue (GetMethod ("Test.Framework.Rocks.MethodRocksTest/MainClassIntStrings", "Finalize").IsFinalizer (), "~MainClassIntStrings"); } [Test] [System.Runtime.CompilerServices.CompilerGeneratedAttribute] public void IsGeneratedCode_CompilerGenerated () { Assert.IsTrue (GetMethod ("IsGeneratedCode_CompilerGenerated").IsGeneratedCode (), "IsCompilerGenerated"); Assert.IsFalse (GetMethod ("FixtureSetUp").IsGeneratedCode (), "FixtureSetUp"); } [Test] [System.CodeDom.Compiler.GeneratedCodeAttribute ("unit test", "1.0")] public void IsGeneratedCode_GeneratedCode () { Assert.IsTrue (GetMethod ("IsGeneratedCode_GeneratedCode").IsGeneratedCode (), "IsCompilerGenerated"); Assert.IsFalse (GetMethod ("FixtureSetUp").IsGeneratedCode (), "FixtureSetUp"); } [Test] public void IsMain () { Assert.IsTrue (GetMethod ("Test.Framework.Rocks.MethodRocksTest/MainClassVoidVoid", "Main").IsMain (), "MainClassVoidVoid"); Assert.IsTrue (GetMethod ("Test.Framework.Rocks.MethodRocksTest/MainClassIntVoid", "Main").IsMain (), "MainClassIntVoid"); Assert.IsTrue (GetMethod ("Test.Framework.Rocks.MethodRocksTest/MainClassVoidStrings", "Main").IsMain (), "MainClassVoidStrings"); Assert.IsTrue (GetMethod ("Test.Framework.Rocks.MethodRocksTest/MainClassIntStrings", "Main").IsMain (), "MainClassIntStrings"); Assert.IsFalse (GetMethod ("FixtureSetUp").IsMain (), "FixtureSetUp"); } [Test] public void IsProperty () { Assert.IsTrue (GetMethod ("get_Value").IsProperty (), "get_Value"); Assert.IsTrue (GetMethod ("set_Value").IsProperty (), "set_Value"); Assert.IsFalse (GetMethod ("FixtureSetUp").IsProperty (), "FixtureSetUp"); } [Test] public void IsVisible () { TypeDefinition type = assembly.MainModule.GetType ("Test.Framework.Rocks.PublicType"); Assert.IsTrue (type.GetMethod ("PublicMethod").IsVisible (), "PublicType.PublicMethod"); Assert.IsTrue (type.GetMethod ("ProtectedMethod").IsVisible (), "PublicType.ProtectedMethod"); Assert.IsFalse (type.GetMethod ("InternalMethod").IsVisible (), "PublicType.InternalMethod"); Assert.IsFalse (type.GetMethod ("PrivateMethod").IsVisible (), "PublicType.PrivateMethod"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.PublicType/NestedPublicType"); Assert.IsTrue (type.GetMethod ("PublicMethod").IsVisible (), "NestedPublicType.PublicMethod"); Assert.IsTrue (type.GetMethod ("ProtectedMethod").IsVisible (), "NestedPublicType.ProtectedMethod"); Assert.IsFalse (type.GetMethod ("PrivateMethod").IsVisible (), "NestedPublicType.PrivateMethod"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.PublicType/NestedProtectedType"); Assert.IsTrue (type.GetMethod ("PublicMethod").IsVisible (), "NestedProtectedType.PublicMethod"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.PublicType/NestedPrivateType"); Assert.IsFalse (type.GetMethod ("PublicMethod").IsVisible (), "NestedPrivateType.PublicMethod"); type = assembly.MainModule.GetType ("Test.Framework.Rocks.InternalType"); Assert.IsFalse (type.GetMethod ("PublicMethod").IsVisible (), "InternalType.PublicMethod"); } [Test] public void IsEventCallback () { Assert.IsTrue (GetMethod ("EventCallback").IsEventCallback (), "EventCallback"); Assert.IsTrue (GetMethod ("FooEventCallback").IsEventCallback (), "FooEventCallback"); Assert.IsFalse (GetMethod ("IsEventCallback").IsEventCallback (), "IsEventCallback"); } [Test] public void GetPropertyByAccessor () { Assert.AreEqual (GetMethod ("get_Value").GetPropertyByAccessor ().Name, "Value", "get_Value"); Assert.AreEqual (GetMethod ("set_Value").GetPropertyByAccessor ().Name, "Value", "set_Value"); Assert.IsNull (GetMethod ("EventCallback").GetPropertyByAccessor (), "EventCallback"); } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Helpers/0000775000175000017500000000000012642235741027272 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Helpers/MethodSignatureTest.cs0000664000175000017500000001371512413742070033564 0ustar00directhexdirecthex00000000000000// // Unit tests for MethodSignature // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // Copyright (C) 2008, 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using NUnit.Framework; namespace Test.Framework { [TestFixture] public class MethodSignatureTest { private TypeDefinition type; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; type = AssemblyDefinition.ReadAssembly (unit).MainModule.GetType ("Test.Framework.MethodSignatureTest"); } private MethodDefinition GetMethod (string name, int parameters) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) { if ((parameters == -1) || (method.Parameters.Count == parameters)) return method; } } return null; } private MethodDefinition GetMethod (string name) { return GetMethod (name, -1); } [Test] public void TestDefaultConstructor () { MethodSignature sig = new MethodSignature (); Assert.IsNull (sig.Name, "Name"); Assert.IsNull (sig.Parameters, "Parameters"); Assert.IsNull (sig.ReturnType, "ReturnType"); Assert.AreEqual (String.Empty, sig.ToString (), "ToString"); } [Test] public void MatchNull () { Assert.IsFalse (new MethodSignature ().Matches (null)); } [Test] public void AlwaysTrueCustomLogic () { MethodSignature ms = new MethodSignature (null, (method) => (true)); Assert.IsFalse (ms.Matches (null), "null"); Assert.IsTrue (ms.Matches (GetMethod ("TestMatch")), "anything"); } [Test] public void AlwaysTrueCustomLogic_CheckReturnValue () { MethodSignature ms = new MethodSignature (null, "System.Void", (method) => (true)); Assert.IsFalse (ms.Matches (null), "null"); Assert.IsTrue (ms.Matches (GetMethod ("TestMatch")), "any name returning void"); Assert.IsFalse (ms.Matches (GetMethod ("Method")), "bool"); } public bool Method () { return false; } public bool Method (bool parameter) { return false; } public bool Method (bool a, string b) { return false; } [Test] public void TestMatch () { Assert.IsTrue (new MethodSignature ().Matches (GetMethod ("TestMatch")), "a"); Assert.IsTrue (new MethodSignature ("TestMatch").Matches (GetMethod ("TestMatch")), "b"); Assert.IsFalse (new MethodSignature ("TestMatch_").Matches (GetMethod ("TestMatch")), "c"); Assert.IsTrue (new MethodSignature (null, "System.Void").Matches (GetMethod ("TestMatch")), "d"); Assert.IsFalse (new MethodSignature (null, "System.Void_").Matches (GetMethod ("TestMatch")), "e"); Assert.IsFalse (new MethodSignature (null, null, new string [1]).Matches (GetMethod ("TestMatch")), "f"); Assert.IsFalse (new MethodSignature (null, null, new string [] { "System.Boolean" }).Matches (GetMethod ("Method", 0)), "g"); Assert.IsFalse (new MethodSignature (null, null, new string [] { null }).Matches (GetMethod ("Method", 0)), "h"); Assert.IsFalse (new MethodSignature (null, null, new string [] { "System.Object" }).Matches (GetMethod ("Method", 0)), "i"); Assert.IsTrue (new MethodSignature (null, null, new string [] { "System.Boolean" }).Matches (GetMethod ("Method", 1)), "j"); Assert.IsTrue (new MethodSignature (null, null, new string [] { null }).Matches (GetMethod ("Method", 1)), "k"); Assert.IsFalse (new MethodSignature (null, null, new string [] { "System.Object" }).Matches (GetMethod ("Method", 1)), "l"); Assert.IsFalse (new MethodSignature (null, null, new string [] { "System.Boolean" }).Matches (GetMethod ("Method", 2)), "m"); Assert.IsFalse (new MethodSignature (null, null, new string [] { null }).Matches (GetMethod ("Method", 2)), "n"); Assert.IsFalse (new MethodSignature (null, null, new string [] { "System.Object" }).Matches (GetMethod ("Method", 2)), "o"); } [Test] public void TestToString () { Assert.AreEqual (String.Empty, new MethodSignature ().ToString (), "empty"); Assert.AreEqual (String.Empty, new MethodSignature (null, "System.Void").ToString (), "return value"); Assert.AreEqual (String.Empty, new MethodSignature (null, "System.Void", new string [] { "System.Object" }).ToString (), "return value + one param"); Assert.AreEqual ("Equals()", new MethodSignature ("Equals").ToString (), "name"); Assert.AreEqual ("System.Boolean Equals()", new MethodSignature ("Equals", "System.Boolean").ToString (), "name + return value"); Assert.AreEqual ("System.Boolean Equals(System.Object)", new MethodSignature ("Equals", "System.Boolean", new string[] { "System.Object" }).ToString (), "name + return value + one param"); Assert.AreEqual ("System.Boolean Equals(A,B)", new MethodSignature ("Equals", "System.Boolean", new string [] { "A", "B" }).ToString (), "name + return value + two param"); } } } mono-tools-4.2/gendarme/framework/Test/Gendarme.Framework.Helpers/StackEntryAnalysisTest.cs0000664000175000017500000004667012413742070034263 0ustar00directhexdirecthex00000000000000// // Unit tests for StackEntryAnalysis // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using NUnit.Framework; namespace Test.Framework { [TestFixture] public class StackEntryAnalysisTest { private AssemblyDefinition assembly; private TypeDefinition type; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Framework.StackEntryAnalysisTest"); } public MethodDefinition GetTest (string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } return null; } public Instruction GetFirstNewObj (MethodDefinition method) { foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.Code == Code.Newobj) return ins; } return null; } public object SimpleReturn () { return new object (); } [Test] public void TestSimpleReturn () { MethodDefinition m = GetTest ("SimpleReturn"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result-Opcode-Ret"); } public object SimpleLoc () { object a = new object (); return a; } [Test] public void TestSimpleLoc () { MethodDefinition m = GetTest ("SimpleLoc"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result-Opcode-Ret"); } public object Loc () { object a = new object (); object b = a; return b; } [Test] public void TestLoc () { MethodDefinition m = GetTest ("Loc"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result-Opcode-Ret"); } public object Loc2 () { int a = 0; int b = 1; int c = 2; int d = 3; object e = new object (); switch (new Random ().Next ()) { case 0: return a; case 1: return b; case 2: return c; case 3: return d; default: return e; } } [Test] public void TestLoc2 () { MethodDefinition m = GetTest ("Loc2"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result-Opcode-Ret"); } public object Pop () { new object (); return null; } [Test] public void TestPop () { MethodDefinition m = GetTest ("Pop"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (0, result.Length); } public object Branch () { object a = new object (); object b; if (new Random ().Next () == 0) return a; else b = a; return b.ToString (); } [Test] public void TestBranch () { MethodDefinition m = GetTest ("Branch"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result[0]-Opcode-Ret"); Assert.AreEqual (OpCodes.Callvirt, result [1].Instruction.OpCode, "result[1]-Opcode-Callvirt"); } public void Branch2 () { Exception a = new Exception (); bool cond = new Random ().Next () == 0; a.Source = cond ? "a" : "b"; //tricks the compiler to load a onto the stack before doing a branch (to get more coverage) } [Test] public void TestBranch2 () { MethodDefinition m = GetTest ("Branch2"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Callvirt, result [0].Instruction.OpCode, "result-Opcode-Callvirt"); } public object TryFinally () { object a = new object (); object b = null; object c; try { b = a; } finally { c = b; b = null; } if (new Random ().Next () == 0) return c.ToString (); else return b; } [Test] public void TestTryFinally () { MethodDefinition m = GetTest ("TryFinally"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Callvirt, result [0].Instruction.OpCode, "result-Opcode-Callvirt"); } public object NestedTryFinally () { object a = new object (); object b = null; object c = null; try { b = a; try { c = new object (); } finally { c = a; a = null; } } finally { b = null; } if (new Random ().Next () == 0) return a; else if (new Random ().Next () == 0) return b; else return c.ToString (); } [Test] public void TestNestedTryFinally () { MethodDefinition m = GetTest ("NestedTryFinally"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Callvirt, result [0].Instruction.OpCode, "result-Opcode-Callvirt"); } public object NestedTryFinally2 () { object a = new object (); object b = null; object c = null; try { b = a; } finally { try { c = new object (); } finally { c = a; a = null; } b = null; } if (new Random ().Next () == 0) return a; else if (new Random ().Next () == 0) return b; else return c.ToString (); } [Test] public void TestNestedTryFinally2 () { MethodDefinition m = GetTest ("NestedTryFinally2"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Callvirt, result [0].Instruction.OpCode, "result-Opcode-Callvirt"); } public object TryCatch () { object a = new object (); object b = null; object c = null; try { if (new Random ().Next () == 0) { a = null; return a; } } catch { b = a; if (new Random ().Next () == 0) return a.ToString (); } return b.GetHashCode (); } [Test] public void TestTryCatch () { MethodDefinition m = GetTest ("TryCatch"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); //no "return a"; Assert.AreEqual (OpCodes.Callvirt, result [0].Instruction.OpCode, "result[0]-Opcode-Callvirt"); //return a.ToString (); Assert.AreEqual (OpCodes.Callvirt, result [1].Instruction.OpCode, "result[1]-Opcode-Callvirt"); //return b.GetHashCode (); } public object TryCatchFinally () { object a = new object (); object b = null; object c = null; try { if (new Random ().Next () == 0) { a = null; return a; } } catch { b = a; if (new Random ().Next () == 0) return a.ToString (); try { a = null; } finally { c = b; b = a; } } finally { } if (new Random ().Next () == 0) return b; else return c.GetHashCode (); } [Test] public void TestTryCatchFinally () { MethodDefinition m = GetTest ("TryCatchFinally"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); //no "return a"; Assert.AreEqual (OpCodes.Callvirt, result [0].Instruction.OpCode, "result[0]-Opcode-Callvirt"); //return a.ToString (); Assert.AreEqual (OpCodes.Callvirt, result [1].Instruction.OpCode, "result[1]-Opcode-Callvirt"); //return c.GetHashCode (); } public object MultipleCatch () { object a = new object (); object b = null; object c = null; try { if (new Random ().Next () == 0) { a = null; return a; } } catch (InvalidOperationException) { b = a; } catch (InvalidCastException) { c = a; } finally { a = null; } if (new Random ().Next () == 0) return a; else if (new Random ().Next () == 0) return b.GetHashCode (); else return c.ToString (); } [Test] public void TestMultipleCatch () { MethodDefinition m = GetTest ("MultipleCatch"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); //no "return a"; Assert.AreEqual (OpCodes.Callvirt, result [0].Instruction.OpCode, "result[0]-Opcode-Callvirt"); //return b.ToString (); Assert.AreEqual (OpCodes.Callvirt, result [1].Instruction.OpCode, "result[1]-Opcode-Callvirt"); //return c.GetHashCode (); } public object Starg (object b) { object a = new object (); b = a; return b; } [Test] public void TestStarg () { MethodDefinition m = GetTest ("Starg"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result-Opcode-Ret"); } public object Starg2 (object a, object b, object c, object d) //force ldarg.s (no macro) { d = new object (); return d; } [Test] public void TestStarg2 () { MethodDefinition m = GetTest ("Starg2"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result-Opcode-Ret"); } public static object StargStatic (object a, object b, object c, object d, object e) //force ldarg.s (no macro) (static (no this)) { e = new object (); return e; } [Test] public void TestStargStatic () { MethodDefinition m = GetTest ("StargStatic"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result-Opcode-Ret"); } public object OutArg (out object b) { object a = new object (); b = a; return b; //this is not guaranteed to work in complex situations. The lookup for stind_ref simply checks all previous instructions for ldargs. } [Test] public void TestOutArg () { MethodDefinition m = GetTest ("OutArg"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); Assert.AreEqual (OpCodes.Stind_Ref, result [0].Instruction.OpCode, "result[0]-Opcode-Stind_Ref"); Assert.AreEqual (OpCodes.Ret, result [1].Instruction.OpCode, "result[1]-Opcode-Ret"); } public object OutArg2 (object a, object b, object c, out object d) //force non macro version { d = new object (); return d; } [Test] public void TestOutArg2 () { MethodDefinition m = GetTest ("OutArg2"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); Assert.AreEqual (OpCodes.Stind_Ref, result [0].Instruction.OpCode, "result[0]-Opcode-Stind_Ref"); Assert.AreEqual (OpCodes.Ret, result [1].Instruction.OpCode, "result[1]-Opcode-Ret"); } public object Switch () { object a = new object (); object b = null; switch (new Random ().Next ()) { case 0: return a.ToString (); case 1: b = a; goto case 3; case 2: a = null; return a; case 3: return b.ToString (); } return null; } [Test] public void TestSwitch () { MethodDefinition m = GetTest ("Switch"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); Assert.AreEqual (OpCodes.Callvirt, result [0].Instruction.OpCode, "result[0]-Opcode-Callvirt"); Assert.AreEqual (OpCodes.Callvirt, result [1].Instruction.OpCode, "result[1]-Opcode-Callvirt"); } [Test] public void TestSwitch2 () { //I could not find c# code that loads a reference onto the stack before executing switch //newobj System.Object.ctor <- reference is on the stack //ldc.i4.0 //switch +2,+3 //ret <- default //ret <- switch1 //ret <- switch2 MethodDefinition m = new MethodDefinition ("Switch2", Mono.Cecil.MethodAttributes.Public, this.type); ILProcessor il = m.Body.GetILProcessor (); Instruction switch1 = il.Create (OpCodes.Ret); Instruction switch2 = il.Create (OpCodes.Ret); il.Emit (OpCodes.Newobj, (MethodReference) GetFirstNewObj (GetTest ("Switch")).Operand); //get object.ctor() il.Emit (OpCodes.Ldc_I4_0); il.Emit (OpCodes.Switch, new Instruction [] { switch1, switch2 }); //default il.Emit (OpCodes.Ret); //switch 1 and 2 il.Append (switch1); il.Append (switch2); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (3, result.Length, "result-Length-3"); Assert.AreEqual (OpCodes.Ret, result [0].Instruction.OpCode, "result[0]-Opcode-Ret"); Assert.AreEqual (OpCodes.Ret, result [1].Instruction.OpCode, "result[1]-Opcode-Ret"); Assert.AreEqual (OpCodes.Ret, result [2].Instruction.OpCode, "result[2]-Opcode-Ret"); } public void Castclass () { Exception a = (Exception) new object (); throw a; } [Test] public void TestCastclass () { MethodDefinition m = GetTest ("Castclass"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (OpCodes.Throw, result [0].Instruction.OpCode, "result-Opcode-Throw"); } public void StackOffset () { string a = (string) new object (); a.ToString (); a.CompareTo (a); Console.WriteLine (a); } [Test] public void TestStackOffset () { MethodDefinition m = GetTest ("StackOffset"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (4, result.Length, "result-Length-4"); Assert.AreEqual (0, result [0].StackOffset, "result[0]-StackOffset-0"); Assert.AreEqual (1, result [1].StackOffset, "result[1]-StackOffset-1"); Assert.AreEqual (0, result [2].StackOffset, "result[2]-StackOffset-0"); Assert.AreEqual (0, result [3].StackOffset, "result[3]-StackOffset-0"); } object field; public void Field () { field = new object (); field.ToString (); } [Test] public void TestField () { MethodDefinition m = GetTest ("Field"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); Assert.AreEqual (Code.Stfld, result [0].Instruction.OpCode.Code, "result[0]-Opcode-Stfld"); Assert.AreEqual (Code.Callvirt, result [1].Instruction.OpCode.Code, "result[1]-Opcode-Callvirt"); } public void Field2 () { var t = new StackEntryAnalysisTest (); t.field = new object (); //do not follow assigns to other objects! field.ToString (); t.field.ToString (); } [Test] [Ignore ("StackEntryAnalysis does currently not check which instance the field belongs to. This will need a reverse StackEntry test and AssemblyResolver support (for protected fields and/or static fields).")] public void TestField2 () { MethodDefinition m = GetTest ("Field2"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (1, result.Length, "result-Length-1"); Assert.AreEqual (Code.Stfld, result [0].Instruction.OpCode.Code, "result-Opcode-Stfld"); } static object staticField; public void StaticField () { staticField = new object (); staticField.ToString (); } [Test] public void TestStaticField () { MethodDefinition m = GetTest ("StaticField"); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (GetFirstNewObj (m)); Assert.AreEqual (2, result.Length, "result-Length-2"); Assert.AreEqual (Code.Stsfld, result [0].Instruction.OpCode.Code, "result[0]-Opcode-Stfld"); Assert.AreEqual (Code.Callvirt, result [1].Instruction.OpCode.Code, "result[1]-Opcode-Callvirt"); } /* Cecil doesn't support Calli instructions atm. [Test] public void TestCalli () { //ldftn Calli //calli void () //ret MethodDefinition m = new MethodDefinition ("Calli", Mono.Cecil.MethodAttributes.Public, this.type); m.Body.CilWorker.Emit (OpCodes.Ldftn, m); m.Body.CilWorker.Create (OpCodes.Calli, new CallSite (false, false, MethodCallingConvention.Default, GetTest ("TestCalli").ReturnType)); m.Body.CilWorker.Emit (OpCodes.Ret); StackEntryAnalysis sea = new StackEntryAnalysis (m); StackEntryUsageResult [] result = sea.GetStackEntryUsage (m.Body.Instructions[0]); Assert.AreEqual (1, result.Length); Assert.AreEqual (OpCodes.Calli, result [0].Instruction.OpCode); }*/ } } mono-tools-4.2/gendarme/framework/Test/GlobalSuppressions.cs0000664000175000017500000000027312413742070026374 0ustar00directhexdirecthex00000000000000[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ("Test.Framework", "SuppressTypeRule", Target = "Test.Framework.SuppressMessageAttribute_TypeTest/ClassIndirectlySuppressed")] mono-tools-4.2/gendarme/framework/Test/Makefile.am0000664000175000017500000000004412413742070024237 0ustar00directhexdirecthex00000000000000DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/framework/gendarme-framework.pc.in0000664000175000017500000000032412413742070025773 0ustar00directhexdirecthex00000000000000prefix=@prefix@ assemblies_dir=${prefix}/lib/gendarme Libraries=${assemblies_dir}/Gendarme.Framework.dll Name: Gendarme.Framework Description: Gendarme.Framework Library Version: @VERSION@ Libs: -r:${Libraries} mono-tools-4.2/gendarme/framework/Makefile.am0000664000175000017500000001330612413742070023325 0ustar00directhexdirecthex00000000000000include ../options.make SUBDIRS = Test frameworkdir=$(prefix)/lib/gendarme framework_SCRIPTS = ../bin/Gendarme.Framework.dll EXTRA_DIST = $(framework_sources) $(framework_sources_in) $(framework_test_build_sources) \ Gendarme.Framework.csproj gendarme-framework.pc.in CLEANFILES = $(framework_SCRIPTS) $(framework_SCRIPTS).mdb Test.Framework.dll $(framework_SCRIPTS).doc $(framework_doc) DISTCLEANFILES = ../AssemblyInfo.cs Makefile.in gendarme-framework.pc pkgconfig_in_files = gendarme-framework.pc.in pkgconfigdir= $(prefix)/lib/pkgconfig pkgconfig_DATA = $(pkgconfig_in_files:.pc.in=.pc) framework_doc_source = doc/Gendarme.Framework.source framework_doc_tree = doc/Gendarme.Framework.tree framework_doc_zip = doc/Gendarme.Framework.zip framework_documentationdir = $(prefix)/lib/monodoc/sources framework_documentation_DATA = $(framework_doc) framework_doc = $(framework_doc_zip) $(framework_doc_source) $(framework_doc_tree) generated_doc = doc/generated/index.xml framework_sources_in = ../AssemblyInfo.cs.in framework_generated_sources = $(framework_sources_in:.in=) framework_sources = \ ../AssemblyStaticInfo.cs \ Gendarme.Framework.Engines/NamespaceEngine.cs \ Gendarme.Framework.Engines/OpCodeEngine.cs \ Gendarme.Framework.Engines/SuppressMessageEngine.cs \ Gendarme.Framework.Helpers/Log.cs \ Gendarme.Framework.Helpers/MethodPrinter.cs \ Gendarme.Framework.Helpers/MethodSignature.cs \ Gendarme.Framework.Helpers/MethodSignatures.cs \ Gendarme.Framework.Helpers/Namespace.cs \ Gendarme.Framework.Helpers/OpCodeBitmask.cs \ Gendarme.Framework.Helpers/PrimitiveReferences.cs \ Gendarme.Framework.Helpers/StackEntryAnalysis.cs \ Gendarme.Framework.Helpers/StackEntryUsageResult.cs \ Gendarme.Framework.Helpers/StreamLineReader.cs \ Gendarme.Framework.Rocks/AssemblyRocks.cs \ Gendarme.Framework.Rocks/CecilRocks.cs \ Gendarme.Framework.Rocks/CommonRocks.cs \ Gendarme.Framework.Rocks/CustomAttributeRocks.cs \ Gendarme.Framework.Rocks/FieldRocks.cs \ Gendarme.Framework.Rocks/InstructionRocks.cs \ Gendarme.Framework.Rocks/MethodRocks.cs \ Gendarme.Framework.Rocks/ModuleRocks.cs \ Gendarme.Framework.Rocks/ParameterRocks.cs \ Gendarme.Framework.Rocks/PropertyRocks.cs \ Gendarme.Framework.Rocks/TypeRocks.cs \ Gendarme.Framework.Rocks/VariableDefinitionRocks.cs \ Gendarme.Framework/ApplicabilityScope.cs \ Gendarme.Framework/AssemblyResolver.cs \ Gendarme.Framework/BasicIgnoreList.cs \ Gendarme.Framework/Bitmask.cs \ Gendarme.Framework/Confidence.cs \ Gendarme.Framework/Defect.cs \ Gendarme.Framework/DocumentationUriAttribute.cs \ Gendarme.Framework/Engine.cs \ Gendarme.Framework/EngineController.cs \ Gendarme.Framework/EngineDependencyAttribute.cs \ Gendarme.Framework/EngineEventArgs.cs \ Gendarme.Framework/FxCopCompatibilityAttribute.cs \ Gendarme.Framework/HierarchicalEventArgs.cs \ Gendarme.Framework/IAssemblyRule.cs \ Gendarme.Framework/IIgnoreList.cs \ Gendarme.Framework/IMethodRule.cs \ Gendarme.Framework/IRule.cs \ Gendarme.Framework/IRunner.cs \ Gendarme.Framework/ITypeRule.cs \ Gendarme.Framework/ProblemAttribute.cs \ Gendarme.Framework/Rule.cs \ Gendarme.Framework/RuleResult.cs \ Gendarme.Framework/Runner.cs \ Gendarme.Framework/RunnerEventArgs.cs \ Gendarme.Framework/Severity.cs \ Gendarme.Framework/SolutionAttribute.cs \ Gendarme.Framework/Symbols.cs \ Gendarme.Framework/ThreadModelAttribute.cs framework_build_sources = $(addprefix $(srcdir)/, $(framework_sources)) framework_build_sources += $(framework_generated_sources) ../bin/Gendarme.Framework.dll: $(framework_build_sources) $(CECIL_ASM) test -d ../bin || mkdir ../bin $(MCS) $(GENDARME_OPTIONS) -target:library -doc:$(framework_SCRIPTS).doc -r:$(CECIL_ASM) \ -out:$@ $(framework_build_sources) framework_test_sources = \ GlobalSuppressions.cs \ Gendarme.Framework/BitmaskTest.cs \ Gendarme.Framework/ThreadModelAttributeTest.cs \ Gendarme.Framework.Engines/SuppressMessageAttributeTest.cs \ Gendarme.Framework.Helpers/MethodSignatureTest.cs \ Gendarme.Framework.Helpers/StackEntryAnalysisTest.cs \ Gendarme.Framework.Rocks/RocksTest.cs \ Gendarme.Framework.Rocks/AssemblyRocksTest.cs \ Gendarme.Framework.Rocks/CustomAttributeRocksTest.cs \ Gendarme.Framework.Rocks/InstructionRocksTest.cs \ Gendarme.Framework.Rocks/MethodRocksTest.cs \ Gendarme.Framework.Rocks/ParameterRocksTest.cs \ Gendarme.Framework.Rocks/TypeRocksTest.cs \ Gendarme.Framework.Rocks/VariableDefinitionRocksTest.cs \ Gendarme.Framework.Rocks/FieldRocksTest.cs framework_test_build_sources = $(addprefix $(srcdir)/Test/, $(framework_test_sources)) Test.Framework.dll: $(framework_test_build_sources) $(framework_rules_SCRIPTS) ../bin/Gendarme.Framework.dll $(CECIL_ASM) $(MCS) $(TESTS_OPTIONS) -target:library -d:CODE_ANALYSIS -pkg:mono-nunit \ -r:$(CECIL_ASM) -r:../bin/Gendarme.Framework.dll -r:../rules/Test.Rules/Test.Rules.dll \ -out:$@ $(framework_test_build_sources) test: Test.Framework.dll run-test: test MONO_PATH=../bin/:../rules/Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe Test.Framework.dll self-test: $(framework_SCRIPTS) mono --debug ../bin/gendarme.exe $(framework_SCRIPTS) $(generated_doc): $(framework_SCRIPTS) mkdir -p doc mdoc update -i $(framework_SCRIPTS).doc -o doc/generated $(framework_SCRIPTS) touch $(generated_doc) $(framework_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/Gendarme.Framework doc/generated $(framework_doc_tree): $(generated_doc) $(framework_doc_source): echo -e "\n\n\t\n\t\n" > $(framework_doc_source) clean-local: rm -fr doc/ mono-tools-4.2/gendarme/framework/Gendarme.Framework.csproj0000775000175000017500000002075212413742070026177 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {CD6818D5-B398-486C-B180-92A07B143AFD} Library Properties Gendarme.Framework Gendarme.Framework 3.5 true v4.0 http://localhost/Gendarme.Framework/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false ..\bin\ DEBUG;TRACE prompt 3 AllRules.ruleset pdbonly true bin\Release\ TRACE;RELEASE prompt 4 AllRules.ruleset 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/AssemblyInfo.cs.in0000664000175000017500000000036512413742070022624 0ustar00directhexdirecthex00000000000000// // AssemblyInfo.cs.in for Gendarme // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-2008 Novell, Inc (http://www.novell.com) // using System.Reflection; [assembly: AssemblyVersion ("@GENDARME_VERSION@")] mono-tools-4.2/gendarme/mono-options.ignore0000664000175000017500000000773512413742070023153 0ustar00directhexdirecthex00000000000000# NDesk.Options ignored defects R: Gendarme.Rules.Smells.AvoidSwitchStatementsRule N: NDesk.Options R: Gendarme.Rules.Performance.AvoidConcatenatingCharsRule M: System.Boolean NDesk.Options.OptionSet::ParseBundledValue(System.String,System.String,NDesk.Options.OptionContext) M: System.String NDesk.Options.OptionSet::GetArgumentName(System.Int32,System.Int32,System.String) R: Gendarme.Rules.Design.Generic.AvoidDeclaringCustomDelegatesRule T: NDesk.Options.OptionAction`2 R: Gendarme.Rules.Design.AvoidRefAndOutParametersRule M: System.Boolean NDesk.Options.OptionSet::GetOptionParts(System.String,System.String&,System.String&,System.String&,System.String&) R: Gendarme.Rules.Performance.AvoidRepetitiveCallsToPropertiesRule M: System.Boolean NDesk.Options.OptionSet::GetOptionParts(System.String,System.String&,System.String&,System.String&,System.String&) R: Gendarme.Rules.Performance.AvoidReturningArraysOnPropertiesRule M: System.String[] NDesk.Options.Option::get_Names() M: System.String[] NDesk.Options.Option::get_ValueSeparators() R: Gendarme.Rules.Exceptions.DoNotSwallowErrorsCatchingNonSpecificExceptionsRule M: T NDesk.Options.Option::Parse(System.String,NDesk.Options.OptionContext) R: Gendarme.Rules.Exceptions.InstantiateArgumentExceptionCorrectlyRule M: System.Void NDesk.Options.Option::AddSeparators(System.String,System.Int32,System.Collections.Generic.ICollection`1) M: System.String NDesk.Options.OptionSet::GetKeyForItem(NDesk.Options.Option) R: Gendarme.Rules.Serialization.MarkEnumerationsAsSerializableRule T: NDesk.Options.OptionValueType R: Gendarme.Rules.Performance.PreferCharOverloadRule M: System.String NDesk.Options.OptionSet::GetArgumentName(System.Int32,System.Int32,System.String) R: Gendarme.Rules.Naming.UseCorrectSuffixRule T: NDesk.Options.OptionSet R: Gendarme.Rules.Design.Generic.AvoidMethodWithUnusedGenericTypeRule M: T NDesk.Options.Option::Parse(System.String,NDesk.Options.OptionContext) R: Gendarme.Rules.Correctness.CheckParametersNullityInVisibleMethodsRule M: T NDesk.Options.Option::Parse(System.String,NDesk.Options.OptionContext) M: System.Collections.Generic.List`1 NDesk.Options.OptionSet::Parse(System.Collections.Generic.IEnumerable`1) M: System.Boolean NDesk.Options.OptionSet::Parse(System.String,NDesk.Options.OptionContext) R: Gendarme.Rules.Maintainability.AvoidLackOfCohesionOfMethodsRule T: NDesk.Options.OptionContext R: Gendarme.Rules.BadPractice.PreferEmptyInstanceOverNullRule M: System.String NDesk.Options.OptionValueCollection::get_Item(System.Int32) R: Gendarme.Rules.Maintainability.VariableNamesShouldNotMatchFieldNamesRule T: NDesk.Options.OptionValueCollection T: NDesk.Options.OptionContext T: NDesk.Options.Option T: NDesk.Options.OptionSet T: NDesk.Options.OptionSet/ActionOption T: NDesk.Options.OptionSet/ActionOption`1 T: NDesk.Options.OptionSet/ActionOption`2 R: Gendarme.Rules.Design.Generic.DoNotExposeGenericListsRule T: NDesk.Options.OptionValueCollection T: NDesk.Options.OptionSet # CSC only - AddImpl and GetArgumentName R: Gendarme.Rules.Smells.AvoidCodeDuplicatedInSameClassRule T: NDesk.Options.OptionSet R: Gendarme.Rules.Globalization.PreferStringComparisonOverrideRule M: System.String NDesk.Options.OptionSet::GetArgumentName(System.Int32,System.Int32,System.String) R: Gendarme.Rules.Globalization.PreferIFormatProviderOverrideRule M: System.Void NDesk.Options.Option::AddSeparators(System.String,System.Int32,System.Collections.Generic.ICollection`1) M: System.Boolean NDesk.Options.OptionSet::ParseBundledValue(System.String,System.String,NDesk.Options.OptionContext) M: System.Void NDesk.Options.OptionValueCollection::AssertValid(System.Int32) M: System.Void NDesk.Options.Option::.ctor(System.String,System.String,System.Int32) M: NDesk.Options.OptionValueType NDesk.Options.Option::ParsePrototype() M: T NDesk.Options.Option::Parse(System.String,NDesk.Options.OptionContext) M: System.Void NDesk.Options.OptionSet::ParseValue(System.String,NDesk.Options.OptionContext) mono-tools-4.2/gendarme/rules/0000775000175000017500000000000012642235743020433 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/ChangeLog0000664000175000017500000002433112413742070022200 0ustar00directhexdirecthex000000000000002010-08-06 Antoine Vandecreme * common.make: Add support for resources 2009-07-08 Sebastien Pouliot * common.make: Add a 'touch hack' so we only rebuild documentation when a rule assembly is changed. 2009-01-27 Jonathan Pryor * common.make ($(rules_doc_source)): Change the .source file contents so that rules are placed under the 'Commands and Files/Gendarme' node. 2009-01-09 Jesse Jones * Makefike.am: put rules target back in (needed for the new console target). 2008-12-19 Sebastien Pouliot * Makefile.am: Simplify calls into subdirectories for test and run-test. Remove self-test at this stage (still possible globally or on a specific rule assembly). 2008-12-01 Jesse Jones * Makefile.am: Added rules target. * common.make: Added rule target. 2008-11-23 Sebastien Pouliot * Makefile.am: Avoid re-building documentation needlessly. This fix the case where a make install, under su, would fail to locate mdoc. 2008-11-17 Jesse Jones * common.make: Copy bin/gendarme.exe.config to $(tests_dll).config. Also add the config file to CLEANFILES. 2008-11-14 Jesse Jones * common.make: Uses new options.make file. 2008-11-07 Alan McGovern * rules.mds: * Makefile.am: * common.make: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-02 Sebastien Pouliot * common.make: Regenerate documentation if the .doc file has changed 2008-10-31 Jesse Jones * common.make: Empty make targets don't seem to build on OS-X which causes problems when we try to build xml files which aren't there. Fixed this by adding a prereq on the doc directory in addition to the xml files. * common.make: tests_dll prereq was completely wrong: it used test_build_sources which was never set instead of tests_build_sources. 2008-10-30 Sebastien Pouliot * config.make: Fix "make distcheck" that I broke when adding AssemblyStaticInfo.cs to every rule assembly. 2008-10-30 Jesse Jones * Makefile.am: Added EXTRA_RULES_OPTIONS and EXTRA_TESTS_OPTIONS so that we can build the rules consistently. EXTRA_TESTS_OPTIONS now defines DEBUG and TRACE (which only one rule did before) and disables warnings. EXTRA_RULES_OPTIONS also defines DEBUG and TRACE, enables all warnings, makes warnings errors, and enables checked arithmetic. 2008-10-30 Jesse Jones * common.make: Use 'expr x : y' instead of non-portable 'expr match x y'. 2008-10-26 Sebastien Pouliot * common.make: Make all rule assemblies include AssemblyStaticInfo.cs in its build. 2008-10-21 Sebastien Pouliot * common.make: Don't warn if XML documentation is incomplete (1591) since we only document the class (and nothing else) for the wiki. 2008-10-21 Néstor Salceda * common.make: As we do when we compile, the doc directory is generated if needed. * Gendarme.Rules.*/doc: We don't need to keep the doc directory for every rule category, because it's created if needed. 2008-10-21 Néstor Salceda * common.make: This target is not longer needed, because the artifacts which will be built are placed in the SCRIPTS and DATA. 2008-10-21 Néstor Salceda * common.make: Extracted some common code from Makefiles and put in this file. This reduces the duplication among Makefiles and make it easier to maintain. 2008-10-19 Néstor Salceda * common.make: Added the targets for generate the documentation from the XML code comments in the source code. It also packages and make it installable in Monodoc. * Makefile.am: This target is not longer needed because the doc building is integrated in the build process. 2008-10-15 Néstor Salceda * Makefile.am: Added the doc target in order to update or generate the rules documentation for each category. * common.make: Added the doc target in order to generate or update the documentation for the chosen category. It also generates a .doc file with the comments in the source code for extracting in the documentation. 2008-08-26 Sebastien Pouliot * Makefile.am: Add Gendarme.Rules.Design.Generic to the build. * rules.xml: Add Gendarme.Rules.Design.Generic to default and into its own category. 2008-08-25 Sebastien Pouliot * Makefile.am: Add Gendarme.Rules.Security.Cas to the build. * rules.xml: Add Gendarme.Rules.Security.Cas to default and into its own category. 2008-08-17 Sebastien Pouliot * Makefile.am: Add Gendarme.Rules.Design.Linq to the build. * rules.xml: Add Gendarme.Rules.Design.Linq to default and into its own category. 2008-07-18 Sebastien Pouliot * rules.xml: Add Maintainability rules to "default" (found by Richard Birky). 2008-07-10 Sebastien Pouliot * Makefile.am: Add common.make to the dist 2008-07-09 Sebastien Pouliot * common.make: Cut down on Makefile.am copy/paste (and hopefully the errors inside them ;-) 2008-04-27 Andres G. Aragoneses * rules.mds, tests.mds: added new projects for Gendarme.Rules.Maintainability. 2008-04-27 Nestor Salceda * rules.xml: Add Maintainability rules to "self-test" and a new "maintainability" ruleset. 2008-04-27 Nestor Salceda * Makefile.am: Appended the Maintainability build. 2008-03-24 Sebastien Pouliot * Makefile.am: Re-order directories to start with Test.Rules 2008-03-12 Sebastien Pouliot * Makefile.am: Add Test.Rules to the build. * tests.mds: Add Test.Rules to MD testing solution. 2008-02-16 Sebastien Pouliot * Makefile.am: Add Gendarme.Rules.Serialization to the build. * rules.xml: Add Serialization rules to "default", "self-test" and a new "serialization" ruleset. * rules.mds: Add Serialization rules project to the solution. * tests.mds: Add Serialization unit tests project to the solution. 2008-01-29 Sebastien Pouliot * rules.xml: Order rules alphabetically. Update mono-bcl rule set with newer rules. 2008-01-28 Sebastien Pouliot * rules.xml: In default only exclude NullDerefRule from Correctness and stop excluding ToStringReturnsNullRule from BadPractice. In mono-bcl include everything except MethodCanBeMadeStaticRule and NullDerefRule from Correctness and exclude MonoCompatibilityReviewRule from Portability. 2008-01-02 Sebastien Pouliot * rules.mds, tests.mds: Add Gendarme.Rules.Interoperability to MonoDevelop solution files. * rules.xml: Add Gendarme.Rules.Interoperability rules 2007-12-30 Sebastien Pouliot * Makefile.am: Add Gendarme.Rules.Interoperability to the build. 2007-12-16 Sebastien Pouliot * rules.xml: Added Correctness rules (except NullDeRef) to "self-test". Renamed monoBCL to mono-bcl to avoid mixed cases. Re-active AvoidUninstantiatedInternalClassesRule in default. 2007-11-29 Sebastien Pouliot * rules.xml: Add a new "self-test" set used for testing Gendarme itself 2007-11-18 Nestor Salceda * rules.xml: Added ToStringReturnsNullRule to the profiles, because the bug has been fixed. 2007-10-19 Nestor Salceda * rules.xml: Update with the profiles page in the group. There are 2 rules deactivated because I should deal with and fix some bugs. 2007-10-15 Nestor Salceda * rules.xml: Added the design and badpractice rulesets. 2007-10-09 Nestor Salceda * rules.md-nunit: Fix the path for Test.Rules.BadDesign.dll assembly in the unit tests. 2007-10-09 Nestor Salceda * rules.md-nunit: Update unit tests to load assemblies in ../bin directory. 2007-10-07 Sebastien Pouliot * Makefile.am: Add Gendarme.Rules.BadPractice to the build 2007-09-26 Nestor Salceda * rules.xml: Added Naming rules to "all" and new "naming" ruleset. Added new "smells" ruleset. Added "monoBCL" ruleset as part of the profiles task. 2007-09-14 Nestor Salceda * Gendarme.Rules.Smells: Merging GSoC 2007 work. * Makefile.am: Added Gendarme.Rules.Smells. 2007-09-13 Nestor Salceda * Gendarme.Rules.Naming: Merging GSoC 2007 work. * Makefile.am: Added Gendarme.Rules.Naming. 2007-03-12 Jb Evain * Update to match the new rules interfaces. 2006-11-06 Sebastien Pouliot * Makefile.am: Add Gendarme.Rules.Ui to the build. * rules.xml: Add UI rules to "all" and a new "ui" ruleset. * rules.mds: Add UI rules project to the solution. * tests.mds: Add UI unit tests project to the solution. 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. * rules.xml: Disabling Gendarme.Rules.Correctness.dll until bug #79486 is fixed. 2006-07-31 Sebastien Pouliot * rules.mds: New. (Sub-)solution file for MonoDevelop. * rules.md-unit: New. MonoDevelop NUnit project file. * tests.mds: New. (Sub-)solution file for MonoDevelop. 2006-06-19 Russell Morris * Makefile.am: Added Gendarme.Rules.Exceptions * rules.xml: Added Gendarme.Rules.Exceptions entries 2006-06-13 Sebastien Pouliot * Makefile.am: Added self-test target to promote compliance ;-) 2006-03-06 Sebastien Pouliot * Makefile.am: Added Gendarme.Rules.Portability 2006-03-01 Sebastien Pouliot * Makefile.am: Added test and run-test targets. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/0000775000175000017500000000000012642235741025535 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ReviewUseOfInt64BitsToDoubleRule.cs0000664000175000017500000001202512413742070034216 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ReviewUseOfInt64BitsToDoubleRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // DMI: Double.longBitsToDouble invoked on an int (DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_INT) /// /// This rule checks for invalid integer to double conversion using the, confusingly named, /// BitConverter.Int64BitsToDouble method. This method converts the actual bits, /// i.e. not the value, into a Double. The rule will warn when anything other than an /// Int64 is being used as a parameter to this method. /// /// /// Bad example: /// /// public double GetRadians (int degrees) /// { /// return BitConverter.Int64BitsToDouble (degrees) * Math.PI / 180.0d; /// } /// /// /// /// Good example: /// /// public double GetRadians (int degree) /// { /// return degrees * Math.PI / 180.0d; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method calls System.BitConverter.Int64BitsToDouble(Int64) in a way that suggests it is trying to convert an integer value, not the bits, into a double.")] [Solution ("Verify the code logic. This could be a bad, non-working, conversion from an integer type into a double.")] [EngineDependency (typeof (OpCodeEngine))] public class ReviewUseOfInt64BitsToDoubleRule : Rule, IMethodRule { // Conv_I8, Conv_U8, Conv_Ovf_I8, Conv_Ovf_I8_Un, Conv_Ovf_U8, Conv_Ovf_U8_Un private static OpCodeBitmask Convert8 = new OpCodeBitmask (0x0, 0x220000000000, 0x60000000044, 0x0); public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { // if the module does not reference System.BitConverter.Int64BitsToDouble then no // then there's no point in enabling the rule Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyMemberReference ((MemberReference mr) => { return IsInt64BitsToDouble (mr); }) ); }; } static bool IsInt64BitsToDouble (MemberReference method) { return method.IsNamed ("System", "BitConverter", "Int64BitsToDouble"); } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // exclude methods that don't have calls OpCodeBitmask mask = OpCodeEngine.GetBitmask (method); if (!OpCodeBitmask.Calls.Intersect (mask)) return RuleResult.DoesNotApply; // *and* methods that don't convert into an [u]int64 if (!Convert8.Intersect (mask)) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.FlowControl != FlowControl.Call) continue; if (!IsInt64BitsToDouble (ins.Operand as MethodReference)) continue; // if the previous call convert a value into a long (int64) // then it's likely that the API is being misused switch (ins.Previous.OpCode.Code) { case Code.Conv_I8: case Code.Conv_U8: case Code.Conv_Ovf_I8: case Code.Conv_Ovf_I8_Un: case Code.Conv_Ovf_U8: case Code.Conv_Ovf_U8_Un: Runner.Report (method, ins, Severity.High, Confidence.High); break; } } return Runner.CurrentRuleResult; } #if false public void Convert () { OpCodeBitmask Convert8 = new OpCodeBitmask (0x0, 0x0, 0x0, 0x0); Convert8.Set (Code.Conv_I8); Convert8.Set (Code.Conv_U8); Convert8.Set (Code.Conv_Ovf_I8); Convert8.Set (Code.Conv_Ovf_I8_Un); Convert8.Set (Code.Conv_Ovf_U8); Convert8.Set (Code.Conv_Ovf_U8_Un); Console.WriteLine (Convert8); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ReviewSelfAssignmentRule.cs0000664000175000017500000001506712413742070033023 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ReviewSelfAssignmentRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // SA: Self assignment of field (SA_FIELD_SELF_ASSIGNMENT) // SA: Self assignment of local variable (SA_LOCAL_SELF_ASSIGNMENT) /// /// This rule checks for variables or fields that are assigned to themselves. /// This won't change the value of the variable (or fields) but should be reviewed /// since it could be a typo that hides a real issue in the code. /// /// /// Bad example: /// /// public class Bad { /// private int value; /// /// public Bad (int value) /// { /// // argument is assigned to itself, this.value is unchanged /// value = value; /// } ///} /// /// /// /// Good example: /// /// public class Good { /// private int value; /// /// public Good (int value) /// { /// this.value = value; /// } ///} /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method assigns a variable or field to itself.")] [Solution ("Verify the code logic. This is likely a typo resulting in an incorrect assignment.")] [EngineDependency (typeof (OpCodeEngine))] public class ReviewSelfAssignmentRule : Rule, IMethodRule { // contains Stfld, Stsfld, Starg and Starg_S static OpCodeBitmask mask = new OpCodeBitmask (0x10000, 0x2400000000000000, 0x0, 0x200); static bool Compare (Instruction left, Instruction right, MethodDefinition method) { if (left == null) return (right == null); else if (right == null) return false; // is it on the same instance ? Instruction origin_left = left.TraceBack (method); Instruction origin_right = right.TraceBack (method); // if this is an array access the it must be the same element if (origin_left.IsLoadElement () && origin_right.IsLoadElement ()) { if (!CompareOperand (origin_left.Previous, origin_right.Previous, method)) return false; } else { if (!CompareOperand (origin_left, origin_right, method)) return false; } return Compare (origin_left, origin_right, method); } static bool CompareOperand (Instruction left, Instruction right, MethodDefinition method) { object operand_left = left.GetOperand (method); object operand_right = right.GetOperand (method); if (operand_left == null) return (operand_right == null); return operand_left.Equals (operand_right); } void CheckFields (Instruction ins, Instruction next, MethodDefinition method, bool isStatic) { FieldDefinition field = ins.GetField (); if ((field != null) && (field == next.GetField ())) { // instance fields need extra comparison using method if (isStatic || Compare (next, ins, method)) { string msg = String.Format (CultureInfo.InvariantCulture, "{0} field '{1}' of type '{2}'.", isStatic ? "Static" : "Instance", field.Name, field.FieldType.GetFullName ()); Runner.Report (method, ins, Severity.Medium, Confidence.Normal, msg); } } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // exclude methods that don't store fields or arguments if (!mask.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { Instruction next = ins.Next; if (next == null) continue; if (next.OpCode.Code == Code.Stfld) { // is it the same (instance) field ? CheckFields (ins, next, method, false); } else if (next.OpCode.Code == Code.Stsfld) { // is it the same (static) field ? CheckFields (ins, next, method, true); // too much false positive because compilers add their own variables // and don't always "play well" with them #if false } else if (ins.IsLoadLocal () && next.IsStoreLocal ()) { VariableDefinition variable = next.GetVariable (method); if (variable == ins.GetVariable (method)) { // the compiler often introduce it's own variable if (!variable.Name.StartsWith ("V_")) msg = String.Format ("Variable '{0}' of type '{1}'.", variable.Name, variable.VariableType.GetFullName ()); } #endif } else if (ins.IsLoadArgument () && next.IsStoreArgument ()) { ParameterDefinition parameter = next.GetParameter (method); if (parameter == ins.GetParameter (method)) { string msg = String.Format (CultureInfo.InvariantCulture, "Parameter '{0}' of type '{1}'.", parameter.Name, parameter.ParameterType.GetFullName ()); Runner.Report (method, ins, Severity.Medium, Confidence.Normal, msg); } } } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Stfld); mask.Set (Code.Stsfld); /* if/when the local variables case is fixed mask.Set (Code.Stloc_0); mask.Set (Code.Stloc_1); mask.Set (Code.Stloc_2); mask.Set (Code.Stloc_3); mask.Set (Code.Stloc); mask.Set (Code.Stloc_S); */ mask.Set (Code.Starg); mask.Set (Code.Starg_S); Console.WriteLine (mask); } #endif } } TypesWithNativeFieldsShouldBeDisposableRule.cs0000664000175000017500000001107212413742070036522 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness// // Gendarme.Rules.Correctness.TypesWithNativeFieldsShouldBeDisposableRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule will fire if a type contains IntPtr, UIntPtr, or /// HandleRef fields but does not implement System.IDisposable. /// /// /// Bad examples: /// /// public class DoesNotImplementIDisposable { /// IntPtr field; /// } /// /// abstract public class AbstractDispose : IDisposable { /// IntPtr field; /// /// // the field should be disposed in the type that declares it /// public abstract void Dispose (); /// } /// /// /// /// Good example: /// /// public class Dispose : IDisposable { /// IDisposable field; /// /// public void Dispose () /// { /// UnmanagedFree (field); /// } /// } /// /// [Problem ("This type contains native field(s) but doesn't implement IDisposable.")] [Solution ("Implement IDisposable and free the native field(s) in the Dispose method.")] [FxCopCompatibility ("Microsoft.Design", "CA1049:TypesThatOwnNativeResourcesShouldBeDisposable")] [EngineDependency (typeof (OpCodeEngine))] public class TypesWithNativeFieldsShouldBeDisposableRule : TypesShouldBeDisposableBaseRule { static OpCodeBitmask StoreFieldBitmask = new OpCodeBitmask (0x0, 0x400000000000000, 0x80000000, 0x0); protected override string AbstractTypeMessage { get { return "Field is native. Type should implement a non-abstract Dispose() method"; } } protected override string TypeMessage { get { return "Field is native. Type should implement a Dispose() method"; } } protected override string AbstractDisposeMessage { get { return "Some fields are native pointers. Making this method abstract shifts the reponsability of disposing those fields to the inheritors of this class."; } } protected override void CheckMethod (MethodDefinition method, bool abstractWarning) { if ((method == null) || !method.HasBody) return; OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); // method must have a CALL[VIRT] and either STFLD or STELEM_REF if (!bitmask.Intersect (OpCodeBitmask.Calls) || !bitmask.Intersect (StoreFieldBitmask)) return; foreach (Instruction ins in method.Body.Instructions) { MethodReference mr = (ins.Operand as MethodReference); if (mr == null || mr.DeclaringType.IsNative ()) continue; FieldDefinition field = null; Instruction next = ins.Next; if (next.Is (Code.Stfld)) { field = next.Operand as FieldDefinition; } else if (next.Is (Code.Stobj) || next.Is (Code.Stind_I)) { Instruction origin = next.TraceBack (method); if (origin.Is (Code.Ldelema)) { origin = origin.TraceBack (method); if (origin != null) field = origin.Operand as FieldDefinition; } } if (field != null && FieldCandidates.Contains (field)) { Runner.Report (field, Severity.High, Confidence.High, abstractWarning ? AbstractTypeMessage : TypeMessage); } } } protected override bool FieldTypeIsCandidate (TypeDefinition type) { return ((type != null) && type.IsNative ()); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/FloatComparisonRule.cs0000664000175000017500000000537212413742070032015 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.FloatComparisonRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { [EngineDependency (typeof (OpCodeEngine))] abstract public class FloatingComparisonRule : Rule { public override void Initialize (IRunner runner) { base.Initialize (runner); // we want to avoid checking all methods if the module doesn't refer to either // System.Single or System.Double (big performance difference) // note: mscorlib.dll is an exception since it defines, not refer, System.Single and Double Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib") || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsFloatingPoint (); }); }; } static protected bool IsApplicable (MethodDefinition method) { // we only check methods with a body if ((method == null) || !method.HasBody) return false; // we don't check System.Single and System.Double // special case for handling mscorlib.dll if (method.DeclaringType.IsFloatingPoint ()) return false; // rule applies only if the method contains Call[virt] (calls to Equals) OpCodeBitmask mask = OpCodeEngine.GetBitmask (method); if (OpCodeBitmask.Calls.Intersect (mask)) return true; // *or* Ceq instructions return mask.Get (Code.Ceq); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ChangeLog0000664000175000017500000007573612413742070027323 0ustar00directhexdirecthex000000000000002010-08-06 Antoine Vandecreme * Makefile.am : Add support for resources * ProvideCorrectArgumentsToFormattingMethodsRule.cs : Add support of string resources as format 2010-06-22 Sebastien Pouliot * AvoidMethodsWithSideEffectsInConditionalCodeRule.cs: Apply AvoidLargeClassesRule 2010-06-20 Sebastien Pouliot * ProvideValidXmlStringRule.cs: * ProvideValidXPathExpressionRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-13 Sebastien Pouliot * BadRecursiveInvocationRule.cs: Fix regression if a type cannot be resolved (the original name is still available) 2010-06-13 Sebastien Pouliot * BadRecursiveInvocationRule.cs: * DoNotRecurseInEqualityRule.cs: * DoNotRoundIntegersRule.cs: * EnsureLocalDisposalRule.cs: * ProvideCorrectRegexPatternRule.cs: * ProvideValidXmlStringRule.cs: * ProvideValidXPathExpressionRule.cs: * ReviewSelfAssignmentRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-11 Sebastien Pouliot * AvoidMethodsWithSideEffectsInConditionalCodeRule.cs: Update comment in xmldoc wrt FX4 * ReviewInconsistentIdentityRule.cs: Fix several defects (self test) and reduce memory usage (e.g. array creation) 2010-06-10 Sebastien Pouliot * DontCompareWithNaNRule.cs: Skip rule if the assembly does not refer (or define for mscorlib) Single or Double types * UseValueInPropertySetterRule.cs: Skip rule if the type has no properties. 2010-06-04 Sebastien Pouliot * AvoidMethodsWithSideEffectsInConditionalCodeRule.cs: * EnsureLocalDisposalRule.cs: * ReviewInconsistentIdentityRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-05-08 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsRule.cs: Fix when "ldarg 0" is used instead of the, much more common, "ldarg_0" * MethodCanBeMadeStaticRule.cs: Fix when "ldarg 0" is used instead of the, much more common, "ldarg_0" 2010-05-01 Sebastien Pouliot * AvoidMethodsWithSideEffectsInConditionalCodeRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule on MethodDefinition:: get_DeclaringType and get_Name and TypeReference::Get_FullName * ProvideCorrectArgumentsToFormattingMethodsRule.cs: Apply Avoid RepetitiveCallsToPropertiesRule on MethodDefinition::Parameters. Check (expectedParameters == 0) only once * ProvideValidXmlStringRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule on MethodDefinition::get_Parameters * ProvideValidXPathExpressionRule.cs: Remove duplicate check on SelectSingleNode * ReviewInconsistentIdentityRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule on Type::get_FullName 2010-04-28 Sebastien Pouliot * MethodCanBeMadeStaticRule.cs: Re-order conditions from the fastest to the slowest to return DoesNotApply. Ignore methods decorated with [Conditional("X")] since they could be empty (i.e. not using 'this') in IL while impossible, source wise, to change to static. * ProvideCorrectRegexPatternRule.cs: Change TryComputeArraySize to static (self-test) 2010-04-25 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: Handle compiler generated fields (e.g. used in C# 3 automatic properties). 2010-04-17 Sebastien Pouliot * ProvideCorrectRegexPatternRule.cs: Make rule consistent in case where the argument looks like: boolean_condition ? "good" : "bad" i.e. same result (first or second bad string) and compiler independant. However since we're less sure of the second case we lower our confidence on that defect. 2010-04-10 Sebastien Pouliot * ProvideCorrectArgumentsToFormattingMethodsRule.cs: Fix false positives when globalization, arrays / 'params' are used. Patch by Antoine Vandecrème 2010-01-30 Sebastien Pouliot * ReviewDoubleAssignmentRule: Apply PreferEmptyInstanceOverNullRule 2010-01-27 Sebastien Pouliot * AvoidMethodsWithSideEffectsInConditionalCodeRule.cs: Apply MethodCanBeMadeStaticRule * CallingEqualsWithNullArgRule.cs: Apply rule to Equals that are not public. * ReviewInconsistentIdentityRule.cs: Apply rules to CompareTo that are not public. 2010-01-06 Jb Evain * UseNoInliningWithGetCallingAssemblyRule.cs: Fix the documentation and do some refactoring. 2010-01-04 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsRule.cs: Handle boxing correctly (e.g. when dealing with generics). Fix bug #567817 2010-01-02 Sebastien Pouliot * UseNoInliningWithGetCallingAssemblyRule.cs: New. Rule to ensure Assembly.GetCallingAssembly is called from a method decorated with [MethodImpl (MethodImplOptions.NoInlining)] * Makefile.am: Add new rule and tests to the build. Add -d:DEBUG to unit tests assembly to remove the three failures in AvoidMethodsWithSideEffectsInConditionalCodeTest 2009-11-28 Sebastien Pouliot * ReviewInconsistentIdentityTest.cs: Don't process methods without bodies (e.g. abstract, pinvoke...) 2009-07-28 Cedric Vivier * EnsureLocalDisposalRule.cs: Do not issue false positives for value type disposables. 2009-07-24 Jesse Jones * AvoidFloatingPointEqualityRule.cs: Rewrote the description and examples. 2009-07-01 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-06-10 Cedric Vivier * BadRecursiveInvocationRule.cs: Catch recursion on static properties/methods when the call is the first instruction (excluding arguments if any). 2008-04-30 Jesse Jones * AvoidMethodsWithSideEffectsInConditionalCodeRule.cs: Added new rule. 2008-03-19 Jesse Jones * ReviewInconsistentIdentityRule.cs: Handle Ldflda so we notice when value type fields are used. Complain if GetHashCode uses no fields/properties but equality methods do (this catches the important case where GetHashCode code merely calls base). 2009-02-19 Cedric Vivier * ProvideCorrectXPathExpressionRule.cs: New. Rule that checks valid XPath expressions are provided to methods. 2009-02-19 Cedric Vivier * ProvideValidXmlStringRule.cs: New. Rule that checks valid XML strings are provided to methods and properties. 2009-01-03 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsRule.cs: Refactor to extract new methods from CheckMethod (self-test). Fix the typo in solution (mentioned in bug #463003). 2009-01-03 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsRule.cs: Fix case for out parameters which were not ignored for arrays. [Fix #463003] 2008-12-30 Sebastien Pouliot * EnsureLocalDisposalRule.cs: Resolve early (since IsProperty rock would do it anyway) and use the MethodDefinition afterward. Based on patch from Tamara Roberson. * ProvideCorrectRegexPatternRule.cs: Move some checks after calling Resolve (to avoid calling it twice with IsProperty). [partial fix for #462925] 2008-12-29 Sebastien Pouliot * ReviewSelfAssignmentRule.cs: Fix the check when a call chain containing an indexer is used. 2008-12-28 Cedric Vivier * EnsureLocalDisposalRule.cs: New. Rule that checks if locals are guaranteed to be disposed of before the method returns. 2008-12-27 Jesse Jones * ReviewInconsistentIdentityRule.cs: Added an assert to verify that equalityMethods's reserve size is sufficient. 2008-12-23 Cedric Vivier * ProvideCorrectRegexPatternRule.cs: New. Rule that checks if methods/constructors are provided a valid regular expression pattern. 2008-12-19 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsRule.cs: Make sure (null == obj) is treated identically to (obj == null). Note: code generated by mcs does not produce IL that resulted in false positives. 2008-12-19 Jesse Jones * ReviewInconsistentIdentityRule.cs: Added. 2008-12-13 Jesse Jones * ReviewUseOfInt64BitsToDoubleRule.cs: Fix AnalyzeModule so that it activates the rule properly when multiple assemblies or modules are being checked. 2008-12-10 Sebastien Pouliot * ProvideCorrectArgumentsToFormattingMethodsRule.cs: Don't check the last char of a string for '{' since it's too late to read a digit after it. [Fix #458175] 2008-12-07 Jesse Jones * DoNotRecurseInEqualityRule.cs, Makefile.am: Added new rule. 2008-12-05 Sebastien Pouliot * AttributeStringLiteralsShouldParseCorrectlyRule.cs: Use HasParameters * CheckParametersNullityInVisibleMethodsRule.cs: Use HasParameters 2008-11-30 Sebastien Pouliot * AttributeStringLiteralsShouldParseCorrectlyRule.cs: Use Has{x} methods to avoid creating empty collections in Cecil. Remove the checks leading to DoesNotApply since they were too complex to improve readability (with added Has{x} calls) and did not help performance. * AvoidConstructorsInStaticTypesRule.cs: Use HasConstructors, HasMethods and HasFields. * CheckParametersNullityInVisibleMethodsRule.cs: Use HasParameters * DisposableFieldsShouldBeDisposedRule.cs: Use HasFields to skip the second half of the rule. 2008-11-18 Sebastien Pouliot * BadRecursiveInvocationRule.cs: Avoid calling Body.Instructions property chain so many times (24% of the calls to get_Body came from here). 2008-11-13 Jesse Jones * NullDerefAnalysis.cs: Added a comment describing one way we can fix the latest problem with the rule. 2008-11-13 Sebastien Pouliot * dataflow/CFG.cs: Extract helper class MethodPrinter. Patch by Jesse Jones 2008-11-09 Jesse Jones * NullDerefAnalysis.cs, dataflow/Dataflow.cs: Write debug output using Trace instead of Console. * NullDerefRule.cs: write the dot file only if triply verbose. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Correctness.mdp: * Gendarme.Rules.Correctness.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-01 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsRule.cs: New. Simple rule to look for missing null check on method's parameters. Porbably short lived wrt NullDerefRule being worked on actively but still a near-zero false positive solution for 2.2. * Makefile.am: Add moved rule and test to the build. 2008-10-30 Jesse Jones * dataflow/*.cs: Tweaked the verbose logging in the NullDerefRule and associated classes so that the output is easier to parse and explains where failures occurred. * NullDerefAnalysis.cs: - Endfinally should not pop anything off the stack. - Leave should pop everything off the stack, not one frame. (This was causing fatal exceptions in self-test). - Leave should pop everything off the stack. - Don't report a failure if the this argument to a method call is Nullity.Unknown. 2008-10-27 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: Changed to use OpCodeEngine and MethodSignature. * FinalizersShouldCallBaseClassFinalizerRule.cs: Moved from Design. Updated namespace and added support for OpCodeEngine. * FloatComparisonRule.cs: Add null check in IsApplicable method * Gendarme.Rules.Correctness.mdp: Add new rule to MD project file. * Makefile.am: Add moved rule and test to the build. 2008-10-26 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: Moved from Design. * Makefile.am: Add new rule and test to the build. 2008-10-23 Néstor Salceda * AttributeStringLiteralsShouldParseCorrectlyRule.cs: Refactored the methods CheckAttributesIn. Returning a RuleResult doesn't make sense and it introduces a CodeDuplicated in self-test. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Correctness.xml, doc/Gendarme.Rules.Correctness: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-10-12 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs: Add [FxCopCompatibility] attribute. 2008-10-11 Sebastien Pouliot * MethodCanBeMadeStaticRule.cs: Add [FxCopCompatibility] attribute. * ReviewCastOnIntegerDivisionRule.cs: New. Rule that check for wrong casts when integers are divided, resulting in truncated floating point values. * ReviewCastOnIntegerMultiplicationRule.cs: New. Rule that check for wrong cast when multiplying integers, potentially resulting in an overflow before the cast is done to a larger type. * Makefile.am: Add new rules and tests to the build. 2008-10-07 Sebastien Pouliot * AttributeStringLiteralsShouldParseCorrectlyRule.cs: Add the [FxCopCompatibility] attribute and a few minor changes to the XML documentation. 2008-10-06 Néstor Salceda * AttributeStringLiteralsShouldParseCorrectlyRule.cs: New. Rule for ensuring the correct arguments passed as string to attributes. * Gendarme.Rules.Correctness.mdp: Update MD project file. * Makefile.am: Added the rule and test to the build. 2008-09-23 Sebastien Pouliot * FloatComparisonRule.cs: Change IsApplicable to static (self-test) * MethodCanBeMadeStaticRule.cs: Add XML documentation. Remove extra cast into a MethodReference in CheckMethod (self-test). * ProvideCorrectArgumentsToFormattingMethodsRule.cs * ReviewDoubleAssignmentRule.cs: Add OpCodeEngine to require a DUP instruction before analyzing a method. Add XML documentation. * ReviewSelfAssignmentRule.cs: Add OpCodeEngine to require a Stfld, Stsfld, Starg or Starg_S instruction before analyzing a method. Add XML documentation. * ReviewUselessControlFlowRule.cs: Add OpCodeEngine to require a conditional branch instruction before analyzing a method. Add XML documentation. * ReviewUseOfInt64BitsToDoubleRule.cs: Add OpCodeEngine to require a CALL[VIRT] *and* CONV*8* instructions before analyzing a method. Add XML documentation. * ReviewUseOfModuloOneOnIntegersRule.cs: Add OpCodeEngine to require a REM[_UN] instruction before analyzing a method. Add XML documentation. 2008-09-21 Sebastien Pouliot * FloatComparisonRule.cs: Make it abstract so the non-test runners don't try to use it. 2008-09-21 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs: Add missing/fix existing code examples. * AvoidFloatingPointEqualityRule.cs: New file for the renamed FloatComparisonRule rule. Now use FloatComparisonRule as it's base class. Add XML documentation. * CallingEqualsWithNullArgRule.cs: Fix missing ')' in XML docs. * DontCompareWithNaNRule.cs: Use FloatComparisonRule as base class. Add extra bitmask checks for LDC_R[4|8] to ignore more methods. Add XML documentation. * FloatComparisonRule.cs: Now used as a base class for both AvoidFloatingPointEqualityRule and DoNotCompareWithNaNRule. Make it use the OpCodeEngine to avoid analyzing methods that cannot have defects. * UseValueInPropertySetterRule.cs: Add XML documentation. 2008-09-21 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs: Add XML documentation. * BadRecursiveInvocationRule.cs: Add OpCodeEngine to require a Call[virt] or Newobj instruction before analyzing a method. Fixed case where a lot of parameters are used. Add XML documentation. * CallingEqualsWithNullArgRule.cs: Add OpCodeEngine to require a Call or Callvirt and a Ldnull instruction before analyzing a method. Add XML documentation. * DoNotRoundIntegersRule.cs: Add XML documentation. 2008-09-14 Sebastien Pouliot * ProvideCorrectArgumentsToFormattingMethodsRule.cs: Use OpCodeEngine to avoid methods without call[virt] instruction. Fix false positives when using a method's return value as an argument to a String.Format call. Handle special "{{" formatting code. 2008-08-18 Sebastien Pouliot * CallingEqualsWithNullArgRule.cs: Use TraceBack rock to reduce (and simplify) source code. Use simpler overload for Report. * UseValueInPropertySetterRule.cs: Use GetParameter rock to (and simplify) source code. Use simpler overload for Report. 2008-08-12 Néstor Salceda * ProvideCorrectArgumentsToFormattingMethodsRule.cs: Clean up and optimize some code. This patch uses a BitArray instead of HashSet, and uses less memory. 2008-08-11 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs: Fix case where we can't resolve the base type when checking for static types. * BadRecursiveInvocationRule.cs: Fix case where we can't resolve a type. * ReviewSelfAssignmentRule.cs: Fix two cases where the field's types cannot be resolved. 2008-07-24 Sebastien Pouliot * DoNotRoundIntegersRule.cs: Move up break condition to make sure we're not missing the return value of a previous call before Round. 2008-07-23 Sebastien Pouliot * BadRecursiveInvocationRule.cs: Fix false positives when generics or explicit interfaces are being used. Optimized CompareMethods to use MetadataToken (when possible) and removed Instructions.IndexOf call. 2008-07-22 Nestor Salceda * ProvideCorrectArgumentsToFormattingMethodsRule.cs: Remove the use Regexp, and use a HashSet as Dan suggested. 2008-07-18 Nestor Salceda * ProvideCorrectArgumentsToFormattingMethodsRule.cs: New. Rule to check the correct fields passed to a formatting method. * Makefile.am: Add rule/test to the build. * Gendarme.Rules.Correctness.mdp: Add rule to MD project file. 2008-07-18 Sebastien Pouliot * BadRecursiveInvocationRule.cs: Fix typo in [Problem] as noted by Richard Birkby. 2008-07-12 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs: Rework the rule to be more specific to 1.x code - where we want to the possibility to instantiate "static" types by avoiding a visible default ctor. * Makefile.am: Fix typo that limited the number of tests being built and executed. 2008-07-12 Sebastien Pouliot * ReviewUseOfModuloOneOnIntegersRule.cs: Remove unused field (self-test) 2008-07-09 Sebastien Pouliot * BadRecursiveInvocationRule.cs, * DoNotRoundIntegersRule.cs, * DontCompareWithNaNRule.cs, * FloatComparisonRule.cs: Deal with possible null values if resolving fails. * Makefile.am: Refactor to extract common stuff into new ../common.make file. Rebuild if the framework has changed. 2008-07-06 Sebastien Pouliot * ReviewDoubleAssignmentRule.cs: Simplify logic using the new TraceBack rock. * ReviewSelfAssignmentRule.cs: New. Rule to check if a field or parameter is being assigned to itself (resulting in no change). * Gendarme.Rules.Correctness.mdp: Add rule to MD project file. * Makefile.am: Add new rule and tests to the build. 2008-06-27 Sebastien Pouliot * ReviewUseOfInt64BitsToDoubleRule.cs: New. Rule to check if the BitConverter.Int64BitsToDouble is used in it's intended sense (i.e. converting bits). * Gendarme.Rules.Correctness.mdp: Add rule to MD project file. * Makefile.am: Add new rule and tests to the build. 2008-06-23 Sebastien Pouliot * DoNotRoundIntegersRule.cs: New. Rule to detect cases where a rounding method (like Floor, Ceiling, Truncate or Round) is being used on an integer value. * Gendarme.Rules.Correctness.mdp: Add rule to MD project file. * Makefile.am: Add new rule and tests to the build. 2008-06-16 Sebastien Pouliot * ReviewUselessControlFlowRule.cs: New. Rule to detect useless control flow in the method IL. They are either (potentially dangerous) typos or empty code block (e.g. forgotten, or not, TODO). * Gendarme.Rules.Correctness.mdp: Add rule to MD project file. * Makefile.am: Add new rule and tests to the build. 2008-06-15 Sebastien Pouliot * ReviewDoubleAssignmentRule.cs: Handle same fields from different instances. * ReviewUseOfModuloOneOnIntegersRule.cs: New. Rule to detect modulo 1 (x % 0) on integral types. This always return 0 and is probably a typo. * Gendarme.Rules.Correctness.mdp: Add rule to MD project file. * Makefile.am: Add new rule and tests to the build. 2008-06-14 Sebastien Pouliot * ReviewDoubleAssignmentRule.cs: New. Rule to detect double assignments on fields or variables (e.g. x = x = 42;) * Gendarme.Rules.Correctness.mdp: Add rule to MD project file. * Makefile.am: Add new rule and tests to the build. 2008-04-27 Jb Evain * MethodCanBeMadeStaticRule.cs: Disable this rule when analyzing event callbacks. 2008-04-05 Sebastien Pouliot * DontCompareWithNaNRule.cs, FloatComparisonRule.cs: mscorlib defines, not refer, to System.Single|Double (and the rule must apply to it too!) 2008-03-04 Sebastien Pouliot * DontCompareWithNaNRule.cs, FloatComparisonRule.cs: Don't execute rules if the module does not use floating point types. 2008-02-16 Sebastien Pouliot * Makefile.am: Remove NullDerefRule from build until it's fixed (and avoid the noise it cause in self-tests) 2008-02-16 Nestor Salceda * Makefile.am: Removed the -langversion:linq option. You should use at least the 1.9 gmcs version to compile. 2008-02-15 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs * BadRecursiveInvocationRule.cs * CallingEqualsWithNullArgRule.cs * DontCompareWithNaNRule.cs * FloatComparisonRule.cs * MethodCanBeMadeStaticRule.cs * NullDerefAnalysis.cs * NullDerefFrame.cs * NullDerefRule.cs * Nullity.cs * UseValueInPropertySetterRule.cs: Update rules wrt framework changes. 2008-01-29 Sebastien Pouliot * FloatComparisonRule.cs: Handle "this" and don't report defects on System.Single or System.Double (useful for mono itself :) * UseValueInPropertySetterRule.cs: Handle this[] with multiple parameters. 2008-01-16 Nestor Salceda * Makefile.am: Compile the rules with -langversion:linq flag. This fixes the compiler error building the Correctness set. 2008-01-12 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs: Use new Location ctor. * CallingEqualsWithNullArgRule.cs: Change three methods to static. Use new Location ctor. * DontCompareWithNaNRule.cs: New. Rule that reports comparing (with either ==, != or Equals) a floating-point value with NaN. * FloatComparisonRule.cs: Remove the recently added checks for NaN (see new rule). Simplify error reporting. * NonNullAttributeCollector.cs: Change one method to static. * NullDerefAnalysis.cs: Change two methods to static. Use new Location ctor. * NullDerefFrame.cs: Change one method to static. * UseValueInPropertySetterRule.cs: Don't report empty setters. There's too many of them, mostly on purpose, so it hides the real problems. * dataflow/BasicBlock.cs: Change fields to internal. * dataflow/CFG.cs: Change four methods to static. * Gendarme.Rules.Correctness.xml.in: Add rule description. * Makefile.am: Add new rule and tests to the build. 2008-01-06 Sebastien Pouliot * BadRecursiveInvocationRule.cs: Detect more case of endless recursion, even where parameters aren't identical. Still not perfect (see ignored unit tests) but can process corlib without false positives. * FloatComparisonRule.cs: Remove object array of special values (float and double constants). Change OpCode array to static (to reduce memory allocations). Add support to detect Double.Equals and support for Conv_R_Un, Ldarg_0 (for static methods), Ldelem_R4 and Ldelem_R8 instructions (for arrays). * MethodCanBeMadeStaticRule.cs: Avoid checking constructors. * UseValueInPropertySetterRule.cs: Add support for Ldarga[_S] when checking for value. Report a different message for empty setters (to ease the reviewer job ;-) since it's less likely an error. 2008-01-05 Sebastien Pouliot * MethodCanBeMadeStaticRule.cs: Ignore generated code. Return a complete message (not just a failure). * NonNullAttribute.cs: seal the attribute (fix warning) * UseValueInPropertySetterRule.cs: Fix rule to work properly with static methods. 2008-01-05 Nestor Salceda * AvoidConstructorsInStaticTypesRule.cs: Use rocks for check if a method is autogenerated. 2008-01-05 Nestor Salceda * Makefile.am: Compile with -langversion:linq parameter. * UseValueInPropertySetterRule.cs: Use rocks for check if the method is a setter property. 2007-12-16 Sebastien Pouliot * Makefile.am: Remove OpCodeConstants.cs from build. 2007-12-16 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs: The rule doesn't apply for compiler generated types. Avoid creating MessageCollection if unneeded (e.g. no error). 2007-12-16 Sebastien Pouliot * BadRecursiveInvocationRule.cs: Use Cecil definitions, not OpCodeConstants. * NullDerefAnalysis.cs: Use Cecil definitions, not OpCodeConstants. Remove bunch of unneeded code duplication in switch. * pCodeConstants.c: Removed. Cecil provides them. 2007-12-16 Sebastien Pouliot * NullDerefAnalysis.cs: Avoid InvalidCastException * UseValueInPropertySetterRule.cs: Don't report error when a setter is simply throwing an exception. 2007-11-30 Nestor Salceda * FloatComparisonRule.cs: Extract a method for avoid the Long Method smell. This fixes the warning in the self-test. 2007-11-22 Sebastien Pouliot * NullDerefFrame.cs: Remove use of /n using StringBuilder.AppendLine * dataflow/CFG.cs: Remove use of /n using StreamWriter.WriteLine 2007-11-22 Sebastien Pouliot * UseValueInPropertySetterRule.cs: Apply JB's suggestion to use SemanticsAttributes instead of the SpecialName + "set_" checks. 2007-11-22 Sebastien Pouliot * UseValueInPropertySetterRule.cs: Avoid creating MessageCollection if unneeded (e.g. no error). Stop looping instruction when we determine that value has been accessed. 2007-11-21 Sebastien Pouliot * CallingEqualsWithNullArgRule.cs: Avoid creating MessageCollection if unneeded (e.g. no error). Check for calli (along with call and callvirt). Check previous instructions (not just the last one) for ldnull (skipping NOP and constrained). Fix bug on MS.NET where a constrained instruction could be found just before). 2007-11-03 Nestor Salceda * Gendarme.Rules.Correctness.xml.in: Added the Uri for CallingEqualsWithNullArgRule, AvoidConstructorsInStaticTypesRule, FloatComparisonRule, UseValueInPropertySetterRule. 2007-11-03 Nestor Salceda * AvoidConstructorsInStaticTypesRule.cs: Added the code for avoid false positives if the class doesn't contains fields and methods. 2007-10-28 Nestor Salceda * Gendarme.Rules.Correctness.xml.in: Added documentation for AvoidConstructorsInStaticTypes, FloatComparisonRule and UseValueInPropertySetterRule. 2007-10-19 Nestor Salceda * UseValueInPropertySetterRule.cs: If a method is empty, then the rule will skip this method, because could be an stub or empty method. This fixes the NullReferenceException if the method body is empty. 2007-10-19 Nestor Salceda * FloatComparisonRule.cs: Before get the instructions from the method body, the existence of method body should be checked. This fixes the NullReferenceException. 2007-10-19 Nestor Salceda * CallingEqualsWithNullArgRule.cs: Before get the instructions from a method body, the existence of method body should be checked. Perhaps exists better solutions for this case, but this solution fixes the NullReferenceException. 2007-10-09 Nestor Salceda * Makefile.am: Remove the duplicate entry of CallingEqualsWithNullArgRule.cs in the building process. This fixes a compiler warning. 2007-10-07 Sebastien Pouliot * AvoidConstructorsInStaticTypesRule.cs: Unit tests (Lukasz Knop, GSoC 2007) * CallingEqualsWithNullArgRule.cs: New rule (Nidhi Rawal, GSoC 2007) * FloatComparisonRule.cs: Unit tests (Lukasz Knop, GSoC 2007) * UseValueInPropertySetterRule.cs: Unit tests (Lukasz Knop, GSoC 2007) * Gendarme.Rules.Correctness.xml.in: Update rule description. * Gendarme.Rules.Correctness.mdp: Update project file. * Makefile.am: Update build file. 2007-03-12 Alp Toker * Gendarme.Rules.Correctness.xml.in: Typo fix. 2007-02-27 Jb Evain * MethodCanBeMadeStatic.cs: Add new rule. 2006-10-16 Sebastien Pouliot * BadRecursiveInvocationRule.cs: Fix case where the compiler (CSC) selects the base class to call (fix by Aaron Tomb). Also remove the check for parameter names which may not match in the base class. 2006-10-15 Sebastien Pouliot * Gendarme.Rules.Concurrency.xml.in: Update Uri for rules (to generate more useful reports). 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-28 Christian Birkl * Gendarme.Rules.Correctness.csproj: Included ChangeLog * BadRecursiveInvocationRule.cs, NullDerefRule.cs, NullDerefAnalysis.cs: Migrated untyped IList messages collection to typed MessageCollection class. 2006-07-31 Sebastien Pouliot * Gendarme.Rules.Correctness.mdp: New. Project file for MonoDevelop. 2006-06-13 Sebastien Pouliot * Makefile.am: Use -pkg:mono-nunit to reference nunit assemblies. Added self-test target to promote compliance ;-) mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ReviewCastOnIntegerDivisionRule.cs0000664000175000017500000001064212413742070034305 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ReviewCastOnIntegerDivisionRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // ICAST: int division result cast to double or float (ICAST_IDIV_CAST_TO_DOUBLE) /// /// This rule checks for integral divisions where the result is cast to a floating point /// type. It's usually best to instead cast an operand to the floating point type so /// that the result is not truncated. /// /// /// Bad example: /// /// public double Bad (int a, int b) /// { /// // integers are divided, then the result is casted into a double /// // i.e. Bad (5, 2) == 2.0d /// return a / b; /// } /// /// /// /// Good example: /// /// public double Good (int a, int b) /// { /// // a double is divided by an integer, which result in a double result /// // i.e. Good (5, 2) == 2.5d /// return (double) a / b; /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("The result of an integral division is cast to a Single or Double. This is questionable unless you really want the truncated result.")] [Solution ("Cast an operand to Single or Double, not the result.")] [EngineDependency (typeof (OpCodeEngine))] public class ReviewCastOnIntegerDivisionRule : Rule, IMethodRule { // DIV and DIV[_UN] static OpCodeBitmask Div = new OpCodeBitmask (0x0, 0xC000000, 0x0, 0x0); static bool IsFloatingPointArguments (Instruction ins, MethodDefinition method) { TypeReference tr = ins.GetOperandType (method); if (tr == null) return false; return tr.IsFloatingPoint (); } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // exclude methods that don't have division instructions if (!OpCodeEngine.GetBitmask (method).Intersect (Div)) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Div: case Code.Div_Un: // if the next step is a conversion to a FP value it means // that the result, on the stack, is not in it's final form switch (ins.Next.OpCode.Code) { case Code.Conv_R_Un: // no doubt since the result is unsigned it's not a FP Runner.Report (method, ins, Severity.High, Confidence.High); break; case Code.Conv_R4: case Code.Conv_R8: // it could be a R4 converted into a R8 (or vice versa) // Note: we don't have to check both divided and divisor since they will // be converted to the same type on the stack before the call to DIV if (!IsFloatingPointArguments (ins.TraceBack (method), method)) Runner.Report (method, ins, Severity.High, Confidence.High); break; } break; } } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Div); mask.Set (Code.Div_Un); Console.WriteLine (mask); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/AvoidFloatingPointEqualityRule.cs0000664000175000017500000001734612413742070034177 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.AvoidFloatingPointEqualityRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// In general floating point numbers cannot be usefully compared using the equality and /// inequality operators. This is because floating point numbers are inexact and most floating /// point operations introduce errors which can accumulate if multiple operations are performed. /// This rule will fire if [in]equality comparisons are used with Single or Double /// types. In general such comparisons should be done with some sort of epsilon test instead /// of a simple compare (see the code below). /// /// For more information: /// /// /// [http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm Floating Point Comparison (General Problem)] /// /// /// [http://www.yoda.arachsys.com/csharp/floatingpoint.html Another article about floating point comparison (more .NET adapted)] /// /// /// /// /// Bad example: /// /// // This may or may not work as expected. In particular, if the values are from /// // high precision real world measurements or different algorithmic sources then /// // it's likely that they will have small errors and an exact inequality test will not /// // work as expected. /// public static bool NearlyEqual (double [] lhs, double [] rhs) /// { /// if (ReferenceEquals (lhs, rhs)) { /// return true; /// } /// if (lhs.Length != rhs.Length) { /// return false; /// } /// for (int i = 0; i < lhs.Length; ++i) { /// if (lhs [i] != rhs [i]) { /// return false; /// } /// } /// return true; /// } /// /// /// /// Good example: /// /// // This will normally work fine. However it will not work with infinity (because /// // infinity - infinity is a NAN). It's also difficult to use if the values may /// // have very large or very small magnitudes (because the epsilon value must /// // be scaled accordingly). /// public static bool NearlyEqual (double [] lhs, double [] rhs, double epsilon) /// { /// if (ReferenceEquals (lhs, rhs)) { /// return true; /// } /// if (lhs.Length != rhs.Length) { /// return false; /// } /// for (int i = 0; i < lhs.Length; ++i) { /// if (Math.Abs (lhs [i] - rhs [i]) > epsilon) { /// return false; /// } /// } /// return true; /// } /// /// /// Prior to Gendarme 2.2 this rule was named FloatComparisonRule. [Problem ("This method contains code that performs equality operations between floating point numbers.")] [Solution ("Instead use the absolute difference between the two floating point values and a small constant value.")] public class AvoidFloatingPointEqualityRule : FloatingComparisonRule, IMethodRule { private const string EqualityMessage = "Floating point values should not be directly compared for equality (e.g. == or !=)."; private const string EqualsMessage = "Floating point values should not be directly compared for equality using [Single|Double].Equals."; private static bool CheckCeqInstruction (Instruction instruction, MethodDefinition method) { bool problem = false; switch (instruction.OpCode.Code) { case Code.Conv_R_Un: case Code.Conv_R4: case Code.Conv_R8: return true; case Code.Ldc_R4: return !CheckFloatConstants ((float) instruction.Operand); case Code.Ldc_R8: return !CheckDoubleConstants ((double) instruction.Operand); case Code.Ldelem_R4: case Code.Ldelem_R8: return true; case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: case Code.Ldloc_S: case Code.Ldloc: case Code.Ldloca: case Code.Ldloca_S: return instruction.GetVariable (method).VariableType.IsFloatingPoint (); case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: case Code.Ldarg: case Code.Ldarg_S: case Code.Ldarga: case Code.Ldarga_S: ParameterDefinition parameter = instruction.GetParameter (method); // handle 'this' if (parameter == null) return method.DeclaringType.IsFloatingPoint (); return parameter.ParameterType.IsFloatingPoint (); case Code.Call: case Code.Callvirt: MethodReference call = instruction.Operand as MethodReference; return call.ReturnType.IsFloatingPoint (); case Code.Ldfld: case Code.Ldflda: case Code.Ldsfld: case Code.Ldsflda: FieldReference field = instruction.Operand as FieldReference; return field.FieldType.IsFloatingPoint (); } return problem; } public RuleResult CheckMethod (MethodDefinition method) { if (!IsApplicable (method)) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { switch (instruction.OpCode.Code) { case Code.Ceq: if (CheckCeqInstruction (SkipArithmeticOperations (instruction), method)) { Runner.Report (method, instruction, Severity.High, Confidence.Total, EqualityMessage); } break; case Code.Call: case Code.Callvirt: MemberReference member = instruction.Operand as MemberReference; if ((member != null) && (member.Name == "Equals") && member.DeclaringType.IsFloatingPoint ()) { Runner.Report (method, instruction, Severity.High, Confidence.Total, EqualsMessage); } break; } } return Runner.CurrentRuleResult; } static OpCode [] arithOpCodes = new OpCode [] { OpCodes.Mul, OpCodes.Add, OpCodes.Sub, OpCodes.Div }; private static Instruction SkipArithmeticOperations (Instruction instruction) { Instruction prevInstr = instruction.Previous; while (Array.Exists (arithOpCodes, delegate (OpCode code) { return code == prevInstr.OpCode; })) { prevInstr = prevInstr.Previous; } return prevInstr; } private static bool CheckFloatConstants (float value) { // IsInfinity covers both positive and negative infinity return (Single.IsInfinity (value) || (Single.MinValue.CompareTo (value) == 0) || (Single.MaxValue.CompareTo (value) == 0)); } private static bool CheckDoubleConstants (double value) { // IsInfinity covers both positive and negative infinity return (Double.IsInfinity (value) || (Double.MinValue.CompareTo (value) == 0) || (Double.MaxValue.CompareTo (value) == 0)); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/DontCompareWithNaNRule.cs0000664000175000017500000001140712413742070032355 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.DoNotCompareWithNaNRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// As defined in IEEE 754 it's impossible to compare any floating-point value, even /// another NaN, with NaN. Such comparison will always return false /// (more information on [http://en.wikipedia.org/wiki/NaN wikipedia]). The framework /// provides methods, Single.IsNaN and Double.IsNaN, to check for /// NaN values. /// /// /// Bad example: /// /// double d = ComplexCalculation (); /// if (d == Double.NaN) { /// // this will never be reached, even if d is NaN /// Console.WriteLine ("No solution exists!"); /// } /// /// /// /// Good example: /// /// double d = ComplexCalculation (); /// if (Double.IsNaN (d)) { /// Console.WriteLine ("No solution exists!"); /// } /// /// [Problem ("This method compares a floating point value with NaN (Not a Number) which always return false, even for (NaN == NaN).")] [Solution ("Replace the code with a call to the appropriate Single.IsNaN(value) or Double.IsNaN(value).")] [FxCopCompatibility ("Microsoft.Usage", "CA2242:TestForNaNCorrectly")] public class DoNotCompareWithNaNRule : FloatingComparisonRule, IMethodRule { private const string EqualityMessage = "A floating point value is compared (== or !=) with [Single|Double].NaN."; private const string EqualsMessage = "[Single|Double].Equals is called using NaN."; private static bool CheckPrevious (IList il, int index) { for (int i = index; i >= 0; i--) { Instruction ins = il [i]; switch (ins.OpCode.Code) { case Code.Ldc_R4: // return false, invalid, is NaN is detected return !Single.IsNaN ((float) ins.Operand); case Code.Ldc_R8: // return false, invalid, is NaN is detected return !Double.IsNaN ((double) ins.Operand); case Code.Nop: case Code.Ldarg: case Code.Ldarg_1: case Code.Ldloca: case Code.Ldloca_S: case Code.Stloc: case Code.Stloc_0: case Code.Stloc_1: // continue break; default: return true; } } return true; } // contains LDC_R4 and LDC_R8 static OpCodeBitmask Ldc_R = new OpCodeBitmask (0xC00000000, 0x0, 0x0, 0x0); public RuleResult CheckMethod (MethodDefinition method) { if (!IsApplicable (method)) return RuleResult.DoesNotApply; // extra check - rule applies only if the method contains Ldc_R4 or Ldc_R8 if (!Ldc_R.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; IList il = method.Body.Instructions; for (int i = 0; i < il.Count; i++) { Instruction ins = il [i]; switch (ins.OpCode.Code) { // handle == and != case Code.Ceq: if (!CheckPrevious (il, i - 1)) { Runner.Report (method, ins, Severity.Critical, Confidence.Total, EqualityMessage); } break; // handle calls to [Single|Double].Equals case Code.Call: case Code.Callvirt: MemberReference callee = ins.Operand as MemberReference; if ((callee != null) && (callee.Name == "Equals") && callee.DeclaringType.IsFloatingPoint ()) { if (!CheckPrevious (il, i - 1)) { Runner.Report (method, ins, Severity.Critical, Confidence.Total, EqualsMessage); } } break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ProvideValidXmlStringRule.cs0000664000175000017500000001274312413742070033155 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ProvideValidXmlStringRule class // // Authors: // Cedric Vivier // // Copyright (C) 2009 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Globalization; using System.Xml; using System.Xml.XPath; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using System.Text.RegularExpressions; namespace Gendarme.Rules.Correctness { /// /// This rule verifies that valid XML string arguments are passed as arguments. /// /// /// Bad example (using LoadXml): /// /// XmlDocument doc = new XmlDocument (); /// doc.LoadXml ("<book>"); /// /// /// /// Good example (using LoadXml): /// /// XmlDocument doc = new XmlDocument (); /// doc.LoadXml ("<book />"); /// /// /// /// Bad example (using InnerXml): /// /// bookElement.InnerXml = "<author>Robert J. Sawyer</authr>"; /// /// /// /// Good example (using InnerXml): /// /// bookElement.InnerXml = "<author>Robert J. Sawyer</author>"; /// /// /// This rule is available since Gendarme 2.6 [Problem ("An invalid XML string is provided to a method.")] [Solution ("Fix the invalid XML string.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class ProvideValidXmlStringRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { foreach (AssemblyNameReference name in e.CurrentModule.AssemblyReferences) { if (name.Name == "System.Xml") { Active = true; return; } } Active = false; //no System.Xml assembly reference has been found }; } void CheckString (MethodDefinition method, Instruction ins, int argumentOffset) { Instruction ld = ins.TraceBack (method, argumentOffset); if (null == ld) return; switch (ld.OpCode.Code) { case Code.Ldstr: CheckString (method, ins, (string) ld.Operand); break; case Code.Ldsfld: FieldReference f = (FieldReference) ld.Operand; if (f.Name == "Empty" && f.DeclaringType.IsNamed ("System", "String")) CheckString (method, ins, null); break; case Code.Ldnull: CheckString (method, ins, null); break; } } void CheckString (MethodDefinition method, Instruction ins, string xml) { if (string.IsNullOrEmpty (xml)) { Runner.Report (method, ins, Severity.High, Confidence.Total, "XML string is null or empty."); return; } try { (new XmlDocument ()).LoadXml (xml); } catch (XmlException e) { string msg = String.Format (CultureInfo.InvariantCulture, "XML string '{0}' is invalid. Details: {1}", xml, e.Message); Runner.Report (method, ins, Severity.High, Confidence.High, msg); } } void CheckCall (MethodDefinition method, Instruction ins, MethodReference mref) { if (null == mref || !mref.HasParameters) return; switch (mref.Name) { case "LoadXml": if (mref.DeclaringType.IsNamed ("System.Xml", "XmlDocument")) CheckString (method, ins, -1); break; case "set_InnerXml": case "set_OuterXml": TypeReference tr = mref.DeclaringType; if (tr.Inherits ("System.Xml", "XmlNode") || tr.Inherits ("System.Xml.XPath", "XPathNavigator")) CheckString (method, ins, -1); break; case "AppendChild": case "PrependChild": case "InsertAfter": case "InsertBefore": IList pdc = mref.Parameters; if (pdc.Count == 1 && pdc [0].ParameterType.IsNamed ("System", "String") && mref.DeclaringType.Inherits ("System.Xml.XPath", "XPathNavigator")) CheckString (method, ins, -1); break; } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; //is there any interesting opcode in the method? OpCodeBitmask calls = OpCodeBitmask.Calls; if (!calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if (!calls.Get (ins.OpCode.Code)) continue; CheckCall (method, ins, (MethodReference) ins.Operand); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/DoNotRoundIntegersRule.cs0000664000175000017500000001353612413742070032452 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.DoNotRoundIntegersRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // ICAST: int value cast to double and then passed to Math.ceil (ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL) // ICAST: int value cast to float and then passed to Math.round (ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND) /// /// This rule check for attempts to call System.Math.Round, System.Math.Ceiling, System.Math.Floor or /// System.Math.Truncate on an integral type. This often indicate a typo in the source code /// (e.g. wrong variable) or an unnecessary operation. /// /// /// Bad example: /// /// public decimal Compute (int x) /// { /// return Math.Truncate ((decimal) x); /// } /// /// /// /// Good example: /// /// public decimal Compute (int x) /// { /// return (decimal) x; /// } /// /// [Problem ("This method calls round/ceil/floor/truncate with an integer value.")] [Solution ("Verify the code logic. This could be a typo (wrong variable) or an unnecessary operation.")] [EngineDependency (typeof (OpCodeEngine))] public class DoNotRoundIntegersRule : Rule, IMethodRule { static TypeReference GetType (Instruction ins, MethodDefinition method) { object operand = ins.GetOperand (method); ParameterDefinition parameter = (operand as ParameterDefinition); if (parameter != null) return parameter.ParameterType; FieldDefinition field = (operand as FieldDefinition); if (field != null) return field.FieldType; VariableDefinition variable = (operand as VariableDefinition); if (variable != null) return variable.VariableType; return null; // unknown } static TypeReference GetArgumentType (Instruction ins, MethodDefinition method) { switch (ins.OpCode.Code) { case Code.Conv_R8: // a convertion to a double! what was the original type ? // check for unsigned convertion if (ins.Previous.OpCode.Code == Code.Conv_R_Un) ins = ins.Previous; break; case Code.Call: case Code.Callvirt: MethodReference mr = (ins.Operand as MethodReference); TypeReference rv = mr.ReturnType; // a call that return a decimal or floating point is ok if (rv.IsFloatingPoint ()) return null; // but convertion into decimals are not... if (rv.IsNamed ("System", "Decimal")) { if (!mr.DeclaringType.IsNamed ("System", "Decimal")) return null; // ... unless it's a convertion from a FP value switch (mr.Name) { case "op_Implicit": case "op_Explicit": if (mr.Parameters [0].ParameterType.IsFloatingPoint ()) return null; break; default: // this it's not likely to be an integral type or // cannot be detected at analysis time (e.g. Parse) return null; } } return rv; default: return null; } // floating point values are ok (so we return null) TypeReference type = GetType (ins.Previous, method); return (type == null || type.IsFloatingPoint ()) ? null : type; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // exclude methods that don't have calls if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { MethodReference mr = ins.GetMethod (); if ((mr == null) || !mr.DeclaringType.IsNamed ("System", "Math")) continue; Instruction value = null; string name = mr.Name; switch (name) { case "Ceiling": case "Floor": case "Truncate": value = ins.Previous; break; case "Round": // variable number of arguments for different overloads int n = ins.GetPopCount (method); value = ins.Previous; while (value != null) { // stop before first parameter if (n == 1) break; n += value.GetPopCount (method) - value.GetPushCount (); value = value.Previous; } break; } if (value == null) continue; TypeReference type = GetArgumentType (value, method); if (type == null) continue; string msg = String.Format (CultureInfo.InvariantCulture, "Math.{0} called on a {1}.", name, type.GetFullName ()); Runner.Report (method, ins, Severity.Medium, Confidence.Normal, msg); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ReviewDoubleAssignmentRule.cs0000664000175000017500000001422312413742070033335 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ReviewDoubleAssignmentRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // SA: Double assignment of field (SA_FIELD_DOUBLE_ASSIGNMENT) // SA: Double assignment of local variable (SA_LOCAL_DOUBLE_ASSIGNMENT) /// /// This rule checks for variables or fields that are assigned multiple times /// using the same value. This won't change the value of the variable (or fields) /// but should be reviewed since it could be a typo that hides a real issue in /// the code. /// /// /// Bad example: /// /// public class Bad { /// private int x, y; /// /// public Bad (int value) /// { /// // x is assigned twice, but y is not assigned /// x = x = value; /// } /// } /// /// /// /// Good example: /// /// public class Good { /// private int x, y; /// /// public Good (int value) /// { /// // x = y = value; was the original meaning but since it's confusing... /// x = value; /// y = value; /// } ///} /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method assigns the same value twice to the same variable or field.")] [Solution ("Verify the code logic. This is likely a typo where the second assignment is unneeded or should have been used with another variable/field.")] [EngineDependency (typeof (OpCodeEngine))] public class ReviewDoubleAssignmentRule : Rule, IMethodRule { static string CheckDoubleAssignementOnInstanceFields (MethodDefinition method, Instruction ins, Instruction next) { // for an instance fiels the pattern is more complex because we must check that we're assigning to the same instance // first we go forward: DUP, STLOC, STFLD, LDLOC, STFLD Instruction load = next.Next; if ((load == null) || !load.IsLoadLocal ()) return String.Empty; // check that this is the same variable VariableDefinition vd1 = ins.GetVariable (method); VariableDefinition vd2 = load.GetVariable (method); if (vd1.Index != vd2.Index) return String.Empty; Instruction stfld = load.Next; if ((stfld == null) || (stfld.OpCode.Code != Code.Stfld)) return String.Empty; // check that we're assigning the same field twice FieldReference fd1 = (next.Operand as FieldReference); FieldReference fd2 = (stfld.Operand as FieldReference); if (fd1.MetadataToken.RID != fd2.MetadataToken.RID) return String.Empty; // backward: DUP, (possible CONV), LD (value to be duplicated), LD instance, LD instance if (stfld.TraceBack (method).GetOperand (method) != next.TraceBack (method).GetOperand (method)) return String.Empty; return String.Format (CultureInfo.InvariantCulture, "Instance field '{0}' on same variable '{1}'.", fd1.Name, vd1.Name); } static string CheckDoubleAssignement (MethodDefinition method, Instruction ins, Instruction next) { // for a static field the pattern is // DUP, STSFLD, STSFLD if (ins.OpCode.Code == Code.Stsfld) { if (next.OpCode.Code != Code.Stsfld) return String.Empty; // check that we're assigning the same field twice FieldDefinition fd1 = ins.GetField (); FieldDefinition fd2 = next.GetField (); if (fd1.MetadataToken.RID != fd2.MetadataToken.RID) return String.Empty; return String.Format (CultureInfo.InvariantCulture, "Static field '{0}'.", fd1.Name); } else if (ins.IsStoreLocal ()) { // for a local variable the pattern is // DUP, STLOC, STLOC VariableDefinition vd2 = next.GetVariable (method); // check that we're assigning the same variable twice if (vd2 != null) { VariableDefinition vd1 = ins.GetVariable (method); if (vd1.Index != vd2.Index) return String.Empty; return String.Format (CultureInfo.InvariantCulture, "Local variable '{0}'.", vd1.Name); } else if (next.OpCode.Code == Code.Stfld) { // instance fields are a bit more complex... return CheckDoubleAssignementOnInstanceFields (method, ins, next); } } return String.Empty; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // exclude methods that don't have any DUP instruction if (!OpCodeEngine.GetBitmask (method).Get (Code.Dup)) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.Code != Code.Dup) continue; Instruction next = ins.Next; if (next == null) continue; Instruction nn = next.Next; if (nn == null) continue; string msg = CheckDoubleAssignement (method, next, nn); if (msg.Length > 0) Runner.Report (method, ins, Severity.Medium, Confidence.Normal, msg); } return Runner.CurrentRuleResult; } } } ProvideCorrectArgumentsToFormattingMethodsRule.cs0000664000175000017500000002473012413742070037337 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness// // Gendarme.Rules.Correctness.ProvideCorrectArgumentsToFormattingMethodsRule // // Authors: // Néstor Salceda // Antoine Vandecreme // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using System.IO; using System.Resources; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Correctness { /// /// This rule checks that the format string used with String.Format matches /// the other parameters used with the method. /// /// /// Bad examples: /// /// string s1 = String.Format ("There is nothing to format here!"); /// // no argument to back {0} /// string s2 = String.Format ("Hello {0}!"); /// /// /// /// Good examples: /// /// string s1 = "There is nothing to format here!"; /// string s2 = String.Format ("Hello {0}!", name); /// /// /// This rule is available since Gendarme 2.2 [Problem ("You are calling a Format method without the correct arguments. This could result in a FormatException being thrown.")] [Solution ("Pass the correct arguments to the formatting method.")] [FxCopCompatibility ("Microsoft.Usage", "CA2241:ProvideCorrectArgumentsToFormattingMethods")] [EngineDependency (typeof (OpCodeEngine))] public class ProvideCorrectArgumentsToFormattingMethodsRule : Rule, IMethodRule { static MethodSignature formatSignature = new MethodSignature ("Format", "System.String"); static BitArray results = new BitArray (16); private static string GetLoadStringFormatInstruction (Instruction call, MethodDefinition method, int formatPosition) { Instruction loadString = call.TraceBack (method, -formatPosition); if (loadString == null) return null; // If we find a variable load, search the store while (loadString.IsLoadLocal ()) { Instruction storeIns = GetStoreLocal (loadString, method); if (storeIns == null) return null; loadString = storeIns.TraceBack (method); if (loadString == null) return null; } switch (loadString.OpCode.Code) { case Code.Call: case Code.Callvirt: return GetLoadStringFromCall (loadString.Operand as MethodReference); case Code.Ldstr: return loadString.Operand as string; default: return null; } } // this works because there's an earlier check limiting this to generated code // which is a simple, well-known, case where the first string load is known private static string GetResourceNameFromResourceGetter (MethodDefinition md) { foreach (Instruction instruction in md.Body.Instructions) if (instruction.OpCode.Code == Code.Ldstr) return instruction.Operand as string; return null; } private static EmbeddedResource GetEmbeddedResource (AssemblyDefinition ad, string resourceClassName) { IList resources = ad.MainModule.Resources; foreach (EmbeddedResource resource in resources) if (resourceClassName == resource.Name) return resource; return null; } private static string GetLoadStringFromCall (MethodReference mr) { MethodDefinition md = mr.Resolve (); if ((md == null) || !IsResource (md)) return null; string resourceName = GetResourceNameFromResourceGetter (md); if (resourceName == null) return null; AssemblyDefinition ad = md.GetAssembly (); string resourceClassName = md.DeclaringType.GetFullName () + ".resources"; EmbeddedResource resource = GetEmbeddedResource (ad, resourceClassName); if (resource == null) return null; using (MemoryStream ms = new MemoryStream (resource.GetResourceData ())) using (ResourceSet resourceSet = new ResourceSet (ms)) { return resourceSet.GetString (resourceName); } } private static bool IsResource (MethodDefinition method) { return method.IsStatic && method.IsGetter && method.IsGeneratedCode (); } // Get the store instruction associated with the load instruction private static Instruction GetStoreLocal (Instruction loadIns, MethodDefinition method) { Instruction storeIns = loadIns.Previous; do { // look for a STLOC* instruction and compare the variable indexes if (storeIns.IsStoreLocal () && AreMirrorInstructions (loadIns, storeIns, method)) return storeIns; storeIns = storeIns.Previous; } while (storeIns != null); return null; } // Return true if both ld and st are store and load associated instructions private static bool AreMirrorInstructions (Instruction ld, Instruction st, MethodDefinition method) { return (ld.GetVariable (method).Index == st.GetVariable (method).Index); } //TODO: It only works with 0 - 9 digits private static int GetExpectedParameters (string loaded) { results.SetAll (false); // if last character is { then there's no digit after it for (int index = 0; index < loaded.Length - 1; index++) { if (loaded [index] == '{') { char next = loaded [index + 1]; if (Char.IsDigit (next)) results.Set (next - '0', true); else if (next == '{') index++; // skip special {{ } } int counter = 0; //TODO: Check the order of the values too, by example // String.Format ("{1} {2}", x, y); <-- with this impl // it would return 0 foreach (bool value in results) { if (value) counter++; } return counter; } private static bool TryComputeArraySize (Instruction call, MethodDefinition method, int lastParameterPosition, out int elementsPushed) { elementsPushed = 0; Instruction loadArray = call.TraceBack (method, -lastParameterPosition); if (loadArray == null) return false; while (loadArray.OpCode != OpCodes.Newarr) { if (loadArray.OpCode == OpCodes.Dup) loadArray = loadArray.TraceBack (method); else if (loadArray.IsLoadLocal ()) { Instruction storeIns = GetStoreLocal (loadArray, method); if (storeIns == null) return false; loadArray = storeIns.TraceBack (method); } else return false; if (loadArray == null) return false; } if (loadArray.Previous == null) return false; // Previous operand should be a ldc.I4 instruction type object previousOperand = loadArray.Previous.GetOperand (method); if (!(previousOperand is int)) return false; elementsPushed = (int) previousOperand; return true; } private void CheckCallToFormatter (Instruction call, MethodDefinition method) { MethodReference mr = (call.Operand as MethodReference); IList pdc = mr.Parameters; int formatPosition = 0; int nbParameters = pdc.Count; int elementsPushed = nbParameters - 1; // String.Format (string, object) -> elementsPushed = 1 // String.Format (string, object, object) -> elementsPushed = 2 // String.Format (string, object, object, object) -> elementsPushed = 3 // String.Format (string, object[]) -> compute // String.Format (IFormatProvider, string, object[]) -> compute if (!pdc [nbParameters - 1].ParameterType.IsNamed ("System", "Object")) { // If we cannot determine the array size, we succeed (well we don't fail/report) if (!TryComputeArraySize (call, method, nbParameters - 1, out elementsPushed)) return; // String.Format (IFormatProvider, string, object[]) -> formatPosition = 1 if (!pdc [0].ParameterType.IsNamed ("System", "String")) formatPosition = 1; } // if we don't find the content we succeed (well we don't fail/report). string loadString = GetLoadStringFormatInstruction (call, method, formatPosition); if (loadString == null) return; int expectedParameters = GetExpectedParameters (loadString); // There aren't parameters, and isn't a string with '{' characters if (expectedParameters == 0 && elementsPushed == 0) { Runner.Report (method, call, Severity.Low, Confidence.Normal, "You are calling String.Format without arguments, you can remove the call to String.Format"); return; } if (expectedParameters < elementsPushed) { string msg = String.Format (CultureInfo.InvariantCulture, "Extra parameters are provided to String.Format, {0} provided but only {1} expected", elementsPushed, expectedParameters); Runner.Report (method, call, Severity.Medium, Confidence.Normal, msg); return; } if (elementsPushed < expectedParameters) { string msg = String.Format (CultureInfo.InvariantCulture, "The String.Format method is expecting {0} parameters, but only {1} are found.", expectedParameters, elementsPushed); Runner.Report (method, call, Severity.Critical, Confidence.Normal, msg); } } public RuleResult CheckMethod (MethodDefinition method) { // if method has no IL, the rule doesn't apply if (!method.HasBody) return RuleResult.DoesNotApply; // and when the IL contains a Call[virt] instruction if (!OpCodeEngine.GetBitmask (method).Intersect (OpCodeBitmask.Calls)) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.FlowControl != FlowControl.Call) continue; MethodReference mr = (instruction.Operand as MethodReference); if (formatSignature.Matches (mr) && mr.DeclaringType.IsNamed ("System", "String")) CheckCallToFormatter (instruction, method); } return Runner.CurrentRuleResult; } } } AvoidCodeWithSideEffectsInConditionalCodeRule.cs0000664000175000017500000001417012413742070036676 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness// // Gendarme.Rules.Correctness.AvoidCodeWithSideEffectsInConditionalCodeRule // // Authors: // Jesse Jones // // (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; using System; using System.Collections.Generic; using System.Globalization; namespace Gendarme.Rules.Correctness { /// /// A number of System methods are conditionally compiled on #defines. /// For example, System.Diagnostics.Trace::Assert is a no-op if TRACE /// is not defined and System.Diagnostics.Debug::Write is a no-op if DEBUG /// is not defined. /// /// When calling a conditionally compiled method care should be taken to /// avoid executing code which has visible side effects. The reason is that /// the state of the program should generally not depend on the value of /// a define. If it does it is all too easy to create code which, for example, /// works in DEBUG but fails or behaves differently in release. /// /// This rule flags expressions used to construct the arguments to a /// conditional call if those expressions write to a local variable, method /// argument, or field. This includes pre/postfix increment and decrement /// expressions and assignment expressions. /// /// /// Bad example: /// /// internal sealed class Helpers { /// public string StripHex (string text) /// { /// int i = 0; /// /// // This code will work in debug, but not in release. /// Debug.Assert (text [i++] == '0'); /// Debug.Assert (text [i++] == 'x'); /// /// return text.Substring (i); /// } /// } /// /// /// /// Good example: /// /// internal sealed class Helpers { /// public string StripHex (string text) /// { /// Debug.Assert (text [0] == '0'); /// Debug.Assert (text [1] == 'x'); /// /// return text.Substring (2); /// } /// } /// /// [Problem ("A conditionally compiled method is being called, but one of the actual arguments mutates state.")] [Solution ("If the state must be changed then do it outside the method call.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidCodeWithSideEffectsInConditionalCodeRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!mask.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; Log.WriteLine (this); Log.WriteLine (this, "---------------------------------------"); Log.WriteLine (this, method); foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference target = ins.Operand as MethodReference; string define = AvoidMethodsWithSideEffectsInConditionalCodeRule.ConditionalOn (target); if (define != null) { Log.WriteLine (this, "call to {0} method at {1:X4}", define, ins.Offset); string name = Mutates (method, ins); if (name != null) { string mesg = String.Format (CultureInfo.InvariantCulture, "{0}::{1} is conditionally compiled on {2} but mutates {3}", target.DeclaringType.Name, target.Name, define, name); Log.WriteLine (this, mesg); Confidence confidence = AvoidMethodsWithSideEffectsInConditionalCodeRule.GetConfidence (define); Runner.Report (method, ins, Severity.High, confidence, mesg); } } break; } } return Runner.CurrentRuleResult; } private string Mutates (MethodDefinition method, Instruction end) { string name = null; Instruction ins = AvoidMethodsWithSideEffectsInConditionalCodeRule.FullTraceBack (method, end); if (ins != null) { Log.WriteLine (this, "checking args for call at {0:X4} starting at {1:X4}", end.Offset, ins.Offset); while (ins.Offset < end.Offset && name == null) { if (ins.IsStoreArgument ()) { ParameterDefinition pd = ins.Operand as ParameterDefinition; name = "argument " + pd.Name; } else if (ins.IsStoreLocal ()) { VariableDefinition vd = ins.GetVariable (method); if (!vd.IsGeneratedName ()) name = "local " + vd.Name; } else if (ins.OpCode.Code == Code.Stfld || ins.OpCode.Code == Code.Stsfld) { FieldReference fr = ins.Operand as FieldReference; if (!fr.IsGeneratedCode ()) name = "field " + fr.Name; } ins = ins.Next; } } return name; } #if false private void Bitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Starg); mask.Set (Code.Starg_S); mask.Set (Code.Stloc_0); mask.Set (Code.Stloc_1); mask.Set (Code.Stloc_2); mask.Set (Code.Stloc_3); mask.Set (Code.Stloc); mask.Set (Code.Stloc_S); mask.Set (Code.Stfld); mask.Set (Code.Stsfld); Console.WriteLine (mask); } #endif static OpCodeBitmask mask = new OpCodeBitmask (0x93C00, 0x2400000000000000, 0x0, 0x1200); } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ProvideCorrectRegexPatternRule.cs0000664000175000017500000001621612413742070034177 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ProvideCorrectRegexPatternRule class // // Authors: // Cedric Vivier // Sebastien Pouliot // // Copyright (C) 2008 Cedric Vivier // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using System.Text.RegularExpressions; namespace Gendarme.Rules.Correctness { /// /// This rule verifies that valid regular expression strings are used as arguments. /// /// /// Bad example: /// /// //Invalid end of pattern /// Regex re = new Regex ("^\\"); /// /// /// /// Good example: /// /// Regex re = new Regex (@"^\\"); /// /// /// /// Bad example: /// /// //Unterminated [] set /// Regex re = new Regex ("([a-z)*"); /// /// /// /// Good example: /// /// Regex re = new Regex ("([a-z])*"); /// /// /// /// Bad example: /// /// //Reference to undefined group number 2 /// return Regex.IsMatch (code, @"(\w)-\2"); /// /// /// /// Good example: /// /// return Regex.IsMatch (code, @"(\w)-\1"); /// /// /// This rule is available since Gendarme 2.4 [Problem ("An invalid regular expression string is provided to a method/constructor.")] [Solution ("Fix the invalid regular expression.")] [EngineDependency (typeof (OpCodeEngine))] public class ProvideCorrectRegexPatternRule : Rule, IMethodRule { static OpCodeBitmask callsAndNewobjBitmask = BuildCallsAndNewobjOpCodeBitmask (); public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { string assembly_name = e.CurrentAssembly.Name.Name; bool usingRegexClass = (assembly_name == "System"); bool usingValidatorClass = (e.CurrentModule.Runtime >= TargetRuntime.Net_2_0) && (assembly_name == "System.Configuration"); // if we're not analyzing System.dll or System.Configuration.dll then check if we're using them if (!usingRegexClass && !usingValidatorClass) { Active = e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Text.RegularExpressions", "Regex") || tr.IsNamed ("System.Configuration", "RegexStringValidator"); }); } else { Active = true; } }; } void CheckArguments (MethodDefinition method, Instruction ins, Instruction ld) { // handle things like: boolean_condition ? "string-1" : "string-2" // where the first string (compiler dependent) is ok, while the second is bad if (CheckLoadInstruction (method, ins, ld, Confidence.High)) { Instruction previous = ld.Previous; if ((previous != null) && (previous.Operand == ins)) { CheckLoadInstruction (method, ins, previous.Previous, Confidence.Normal); } } } bool CheckLoadInstruction (MethodDefinition method, Instruction ins, Instruction ld, Confidence confidence) { switch (ld.OpCode.Code) { case Code.Ldstr: return CheckPattern (method, ins, (string) ld.Operand, confidence); case Code.Ldsfld: FieldReference f = (FieldReference) ld.Operand; if (f.Name != "Empty" || !f.DeclaringType.IsNamed ("System", "String")) return false; return CheckPattern (method, ins, null, confidence); case Code.Ldnull: return CheckPattern (method, ins, null, confidence); } return true; } bool CheckPattern (MethodDefinition method, Instruction ins, string pattern, Confidence confidence) { if (string.IsNullOrEmpty (pattern)) { Runner.Report (method, ins, Severity.High, Confidence.High, "Pattern is null or empty."); return false; } try { new Regex (pattern); return true; } catch (Exception e) { /* potential set of exceptions is not well documented and potentially changes with regarts to different runtime and/or runtime version. */ string msg = String.Format (CultureInfo.InvariantCulture, "Pattern '{0}' is invalid. Reason: {1}", pattern, e.Message); Runner.Report (method, ins, Severity.High, confidence, msg); return false; } } void CheckCall (MethodDefinition method, Instruction ins, MethodReference call) { if (null == call) //resolution did not work return; if (!call.HasParameters) return; TypeReference type = call.DeclaringType; if (!type.IsNamed ("System.Text.RegularExpressions", "Regex") && !type.IsNamed ("System.Configuration", "RegexStringValidator")) return; MethodDefinition mdef = call.Resolve (); if (null == mdef) return; //check only constructors and static non-property methods if (!mdef.IsConstructor && (mdef.HasThis || mdef.IsProperty ())) return; foreach (ParameterDefinition p in mdef.Parameters) { string pname = p.Name; if ((pname == "pattern" || pname == "regex") && p.ParameterType.IsNamed ("System", "String")) { Instruction ld = ins.TraceBack (method, -(call.HasThis ? 0 : p.Index)); if (ld != null) CheckArguments (method, ins, ld); return; } } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; //is there any interesting opcode in the method? if (!callsAndNewobjBitmask.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if (!callsAndNewobjBitmask.Get (ins.OpCode.Code)) continue; CheckCall (method, ins, (MethodReference) ins.Operand); } return Runner.CurrentRuleResult; } static OpCodeBitmask BuildCallsAndNewobjOpCodeBitmask () { #if true return new OpCodeBitmask (0x8000000000, 0x4400000000000, 0x0, 0x0); #else OpCodeBitmask mask = new OpCodeBitmask (); mask.UnionWith (OpCodeBitmask.Calls); mask.Set (Code.Newobj); return mask; #endif } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ReviewCastOnIntegerMultiplicationRule.cs0000664000175000017500000001034212413742070035513 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ReviewCastOnIntegerMultiplicationRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // ICAST: Result of integer multiplication cast to long (ICAST_INTEGER_MULTIPLY_CAST_TO_LONG) /// /// This rule checks for integral multiply operations where the result is cast to /// a larger integral type. It's safer instead to cast an operand to the larger type /// to minimize the chance of overflow. /// /// /// Bad example: /// /// public long Bad (int a, int b) /// { /// // e.g. Bad (Int32.MaxInt, Int32.MaxInt) == 1 /// return a * b; /// } /// /// /// /// Good example: /// /// public long Good (int a, int b) /// { /// // e.g. Good (Int32.MaxInt, Int32.MaxInt) == 4611686014132420609 /// return (long) a * b; /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("This method casts the result of an integer multiplication into a larger integer. This may result in an overflow before the cast can be done.")] [Solution ("Cast the operands instead of the result.")] [EngineDependency (typeof (OpCodeEngine))] public class ReviewCastOnIntegerMultiplicationRule : Rule, IMethodRule { static OpCodeBitmask Mul = new OpCodeBitmask (0x0, 0x2000000, 0xC0000000000000, 0x0); static bool IsFloatingPointArguments (Instruction ins, MethodDefinition method) { TypeReference tr = ins.GetOperandType (method); if (tr == null) return false; return tr.IsFloatingPoint (); } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // exclude methods that don't have MUL* instructions if (!OpCodeEngine.GetBitmask (method).Intersect (Mul)) return RuleResult.DoesNotApply; Severity s; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Mul: // potential for bad values s = Severity.High; break; case Code.Mul_Ovf: case Code.Mul_Ovf_Un: // the code use 'checked' (or is compiled with it) // so a runtime exception will be thrown s = Severity.Medium; break; default: continue; } if (IsFloatingPointArguments (ins.TraceBack (method), method)) continue; switch (ins.Next.OpCode.Code) { case Code.Conv_I8: case Code.Conv_Ovf_I8: case Code.Conv_Ovf_I8_Un: case Code.Conv_U8: case Code.Conv_Ovf_U8: case Code.Conv_Ovf_U8_Un: Runner.Report (method, ins, s, Confidence.Normal); break; } } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Mul); mask.Set (Code.Mul_Ovf); mask.Set (Code.Mul_Ovf_Un); Console.WriteLine (mask); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ReviewUselessControlFlowRule.cs0000664000175000017500000001064512413742070033712 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ReviewUselessControlFlowRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // UCF: Useless control flow to next line (UCF_USELESS_CONTROL_FLOW_NEXT_LINE) // UCF: Useless control flow (UCF_USELESS_CONTROL_FLOW) /// /// This rule checks for empty blocks that produce useless control flow inside IL. /// This usually occurs when a block is left incomplete or when a typo is made. /// /// /// Bad example (empty): /// /// if (x == 0) { /// // TODO - ever seen such a thing ? ;-) /// } /// /// /// /// Bad example (typo): /// /// if (x == 0); { /// Console.WriteLine ("always printed"); /// } /// /// /// /// Good example: /// /// if (x == 0) { /// Console.WriteLine ("printed only if x == 0"); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method contains conditional code which does not change the flow of execution.")] [Solution ("Verify the code logic. This is likely a typo (e.g. an extra ';') or dead code (empty condition).")] [EngineDependency (typeof (OpCodeEngine))] public class ReviewUselessControlFlowRule : Rule, IMethodRule { private static OpCodeBitmask Branches = new OpCodeBitmask (0x8704380000000000, 0x0, 0x0, 0x0); public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // exclude methods that don't have any conditional branches if (!Branches.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Brfalse: case Code.Brfalse_S: case Code.Brtrue: case Code.Brtrue_S: // BNE is used by [G]MCS case Code.Bne_Un: case Code.Bne_Un_S: case Code.Beq: case Code.Beq_S: Instruction br = (ins.Operand as Instruction); int delta = br.Offset - ins.Next.Offset; if (delta == 0) { // Medium: since compiler already warned about this Runner.Report (method, ins, Severity.Medium, Confidence.Normal); } else if (delta <= 2) { // is the block (between the jumps) small and empty ? // CSC does this, probably to help the debugger. // [G]MCS does not while (delta > 0) { br = br.Previous; if (br.OpCode.Code != Code.Nop) break; delta--; } if (delta == 0) Runner.Report (method, ins, Severity.Low, Confidence.Normal); } break; } } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask branches = new OpCodeBitmask (); branches.Set (Code.Brfalse); branches.Set (Code.Brfalse_S); branches.Set (Code.Brtrue); branches.Set (Code.Brtrue_S); branches.Set (Code.Bne_Un); branches.Set (Code.Bne_Un_S); branches.Set (Code.Beq); branches.Set (Code.Beq_S); Console.WriteLine (branches); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ProvideValidXPathExpressionRule.cs0000664000175000017500000001354712413742070034335 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ProvideValidXPathExpressionRule class // // Authors: // Cedric Vivier // // Copyright (C) 2009 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Xml; using System.Xml.XPath; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using System.Text.RegularExpressions; namespace Gendarme.Rules.Correctness { /// /// This rule verifies that valid XPath expression strings are passed as arguments. /// /// /// Bad example (node selection): /// /// XmlNodeList nodes = document.SelectNodes ("/book[@npages == 100]/@title"); /// /// /// /// Good example (node selection): /// /// XmlNodeList nodes = document.SelectNodes ("/book[@npages = 100]/@title"); /// /// /// /// Bad example (expression compilation): /// /// var xpath = XPathExpression.Compile ("/book[@npages == 100]/@title"); /// /// /// /// Good example (expression compilation): /// /// var xpath = XPathExpression.Compile ("/book[@npages = 100]/@title"); /// /// /// This rule is available since Gendarme 2.6 [Problem ("An invalid XPath expression string is provided to a method.")] [Solution ("Fix the invalid XPath expression.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class ProvideValidXPathExpressionRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { foreach (AssemblyNameReference name in e.CurrentModule.AssemblyReferences) { if (name.Name == "System.Xml") { Active = true; return; } } Active = false; //no System.Xml assembly reference has been found }; } void CheckString (MethodDefinition method, Instruction ins, int argumentOffset) { Instruction ld = ins.TraceBack (method, argumentOffset); if (null == ld) return; switch (ld.OpCode.Code) { case Code.Ldstr: CheckString (method, ins, (string) ld.Operand); break; case Code.Ldsfld: FieldReference f = (FieldReference) ld.Operand; if (f.Name == "Empty" && f.DeclaringType.IsNamed ("System", "String")) CheckString (method, ins, null); break; case Code.Ldnull: CheckString (method, ins, null); break; } } void CheckString (MethodDefinition method, Instruction ins, string expression) { if (string.IsNullOrEmpty (expression)) { Runner.Report (method, ins, Severity.High, Confidence.Total, "Expression is null or empty."); return; } try { XPathExpression.Compile (expression); } catch (XPathException e) { string msg = String.Format (CultureInfo.InvariantCulture, "Expression '{0}' is invalid. Details: {1}", expression, e.Message); Runner.Report (method, ins, Severity.High, Confidence.High, msg); } } void CheckCall (MethodDefinition method, Instruction ins, MethodReference mref) { if (null == mref || !mref.HasParameters) return; switch (mref.Name) { case "Compile": TypeReference tr = mref.DeclaringType; if (tr.IsNamed ("System.Xml.XPath", "XPathExpression") || tr.Inherits ("System.Xml.XPath", "XPathNavigator")) CheckString (method, ins, GetFirstArgumentOffset (mref)); break; case "SelectNodes": if (mref.DeclaringType.IsNamed ("System.Xml", "XmlNode")) CheckString (method, ins, -1); break; case "Evaluate": case "Select": CheckXPathNavigatorString (method, ins, mref); break; case "SelectSingleNode": CheckXPathNavigatorString (method, ins, mref); if (mref.DeclaringType.IsNamed ("System.Xml", "XmlNode")) CheckString (method, ins, -1); break; } } void CheckXPathNavigatorString (MethodDefinition method, Instruction ins, MethodReference mref) { if (mref.Parameters [0].ParameterType.IsNamed ("System", "String")) { if (mref.DeclaringType.Inherits ("System.Xml.XPath", "XPathNavigator")) CheckString (method, ins, -1); } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; //is there any interesting opcode in the method? OpCodeBitmask calls = OpCodeBitmask.Calls; if (!calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if (!calls.Get (ins.OpCode.Code)) continue; CheckCall (method, ins, (MethodReference) ins.Operand); } return Runner.CurrentRuleResult; } static int GetFirstArgumentOffset (IMethodSignature mref) { return (mref.HasThis ? -1 : 0); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Gendarme.Rules.Correctness.csproj0000775000175000017500000002067112413742070034066 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {732905E1-1FD4-403A-93DD-EC4CF120091E} Library Properties Gendarme.Rules.Correctness Gendarme.Rules.Correctness 3.5 true v4.0 http://localhost/Gendarme.Rules.Correctness/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full true ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Correctness.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 ..\..\console\bin\Release\Gendarme.Rules.Correctness.xml 1591 1570 AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Makefile.in0000664000175000017500000007266612642235731027622 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Correctness ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -r:System.Configuration \ -d:DEBUG \ -resource:Test/Resources.resources,Tests.Rules.Correctness.Resource.resources console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) \ $(prefixed_rules_category).csproj Test/Resource.resx CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AttributeStringLiteralsShouldParseCorrectlyRule.cs \ AvoidCodeWithSideEffectsInConditionalCodeRule.cs \ AvoidConstructorsInStaticTypesRule.cs \ AvoidFloatingPointEqualityRule.cs \ AvoidMethodsWithSideEffectsInConditionalCodeRule.cs \ DeclareEventsExplicitlyRule.cs \ DoNotRecurseInEqualityRule.cs \ BadRecursiveInvocationRule.cs \ CallingEqualsWithNullArgRule.cs \ CheckParametersNullityInVisibleMethodsRule.cs \ DisposableFieldsShouldBeDisposedRule.cs \ DoNotRoundIntegersRule.cs \ DontCompareWithNaNRule.cs \ EnsureLocalDisposalRule.cs \ FinalizersShouldCallBaseClassFinalizerRule.cs \ FloatComparisonRule.cs \ ReviewInconsistentIdentityRule.cs \ MethodCanBeMadeStaticRule.cs \ ProvideCorrectArgumentsToFormattingMethodsRule.cs \ ProvideCorrectRegexPatternRule.cs \ ProvideValidXmlStringRule.cs \ ProvideValidXPathExpressionRule.cs \ ReviewCastOnIntegerDivisionRule.cs \ ReviewCastOnIntegerMultiplicationRule.cs \ ReviewDoubleAssignmentRule.cs \ ReviewSelfAssignmentRule.cs \ ReviewUselessControlFlowRule.cs \ ReviewUseOfInt64BitsToDoubleRule.cs \ ReviewUseOfModuloOneOnIntegersRule.cs \ TypesShouldBeDisposableBaseRule.cs \ TypesWithDisposableFieldsShouldBeDisposableRule.cs \ TypesWithNativeFieldsShouldBeDisposableRule.cs \ UseNoInliningWithGetCallingAssemblyRule.cs \ UseValueInPropertySetterRule.cs tests_resource_resx = Test/Resource.resx tests_resource_prefix_resx = $(addprefix $(srcdir)/, $(tests_resource_resx)) EXTRA_TESTS_DEPS = Test/Resources.resources tests_sources = \ AttributeStringLiteralsShouldParseCorrectlyTest.cs \ AvoidCodeWithSideEffectsInConditionalCodeTest.cs \ AvoidConstructorsInStaticTypesTest.cs \ AvoidFloatingPointEqualityTest.cs \ AvoidMethodsWithSideEffectsInConditionalCodeTest.cs \ DeclareEventsExplicitlyTest.cs \ DoNotRecurseInEqualityTest.cs \ BadRecursiveInvocationTest.cs \ CallingEqualsWithNullArgTest.cs \ CheckParametersNullityInVisibleMethodsTest.cs \ DisposableFieldsShouldBeDisposedTest.cs \ DontCompareWithNaNTest.cs \ DoNotRoundIntegersTest.cs \ EnsureLocalDisposalTest.cs \ FinalizersShouldCallBaseClassFinalizerTest.cs \ ReviewInconsistentIdentityTest.cs \ MethodCanBeMadeStaticTest.cs \ ProvideCorrectArgumentsToFormattingMethodsTest.cs \ ProvideCorrectRegexPatternTest.cs \ ProvideValidXmlStringTest.cs \ ProvideValidXPathExpressionTest.cs \ Resource.Designer.cs \ ReviewCastOnIntegerDivisionTest.cs \ ReviewCastOnIntegerMultiplicationTest.cs \ ReviewDoubleAssignmentTest.cs \ ReviewSelfAssignmentTest.cs \ ReviewUselessControlFlowTest.cs \ ReviewUseOfInt64BitsToDoubleTest.cs \ ReviewUseOfModuloOneOnIntegersTest.cs \ TypesWithDisposableFieldsShouldBeDisposableTest.cs \ TypesWithNativeFieldsShouldBeDisposableTest.cs \ UseNoInliningWithGetCallingAssemblyTest.cs \ UseValueInPropertySetterTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Correctness/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Correctness/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc Test/Resources.resources: $(tests_resource_resx) resgen2 -usesourcepath -compile $(tests_resource_resx),Test/Resources.resources; # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/DoNotRecurseInEqualityRule.cs0000664000175000017500000001015312413742070033267 0ustar00directhexdirecthex00000000000000// // DoNotRecurseInEqualityRule: flag recursive operator== and !=. // // Authors: // Jesse Jones // // Copyright (C) 2008 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// An operator== or operator!= method is calling itself recursively. This is /// usually caused by neglecting to cast an argument to System.Object before /// comparing it to null. /// /// /// Bad example: /// /// public static bool operator== (Customer lhs, Customer rhs) /// { /// if (object.ReferenceEquals (lhs, rhs)) { /// return true; /// } /// if (lhs == null || rhs == null) { /// return false; /// } /// return lhs.name == rhs.name && lhs.address == rhs.address; /// } /// /// /// /// Good example: /// /// public static bool operator== (Customer lhs, Customer rhs) /// { /// if (object.ReferenceEquals (lhs, rhs)) { /// return true; /// } /// if ((object) lhs == null || (object) rhs == null) { /// return false; /// } /// return lhs.name == rhs.name && lhs.address == rhs.address; /// } /// /// /// This rule is available since Gendarme 2.4 [Problem ("An operator== or operator!= method is calling itself recursively.")] [Solution ("Fix null argument checks so that they first cast the argument to System.Object.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class DoNotRecurseInEqualityRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule applies only if the method has a body if (!method.HasBody) return RuleResult.DoesNotApply; // ignore everything but operator== and operator!= string name = method.Name; if (!method.IsSpecialName || (name != "op_Equality" && name != "op_Inequality")) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no Call[virt] in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; Log.WriteLine (this); Log.WriteLine (this, "---------------------------------------"); Log.WriteLine (this, method); foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference callee = (ins.Operand as MethodReference).Resolve(); // need the resolve for generics if (callee != null) { if (callee.MetadataToken == method.MetadataToken) { // MethodReference.ToString is very costly but, in this case, won't be called often if (callee.ToString () == method.ToString ()) { Log.WriteLine (this, "recursive call at {0:X4}", ins.Offset); Runner.Report (method, ins, Severity.Critical, Confidence.Normal); } } } break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ReviewInconsistentIdentityRule.cs0000664000175000017500000003130512413742070034264 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule // // Authors: // Jesse Jones // Sebastien Pouliot // // Copyright (C) 2008 Jesse Jones // 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; using System.Collections.Generic; using System.Diagnostics; using System.Text; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule checks to see if a type manages its identity in a /// consistent way. It checks: /// /// /// Equals methods, relational operators and CompareTo /// must either use the same set of fields and properties or call a /// helper method. /// /// /// GetHashCode must use the same or a subset of /// the fields used by the equality methods or call a helper method. /// /// /// Clone must use the same or a superset of /// the fields used by the equality methods or call a helper method. /// /// /// /// This rule is available since Gendarme 2.4 [Problem ("The type does not manage identity consistently in its Equals, relational operator, CompareTo, GetHashCode, and Clone methods.")] [Solution ("Equals, relational operator, CompareTo methods should use the same fields and getter properties. GetHashCode should use the same fields/properties or a strict subset of them. Clone should use the same fields/properties or a superset of them.")] public sealed class ReviewInconsistentIdentityRule: Rule, ITypeRule { private HashSet methods = new HashSet (); private MethodInfo hash = new MethodInfo (); private MethodInfo clone = new MethodInfo (); private sealed class MethodInfo { private HashSet fields; private HashSet getters; public bool Delegates { get; set; } // i.e. calls a method (but not a property of the type) public HashSet Fields { get { if (fields == null) fields = new HashSet (); return fields; } } public HashSet Getters { get { if (getters == null) getters = new HashSet (); return getters; } } public bool HasFields { get { return ((fields != null) && (fields.Count > 0)); } } public bool HasGetters { get { return ((getters != null) && (getters.Count > 0)); } } public MethodDefinition Method { get; set; } public void Clear () { Delegates = false; if (fields != null) fields.Clear (); if (getters != null) getters.Clear (); Method = null; } } private void AddMethod (MethodDefinition method) { if (method != null) methods.Add (new MethodInfo () { Method = method }); } private static readonly string [] args1 = new string [1]; private static readonly string [] args2 = new string [2]; private static readonly MethodSignature CompareTo = new MethodSignature ("CompareTo", "System.Int32", new string [] { "System.Object" }); private void GetMethods (TypeReference type) { string full_name = type.GetFullName (); args1 [0] = full_name; AddMethod (type.GetMethod (MethodSignatures.Equals)); AddMethod (type.GetMethod ("Equals", "System.Boolean", args1)); AddMethod (type.GetMethod ("CompareTo", "System.Int32", args1)); // generic version AddMethod (type.GetMethod (CompareTo)); // non-generic version // Note that we don't want to use MethodSignatures for these // because we don't want any weird overloads. args2 [0] = full_name; args2 [1] = full_name; AddMethod (type.GetMethod ("op_Equality", "System.Boolean", args2)); AddMethod (type.GetMethod ("op_Inequality", "System.Boolean", args2)); AddMethod (type.GetMethod ("op_LessThan", "System.Boolean", args2)); AddMethod (type.GetMethod ("op_LessThanOrEqual", "System.Boolean", args2)); AddMethod (type.GetMethod ("op_GreaterThan", "System.Boolean", args2)); AddMethod (type.GetMethod ("op_GreaterThanOrEqual", "System.Boolean", args2)); clone.Method = type.GetMethod (MethodSignatures.Clone); hash.Method = type.GetMethod (MethodSignatures.GetHashCode); } private HashSet stored_fields = new HashSet (); private HashSet property_setters = new HashSet (); private void ProcessMethod (TypeDefinition type, MethodInfo info) { MethodDefinition method = info.Method; Log.WriteLine (this, method); // don't process abstract, pinvoke... methods if (!method.HasBody) return; stored_fields.Clear (); property_setters.Clear (); // For each instruction in the method, foreach (Instruction ins in method.Body.Instructions) { // If we're loading a field which belongs to our type then // we need to add it to our list of referenced fields. if (ins.OpCode.Code == Code.Ldfld || ins.OpCode.Code == Code.Ldflda) { if (method.IsStatic) { if (ins.Previous.IsLoadArgument ()) { ParameterDefinition pd = ins.Previous.GetParameter (method); if (pd != null && pd.ParameterType == method.DeclaringType) { FieldDefinition field = ins.GetField (); info.Fields.Add (field); } } } else { if (ins.Previous.OpCode.Code == Code.Ldarg_0) { FieldDefinition field = ins.GetField (); info.Fields.Add (field); } } // We'll ignore any fields which we wind up storing into. (These // will typically be something like a GetHashCode cache.) } else if (ins.OpCode.Code == Code.Stfld) { if (!MethodSignatures.Clone.Matches (method)) { FieldDefinition field = ins.GetField (); stored_fields.Add (field); } // If we're calling a method which belongs to our type then, } else if (ins.OpCode.Code == Code.Call || ins.OpCode.Code == Code.Callvirt) { MethodDefinition callee = (ins.Operand as MethodReference).Resolve (); if (callee != null && callee.DeclaringType == method.DeclaringType) { // if it is a getter then save a reference to it, if (callee.IsGetter) info.Getters.Add (callee); // if it's a setter then we'll ignore the corresponding getter, else if (callee.IsSetter) property_setters.Add (callee); // anything else is assumed to be some sort of helper method which means // we don't know all of the state which this method may use. else info.Delegates = true; } } } info.Fields.ExceptWith (stored_fields); if (property_setters.Count > 0) { foreach (PropertyDefinition prop in type.Properties) { if (prop.GetMethod != null && property_setters.Contains (prop.SetMethod)) info.Getters.Remove (prop.GetMethod); } } #if DEBUG if (info.HasFields) { StringBuilder sb = new StringBuilder (); sb.Append (method.Name).Append (" uses fields "); AppendTo (sb, info.Fields); Log.WriteLine (this, sb.ToString ()); } if (info.HasGetters) { StringBuilder sb = new StringBuilder (); sb.Append (method.Name).Append (" uses getters "); AppendTo (sb, info.Getters); Log.WriteLine (this, sb.ToString ()); } Log.WriteLine (this); #endif } // It's a bit silly to stick these into fields, but it does save some // allocations in a highly used code path... private HashSet fields = new HashSet (); private HashSet getters = new HashSet (); private List badNames = new List (); private void CheckMethods () { // Get the set of all fields/getters used by the equality methods. foreach (MethodInfo info in methods) { if (info.HasFields) fields.UnionWith (info.Fields); if (info.HasGetters) getters.UnionWith (info.Getters); } } private void CheckBadNames () { // If an equality or comparison method uses a subset of the // full set then we have a problem. MethodDefinition first = null; foreach (MethodInfo info in methods) { if (info.Delegates) continue; if (info.HasFields && (info.Fields.Count < fields.Count)) { first = first ?? info.Method; badNames.Add (info.Method); } else if (info.HasGetters && (info.Getters.Count < getters.Count)) { first = first ?? info.Method; badNames.Add (info.Method); } } if (badNames.Count > 0) { Report (first, "Inconsistent:", badNames, null); badNames.Clear (); } } private void CheckHashMethod () { // We also have a problem if GetHashCode does not check a // subset of the equality state. if (hash.Method != null && !hash.Delegates) { // Note that if there are no equality fields or getters then the // equality methods delegate all of their work so we don't // don't know which state they are checking. if (fields.Count > 0 || getters.Count > 0) { if (!hash.HasFields && !hash.HasGetters) { Report (hash.Method, "GetHashCode does not use any of the fields and/or properties used by the equality methods.", null, null); } else if (!hash.Fields.IsSubsetOf (fields) || !hash.Getters.IsSubsetOf (getters)) { hash.Fields.ExceptWith (fields); hash.Getters.ExceptWith (getters); Report (hash.Method, "GetHashCode uses fields and/or properties not used by the equality methods:", hash.Fields, hash.Getters); } } } hash.Clear (); } private void CheckCloneMethod () { // We also have a problem if Clone does not use a // superset of the equality state. if (clone.Method != null && !clone.Delegates && (clone.HasFields || clone.HasGetters)) { if (fields.Count > 0 || getters.Count > 0) { if (!clone.Fields.IsSupersetOf (fields) || !clone.Getters.IsSupersetOf (getters)) { fields.ExceptWith (clone.Fields); getters.ExceptWith (clone.Getters); Report (clone.Method, "Clone does not use fields and/or properties used by the equality methods:", fields, getters); } } } clone.Clear (); } static void AppendTo (StringBuilder sb, IEnumerable values) { foreach (MemberReference mr in values) { sb.Append (' '); sb.Append (mr.Name); } } private void Report (IMetadataTokenProvider method, string message, IEnumerable first, IEnumerable second) { StringBuilder sb = new StringBuilder (message); if (first != null) AppendTo (sb, first); if (second != null) AppendTo (sb, second); string mesg = sb.ToString (); Log.WriteLine (this, mesg); Runner.Report (method, Severity.High, Confidence.Normal, mesg); } public RuleResult CheckType (TypeDefinition type) { if (!type.HasMethods || !type.HasFields || type.IsEnum) return RuleResult.DoesNotApply; Log.WriteLine (this); Log.WriteLine (this, "------------------------------------"); Log.WriteLine (this, type); GetMethods (type); if (methods.Count > 0) { foreach (MethodInfo info in methods) ProcessMethod (type, info); if (hash.Method != null) ProcessMethod (type, hash); if (clone.Method != null) ProcessMethod (type, clone); CheckMethods (); CheckBadNames (); CheckHashMethod (); CheckCloneMethod (); methods.Clear (); fields.Clear (); getters.Clear (); } return Runner.CurrentRuleResult; } } } TypesWithDisposableFieldsShouldBeDisposableRule.cs0000664000175000017500000001123112413742070037356 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness// // Gendarme.Rules.Correctness.TypesWithDisposableFieldsShouldBeDisposableRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule will fire if a type contains disposable fields, i.e. fields whose types implements /// System.IDisposable, but where the type itself does not implement System.IDisposable. /// The rule will not report types that are not assigning themselves new instances to the fields. /// /// /// Bad examples: /// /// class DoesNotImplementIDisposable { /// IDisposable field; /// } /// /// class AbstractDispose : IDisposable { /// IDisposable field; /// /// // the field should be disposed in the type that declares it /// public abstract void Dispose (); /// } /// /// /// /// Good example: /// /// class Dispose : IDisposable { /// IDisposable field; /// /// public void Dispose () /// { /// field.Dispose (); /// } /// } /// /// [Problem ("This type contains disposable field(s) but doesn't implement IDisposable.")] [Solution ("Implement IDisposable and free the disposable field(s) in the Dispose method.")] [FxCopCompatibility ("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")] [EngineDependency (typeof (OpCodeEngine))] public class TypesWithDisposableFieldsShouldBeDisposableRule : TypesShouldBeDisposableBaseRule { static OpCodeBitmask StoreFieldBitmask = new OpCodeBitmask (0x0, 0x400000000000000, 0x80000000, 0x0); protected override string AbstractTypeMessage { get { return "Field implement IDisposable. Type should implement a non-abstract Dispose() method"; } } protected override string TypeMessage { get { return "Field implement IDisposable. Type should implement a Dispose() method"; } } protected override string AbstractDisposeMessage { get { return "Some field(s) implement IDisposable. Making this method abstract shifts the reponsability of disposing those fields to the inheritors of this class."; } } protected override void CheckMethod (MethodDefinition method, bool abstractWarning) { if ((method == null) || !method.HasBody) return; OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); // method must have a NEWOBJ and either STFLD or STELEM_REF if (!bitmask.Get (Code.Newobj) || !bitmask.Intersect (StoreFieldBitmask)) return; foreach (Instruction ins in method.Body.Instructions) { if (!ins.Is (Code.Newobj)) continue; FieldDefinition field = null; Instruction next = ins.Next; if (next.Is (Code.Stfld)) { field = next.Operand as FieldDefinition; } else if (next.Is (Code.Stelem_Ref)) { Instruction origin = next.TraceBack (method); if (origin != null) field = origin.Operand as FieldDefinition; } if (field != null && FieldCandidates.Contains (field)) { Runner.Report (field, Severity.High, Confidence.High, abstractWarning ? AbstractTypeMessage : TypeMessage); } } } protected override bool FieldTypeIsCandidate (TypeDefinition type) { // enums and primitives don't implement IDisposable if ((type == null) || type.IsEnum || type.IsPrimitive) return false; return type.Implements ("System", "IDisposable"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/UseNoInliningWithGetCallingAssemblyRule.cs0000664000175000017500000001031412413742070035714 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.UseNoInliningWithGetCallingAssemblyRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule warns when a method call Assembly.GetCallingAssembly() from a /// method that is not decorated with [MethodImpl(MethodImplOptions.NoInlining)]. /// Without this attribute the method could be inlined by the JIT. In this case the /// calling assembly would be the assembly of the caller (of the inlined method), /// which could be different than the assembly of the real, source-wise, caller to /// Assembly.GetCallingAssembly. /// /// /// Bad example: /// /// public void ShowInfo () /// { /// Console.WriteLine (Assembly.GetCallingAssembly ().Location); /// } /// /// /// /// Good example: /// /// [MethodImpl (MethodImplOptions.NoInlining)] /// public void ShowInfo () /// { /// Console.WriteLine (Assembly.GetCallingAssembly ().Location); /// } /// /// /// This rule is available since Gendarme 2.8 [Problem ("Assembly.GetCallingAssembly() is called from a method that could be inlined by the JIT")] [Solution ("Decorate method with [MethodImpl(MethodImplOptions.NoInlining)] to ensure it will never be inlined.")] [EngineDependency (typeof (OpCodeEngine))] public class UseNoInliningWithGetCallingAssemblyRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { // if the module does not reference System.Reflection.Assembly.GetCallingAssembly // then there's no point in enabling the rule Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyMemberReference ((MemberReference mr) => { return IsGetCallingAssembly (mr); }) ); }; } static bool IsGetCallingAssembly (MemberReference method) { return method.IsNamed ("System.Reflection", "Assembly", "GetCallingAssembly"); } static bool IsCallToGetCallingAssembly (Instruction instruction) { var code = instruction.OpCode.Code; if (code != Code.Call && code != Code.Callvirt) return false; return IsGetCallingAssembly (instruction.GetMethod ()); } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // we do not need to check if the method can't be inlined if (method.NoInlining) return RuleResult.Success; foreach (Instruction current in method.Body.Instructions) { if (IsCallToGetCallingAssembly (current)) { Runner.Report (method, current, Severity.High, Confidence.Total); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/CallingEqualsWithNullArgRule.cs0000664000175000017500000000762312413742070033563 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.CallingEqualsWithNullArgRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule checks for methods that call Equals with a null actual parameter. /// Such calls should always return false. /// /// /// Bad example: /// /// public void MakeStuff () /// { /// MyClass myClassInstance = new MyClass (); /// MyClass otherClassInstance = null; /// Console.WriteLine (myClassInstance.Equals (otherClassInstance)); /// } /// /// /// /// Good example: /// /// public void MakeStuff () /// { /// MyClass myClassInstance = new MyClass (); /// MyClass otherClassInstance = new MyClass (); /// Console.WriteLine (myClassInstance.Equals (otherClassInstance)); /// } /// /// [Problem ("This method calls Equals(object) with a null argument.")] [Solution ("Either use a different argument or remove the Equals call (it will always return false).")] [EngineDependency (typeof (OpCodeEngine))] public class CallingEqualsWithNullArgRule: Rule, IMethodRule { // MethodSignatures.Equals check for a System.Object parameter while this rule is more general // and will work as long as there is a single parameter, whatever the type private static readonly new MethodSignature Equals = new MethodSignature ("Equals", "System.Boolean", new string [1]); public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); // is there any Call or Callvirt instructions in the method ? if (!OpCodeBitmask.Calls.Intersect (bitmask)) return RuleResult.DoesNotApply; // is there a Ldnull instruction in the method ? if (!bitmask.Get (Code.Ldnull)) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: // if we're calling bool type.Equals({anytype}) if (!Equals.Matches (ins.Operand as MethodReference)) continue; // and that the previous, real, instruction is loading a null value // note: check the first parameter (not the instance) Instruction source = ins.TraceBack (method, -1); if ((source != null) && (source.OpCode.Code == Code.Ldnull)) Runner.Report (method, ins, Severity.Low, Confidence.High); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/ReviewUseOfModuloOneOnIntegersRule.cs0000664000175000017500000000714612413742070034741 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.ReviewUseOfModuloOneOnIntegersRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // INT: Integer remainder modulo 1 (INT_BAD_REM_BY_1) /// /// This rule checks for a modulo one (1) operation on an integral type. This is most /// likely a typo since the result is always 0. This usually happen when someone confuses /// a bitwise operation with a remainder. /// /// /// Bad example: /// /// public bool IsOdd (int i) /// { /// return ((i % 1) == 1); /// } /// /// /// /// Good example: /// /// public bool IsOdd (int i) /// { /// return ((i % 2) != 0); // or ((x & 1) == 1) /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method computes the modulo (%) 1 of a integral value. This always evaluates to zero.")] [Solution ("Verify the code logic. The logic should probably be (i % 2) to separate even/odd or (i & 1) to check the least significant bit.")] [EngineDependency (typeof (OpCodeEngine))] public class ReviewUseOfModuloOneOnIntegersRule : Rule, IMethodRule { // Rem[_Un] private static OpCodeBitmask Remainder = new OpCodeBitmask (0x0, 0x30000000, 0x0, 0x0); static bool CheckModuloOne (Instruction ins) { switch (ins.OpCode.Code) { case Code.Ldc_I4_1: return true; case Code.Ldc_I4_S: return ((int)(sbyte) ins.Operand == 1); case Code.Ldc_I4: return ((int)ins.Operand == 1); case Code.Ldc_I8: return ((long)ins.Operand == 1); case Code.Conv_I4: case Code.Conv_I8: return CheckModuloOne (ins.Previous); default: return false; } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!Remainder.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Rem: case Code.Rem_Un: if (CheckModuloOne (ins.Previous)) Runner.Report (method, ins, Severity.High, Confidence.Total); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/EnsureLocalDisposalRule.cs0000664000175000017500000002553612413742070032634 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.EnsureLocalDisposalRule class // // Authors: // Cedric Vivier // Sebastien Pouliot // // Copyright (C) 2008 Cedric Vivier // 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.Generic; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Correctness { /// /// This rule checks that disposable locals are always disposed of before the /// method returns. /// Use a 'using' statement (or a try/finally block) to guarantee local disposal /// even in the event an unhandled exception occurs. /// /// /// Bad example (non-guaranteed disposal): /// /// void DecodeFile (string file) /// { /// var stream = new StreamReader (file); /// DecodeHeader (stream); /// if (!DecodedHeader.HasContent) { /// return; /// } /// DecodeContent (stream); /// stream.Dispose (); /// } /// /// /// /// Good example (non-guaranteed disposal): /// /// void DecodeFile (string file) /// { /// using (var stream = new StreamReader (file)) { /// DecodeHeader (stream); /// if (!DecodedHeader.HasContent) { /// return; /// } /// DecodeContent (stream); /// } /// } /// /// /// /// Bad example (not disposed of / not locally disposed of): /// /// void DecodeFile (string file) /// { /// var stream = new StreamReader (file); /// Decode (stream); /// } /// /// void Decode (Stream stream) /// { /// /*code to decode the stream*/ /// stream.Dispose (); /// } /// /// /// /// Good example (not disposed of / not locally disposed of): /// /// void DecodeFile (string file) /// { /// using (var stream = new StreamReader (file)) { /// Decode (stream); /// } /// } /// /// void Decode (Stream stream) /// { /// /*code to decode the stream*/ /// } /// /// /// This rule is available since Gendarme 2.4 [Problem ("This disposable local is not guaranteed to be disposed of before the method returns.")] [Solution ("Use a 'using' statement or surround the local's usage with a try/finally block.")] [FxCopCompatibility("Microsoft.Reliability", "CA2000:DisposeObjectsBeforeLosingScope")] [EngineDependency (typeof (OpCodeEngine))] public sealed class EnsureLocalDisposalRule : Rule, IMethodRule { OpCodeBitmask callsAndNewobjBitmask = BuildCallsAndNewobjOpCodeBitmask (); Bitmask locals = new Bitmask (); static bool IsDispose (MethodReference call) { if (!call.HasThis) return false; return MethodSignatures.Dispose.Matches (call) || MethodSignatures.DisposeExplicit.Matches (call); } static bool DoesReturnDisposable (MethodReference call) { //ignore properties (likely not the place where the IDisposable is *created*) MethodDefinition method = call.Resolve (); if ((method == null) || call.IsProperty ()) return false; if (method.IsConstructor) { if (method.DeclaringType.IsGeneratedCode ()) return false; //eg. generators return method.DeclaringType.Implements ("System", "IDisposable"); } return method.ReturnType.Implements ("System", "IDisposable"); } static bool IsSetter (MethodReference m) { if (m == null) return false; MethodDefinition md = m.Resolve (); if (md == null) return m.Name.StartsWith ("set_", StringComparison.Ordinal); return md.IsSetter; } static bool IsInsideFinallyBlock (MethodDefinition method, Instruction ins) { MethodBody body = method.Body; if (!body.HasExceptionHandlers) return false; foreach (ExceptionHandler eh in body.ExceptionHandlers) { if (eh.HandlerType != ExceptionHandlerType.Finally) continue; if (ins.Offset >= eh.HandlerStart.Offset || ins.Offset < eh.HandlerEnd.Offset) return true; } return false; } void Clear (MethodDefinition method, Instruction ins) { VariableDefinition v = ins.GetVariable (method); if (v != null) locals.Clear ((ulong) v.Index); } void CheckForReturn (MethodDefinition method, Instruction ins) { if (ins.IsLoadLocal ()) Clear (method, ins); } void CheckForOutParameters (MethodDefinition method, Instruction ins) { Instruction iref = ins.TraceBack (method); if (iref == null) return; ParameterDefinition p = iref.GetParameter (method); if ((p != null) && p.IsOut) { ins = ins.Previous; if (ins.IsLoadLocal ()) Clear (method, ins); } } void CheckDisposeCalls (MethodDefinition method, Instruction ins) { Instruction instance = ins.TraceBack (method); if (instance == null) return; VariableDefinition v = instance.GetVariable (method); ulong index = v == null ? UInt64.MaxValue : (ulong) v.Index; if (v != null && locals.Get (index)) { if (!IsInsideFinallyBlock (method, ins)) { string msg = String.Format (CultureInfo.InvariantCulture, "Local {0}is not guaranteed to be disposed of.", GetFriendlyNameOrEmpty (v)); Runner.Report (method, Severity.Medium, Confidence.Normal, msg); } locals.Clear (index); } } bool CheckCallsToOtherInstances (MethodDefinition method, Instruction ins, MethodReference call) { Instruction p = ins.TraceBack (method, 0); if (p.Is (Code.Ldarg_0)) return false; if (call.HasParameters) { for (int i = 1; i <= call.Parameters.Count; i++) { p = ins.TraceBack (method, -i); Clear (method, p); } } return true; } void CheckReassignment (MethodDefinition method, Instruction ins) { VariableDefinition v = ins.GetVariable (method); ulong index = (ulong) v.Index; if (locals.Get (index)) { string msg = String.Format (CultureInfo.InvariantCulture, "Local {0}is not disposed before being re-assigned.", GetFriendlyNameOrEmpty (v)); Runner.Report (method, ins, Severity.High, Confidence.Normal, msg); } else { locals.Set (index); } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; //is there any potential IDisposable-getting opcode in the method? if (!callsAndNewobjBitmask.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // we will not report IDiposable locals that are returned from a method bool return_idisposable = DoesReturnDisposable (method); locals.ClearAll (); foreach (Instruction ins in method.Body.Instructions) { Code code = ins.OpCode.Code; switch (code) { case Code.Ret: if (return_idisposable) CheckForReturn (method, ins.Previous); continue; case Code.Stind_Ref: CheckForOutParameters (method, ins); continue; default: if (!callsAndNewobjBitmask.Get (code)) continue; break; } MethodReference call = (MethodReference) ins.Operand; if (IsDispose (call)) { CheckDisposeCalls (method, ins); continue; } if (call.HasThis && (code != Code.Newobj)) { if (!CheckCallsToOtherInstances (method, ins, call)) continue; } if (!DoesReturnDisposable (call)) continue; Instruction nextInstruction = ins.Next; if (nextInstruction == null) continue; Code nextCode = nextInstruction.OpCode.Code; if (nextCode == Code.Pop || OpCodeBitmask.Calls.Get (nextCode)) { // We ignore setter because it is an obvious share of the IDisposable if (!IsSetter (nextInstruction.Operand as MethodReference)) ReportCall (method, ins, call); } else if (nextInstruction.IsStoreLocal ()) { // make sure we're not re-assigning over a non-disposed IDisposable CheckReassignment (method, nextInstruction); } } ReportNonDisposedLocals (method); return Runner.CurrentRuleResult; } void ReportNonDisposedLocals (MethodDefinition method) { for (ulong i = 0; i < 64; i++) { if (!locals.Get (i)) continue; string msg = String.Format (CultureInfo.InvariantCulture, "Local {0}is not disposed of (at least not locally).", GetFriendlyNameOrEmpty (method.Body.Variables [(int) i])); Runner.Report (method, Severity.High, Confidence.Normal, msg); } } static bool IsFluentLike (MethodReference method) { TypeReference rtype = method.ReturnType; string nspace = rtype.Namespace; string name = rtype.Name; // StringBuilder StringBuilder.Append (...) if (method.DeclaringType.IsNamed (nspace, name)) return true; return (method.HasParameters && method.Parameters [0].ParameterType.IsNamed (nspace, name)); } void ReportCall (MethodDefinition method, Instruction ins, MethodReference call) { TypeReference type = ins.Is (Code.Newobj) ? call.DeclaringType : call.ReturnType; bool fluent = IsFluentLike (call); string msg = String.Format (CultureInfo.InvariantCulture, "Local of type '{0}' is not disposed of ({1}).", type.Name, fluent ? "is this a fluent-like API ?" : "at least not locally"); Runner.Report (method, ins, Severity.High, fluent ? Confidence.Normal : Confidence.High, msg); } static string GetFriendlyNameOrEmpty (VariableReference variable) { string tname = variable.VariableType.Name; if (variable.IsGeneratedName ()) return String.Format (CultureInfo.InvariantCulture, "of type '{0}' ", tname); return String.Format (CultureInfo.InvariantCulture, "'{0}' of type '{1}' ", variable.Name, tname); } static OpCodeBitmask BuildCallsAndNewobjOpCodeBitmask () { #if true return new OpCodeBitmask (0x8000000000, 0x4400000000000, 0x0, 0x0); #else OpCodeBitmask mask = new OpCodeBitmask (); mask.UnionWith (OpCodeBitmask.Calls); mask.Set (Code.Newobj); return mask; #endif } } } AttributeStringLiteralsShouldParseCorrectlyRule.cs0000664000175000017500000001410212413742070037520 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness// // Gendarme.Rules.Correctness.AttributeStringLiteralShouldParseCorrectlyRule class // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; namespace Gendarme.Rules.Correctness { /// /// As attributes are used at compile time, only constants can /// be passed to constructors. This can lead to runtime errors for /// things like malformed URI strings. /// /// This rule checks attributes with the following types, represented as /// a string, and validates the string value: /// /// /// Version /// /// /// Guid /// /// /// Uri /// /// /// /// /// Bad example: /// /// [assembly: AssemblyFileVersion ("fooo")] /// /// /// /// Good example: /// /// [assembly: AssemblyFileVersion ("0.0.1.*")] /// /// /// This rule is available since Gendarme 2.2 [Problem ("An url, version, or guid string seems to be malformed.")] [Solution ("Correctly format the reported parameters.")] [FxCopCompatibility ("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly")] public class AttributeStringLiteralsShouldParseCorrectlyRule : Rule, IMethodRule, ITypeRule, IAssemblyRule { static bool Contains (string original, string value) { return original.IndexOf (value, 0, StringComparison.OrdinalIgnoreCase) != -1; } void CheckParametersAndValues (IMetadataTokenProvider provider, IMethodSignature constructor, IList arguments) { for (int index = 0; index < arguments.Count; index++) { ParameterDefinition parameter = constructor.Parameters[index]; if (parameter.ParameterType.IsNamed ("System", "String")) { string value = (string) arguments [index].Value; if (Contains (parameter.Name, "version")) { Version v = null; if (!Version.TryParse (value, out v)) { string msg = String.Format (CultureInfo.InvariantCulture, "The value passed: {0} can't be parsed to a valid Version.", value); Runner.Report (provider, Severity.High, Confidence.High, msg); } continue; } if (Contains (parameter.Name, "url") || Contains (parameter.Name, "uri") || Contains (parameter.Name, "urn")) { Uri parsed = null; if (!Uri.TryCreate (value, UriKind.Absolute, out parsed)) { string msg = String.Format (CultureInfo.InvariantCulture, "The valued passed {0} can't be parsed to a valid Uri.", value); Runner.Report (provider, Severity.High, Confidence.High, msg); } continue; } if (Contains (parameter.Name, "guid")) { Guid g; if (!Guid.TryParse (value, out g)) { string msg = String.Format (CultureInfo.InvariantCulture, "The valued passed {0} can't be parsed to a valid Guid.", value); Runner.Report (provider, Severity.High, Confidence.High, msg); } continue; } } } } void CheckAttributesIn (ICustomAttributeProvider provider) { if (!provider.HasCustomAttributes) return; //There isn't a relationship between //IMetadataTokenProvider and ICustomAttributeProvider, //altough a method, or type, implements both interfaces. IMetadataTokenProvider metadataProvider = provider as IMetadataTokenProvider; foreach (CustomAttribute attribute in provider.CustomAttributes) { // if the attribute has no argument then there will be nothing to check later, skip it if (!attribute.HasConstructorArguments) continue; MethodReference ctor = attribute.Constructor; if (ctor.HasParameters) CheckParametersAndValues (metadataProvider, ctor, attribute.ConstructorArguments); } } void CheckAttributesIn (IEnumerable targets) { foreach (ICustomAttributeProvider provider in targets) CheckAttributesIn (provider); } public RuleResult CheckMethod (MethodDefinition method) { CheckAttributesIn (method); CheckAttributesIn (method.MethodReturnType); if (method.HasParameters) CheckAttributesIn (method.Parameters); if (method.HasGenericParameters) CheckAttributesIn (method.GenericParameters); return Runner.CurrentRuleResult; } public RuleResult CheckType (TypeDefinition type) { CheckAttributesIn (type); if (type.HasFields) CheckAttributesIn (type.Fields); if (type.HasProperties) CheckAttributesIn (type.Properties); if (type.HasEvents) CheckAttributesIn (type.Events); if (type.HasGenericParameters) CheckAttributesIn (type.GenericParameters); return Runner.CurrentRuleResult; } public RuleResult CheckAssembly (AssemblyDefinition assembly) { CheckAttributesIn (assembly); CheckAttributesIn (assembly.Modules); return Runner.CurrentRuleResult; } } } CheckParametersNullityInVisibleMethodsRule.cs0000664000175000017500000002025512413742070036406 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness// // Gendarme.Rules.Correctness.CheckParametersNullityInVisibleMethodsRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008,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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule checks if all nullable parameters of visible methods are compared /// with '''null''' before they get used. This reduce the likelyhood of the runtime /// throwing a NullReferenceException. /// /// /// Bad example: /// /// [DllImport ("message")] /// internal static extern byte [] Parse (string s, int length); /// /// public bool TryParse (string s, out Message m) /// { /// // is 's' is null then 's.Length' will throw a NullReferenceException /// // which a TryParse method should never do /// byte [] data = Parse (s, s.Length); /// if (data == null) { /// m = null; /// return false; /// } /// m = new Message (data); /// return true; /// } /// /// /// /// Good example: /// /// [DllImport ("message")] /// internal static extern byte [] Parse (string s, int length); /// /// public bool TryParse (string s, out Message m) /// { /// if (s == null) { /// m = null; /// return false; /// } /// byte [] data = Parse (s, s.Length); /// if (data == null) { /// m = null; /// return false; /// } /// m = new Message (data); /// return true; /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("A visible method does not check its parameter(s) for null values.")] [Solution ("Since the caller is unknown you should always verify all of your parameters to protect yourself.")] [FxCopCompatibility ("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods")] public class CheckParametersNullityInVisibleMethodsRule : Rule, IMethodRule { static OpCodeBitmask null_compare = new OpCodeBitmask (0x300180000000000, 0x0, 0x0, 0x0); static OpCodeBitmask check = new OpCodeBitmask (0x0, 0x70000000000FFE0, 0x100FFF800, 0x0); private Bitmask has_null_check = new Bitmask (); private void CheckParameter (ParameterDefinition parameter) { // nothing to do if it could not be resolved if (parameter == null) return; // out parameters can't be null if (parameter.IsOut) return; int sequence = parameter.Index; // ldarg this - 'this' cannot be null if (sequence == -1) return; // was there a null check done before ? if (has_null_check.Get (sequence)) return; // make sure we don't report it more than once has_null_check.Set (sequence); // ignore a value type parameter (as long as its not an array of value types) TypeReference ptype = parameter.ParameterType; // take care of references (ref) ByReferenceType rt = (ptype as ByReferenceType); if (rt != null) ptype = rt.ElementType; if (ptype.IsValueType && !ptype.IsArray) return; // last chance, if the type is a generic type constrained not to be nullable GenericParameter gp = (parameter.ParameterType as GenericParameter); if ((gp != null) && gp.HasNotNullableValueTypeConstraint) return; // nullable with no check // we assume a better control of family members so this is less severe Severity s = (parameter.Method as MethodDefinition).IsFamily ? Severity.Medium : Severity.High; Runner.Report (parameter, s, Confidence.Normal); } private void CheckArgument (MethodDefinition method, Instruction ins) { ParameterDefinition parameter = ins.GetParameter (method); if (parameter == null) return; // avoid checking parameters where a null check was already found if (has_null_check.Get (parameter.Index)) return; Instruction next = ins.Next; Code nc = next.OpCode.Code; switch (nc) { case Code.Box: // generics case Code.Ldind_Ref: // load indirect reference next = next.Next; nc = next.OpCode.Code; break; case Code.Isinst: has_null_check.Set (parameter.Index); return; } if (null_compare.Get (nc)) { has_null_check.Set (parameter.Index); } else { // compare with null (next or previous to current instruction) // followed by a CEQ instruction if (nc == Code.Ldnull) { if (next.Next.OpCode.Code == Code.Ceq) has_null_check.Set (parameter.Index); } else if (nc == Code.Ceq) { if (ins.Previous.OpCode.Code == Code.Ldnull) has_null_check.Set (parameter.Index); } } } private void CheckCall (MethodDefinition method, Instruction ins) { MethodDefinition md = (ins.Operand as MethodReference).Resolve (); if (md == null) return; // no dereference possible by calling a static method if (!md.IsStatic) { Instruction instance = ins.TraceBack (method); CheckParameter (instance.GetParameter (method)); } // if was pass one of our parameter to another call then // this new call "takes" responsability of the null check // note: not perfect but greatly reduce false positives if (!md.HasParameters) return; int base_index = md.IsStatic ? 0 : -1; for (int i = 0; i < md.Parameters.Count; i++) { Instruction pi = ins.TraceBack (method, base_index - i); if (pi == null) continue; // generic types will be be boxed, skip that if (pi.OpCode.Code == Code.Box) pi = pi.Previous; ParameterDefinition p = pi.GetParameter (method); if (p != null) has_null_check.Set (p.Index); } } public RuleResult CheckMethod (MethodDefinition method) { // p/invoke, abstract methods and method without parameters if (!method.HasBody || !method.HasParameters || !method.IsVisible ()) return RuleResult.DoesNotApply; has_null_check.ClearAll (); int parameters = method.Parameters.Count; // check foreach (Instruction ins in method.Body.Instructions) { if (ins.IsLoadArgument ()) { CheckArgument (method, ins); } else if (OpCodeBitmask.Calls.Get (ins.OpCode.Code)) { CheckCall (method, ins); } else if (check.Get (ins.OpCode.Code)) { Instruction owner = ins; // fields (no need to check static fields), ldind, ldelem, ldlen while ((owner != null) && check.Get (owner.OpCode.Code)) { owner = owner.TraceBack (method); } CheckParameter (owner.GetParameter (method)); } // stop processing instructions once all parameters are validated if (has_null_check.Count () == parameters) break; } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask null_compare = new OpCodeBitmask (); null_compare.Set (Code.Brfalse); null_compare.Set (Code.Brfalse_S); null_compare.Set (Code.Brtrue); null_compare.Set (Code.Brtrue_S); Console.WriteLine (null_compare); OpCodeBitmask check = new OpCodeBitmask (); check.UnionWith (OpCodeBitmask.LoadElement); check.UnionWith (OpCodeBitmask.LoadIndirect); check.Set (Code.Ldlen); check.Set (Code.Ldfld); check.Set (Code.Ldflda); check.Set (Code.Stfld); Console.WriteLine (check); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/DeclareEventsExplicitlyRule.cs0000664000175000017500000000611112413742070033500 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.DeclareEventsExplicitlyRule // // Authors: // Sebastien Pouliot // // 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 Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Correctness { /// /// This rule detect is an event handler was declared without the event /// keyword, making the declaration a simple field in its type. Such occurances /// are likely a typo and should be fixed. /// /// /// Bad example: /// /// public class EventLess { /// public static EventHandler<EventArgs> MyEvent; /// } /// /// /// /// Good example: /// /// public class Event { /// public static event EventHandler<EventArgs> MyEvent; /// } /// /// // suggested in https://bugzilla.novell.com/show_bug.cgi?id=669192 [Problem ("An event handler was declared without the 'event' keyword")] [Solution ("Add the missing 'event' keyword to your event handler declaration")] public class DeclareEventsExplicitlyRule : Rule, ITypeRule { static bool LookForEvent (MemberReference field, TypeDefinition type) { string fname = field.Name; foreach (EventDefinition evnt in type.Events) { if (fname == evnt.Name) return true; } return false; } public RuleResult CheckType (TypeDefinition type) { if (!type.HasFields || type.IsEnum) return RuleResult.DoesNotApply; // allow to short-circuit LookForEvent if the type has no event bool has_events = type.HasEvents; foreach (FieldDefinition field in type.Fields) { TypeReference ftype = field.FieldType; if (ftype.Namespace != "System") continue; switch (ftype.Name) { case "EventHandler": case "EventHandler`1": // is there (any?) event matching the field name ? if (!has_events || !LookForEvent (field, type)) Runner.Report (field, Severity.High, Confidence.High); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/MethodCanBeMadeStaticRule.cs0000664000175000017500000001060512413742070032760 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.MethodCanBeMadeStaticRule // // Authors: // Jb Evain // Sebastien Pouliot // // Copyright (C) 2007 Jb Evain // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule checks for methods that do not require anything from the current /// instance. Those methods can be converted into static methods, which helps /// a bit with performance (the hidden this parameter can be omitted), /// and clarifies the API. /// /// /// Bad example: /// /// public class Bad { /// private int x, y, z; /// /// bool Valid (int value) /// { /// // no instance members are used /// return (value > 0); /// } /// /// public int X { /// get { /// return x; /// } /// set { /// if (!Valid (value)) { /// throw ArgumentException ("X"); /// } /// x = value; /// } /// } /// /// // same for Y and Z ///} /// /// /// /// Good example: /// /// public class Good { /// private int x, y, z; /// /// static bool Valid (int value) /// { /// return (value > 0); /// } /// /// // same X (and Y and Z) as before ///} /// /// [Problem ("This method does not use any instance fields, properties or methods and can be made static.")] [Solution ("Make the method static.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] public class MethodCanBeMadeStaticRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // we only check non static, non virtual methods and not constructors if (method.IsStatic || method.IsVirtual || method.IsConstructor) return RuleResult.DoesNotApply; // we only check methods with a body if (!method.HasBody) return RuleResult.DoesNotApply; // we also don't check event callbacks, as they usually bring a lot of false positive, // and that developers are tied to their signature if (method.IsEventCallback ()) return RuleResult.DoesNotApply; // that aren't compiler generated (e.g. anonymous methods) or generated by a tool (e.g. web services) if (method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // methods with [Conditional] can be empty (not using 'this') IL-wise but not source-wise, ignore them if (method.HasCustomAttributes) { if (method.HasAttribute ("System.Diagnostics", "ConditionalAttribute")) return RuleResult.DoesNotApply; } // rule applies // if we find a use of the "this" reference, it's ok // in most (all?) case "this" is used with the ldarg_0 instruction if (OpCodeEngine.GetBitmask (method).Get (Code.Ldarg_0)) return RuleResult.Success; // but it's also valid to have an ldarg with a 0 value operand foreach (Instruction instr in method.Body.Instructions) { if (instr.OpCode.Code == Code.Ldarg) { ParameterDefinition pd = (instr.Operand as ParameterDefinition); if (pd.Index == -1) return RuleResult.Success; } } Runner.Report (method, Severity.Low, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/DisposableFieldsShouldBeDisposedRule.cs0000664000175000017500000002326512413742070035253 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.DisposableFieldsShouldBeDisposedRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // Copyright (C) 2008-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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// The rule inspects all fields for disposable types and, if System.IDisposable is /// implemented, checks that the type's Dispose method does indeed call Dispose on /// all disposable fields. /// /// /// Bad example: /// /// class DoesNotDisposeMember : IDisposable { /// byte[] buffer; /// IDisposable field; /// /// public void Dispose () /// { /// buffer = null; /// // field is not disposed /// } /// } /// /// /// /// Good example: /// /// class DisposePattern : IDisposable { /// byte[] buffer; /// IDisposable field; /// bool disposed; /// /// public void Dispose () /// { /// Dispose (true); /// } /// /// private void Dispose (bool disposing) /// { /// if (!disposed) { /// if (disposing) { /// field.Dispose (); /// } /// buffer = null; /// disposed = true; /// } /// } /// } /// /// [Problem ("This type contains disposable field(s) which aren't disposed.")] [Solution ("Ensure that every disposable field(s) is correctly disposed.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed")] public class DisposableFieldsShouldBeDisposedRule : Rule, ITypeRule { private List disposeableFields = new List (); private static MethodDefinition GetNonAbstractMethod (TypeReference type, MethodSignature signature) { MethodDefinition method = type.GetMethod (signature); if ((method == null) || method.IsAbstract) return null; return method; } public RuleResult CheckType (TypeDefinition type) { // rule applies only to types and structures (value types) if (type.IsEnum || type.IsInterface || type.IsDelegate ()) return RuleResult.DoesNotApply; // rule doesn't apply to generated code (out of developer control) if (type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // note: other rule will complain if there are disposable or native fields // in a type that doesn't implement IDisposable, so we don't bother here if (!type.Implements ("System", "IDisposable")) return RuleResult.DoesNotApply; MethodDefinition implicitDisposeMethod = GetNonAbstractMethod (type, MethodSignatures.Dispose); MethodDefinition explicitDisposeMethod = GetNonAbstractMethod (type, MethodSignatures.DisposeExplicit); bool has_implicit = (implicitDisposeMethod != null); bool has_explicit = (explicitDisposeMethod != null); // note: handled by TypesWithDisposableFieldsShouldBeDisposableRule if (!has_implicit && !has_explicit) return RuleResult.Success; //Check for baseDispose CheckBaseDispose (type, implicitDisposeMethod, explicitDisposeMethod); // skip the rest if the type does not provide any fields itself if (!type.HasFields) return Runner.CurrentRuleResult; //List of disposeableFields disposeableFields.Clear (); foreach (FieldDefinition field in type.Fields) { // we can't dispose static fields in IDisposable if (field.IsStatic) continue; if (field.IsGeneratedCode ()) continue; if (field.FieldType.IsArray) continue; TypeDefinition fieldType = field.FieldType.Resolve (); if (fieldType == null) continue; if (fieldType.Implements ("System", "IDisposable")) disposeableFields.Add (field); } // nothing to check for, take shortcut out if (disposeableFields.Count == 0) return Runner.CurrentRuleResult; List iList; List eList; if (has_implicit && has_explicit) { iList = disposeableFields; eList = new List (iList); } else { eList = iList = disposeableFields; } if (has_implicit) CheckIfAllFieldsAreDisposed (implicitDisposeMethod, iList); if (has_explicit) CheckIfAllFieldsAreDisposed (explicitDisposeMethod, eList); return Runner.CurrentRuleResult; } private void CheckBaseDispose (TypeDefinition type, MethodDefinition implicitDisposeMethod, MethodDefinition explicitDisposeMethod) { TypeDefinition baseType = type; while (!baseType.BaseType.IsNamed ("System", "Object")) { baseType = baseType.BaseType.Resolve (); // also checks parents, so no need to search further if ((baseType == null) || !baseType.Implements ("System", "IDisposable")) break; //we just check for Dispose() here MethodDefinition baseDisposeMethod = GetNonAbstractMethod (baseType, MethodSignatures.Dispose); if (baseDisposeMethod == null) continue; // no dispose method (yet) or an abstract one if (implicitDisposeMethod != null) CheckIfBaseDisposeIsCalled (implicitDisposeMethod, baseDisposeMethod); if (explicitDisposeMethod != null) CheckIfBaseDisposeIsCalled (explicitDisposeMethod, baseDisposeMethod); break; } } private void CheckIfBaseDisposeIsCalled (MethodDefinition method, MemberReference baseMethod) { bool found = false; if (method.HasBody) { OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); if (bitmask.Get (Code.Ldarg_0) && (OpCodeBitmask.Calls.Intersect (bitmask))) { //Check for a call to base.Dispose(); foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.Code != Code.Ldarg_0) //ldarg_0 (this) continue; Instruction call = ins.Next; //call baseMethod if (call == null) continue; if (call.OpCode.Code != Code.Call && call.OpCode.Code != Code.Callvirt) continue; MethodReference calledMethod = (MethodReference) call.Operand; if (calledMethod.GetFullName () != baseMethod.GetFullName ()) continue; found = true; } } } if (!found) { string s = String.Format (CultureInfo.InvariantCulture, "{0} should call base.Dispose().", method.GetFullName ()); Runner.Report (method, Severity.Medium, Confidence.High, s); } } static readonly MethodSignature DisposeBool = new MethodSignature ("Dispose", "System.Void", new string [] { "System.Boolean" }); private void CheckIfAllFieldsAreDisposed (MethodDefinition method, ICollection fields) { if (method.HasBody) { OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); if (OpCodeBitmask.Calls.Intersect (bitmask)) { //Check if Dispose(bool) is called and if all fields are disposed foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodDefinition md = (ins.Operand as MethodDefinition); if ((md != null) && DisposeBool.Matches (md)) ProcessMethod (md, fields); break; } } // besides the call[virt] if must have a Ldarg0 and Ldfld if (bitmask.Get (Code.Ldarg_0) && bitmask.Get (Code.Ldfld)) ProcessMethod (method, fields); } } if (fields.Count == 0) return; foreach (FieldDefinition field in fields) { string s = String.Format (CultureInfo.InvariantCulture, "Since {0} is Disposable {1}() should call {0}.Dispose()", field.Name, method.Name); Runner.Report (field, Severity.High, Confidence.High, s); } } // note: we CANNOT use OpCodeEngine inside this call since it's also used on code // that can resides outside the assembly set (i.e. that the engine did not process) private static void ProcessMethod (MethodDefinition method, ICollection fieldsToDispose) { if (!method.HasBody) return; foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.Code != Code.Ldarg_0) //ldarg_0 (this) continue; Instruction ldfld = ins.Next; if (ldfld == null) continue; if (ldfld.OpCode.Code != Code.Ldfld) //ldfld continue; Instruction call = ldfld.Next; //call Dispose if (call == null) continue; if (call.OpCode.Code != Code.Call && call.OpCode.Code != Code.Callvirt) continue; if (!MethodSignatures.Dispose.Matches (call.Operand as MethodReference)) continue; FieldDefinition field = (ldfld.Operand as FieldDefinition); if (field != null) fieldsToDispose.Remove (field); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/BadRecursiveInvocationRule.cs0000664000175000017500000001451112413742070033320 0ustar00directhexdirecthex00000000000000// // BadRecursiveInvocationRule: looks for instances of problematic recursive // invocations. // // Authors: // Aaron Tomb // Sebastien Pouliot // // Copyright (C) 2005 Aaron Tomb // 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule checks for a few common scenarios where a method may be infinitely /// recursive. For example, getter properties which call themselves or methods /// with no conditional code which call themselves (instead of the base method). /// /// /// Bad example: /// /// string CurrentDirectory { /// get { /// return CurrentDirectory; /// } /// } /// /// /// /// Good example: /// /// string CurrentDirectory { /// get { /// return base.CurrentDirectory; /// } /// } /// /// [Problem ("This method, or property, invokes itself recursively in a suspicious way.")] [Solution ("Ensure that an exit condition exists to terminate recursion.")] [EngineDependency (typeof (OpCodeEngine))] public class BadRecursiveInvocationRule : Rule, IMethodRule { private static bool CompareMethods (MethodReference method1, MethodReference method2, bool virtual_call) { if (method1 == null) return (method2 == null); if (method2 == null) return false; // shortcut, if it's not virtual then only compare metadata tokens if (!virtual_call) return (method1.MetadataToken == method2.MetadataToken); // we could be implementing an interface (skip position 0 because of .ctor and .cctor) string m1name = method1.Name; bool explicit_interface = (m1name.IndexOf ('.') > 0); if (!explicit_interface && (m1name != method2.Name)) return false; // compare parameters if (!method1.CompareSignature (method2)) return false; TypeReference t2 = method2.DeclaringType; TypeDefinition t2r = t2.Resolve (); if (!explicit_interface && (t2r != null) && !t2r.IsInterface) return true; // we're calling into an interface and this could be us! foreach (MethodReference mr in method1.Resolve ().Overrides) { if (mr.DeclaringType.IsNamed (t2.Namespace, t2.Name)) return true; } return false; } private static bool CheckForEndlessRecursion (MethodDefinition method, int index) { int pcount = method.Parameters.Count; if (!method.HasThis) pcount--; if (index <= pcount) return false; for (int i = pcount; i >= 0; i--) { if (!CheckParams (method, ref index, i)) return false; index--; } return true; } private static bool CheckParams (MethodDefinition method, ref int index, int paramNum) { Instruction insn = method.Body.Instructions [index - 1]; while (insn != null) { switch (insn.OpCode.Code) { case Code.Ldarg: case Code.Ldarg_S: ParameterDefinition param = (ParameterDefinition) insn.Operand; if (method.IsStatic) paramNum++; return (param.Index == paramNum - 1); case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: return (paramNum == (int) (insn.OpCode.Code - Code.Ldarg_0)); case Code.Ldloc: case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: case Code.Ldloc_S: case Code.Ldloca: case Code.Ldloca_S: case Code.Ldfld: case Code.Ldflda: case Code.Call: case Code.Calli: case Code.Callvirt: case Code.Newarr: case Code.Newobj: return false; } index--; insn = insn.Previous; } return false; } OpCodeBitmask CallsNew = new OpCodeBitmask (0x8000000000, 0x4400000000000, 0x0, 0x0); public RuleResult CheckMethod (MethodDefinition method) { // rule applies only if the method has a body if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no Call[virt] or NewObj in the method if (!CallsNew.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; IList instructions = method.Body.Instructions; for (int i = 0; i < instructions.Count; i++) { Instruction ins = instructions [i]; switch (ins.OpCode.FlowControl) { case FlowControl.Call: MethodReference callee = (ins.Operand as MethodReference); // check type name only if the call isn't virtual bool virtual_call = (ins.OpCode.Code == Code.Callvirt); // continue scanning unless we're calling ourself if (!CompareMethods (method, callee, virtual_call)) break; // recursion detected! check if there a way out of it if (CheckForEndlessRecursion (method, i)) { Runner.Report (method, ins, Severity.Critical, Confidence.High); return RuleResult.Failure; } break; case FlowControl.Cond_Branch: case FlowControl.Return: case FlowControl.Throw: // if there's a way to break free before a recursive call then we let it go return RuleResult.Success; } } // should never be reached (since there's always a RET instruction) return RuleResult.Success; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/0000775000175000017500000000000012642235741026454 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ChangeLog0000664000175000017500000003417312413742070030230 0ustar00directhexdirecthex000000000000002010-08-06 Sebastien Pouliot * Makefile.am: Add new files to dist 2010-08-06 Antoine Vandecreme * Tests.Rules.Correctness.csproj: Add Resource.resx and Resource.Designer.cs to project * Resource.resx: Added * Resource.Designer.cs: Added * ProvideCorrectArgumentsToFormattingMethodsTest.cs: Add tests cases with string resources as format 2010-05-01 Sebastien Pouliot * AvoidMethodsWithSideEffectsInConditionalCodeTest.cs: Duplicate the namespace used by code contracts on FX4 and the latest Microsoft.Contracts.dll (for earlier releases like 3.5 and SL3) 2010-04-28 Sebastien Pouliot * MethodCanBeMadeStaticTest.cs: Add test case with [Conditional] method. Update other test cases to the "newer" way of unit testing rules. * ProvideCorrectArgumentsToFormattingMethodsTest.cs: More test cases where an immediate if, e.g. cond ? "a" : "b", would result in false positives (fixed in InstructionRock.TraceBack) 2010-04-25 Sebastien Pouliot * DisposableFieldsShouldBeDisposedTest.cs: Add test case where C# automatic properties are used (which creates a backing field). Test case submitted by Guillaume Gautreau 2010-04-23 Sebastien Pouliot * AvoidCodeWithSideEffectsInConditionalCodeTest.cs: Skip Bad2 if debugging symbols are unavailable (more effective than comments) 2010-04-19 Sebastien Pouliot * AvoidCodeWithSideEffectsInConditionalCodeTest.cs: Add a comment about why 'Bad2' could fail on Windows - i.e. failing to load Mono.Cecil.Pdb.dll * ProvideCorrectRegexPatternRule.cs: Make test cases consistent and add new ones. 2010-04-10 Sebastien Pouliot * ProvideCorrectArgumentsToFormattingMethodsTest.cs: Additional test cases provided by Antoine Vandecrème 2010-01-15 Sebastien Pouliot * DoNotRoundIntegersTest.cs: Fix test under non-English culture (where ',' is used as a decimal separator). Issue reported by Guillaume Gautreau. 2010-01-04 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsTest.cs: Add a generic and a non-generic test case for #567817 2010-01-02 Sebastien Pouliot * UseNoInliningWithGetCallingAssemblyTest.cs: New. Unit tests for UseNoInliningWithGetCallingAssemblyRule 2009-11-28 Sebastien Pouliot * ReviewInconsistentIdentityTest.cs: Add test case with abstract methods. Make the test fixture public (otherwise it won't be executed by nunit). Fix bug #550152 (also reported on the m-l). 2009-04-30 Jesse Jones * AvoidMethodsWithSideEffectsInConditionalCodeTest.cs: Added new rule. 2009-03-19 Jesse Jones * ReviewInconsistentIdentityTest.cs: Updated for rule tweaks. 2009-01-03 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsTest.cs: Add test cases for 'out' parameters. 2008-12-29 Sebastien Pouliot * ReviewUselessControlFlowTest.cs: Reorder and comment the cases where a compiler (like CSC) can remove/optimize the useless control flow (and making the test case fail). * ReviewSelfAssignmentTest.cs: Add test cases for chaining with indexers. 2008-12-19 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsTest.cs: Add test cases where the null check condition is inverted, e.g. (null == obj) instead of the more common (obj == null). 2008-12-19 Jesse Jones * ReviewInconsistentIdentityTest.cs: Added. 2008-12-10 Sebastien Pouliot * ProvideCorrectArgumentsToFormattingMethodsTest.cs: Add test case where a string ends with '{'. This is likely what's happening in #458175 2008-12-07 Jesse Jones * DoNotRecurseInEqualityTest.cs: Added. 2008-11-30 Sebastien Pouliot * AttributeStringLiteralsShouldParseCorrectlyTest.cs: Change the DoesNotApply into Success. 2008-11-15 Jesse Jones * ReviewCastOnIntegerMultiplicationTest.cs: Added some unchecked epressions and a few checked tests. * ReviewUseOfInt64BitsToDoubleTest.cs: StaticFieldGood uses unchecked math. 2008-11-13 Jesse Jones * NullDerefTest.cs: Added a couple more false positives. 2008-11-07 Alan McGovern * Tests.Rules.Correctness.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-02 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsTest.cs: Remove unneeded System.Drawing from the using clauses. 2008-11-01 Sebastien Pouliot * CheckParametersNullityInVisibleMethodsTest.cs: New. Unit tests for CheckParametersNullityInVisibleMethodsRule 2008-10-30 Jesse Jones * NullDerefTest.cs: New. Only has a few tests for now. The rule still reports too many false positives so for now the test and the rule are not part of the official build. 2008-10-27 Sebastien Pouliot * DisposableFieldsShouldBeDisposedTest.cs: Add more test cases for better coverage. * FinalizersShouldCallBaseClassFinalizerTest.cs: Moved from Design. Updated namespace. * Test.Rules.Correctness.mdp: Add moved rule to the MD project 2008-10-26 Sebastien Pouliot * DisposableFieldsShouldBeDisposedTest.cs: Moved from Design. 2008-10-11 Sebastien Pouliot * ReviewCastOnIntegerDivisionTest.cs: New. Unit tests for ReviewCastOnIntegerDivisionRule. * ReviewCastOnIntegerMultiplicationTest.cs: New. Unit tests for ReviewCastOnIntegerMultiplicationRule. 2008-10-06 Néstor Salceda * AttributeStringLiteralsShouldParseCorrectlyTest.cs: New. Unit tests for AttributeStringLiteralsShouldParseCorrectlyRule. * Test.Rules.Correctness.mdp: Updated MD project file. 2008-09-23 Sebastien Pouliot * ReviewDoubleAssignmentTest.cs: Change from Success to DoesNotApply test cases where no DUP instructions are present. * ReviewUselessControlFlowTest.cs: Add test case where no conditional branches are present in a method (e.g. empty). * ReviewUseOfInt64BitsToDoubleTest.cs: Change from Success to DoesNotApply test cases where no CALL[VIRT] or CONV_[OVF_][I|U] 8[_UN] instructions are present. * ReviewUseOfModuloOneOnIntegersTest.cs: Change from Success to DoesNotApply test cases where no REM[_UN] instructions are present. 2008-09-21 Sebastien Pouliot * AvoidFloatingPointEqualityTest.cs: New. Updated the old FloatComparisonRuleTest to use the new test syntax and to have better coverage. * FloatComparisonRuleTest.cs: Removed (was renamed from above) * DontCompareWithNaNTest.cs: Use the new test syntax and add more coverage. 2008-09-21 Sebastien Pouliot * AvoidConstructorsInStaticTypesTest.cs: Add more coverage. * BadRecursiveInvocationTest.cs: Add more coverage. Add test cases with many parameters - one of them currently fails on mono compiled assemblies (works when CSC compiles it). * CallingEqualsWithNullArgTest.cs: Add more coverage. Ensure a LDNULL instruction is present in some test case so the rule does not ignore them. 2008-09-14 Sebastien Pouliot * ProvideCorrectArgumentsToFormattingMethodsRule.cs: Add test cases for using a method return value as an argument of String.Format and for the special "{{" formatting code. 2008-08-18 Sebastien Pouliot * UseValueInPropertySetterTest.cs: Add an additional test case when [MarshalAs] is used. In this case the parameter is not named value at least not when compiled with [g]mcs (csc seems fine). 2008-08-18 Sebastien Pouliot * CallingEqualsWithNullArgTest.cs: Convert test to new, simpler, API and cover 100% of the rule. * UseValueInPropertySetterTest.cs: Convert test to new, simpler, API and cover 100% of the rule. 2008-07-24 Sebastien Pouliot * DoNotRoundIntegersTest.cs: Added new test case provided by Richard Birkby. 2008-07-23 Sebastien Pouliot * BadRecursiveInvocationTest.cs: Update test cases to new format and add cases for generics and explicit interfaces. 2008-07-18 Nestor Salceda * ProvideCorrectArgumentsToFormattingMethodsTest.cs: New. Unit tests for ProvideCorrectArgumentsToFormattingMethodsRule. * Test.Rules.Correctness.mdp: Add tests to the MD project file. 2008-07-12 Sebastien Pouliot * AvoidConstructorsInStaticTypesTest.cs: Update unit tests to the new format/api and to the small changes made to the rule. 2008-07-07 Stephane Delcroix * ConsoleRunner.cs: fix a typo 2008-07-06 Sebastien Pouliot * ReviewSelfAssignmentTest.cs: New. Unit tests for ReviewSelfAssignmentRule. * Test.Rules.Correctness.mdp: Add tests to the MD project file. 2008-06-27 Sebastien Pouliot * ReviewUseOfInt64BitsToDoubleTest.cs: New. Unit tests for ReviewUseOfInt64BitsToDoubleRule. * Test.Rules.Correctness.mdp: Add tests to the MD project file. 2008-06-23 Sebastien Pouliot * DoNotRoundIntegersTest.cs: New. Unit tests for DoNotRoundIntegersRule * Test.Rules.Correctness.mdp: Add tests to the MD project file. 2008-06-16 Sebastien Pouliot * ReviewUselessControlFlowTest.cs: New. Unit tests for ReviewUselessControlFlowRule * Test.Rules.Correctness.mdp: Add tests to the MD project file. 2008-06-15 Sebastien Pouliot * ReviewDoubleAssignmentTest.cs: Add test case where the field comes from differrent instances of the same type. * ReviewUseOfModuloOneOnIntegersTest.cs: New. Unit tests for ReviewUseOfModuloOneOnIntegersRule * Test.Rules.Correctness.mdp: Add tests to the MD project file. 2008-06-14 Sebastien Pouliot * ReviewDoubleAssignmentTest.cs: New. Unit tests for ReviewDoubleAssignmentRule * Test.Rules.Correctness.mdp: Add tests to the MD project file. 2008-05-11 Andres G. Aragoneses * Test.Rules.Correctness.mdp: Fix references. 2008-05-10 Andres G. Aragoneses * UseValueInPropertySetterTest.cs, AvoidConstructorsInStaticTypesTest.cs, DontCompareWithNaNTest.cs, CallingEqualsWithNullArgTest.cs, BadRecursiveInvocationTest.cs, FloatComparisonRuleTest.cs, MethodCanBeMadeStaticTest.cs: Update (to fix build): somebody forgot to include the new namespace when moving TestRunner. 2008-04-27 Jb Evain * MethodCanBeMadeStaticTest.cs: test that ensure that this rule doesn't apply on event callbacks. 2008-02-16 Sebastien Pouliot * DontCompareWithNaNTest.cs: Fix name change. * FloatComparisonRuleTest.cs: Fix test not to depend on compiler. 2008-02-15 Sebastien Pouliot * AvoidConstructorsInStaticTypesTest.cs * BadRecursiveInvocationTest.cs * CallingEqualsWithNullArgTest.cs * DontCompareWithNaNTest.cs * FloatComparisonRuleTest.cs * MethodCanBeMadeStaticTest.cs * UseValueInPropertySetterTest.cs: Update unit tests wrt framework changes. 2008-01-29 Sebastien Pouliot * FloatComparisonRuleTest.cs: Add test case where we compare with "this". * UseValueInPropertySetterTest.cs: Add test case where a "this []" property is used. 2008-01-12 Sebastien Pouliot * DontCompareWithNaNTest.cs: New. Unit tests for NaN. * UseValueInPropertySetterTest.cs: Fix Empty test case since we don't report them anymore (too many false positives). 2008-01-06 Sebastien Pouliot * BadRecursiveInvocationTest.cs: Add more complex test cases to hunt for false positives (detected while scanning corlib). * FloatComparisonRuleTest.cs: Duplicate test cases for Double. Add test cases for FP conversion and FP in arrays. * UseValueInPropertySetterTest.cs: Add test case for empty setter and for a call on the setter value. 2008-01-05 Sebastien Pouliot * AvoidConstructorsInStaticTypesTest.cs: line endings * FloatComparisonRuleTest.cs: line endings * UseValueInPropertySetterTest.cs: line endings and new test cases for static properties * Test.Rules.Correctness.mdp: MonoDevelop removed the "./" prefix before each file. 2007-12-16 Sebastien Pouliot * UseValueInPropertySetterTest.cs: Add test cases where an exception is thrown in the setter (i.e. value isn't used but this should not be reported as an error). 2007-11-03 Nestor Salceda * AvoidConstructorsInStaticTypesTest.cs: Added test for avoid false positives if the class doesn't contains fields or methods. 2007-10-07 Sebastien Pouliot * AvoidConstructorsInStaticTypesTest.cs: Unit tests (Lukasz Knop, GSoC 2007) * CallingEqualsWithNullArgTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * FloatComparisonRuleTest.cs: Unit tests (Lukasz Knop, GSoC 2007) * UseValueInPropertySetterTest.cs: Unit tests (Lukasz Knop, GSoC 2007) * Test.Rules.Correctness.mdp: Update project files. 2007-02-27 Jb Evain * MethodCanBeMadeStaticTest.cs: Add tests for rule MethodCanBeMadeStatic. 2006-10-16 Sebastien Pouliot * BadRecursiveInvocationTest.cs: Modify existing test case to make sure parameter names aren't required to match in a recursive call (e.g. calling base class). 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-20 Jonathan Chambers * Test.Rules.Correctness.csproj: Make reference to nunit.framework not a specific version for portability. 2006-07-31 Sebastien Pouliot * Test.Rules.Correctness.mdp: New. Project file for MonoDevelop. * BadRecursiveInvocationTest.cs: Convert (and add) tests to NUnit format. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ReviewDoubleAssignmentTest.cs0000664000175000017500000001267412413742070034274 0ustar00directhexdirecthex00000000000000// // Unit test for ReviewDoubleAssignmentRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class ReviewDoubleAssignmentTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } private string s; protected byte b; internal ulong ul1, ul2; public void SingleAssignmentOnField () { s = "42"; Console.WriteLine (s); } public void DoubleAssignmentOnField () { s = s = "42"; Console.WriteLine (s); b = b = 42; Console.WriteLine (b); } public void DoubleAssignementOnDifferentFields () { ul1 = ul2 = 42; Console.WriteLine ("{0} - {1}", ul1, ul2); } struct Struct { public long Field; } public void DoubleAssignementOnDifferentInstanceFields () { Struct s1, s2; s1.Field = s2.Field = 42; Console.WriteLine ("{0} - {1}", s1.Field, s2.Field); } [Test] public void Fields () { // no DUP instruction AssertRuleDoesNotApply ("SingleAssignmentOnField"); AssertRuleFailure ("DoubleAssignmentOnField", 2); AssertRuleSuccess ("DoubleAssignementOnDifferentFields"); AssertRuleSuccess ("DoubleAssignementOnDifferentInstanceFields"); } static DateTime dt; static DateTimeKind dtk; static short s1; static short s2; static void SingleAssignmentOnStaticField () { dt = DateTime.UtcNow; Console.WriteLine (dt); } static void DoubleAssignmentOnStaticField () { dt = dt = DateTime.UtcNow; Console.WriteLine (dt); dtk = dtk = DateTimeKind.Unspecified; Console.WriteLine (dtk); } public void DoubleAssignementOnDifferentStaticFields () { s1 = s2 = 42; Console.WriteLine ("{0} - {1}", s1, s2); } [Test] public void StaticFields () { // no DUP instruction AssertRuleDoesNotApply ("SingleAssignmentOnStaticField"); AssertRuleFailure ("DoubleAssignmentOnStaticField", 2); AssertRuleSuccess ("DoubleAssignementOnDifferentStaticFields"); } public void SingleAssignmentOnLocal () { int x = 42; Console.WriteLine (x); } public void DoubleAssignmentOnLocal () { long x = x = -42; Console.WriteLine (x); ulong y = y = 42; Console.WriteLine (y); } public void DoubleAssignementOnDifferentLocals () { byte b1, b2; b1 = b2 = 42; Console.WriteLine ("{0} - {1}", b1, b2); } [Test] public void Locals () { // no DUP instruction AssertRuleDoesNotApply ("SingleAssignmentOnLocal"); AssertRuleFailure ("DoubleAssignmentOnLocal", 2); AssertRuleSuccess ("DoubleAssignementOnDifferentLocals"); } static void SingleAssignmentOnStaticLocal () { float f = 42.0f; Console.WriteLine (f); } static void DoubleAssignmentOnStaticLocal () { double d = d = 42.0; Console.WriteLine (d); } static void DoubleAssignementOnDifferentStaticLocals () { float f1, f2; f1 = f2 = 42.0f; Console.WriteLine ("{0} - {1}", f1, f2); } [Test] public void StaticLocals () { // no DUP instruction AssertRuleDoesNotApply ("SingleAssignmentOnStaticLocal"); AssertRuleFailure ("DoubleAssignmentOnStaticLocal", 1); AssertRuleSuccess ("DoubleAssignementOnDifferentStaticLocals"); } static byte bs; public void MixedDoubleAssignments () { // instance = static = value b = bs = 42; Console.WriteLine ("{0} - {1}", b, bs); bs = b = 21; Console.WriteLine ("{0} - {1}", bs, b); } public void SingleAssignments (byte x, byte y) { b = x; Console.WriteLine (b); bs = y; Console.WriteLine (bs); } public void Call () { SingleAssignments (42, 42); } [Test] public void Others () { AssertRuleSuccess ("MixedDoubleAssignments"); // no DUP instruction AssertRuleDoesNotApply ("SingleAssignments"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ReviewUseOfModuloOneOnIntegersTest.cs0000664000175000017500000001014112413742070035655 0ustar00directhexdirecthex00000000000000// // Unit test for ReviewUseOfModuloOneOnIntegersRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class ReviewUseOfModuloOneOnIntegersTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public int ModuloOne (int i) { return (i % 1); // LDC.I4.1 + REM } public int ModuloTwo (int i) { return (i % 2); } public int Modulo (int i, int m) { return (i % m); } public uint ModuloOneUnsigned (uint i) { return (i % 1); // LDC.I4.1 + REM } public uint ModuloTwoUnsigned (uint i) { return (i % 2); } public uint ModuloUnsigned (uint i, uint m) { return (i % m); } [Test] public void LocalVariables () { AssertRuleFailure ("ModuloOne", 1); AssertRuleSuccess ("ModuloTwo"); AssertRuleSuccess ("Modulo"); AssertRuleFailure ("ModuloOneUnsigned", 1); AssertRuleSuccess ("ModuloTwoUnsigned"); AssertRuleSuccess ("ModuloUnsigned"); } private const long LongOne = 1; public long TwoModuloOneConst (long i) { return ((i % LongOne) % 1); // LDC.I4.1 + CONV.I8 + REM } [Test] public void ConstantAndVariable () { AssertRuleFailure ("TwoModuloOneConst", 2); } // the value is set inside the class constructor protected readonly ulong ULongOne = 1; public ulong ModuloOneReadOnly (ulong i) { return (i % ULongOne); } [Test] public void ReadOnly () { AssertRuleSuccess ("ModuloOneReadOnly"); } public byte ModuloByte (byte i) { return (byte) (i % 1); } public sbyte ModuloSByte (sbyte i) { return (sbyte) (i % 1); } public double ModuloOneDouble (double d) { return (d % 1.0d); // LDC.R8 1 + REM } public float ModuloOneFloat (float f) { return (f % 1.0f); // LDC.R4 1 + REM } [Test] public void FloatingPoint () { AssertRuleSuccess ("ModuloOneDouble"); AssertRuleSuccess ("ModuloOneFloat"); } public Decimal ModuloOneDecimal (decimal d) { return ((d % 1.0m) % 1m); } public Decimal ModuloOneDecimalConst (decimal d) { return (d % Decimal.One); } [Test] public void Decimals () { // decimals needs a method call - i.e. it's not handled by Rem[_Un] IL instructions AssertRuleDoesNotApply ("ModuloOneDecimal"); AssertRuleDoesNotApply ("ModuloOneDecimalConst"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ReviewCastOnIntegerDivisionTest.cs0000664000175000017500000001602112413742070035231 0ustar00directhexdirecthex00000000000000// // Unit test for ReviewCastOnIntegerDivisionRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class ReviewCastOnIntegerDivisionTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no DIV[_UN] AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public double DoubleBadIntDivParameters (int a, int b) { // this compiles into: ldarg.1 ldarg2 div conv.r8 // so the division is made on integers, then the result is casted into a double return a / b; } public double DoubleCorrectIntDivParameters (int a, int b) { // this compiles into: ldarg.1 conv.r8 ldarg2 conv.r8 div // so the division is made on doubles return (double) a / b; } public float FloatBadIntDivParameters (short a, short b) { return a / b; } public float FloatCorrectIntDivParameters (short a, short b) { return (float) a / b; } [Test] public void Parameters () { Assert.AreEqual (1.0d, DoubleBadIntDivParameters (3, 2), "3/2==1d"); AssertRuleFailure ("DoubleBadIntDivParameters"); Assert.AreEqual (1.5d, DoubleCorrectIntDivParameters (3, 2), "3/2==1.5d"); AssertRuleSuccess ("DoubleCorrectIntDivParameters"); Assert.AreEqual (1.0f, FloatBadIntDivParameters (3, 2), "3/2==1f"); AssertRuleFailure ("FloatBadIntDivParameters"); Assert.AreEqual (1.5f, FloatCorrectIntDivParameters (3, 2), "3/2==1.5f"); AssertRuleSuccess ("FloatCorrectIntDivParameters"); } static byte sa = 5; static byte sb = 2; static double sdr; static void DoubleBadIntDivStaticFields () { sdr = sa / sb; } static void DoubleGoodIntDivStaticFields () { sdr = sa / (double) sb; } static sbyte ssa = 5; static sbyte ssb = 2; static float sfr; static void FloatBadIntDivStaticFields () { sfr = ssa / ssb; } static void FloatIntDivStaticFields () { sfr = ssa / (float) ssb; } [Test] public void StaticFields () { DoubleBadIntDivStaticFields (); Assert.AreEqual (2.0d, sdr, "5/2==2d"); AssertRuleFailure ("DoubleBadIntDivStaticFields"); DoubleGoodIntDivStaticFields (); Assert.AreEqual (2.5d, sdr, "3/2==1.5d"); AssertRuleSuccess ("DoubleGoodIntDivStaticFields"); FloatBadIntDivStaticFields (); Assert.AreEqual (2.0d, sfr, "5/2==2f"); AssertRuleFailure ("FloatBadIntDivStaticFields"); FloatIntDivStaticFields (); Assert.AreEqual (2.5d, sfr, "3/2==1.5f"); AssertRuleSuccess ("FloatIntDivStaticFields"); } uint ia = 10; uint ib = 3; double idr; void DoubleBadIntDivFields () { idr = ia / ib; } void DoubleGoodIntDivFields () { idr = (double) ia / (double) ib; } ushort iua = 10; ushort iub = 3; float ifr; void FloatBadIntDivFields () { ifr = iua / iub; } void FloatGoodIntDivFields () { ifr = (float) iua / (float) iub; } [Test] public void Fields () { DoubleBadIntDivFields (); Assert.AreEqual (3.0d, idr, "10/3==3d"); AssertRuleFailure ("DoubleBadIntDivFields"); DoubleGoodIntDivFields (); Assert.AreEqual (3.33d, idr, 0.1d, "10/3==3.33d"); AssertRuleSuccess ("DoubleGoodIntDivFields"); FloatBadIntDivFields (); Assert.AreEqual (3.0f, ifr, "10/3==3f"); AssertRuleFailure ("FloatBadIntDivFields"); FloatGoodIntDivFields (); Assert.AreEqual (3.33f, ifr, 0.1f, "10/3==3.33f"); AssertRuleSuccess ("FloatGoodIntDivFields"); } double DoubleBadIntDivLocals () { long a = 42; return a / 4; } double DoubleGoodIntDivLocals () { long b = 4; return 42 / (double) b; } float FloatBadIntDivLocals () { ulong a = 42; return a / 4; } float FloatGoodIntDivLocals () { ulong b = 4; return 42 / (float) b; } [Test] public void Locals () { Assert.AreEqual (10.0d, DoubleBadIntDivLocals (), "42/4==10d"); AssertRuleFailure ("DoubleBadIntDivLocals"); Assert.AreEqual (10.5d, DoubleGoodIntDivLocals (), 0.1d, "42/4==10.5d"); AssertRuleSuccess ("DoubleGoodIntDivLocals"); Assert.AreEqual (10.0f, FloatBadIntDivLocals (), "42/4==10f"); AssertRuleFailure ("FloatBadIntDivLocals"); Assert.AreEqual (10.5f, FloatGoodIntDivLocals (), 0.1d, "42/4==10.5f"); AssertRuleSuccess ("FloatGoodIntDivLocals"); } double DivD (float a, float b) { return a / b; } float DivF (double a, double b) { return (float) (a / b); } [Test] public void DoubleFloatCasting () { AssertRuleSuccess ("DivD"); AssertRuleSuccess ("DivF"); } double DoubleBadArray (int [] array) { return array [0] / array [1]; } double DoubleGoodArray (double[] array) { return array [0] / array [1]; } float FloatBadArray (short [] array) { return array [0] / array [1]; } float FloatGoodArray (float [] array) { return array [0] / array [1]; } [Test] public void Array () { AssertRuleFailure ("DoubleBadArray", 1); AssertRuleSuccess ("DoubleGoodArray"); AssertRuleFailure ("FloatBadArray", 1); AssertRuleSuccess ("FloatGoodArray"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ProvideCorrectRegexPatternTest.cs0000664000175000017500000001522412413742070035124 0ustar00directhexdirecthex00000000000000// // Unit tests for ProvideCorrectRegexPatternRule // // Authors: // Cedric Vivier // Sebastien Pouliot // // Copyright (C) 2008 Cedric Vivier // 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; using NUnit.Framework; using Gendarme.Rules.Correctness; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; using System.Text.RegularExpressions; using System.Configuration; namespace Test.Rules.Correctness { class RegexCases { string foo = "foo"; const string good1 = "good1"; const string bad1 = "bad1\\"; Regex re; string DoesNotApply1 () { return bad1; } void Success0 () { re = new Regex (@"^\\"); } void Failure0 () { re = new Regex ("^\\"); } void Success1 () { re = new Regex (good1); } void Failure1 () { re = new Regex (bad1); } void Success2 (string pattern) { var re = new Regex (pattern); } void Failure2 () { var re = new Regex (@"^([a-z)*"); } bool Success2b (Regex re) { return re.IsMatch ("^([a-z])*"); } void Success2c () { var re = new Regex (this.ToString ()); } void Failure2d1 (bool good) { var re = new Regex (good ? "bad\\" : "good"); } void Failure2d2 (bool good) { var re = new Regex (good ? "good" : "bad\\"); } void Failure2d3 (bool good) { var re = new Regex (good ? null : "good"); } void Failure2d4 (bool good) { var re = new Regex (good ? "good" : null); } void Failure2d5 (bool good) { var re = new Regex (good ? String.Empty : "good"); } void Failure2d6 (bool good) { var re = new Regex (good ? "good" : String.Empty); } bool Success3 (string pattern) { return Regex.IsMatch (foo, pattern); } bool Failure3 (string text) { return Regex.IsMatch (text, @"\9"); } bool Success4 (string pattern) { if (null != Regex.Match (good1, "good")) return true; return Regex.IsMatch (foo, pattern); } bool Failure4 (string text) { if (null != Regex.Match (good1, "good")) return true; return Regex.IsMatch (text, @"\9"); } string Success5 (string source) { return Regex.Replace (source, "foo", "niaa"); } string Failure5 (string source) { return Regex.Replace (source, "foo\\", "niaa"); } string Success6 (string source) { var re = new Regex ("good"); return re.Replace ("bad\\", "bad\\"); } string Failure6 (string source) { return Regex.Replace (source, null, "niaa"); } string Failure7 (string source) { return Regex.Replace (source, "", "niaa"); } string Failure67 (string source) { source = Regex.Replace (source, null, "niaa"); return Regex.Replace (source, "", "niaa"); } } class ValidatorCases { void Success1 (string input) { (new RegexStringValidator ("^[a-z]+")).Validate (input); } void Failure1 (string input) { (new RegexStringValidator ("^[a-z+")).Validate (input); } } [TestFixture] public class ProvideCorrectRegexPatternTest : MethodRuleTestFixture { static bool raisedAnalyzeModuleEvent; [SetUp] public void RaiseAnalyzeModuleEvent () { if (raisedAnalyzeModuleEvent) return; raisedAnalyzeModuleEvent = true; ((TestRunner) Runner).OnModule (DefinitionLoader.GetTypeDefinition ().Module); } [Test] public void DoesNotApply0 () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("DoesNotApply1"); } [Test] public void Success0 () { AssertRuleSuccess ("Success0"); } [Test] public void Success1 () { AssertRuleSuccess ("Success1"); } [Test] public void Success2 () { AssertRuleSuccess ("Success2"); AssertRuleSuccess ("Success2b"); AssertRuleSuccess ("Success2c"); } [Test] public void Success3 () { AssertRuleSuccess ("Success3"); } [Test] public void Success4 () { AssertRuleSuccess ("Success4"); } [Test] public void Success5 () { AssertRuleSuccess ("Success5"); } [Test] public void Success6 () { AssertRuleSuccess ("Success6"); } [Test] public void Failure0 () { AssertRuleFailure ("Failure0", 1); } [Test] public void Failure1 () { AssertRuleFailure ("Failure1", 1); } [Test] public void Failure2 () { AssertRuleFailure ("Failure2", 1); } [Test] public void Failure2d () { AssertRuleFailure ("Failure2d1", 1); AssertRuleFailure ("Failure2d2", 1); AssertRuleFailure ("Failure2d3", 1); AssertRuleFailure ("Failure2d4", 1); AssertRuleFailure ("Failure2d5", 1); AssertRuleFailure ("Failure2d6", 1); } [Test] public void Failure3 () { AssertRuleFailure ("Failure3", 1); } [Test] public void Failure4 () { AssertRuleFailure ("Failure4", 1); } [Test] public void Failure5 () { AssertRuleFailure ("Failure5", 1); } [Test] public void Failure6 () { AssertRuleFailure ("Failure6", 1); } [Test] public void Failure7 () { AssertRuleFailure ("Failure7", 1); } [Test] public void Failure67 () { AssertRuleFailure ("Failure67", 2); } [Test] public void ValidatorClassSuccess1 () { AssertRuleSuccess ("Success1"); } [Test] public void ValidatorClassFailure1 () { AssertRuleFailure ("Failure1", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ReviewInconsistentIdentityTest.cs0000664000175000017500000004422412413742070035217 0ustar00directhexdirecthex00000000000000// // Unit tests for ReviewInconsistentIdentityRule // // Authors: // Jesse Jones // // Copyright (C) 2008 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public sealed class ReviewInconsistentIdentityTest : TypeRuleTestFixture { private sealed class NoFields { } private sealed class Good1 { private string name; private string address; public override bool Equals (object obj) { Good1 rhs = obj as Good1; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Good1 lhs, Good1 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Good1 lhs, Good1 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } } private sealed class Good2 { private string name; private int weight; public override bool Equals (object obj) { Good2 rhs = obj as Good2; if ((object) rhs == null) return false; return name == rhs.name && weight == rhs.weight; } public static bool operator== (Good2 lhs, string name) // rule skips == methods if an arg is not the declaring type { return lhs.name == name; } public static bool operator!= (Good2 lhs, string name) { return lhs.name != name; } public override int GetHashCode () { return unchecked (name.GetHashCode () + weight.GetHashCode ()); } internal string IckyField = "icky"; } private sealed class Good3 { private string name; private int weight; public override bool Equals (object obj) { Good3 rhs = obj as Good3; if ((object) rhs == null) return false; return name == rhs.name && weight == rhs.weight; } public static bool operator== (Good3 lhs, Good3 rhs) { Good2 ick = new Good2(); if (lhs.name == ick.IckyField) // ok to use fields from other types return rhs.name.Length == 0 && lhs.weight == rhs.weight; else return lhs.name == rhs.name && lhs.weight == rhs.weight; } public static bool operator!= (Good3 lhs, Good3 rhs) { return lhs.name != rhs.name || lhs.weight != rhs.weight; } public override int GetHashCode () { return unchecked (name.GetHashCode () + weight.GetHashCode ()); } } private sealed class Good4 { private string name; private string address; public override bool Equals (object obj) { Good4 rhs = obj as Good4; if ((object) rhs == null) return false; return name == rhs.name && address == rhs.address; } public override int GetHashCode () { return name.GetHashCode (); // subset is ok here } } struct Good5 : IEquatable { public readonly string Type; public readonly int Slot; public Good5 (string type, int slot) { this.Type = type; this.Slot = slot; } public static bool operator == (Good5 a, Good5 b) { return a.Slot == b.Slot && a.Type == b.Type; } public static bool operator != (Good5 a, Good5 b) { return a.Slot != b.Slot || a.Type != b.Type; } public override bool Equals (object obj) { if (obj == null) return false; if (!(obj is Good5)) return false; Good5 other = (Good5) obj; return this == other; } public bool Equals (Good5 rhs) { return this == rhs; } public override int GetHashCode () { return Slot.GetHashCode () ^ Type.GetHashCode (); } } private struct Good6 { private double m_value; public int CompareTo (object value) { if (value == null) return 1; double dv = (double)value; if (IsPositiveInfinity (m_value) && IsPositiveInfinity (dv)) return 0; if (IsNegativeInfinity (m_value) && IsNegativeInfinity (dv)) return 0; if (IsNaN (dv)) if (IsNaN (m_value)) return 0; else return 1; if (IsNaN (m_value)) if (IsNaN (dv)) return 0; else return -1; if (m_value > dv) return 1; else if (m_value < dv) return -1; else return 0; } public override bool Equals (object obj) { if (!(obj is Good6)) return false; double value = (double) obj; if (IsNaN (value)) return IsNaN (m_value); return (value == m_value); } public override int GetHashCode () { return (int) m_value; } public static bool IsInfinity (double d) { return double.IsInfinity (d); } public static bool IsNaN (double d) { return double.IsNaN (d); } public static bool IsNegativeInfinity (double d) { return double.IsNegativeInfinity (d); } public static bool IsPositiveInfinity (double d) { return double.IsPositiveInfinity (d); } } private sealed class Good7 { private string name; private string address; private int hash; public override bool Equals (object obj) { Good7 rhs = obj as Good7; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Good7 lhs, Good7 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Good7 lhs, Good7 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { if (hash == 0) hash = unchecked (name.GetHashCode () + address.GetHashCode ()); return hash; } } private sealed class Good8 { private string name; private string address; private int Hash { get; set; } public override bool Equals (object obj) { Good8 rhs = obj as Good8; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Good8 lhs, Good8 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Good8 lhs, Good8 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { if (Hash == 0) Hash = unchecked (name.GetHashCode () + address.GetHashCode ()); return Hash; } } private sealed class Good9 { private string name; private string address; private int Compare (Good9 rhs) { int result = name.CompareTo (rhs.name); if (result == 0) result = address.CompareTo (rhs.address); return result; } public override bool Equals (object obj) { Good9 rhs = obj as Good9; if ((object) rhs == null) return false; return Compare (rhs) == 0; } public static bool operator== (Good9 lhs, Good9 rhs) { return lhs.Compare (rhs) == 0; } public static bool operator!= (Good9 lhs, Good9 rhs) { return lhs.Compare (rhs) != 0; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } } private sealed class Good10 : ICloneable { private string name; private string address; private int age; public object Clone () { Good10 result = new Good10 (); result.name = name; result.address = address; result.age = age; // using more state than equality is ok return result; } public override bool Equals (object obj) { Good10 rhs = obj as Good10; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Good10 lhs, Good10 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Good10 lhs, Good10 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } } private sealed class Good11 { private int weight; public override bool Equals (object obj) { Good11 rhs = obj as Good11; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Good11 lhs, Good11 rhs) { return lhs.weight == rhs.weight; } public static bool operator!= (Good11 lhs, Good11 rhs) { return lhs.weight != rhs.weight; } public override int GetHashCode () { return weight.GetHashCode (); } } private sealed class Bad1 { private string name; private string address; public override bool Equals (object obj) { Bad1 rhs = obj as Bad1; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Bad1 lhs, Bad1 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Bad1 lhs, Bad1 rhs) { return lhs.name != rhs.name; // doesn't use address } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } } private sealed class Bad2 : IEquatable { public string Name { get; set; } public string Address { get; set; } public override bool Equals (object obj) { Bad2 rhs = obj as Bad2; if ((object) rhs == null) return false; return this == rhs; } public bool Equals (Bad2 rhs) { return Name != rhs.Name; // doesn't use Address } public static bool operator== (Bad2 lhs, Bad2 rhs) { return lhs.Name == rhs.Name && lhs.Address == rhs.Address; } public static bool operator!= (Bad2 lhs, Bad2 rhs) { return lhs.Name != rhs.Name || lhs.Address != rhs.Address; } public override int GetHashCode () { return unchecked (Name.GetHashCode () + Address.GetHashCode ()); } } private sealed class Bad3 : IComparable { private string name; private string address; public override bool Equals (object obj) { Bad3 rhs = obj as Bad3; if ((object) rhs == null) return false; return this == rhs; } public int CompareTo (Bad3 rhs) { return name.CompareTo (rhs.name); // doesn't use address } public static bool operator== (Bad3 lhs, Bad3 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Bad3 lhs, Bad3 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } } private sealed class Bad4 : IComparable { private string name; private string address; public override bool Equals (object obj) { Bad4 rhs = obj as Bad4; if ((object) rhs == null) return false; return this == rhs; } public int CompareTo (Bad4 rhs) { int result = name.CompareTo (rhs.name); if (result == 0) result = address.CompareTo (rhs.address); return result; } public static bool operator== (Bad4 lhs, Bad4 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Bad4 lhs, Bad4 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } public static bool operator< (Bad4 lhs, Bad4 rhs) { return lhs.name.CompareTo (rhs.name) < 0; // no address } public static bool operator<= (Bad4 lhs, Bad4 rhs) { return lhs.name.CompareTo (rhs.name) <= 0; // no address } public static bool operator> (Bad4 lhs, Bad4 rhs) { return lhs.CompareTo (rhs) > 0; } public static bool operator>= (Bad4 lhs, Bad4 rhs) { return lhs.CompareTo (rhs) >= 0; } } private sealed class Bad5 { private string name; private string address; private int age; public override bool Equals (object obj) { Bad5 rhs = obj as Bad5; if ((object) rhs == null) return false; return name == rhs.name && address == rhs.address; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode () + age); // can't check more state than equality does } } private sealed class Bad6 { private string name; private string address; private int age; public override bool Equals (object obj) { Bad6 rhs = obj as Bad6; if ((object) rhs == null) return false; return name == rhs.name && address == rhs.address; } public override int GetHashCode () { return 7*age; // must check at least some state used by equality } } private sealed class Bad7 : ICloneable { private string name; private string address; public object Clone () { Bad7 result = new Bad7 (); result.name = name; // missing address return result; } public override bool Equals (object obj) { Bad7 rhs = obj as Bad7; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Bad7 lhs, Bad7 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Bad7 lhs, Bad7 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } } private sealed class Bad8 { private string name; private string address; public Bad8 Clone () { Bad8 result = new Bad8 (); result.address = address; // missing name return result; } public override bool Equals (object obj) { Bad8 rhs = obj as Bad8; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Bad8 lhs, Bad8 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Bad8 lhs, Bad8 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } } private sealed class Bad9 : IComparable { private string name; private string address; public override bool Equals (object obj) { Bad9 rhs = obj as Bad9; if ((object) rhs == null) return false; return this == rhs; } public int CompareTo (object value) { Bad9 rhs = (Bad9) value; int result = name.CompareTo (rhs.name); // no address return result; } public static bool operator== (Bad9 lhs, Bad9 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Bad9 lhs, Bad9 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { return unchecked (name.GetHashCode () + address.GetHashCode ()); } } private sealed class Bad10 { private string name; private string address; public override bool Equals (object obj) { Bad10 rhs = obj as Bad10; if ((object) rhs == null) return false; return this == rhs; } public static bool operator== (Bad10 lhs, Bad10 rhs) { return lhs.name == rhs.name && lhs.address == rhs.address; } public static bool operator!= (Bad10 lhs, Bad10 rhs) { return lhs.name != rhs.name || lhs.address != rhs.address; } public override int GetHashCode () { return base.GetHashCode (); // very bad to do this for classes, also bad for structs if all fields don't participate in equality } } [Test] public void Check () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } public abstract class AbstractEqualsTest : IEquatable { private int field; public abstract bool Equals (AbstractEqualsTest other); public override bool Equals (object obj) { return Equals (obj as AbstractEqualsTest); } } [Test] public void Abstract () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ReviewUseOfInt64BitsToDoubleTest.cs0000664000175000017500000000774512413742070035162 0ustar00directhexdirecthex00000000000000// // Unit test for ReviewUseOfInt64BitsToDoubleRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Framework; using Gendarme.Rules.Correctness; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { #pragma warning disable 649 [TestFixture] public class ReviewUseOfInt64BitsToDoubleTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public double ParametersBad (int x, int y) { return BitConverter.Int64BitsToDouble (x) + BitConverter.Int64BitsToDouble (y); } static short StaticShort = 16; public double StaticFieldBad () { return BitConverter.Int64BitsToDouble (StaticShort); } byte InstanceByte; double InstanceDouble; public double InstanceFieldBad () { return InstanceDouble + BitConverter.Int64BitsToDouble (InstanceByte); } public double LocalVariableBad () { int x = 42; return BitConverter.Int64BitsToDouble (x); } public double CallBad (double d) { return BitConverter.Int64BitsToDouble (d.GetHashCode ()); } [Test] public void Bad () { AssertRuleFailure ("ParametersBad", 2); AssertRuleFailure ("StaticFieldBad", 1); AssertRuleFailure ("InstanceFieldBad", 1); AssertRuleFailure ("LocalVariableBad", 1); AssertRuleFailure ("CallBad", 1); } public double ParametersGood (long x, long y) { return BitConverter.Int64BitsToDouble (x) + BitConverter.Int64BitsToDouble (y); } static ulong StaticULong = 16; public double StaticFieldGood () { return unchecked (BitConverter.Int64BitsToDouble ((long)StaticULong)); } long InstanceLong; public double InstanceFieldGood () { return InstanceDouble + BitConverter.Int64BitsToDouble (InstanceLong); } public double LocalVariableGood () { long x = 42; return BitConverter.Int64BitsToDouble (x); } public double CallGood (long x) { return BitConverter.Int64BitsToDouble (x); } [Test] public void Ok () { // no conversion of [u]long AssertRuleDoesNotApply ("ParametersGood"); AssertRuleDoesNotApply ("StaticFieldGood"); AssertRuleDoesNotApply ("InstanceFieldGood"); AssertRuleDoesNotApply ("CallGood"); // a conversion occurs in this case because the value is assigned from a int (42) AssertRuleSuccess ("LocalVariableGood"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/UseValueInPropertySetterTest.cs0000664000175000017500000001177712413742070034626 0ustar00directhexdirecthex00000000000000// // Unit test for UseValueInPropertySetterRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // Copyright (C) 2007-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; using System.Runtime.InteropServices; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class UseValueInPropertySetterTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public class Item { // use a filed to avoid potential issue with optimization (resulting in empty setters) bool val; public bool UsesValue { set { val = value; } } public bool DoesNotUseValue { set { val = true; } } public void set_NotAProperty(bool value) { val = true; } public int Throw1 { set { throw new NotSupportedException (); } } public int Throw2 { set { throw new NotSupportedException ("value isn't used here"); } } private string Translate (string s) { return "value n'est pas utilise ici"; } public int Throw3 { set { throw new NotSupportedException (Translate ("value isn't used here")); } } public int CouldThrow { set { if (val) throw new NotSupportedException (); } } private static int maxFields = 25; public static int MaxFields { get { return maxFields; } set { maxFields = value; } } public static int MinFields { get { return 0; } set { maxFields = 0; } } public long time; public DateTime Time { set { time = value.Ticks; } } public string Empty { set { } } public object Marshalled { [param:MarshalAs (UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(object))] set { val = (bool) value; } } } public class BitVector32 { int bits; public struct Section { private short mask; private short offset; internal Section (short mask, short offset) { this.mask = mask; this.offset = offset; } public short Mask { get { return mask; } } public short Offset { get { return offset; } } } public int this [BitVector32.Section section] { get { return ((bits >> section.Offset) & section.Mask); } set { if (value < 0) throw new ArgumentException (); if (value > section.Mask) throw new ArgumentException (); bits &= ~(section.Mask << section.Offset); bits |= (value << section.Offset); } } } [Test] public void TestUsesValue() { AssertRuleSuccess ("set_UsesValue"); } [Test] public void TestDoesNotUseValue() { AssertRuleFailure ("set_DoesNotUseValue", 1); } [Test] public void TestNotAProperty() { AssertRuleDoesNotApply ("set_NotAProperty"); } [Test] public void ThrowException () { AssertRuleSuccess ("set_Throw1"); AssertRuleSuccess ("set_Throw2"); AssertRuleSuccess ("set_Throw3"); AssertRuleFailure ("set_CouldThrow", 1); } [Test] public void TestStaticUsesValue () { AssertRuleSuccess ("set_MaxFields"); } [Test] public void TestStaticDoesNotUseValue () { AssertRuleFailure ("set_MinFields", 1); } [Test] public void TestDateValue () { AssertRuleSuccess ("set_Time"); } [Test] public void TestEmpty () { // too many false positive, it seems too common to have empty set to report them // at least for this specific rule AssertRuleSuccess ("set_Empty"); } [Test] public void TestThisProperty () { AssertRuleSuccess ("set_Item"); } [Test] public void TestMarshalled () { // note: with [g]mcs the parameter is not named 'value' AssertRuleSuccess ("set_Marshalled"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ReviewUselessControlFlowTest.cs0000664000175000017500000000644712413742070034646 0ustar00directhexdirecthex00000000000000// // Unit test for ReviewUselessControlFlowRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { #pragma warning disable 642 [TestFixture] public class ReviewUselessControlFlowTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no conditional branch AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void TypoExtraSemiColumn (int x) { // note: C# compilers will *warn* about this - but will compile it // warning CS0642: Possible mistaken empty statement if (x == 1); Console.WriteLine ("of course"); // br[true|false][.s] on next instruction // note: this could be bad, i.e. non-optimal, IL generated by the compiler } public void CorrectCondition (int x) { if (x == 1) Console.WriteLine ("of course"); } [Test] public void ProbableTypo () { AssertRuleSuccess ("CorrectCondition"); // some compilers (e.g. csc), when optimizing, can remove the condition // so no defect will be found in the IL AssertRuleFailure ("TypoExtraSemiColumn", 1); } public void EmptyCondition (int x) { // no compiler warning // - MS C# compiler (CSC) inserts 2 NOP between the brtrue[.s] // - Mono's [G]MCS does not insert NOP so it looks just like the previous case // and the ldstr (probably to help the debugger insert breakpoints) if (x == 0) { // TODO - ever seen such thing ? ;-) } Console.WriteLine ("of course"); } public void Condition (int x) { if (x == 0) { Console.WriteLine ("zero"); } Console.WriteLine ("of course"); } [Test] public void UnneededCode () { AssertRuleSuccess ("Condition"); // some compilers (e.g. csc), when optimizing, can remove the condition // so no defect will be found in the IL AssertRuleFailure ("EmptyCondition", 1); } } } FinalizersShouldCallBaseClassFinalizerTest.cs0000664000175000017500000000625512413742070037274 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit tests for FinalizersShouldCallBaseClassFinalizerRule // // Authors: // Daniel Abramov // // Copyright (C) Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { internal class NoFinalizerDefinedClass { } internal class FinalizerCallingBaseFinalizerClass { ~FinalizerCallingBaseFinalizerClass () { // do some stuff int x = 2 + 2; object o = x.ToString (); int y = o.GetHashCode (); x = y; // compiler generates here base.Finalize () call that looks like this: // call System.Void System.Object::Finalize() // endfinally // ret } } [TestFixture] public class FinalizersShouldCallBaseClassFinalizerTest : TypeRuleTestFixture { TypeDefinition finalizer_not_calling_base_class; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (unit); finalizer_not_calling_base_class = new TypeDefinition ( "Test.Rules.Correctness", "FinalizerNotCallingBaseClass", TypeAttributes.NotPublic, assembly.MainModule.TypeSystem.Object); assembly.MainModule.Types.Add (finalizer_not_calling_base_class); var finalizer = new MethodDefinition ( "Finalize", MethodAttributes.Public | MethodAttributes.Virtual, assembly.MainModule.TypeSystem.Void); finalizer_not_calling_base_class.Methods.Add (finalizer); var il = finalizer.Body.GetILProcessor (); il.Emit (OpCodes.Ret); } [Test] public void TestNoFinalizerDefinedClass () { AssertRuleDoesNotApply (); } [Test] public void TestFinalizerCallingBaseFinalizerClass () { AssertRuleSuccess (); } [Test] public void TestFinalizerNotCallingBaseFinalizerClass () { AssertRuleFailure (finalizer_not_calling_base_class, 1); } [Test] public void NoBaseType () { AssertRuleDoesNotApply (); } } } UseNoInliningWithGetCallingAssemblyTest.cs0000664000175000017500000000426512413742070036574 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit tests for UseNoInliningWithGetCallingAssemblyRule // // Authors: // Sebastien Pouliot // // 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; using System.Reflection; using System.Runtime.CompilerServices; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class UseNoInliningWithGetCallingAssemblyTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void Bad () { Console.WriteLine (Assembly.GetCallingAssembly ().Location); } [MethodImpl (MethodImplOptions.NoInlining)] public void Good () { Console.WriteLine (Assembly.GetCallingAssembly ().Location); } [Test] public void GetCallingAssembly () { AssertRuleFailure ("Bad"); AssertRuleSuccess ("Good"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/BadRecursiveInvocationTest.cs0000664000175000017500000002105112413742070034244 0ustar00directhexdirecthex00000000000000// // Unit tests for BadRecursiveInvocationRule // // Authors: // Aaron Tomb // Sebastien Pouliot // // Copyright (C) 2005 Aaron Tomb // Copyright (C) 2006-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; using System.Runtime.Serialization; using System.Security; using System.Security.Permissions; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { #pragma warning disable 162 [TestFixture] public class BadRecursiveInvocationTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] or NEWOBJ AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } class BadRec { /* This should be an error. */ public int Foo { get { return Foo; } } /* This should be an error. */ public int OnePlusFoo { get { return 1 + OnePlusFoo; } } /* This should be an error. */ public int FooPlusOne { get { return FooPlusOne + 1; } } public static int StaticFooPlusOne { get { return StaticFooPlusOne + 1; } } /* correct */ public int Bar { get { return -1; } } /* a more complex recursion */ public int FooBar { get { return BarFoo; } } public int BarFoo { get { return FooBar; } } /* This should be fine, as it uses 'base.' */ public override int GetHashCode () { return base.GetHashCode (); } /* not fine, missing 'base.' */ public override bool Equals (object obzekt) { return Equals (obzekt); } public static int StaticGoodOverload (object obzekt) { return StaticGoodOverload ((string) obzekt); } public static int StaticGoodOverload (string s) { return 0; } public static int StaticBad (object obzekt) { return StaticBad (obzekt); } public static int StaticBadFibo (int n) { return StaticBadFibo (n - 1) + StaticBadFibo (n - 2); } public int BadFibo (int n) { return BadFibo (n - 1) + BadFibo (n - 2); } public static int StaticFibonacci (int n) { if (n < 2) return n; return StaticFibonacci (n - 1) + StaticFibonacci (n - 2); } public int Fibonacci (int n) { if (n < 2) return n; return Fibonacci (n - 1) + Fibonacci (n - 2); } public void AnotherInstance () { BadRec rec = new BadRec (); rec.AnotherInstance (); } public void Assert () { new PermissionSet (PermissionState.None).Assert (); } static Helper help; public static void Write (bool value) { help.Write (value); } public void Unreachable () { throw new NotImplementedException (); Unreachable (); } } class Helper { public void Write (bool value) { } } [Test] public void RecursiveProperties () { AssertRuleFailure ("get_Foo", 1); AssertRuleFailure ("get_OnePlusFoo", 1); AssertRuleFailure ("get_FooPlusOne", 1); AssertRuleFailure ("get_StaticFooPlusOne", 1); } [Test] public void Property () { AssertRuleDoesNotApply ("get_Bar"); // no method call } [Test, Ignore ("uncaught by rule")] public void IndirectRecursiveProperty () { AssertRuleFailure ("get_FooBar", 1); } [Test] public void OverriddenMethod () { AssertRuleSuccess ("GetHashCode"); } [Test] public void BadRecursiveMethods () { AssertRuleFailure ("Equals", 1); AssertRuleFailure ("StaticBad", 1); } [Test] public void BadFibo () { AssertRuleFailure ("BadFibo", 1); AssertRuleFailure ("StaticBadFibo", 1); } [Test] public void Fibonacci () { AssertRuleSuccess ("Fibonacci"); AssertRuleSuccess ("StaticFibonacci"); } [Test, Ignore ("uncaught by rule")] public void CodeUsingAnInstanceOfItself () { AssertRuleFailure ("AnotherInstance", 1); } [Test] public void TestAssert () { AssertRuleSuccess ("Assert"); } [Test] public void TestStaticCallingAnotherClassWithSameMethodName () { AssertRuleSuccess ("Write"); } [Test] public void TestUnreachable () { AssertRuleSuccess ("Unreachable"); } // test case provided by Richard Birkby internal sealed class FalsePositive7 { public void Run () { GetType (); Console.WriteLine (Select ()); } private static T Select () { Console.WriteLine (); return default (T); } private static string Select () { return Select (); } } [Test] public void Generics () { AssertRuleSuccess (); } internal class InterfaceCallGood : IDeserializationCallback { protected virtual void OnDeserialization (object sender) { ((IDeserializationCallback) this).OnDeserialization (sender); } void IDeserializationCallback.OnDeserialization (object sender) { throw new NotImplementedException (); } } internal class InterfaceCallBad : IDeserializationCallback { void IDeserializationCallback.OnDeserialization (object sender) { // uho ((IDeserializationCallback) this).OnDeserialization (sender); } } [Test] public void Interfaces () { AssertRuleSuccess ("OnDeserialization"); AssertRuleSuccess ("System.Runtime.Serialization.IDeserializationCallback.OnDeserialization"); AssertRuleFailure ("System.Runtime.Serialization.IDeserializationCallback.OnDeserialization", 1); } // since we detect dots for interfaces... we test .ctor and .cctor public class MyObject : ICloneable { static MyObject () { } public MyObject () { Clone (); } public object Clone () { throw new NotImplementedException (); } object ICloneable.Clone () { return new MyObject (); } } [Test] public void Dots () { AssertRuleDoesNotApply (".cctor"); // no call in method AssertRuleSuccess (".ctor"); AssertRuleSuccess ("System.ICloneable.Clone"); } public class Coverage { public int FewParameters (int a, int b, int c) { return FewParameters (a, b, c); } public int ManyParameters (int a, int b, int c, int d, int e) { return ManyParameters (a, b, c, d, e); } static int StaticFewParameters (int a, int b, int c) { return StaticFewParameters (a, b, c); } static int StaticManyParameters (int a, int b, int c, int d, int e) { return StaticManyParameters (a, b, c, d, e); } } [Test] public void MoreCoverage_Static () { AssertRuleFailure ("StaticFewParameters", 1); AssertRuleFailure ("StaticManyParameters", 1); } [Test] public void MoreCoverage_Instance () { AssertRuleFailure ("FewParameters", 1); AssertRuleFailure ("ManyParameters", 1); } [Test] public void StaticGoodOverload () { AssertRuleSuccess ("StaticGoodOverload", new Type [] { typeof (object) }); } class Array { public virtual void SetProperty (string name, object value) { Console.WriteLine ("{0}: {1}", name, value); } internal virtual void SetProperty (string name, object [] args) { SetProperty (name, args [0]); } } [Test] public void ArrayOverload () { AssertRuleSuccess ("SetProperty", new Type [] { typeof (string), typeof (object[]) }); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/AvoidConstructorsInStaticTypesTest.cs0000664000175000017500000000740512413742070036022 0ustar00directhexdirecthex00000000000000// // Unit test for AvoidConstructorsInStaticTypesRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // 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; using System.Reflection; using Mono.Cecil; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Correctness { [TestFixture] public class AvoidConstructorsInStaticTypesTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } public class CannotBeMadeStatic_Method { public void Method() { } } public class CannotBeMadeStatic_Field { private int field = 42; } public class CannotBeMadeStatic_Ctor { CannotBeMadeStatic_Ctor (int a, int b) { } } [Test] public void TestClassCannotBeMadeStatic () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } public class CouldBeStatic { public static void Method () { } } [Test] public void TestClassCanBeMadeStatic () { AssertRuleFailure (1); } public class IsMadeStatic { private IsMadeStatic () { } public static void Method () { } } [Test] public void TestClassHasNoPublicConstructors () { AssertRuleSuccess (); } public class EmptyClass { // this creates a public ctor } public class InheritClass : EmptyClass { private int x; public void Show () { Console.WriteLine (x); } } public class InheritAddingOnlyStatic : InheritClass { static string Message = "Hello"; static public void Display () { Console.WriteLine (Message); } } [Test] public void Inheritance () { AssertRuleFailure (1); // default, visible, ctor AssertRuleSuccess (); AssertRuleSuccess (); } static class StaticClass { static void Show () { Console.WriteLine ("hello"); } } [Test] public void StaticType () { // the nice generic-based test syntax won't work on static types :( Assembly a = typeof (AvoidConstructorsInStaticTypesTest).Assembly; TypeDefinition type = DefinitionLoader.GetTypeDefinition (a, "Test.Rules.Correctness.AvoidConstructorsInStaticTypesTest/StaticClass"); AssertRuleDoesNotApply (type); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ReviewSelfAssignmentTest.cs0000664000175000017500000001411312413742070033741 0ustar00directhexdirecthex00000000000000// // Unit test for ReviewSelfAssignmentTest // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { #pragma warning disable 169, 1717 [TestFixture] public class ReviewSelfAssignmentTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no store instruction AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } int x; public void InstanceField () { // note: C# compilers will *warn* about this // warning CS1717: Assignment made to same variable; did you mean to assign something else? x = x; } struct Struct { public long Field; } Struct s1, s2; public void DifferentInstanceField () { s1.Field = s2.Field; } class Class : ICloneable { public int x; public Class () { } public object Clone () { Class c = new Class (); c.x = x; return c; } } public void SameInstanceField () { // note: C# compilers will *warn* about this // warning CS1717: Assignment made to same variable; did you mean to assign something else? s1.Field = s1.Field; s2.Field = s2.Field; } private long counter; public void AutoIncrement () { Console.WriteLine ("a" + (counter++).ToString ()); } [Test] public void InstanceFields () { AssertRuleFailure ("InstanceField", 1); AssertRuleFailure ("SameInstanceField", 2); AssertRuleSuccess ("DifferentInstanceField"); AssertRuleSuccess ("Clone"); AssertRuleSuccess ("AutoIncrement"); } static string ss = "empty"; public void SameStaticField () { // note: C# compilers will *warn* about this // warning CS1717: Assignment made to same variable; did you mean to assign something else? ss = ss; } public void StaticField () { ss = ""; } [Test] public void StaticFields () { AssertRuleFailure ("SameStaticField", 1); AssertRuleSuccess ("StaticField"); } public void Variable (int y) { // note: C# compilers will *warn* about this // warning CS1717: Assignment made to same variable; did you mean to assign something else? int z = y * 3; z = z; } [Test] [Ignore ("too much false positives since compilers introduce their own variables and we can't differentiate them from user's variables")] public void Variables () { AssertRuleFailure ("SameVariable", 1); } public void SameParameter (int y) { // note: C# compilers will *warn* about this // warning CS1717: Assignment made to same variable; did you mean to assign something else? y = y; x = y * 2; } public void Parameter (int y) { x = y * 2; } static public void StaticSameParameter (string s) { // note: C# compilers will *warn* about this // warning CS1717: Assignment made to same variable; did you mean to assign something else? s = s; ss += s; } static public void StaticParameter (string s) { ss += s; } [Test] public void Parameters () { AssertRuleFailure ("SameParameter", 1); AssertRuleSuccess ("Parameter"); AssertRuleFailure ("StaticSameParameter", 1); AssertRuleSuccess ("StaticParameter"); } public struct Link { public int HashCode; public int Next; } private Link [] links; private void HashSetGood (int a, int b) { links [a].Next = links [b].Next; } private void HashSetBad_Parameter (int a) { links [a].Next = links [a].Next; } private void HashSetBad_Value () { links [411].Next = links [411].Next; } [Test] public void Arrays () { AssertRuleSuccess ("HashSetGood"); AssertRuleFailure ("HashSetBad_Parameter"); AssertRuleFailure ("HashSetBad_Value"); } public class Chain { public Link [] Previous; public Link [] Next; } public void Close (Chain c, int pos) { c.Previous [pos].HashCode = c.Next [pos].HashCode; } public void CloseBad (Chain c, int pos) { c.Previous [pos].HashCode = c.Previous [pos].HashCode; } public void SetLinkChain (Link l, Chain c, int pos) { l.HashCode = c.Previous [pos].HashCode; } public void SetChainLink (Link l, Chain c, int pos) { c.Previous [pos].HashCode = l.HashCode; } [Test] public void ChainWithIndexer () { AssertRuleSuccess ("Close"); AssertRuleFailure ("CloseBad", 1); AssertRuleSuccess ("SetLinkChain"); AssertRuleSuccess ("SetChainLink"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/Makefile.in0000664000175000017500000003150512642235731030524 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Correctness/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Correctness.csproj Resource.resx Resource.Designer.cs DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Correctness/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Correctness/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/AvoidFloatingPointEqualityTest.cs0000664000175000017500000001730112413742070035115 0ustar00directhexdirecthex00000000000000// // Unit test for AvoidFloatingPointEqualityRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { #pragma warning disable 168, 219 [TestFixture] public class AvoidFloatingPointEqualityTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } public class Double { public double field = 0.0d; public static double staticField = 0.0d; public double Property { get { return field; } } public static double StaticMethod () { return 0.0d; } public void Fields () { bool a = field == staticField; bool b = staticField == field; } public bool MethodResult () { bool a = Property == StaticMethod (); bool b = StaticMethod () == Property; return a && b; } public void Parameters (double f, double g) { bool a = f == g; } public bool StaticParameters (double f, double g) { return f == g; } public void Local () { double d1 = 0.0d; double d2 = 0.0d; if (d1 == d2) { int i = 1; Console.WriteLine (d1 == (double)i); } else if (d2 == d1) { uint i = 1; Console.WriteLine ((double)i == d2); } } public void LocalAbove4 () { string s1 = String.Empty; string s2 = String.Empty; string s3 = String.Empty; string s4 = String.Empty; double d1 = 0.0d; double d2 = 0.0d; if (d1 == d2) { Console.WriteLine (d1 == ((double)1)); } else if (d2 == d1) { Console.WriteLine (((double)0) == d2); } } public void ComparisonAfterArithmeticOperation () { double d1 = 0.0d; double d2 = 0.0d; bool a = d1 * 1 == d2 * 1; } public void LegalComparisons () { double d = 0.0d; bool a; bool b; //a = float.PositiveInfinity == f; b = d == double.PositiveInfinity; //a = float.NegativeInfinity == f; b = d == double.NegativeInfinity; } public void EqualsCall () { double d1 = 0.0d; double d2 = 0.0d; if (d1.Equals (d2)) { d1.Equals (1.0); } else { (1.0d).Equals (d2); } } public bool CompareWithArray () { double [] values = new double [] { 0.0d, 1.0d }; return values [0] == values [1]; } } public class Float { public float field = 0f; public static float staticField = 0f; public float Property { get { return field; } } public static float StaticMethod () { return 0f; } public void Fields () { bool a = field == staticField; bool b = staticField == field; } public bool MethodResult () { bool a = Property == StaticMethod(); bool b = StaticMethod() == Property; return a && b; } public void Parameters (float f, float g) { bool a = f == g; } public bool StaticParameters (float f, float g) { return f == g; } public void Local () { float f1 = 0f; float f2 = 0f; if (f1 == f2) { int i = 1; Console.WriteLine (f1 == (float) i); } else if (f2 == f1) { uint i = 1; Console.WriteLine ((float) i == f2); } } public void LocalAbove4 () { string s1 = String.Empty; string s2 = String.Empty; string s3 = String.Empty; string s4 = String.Empty; float f1 = 0f; float f2 = 0f; if (f1 == f2) { Console.WriteLine (f1 == ((float) 1)); } else if (f2 == f1) { Console.WriteLine (((float) 0) == f2); } } public void ComparisonAfterArithmeticOperation () { float f1 = 0f; float f2 = 0f; bool a = f1 * 1 == f2 * 1; } public void LegalComparisons () { float f = 0f; bool a; bool b; //a = float.PositiveInfinity == f; b = f == float.PositiveInfinity; //a = float.NegativeInfinity == f; b = f == float.NegativeInfinity; } public void EqualsCall () { float f1 = 0f; float f2 = 0f; bool a = f1.Equals(f2); } public bool CompareWithArray () { float [] values = new float [] { 0.0f, 1.0f }; return values [0] == values [1]; } } public class Legal { object o = null; public void IntegerComparisons () { int i = 0; int j = 1; bool a = i == j; } public bool NoComparison () { return false; } public bool Property { get { if (o != null) return ((object)o.ToString () == this); else return false; } } } [Test] public void TestFields () { AssertRuleFailure ("Fields", 2); AssertRuleFailure ("Fields", 2); } [Test] public void TestMethodResult () { AssertRuleFailure ("MethodResult", 2); AssertRuleFailure ("MethodResult", 2); } [Test] public void TestParameters () { AssertRuleFailure ("Parameters", 1); AssertRuleFailure ("Parameters", 1); } [Test] public void TestStaticParameters () { AssertRuleFailure ("StaticParameters", 1); AssertRuleFailure ("StaticParameters", 1); } [Test] public void TestLocal () { AssertRuleFailure ("Local"); AssertRuleFailure ("Local"); } [Test] public void TestLocalAbove4 () { AssertRuleFailure ("LocalAbove4"); AssertRuleFailure ("LocalAbove4"); } [Test] public void TestComparisonAfterArithmeticOperation () { AssertRuleFailure ("ComparisonAfterArithmeticOperation", 1); AssertRuleFailure ("ComparisonAfterArithmeticOperation", 1); } [Test] public void TestLegalComparisons () { AssertRuleSuccess ("LegalComparisons"); AssertRuleSuccess ("LegalComparisons"); } [Test] public void TestLegalIntegerComparisons () { AssertRuleSuccess ("IntegerComparisons"); } [Test] public void TestEqualsCall () { AssertRuleFailure ("EqualsCall", 1); AssertRuleFailure ("EqualsCall", 3); } [Test] public void TestNoFloatComparison() { AssertRuleDoesNotApply ("NoComparison"); } [Test] public void TestCompareWithArray () { AssertRuleFailure ("CompareWithArray", 1); AssertRuleFailure ("CompareWithArray", 1); } [Test] public void TestLegalStuff () { AssertRuleSuccess ("get_Property"); } } } CheckParametersNullityInVisibleMethodsTest.cs0000664000175000017500000005315512413742070037342 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit tests for CheckParametersNullityInVisibleMethodsRule. // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Collections; using System.Collections.Generic; using System.IO; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Tests.Rules.Correctness { [TestFixture] public class CheckParametersNullityInVisibleMethodsTest : MethodRuleTestFixture { public void UnusedInstance (object o) { } static public void UnusedStatic (object o) { } public int ValueTypeInstance (int i) { return i.GetHashCode (); } static public int ValueTypeStatic (int i) { return i.GetHashCode (); } public int BadInstance (object o) { return o.GetHashCode (); } static public int BadStatic (object o) { return o.GetHashCode (); } [Test] public void NoCheck () { // parameter is unused so no need to check null AssertRuleSuccess ("UnusedInstance"); AssertRuleSuccess ("UnusedStatic"); // parameter is used but is a value type, so no need to check null AssertRuleSuccess ("ValueTypeInstance"); AssertRuleSuccess ("ValueTypeStatic"); // parameter is used, not a value type, but has no null check AssertRuleFailure ("BadInstance", 1); AssertRuleFailure ("BadStatic", 1); } // only check nullity, nothing else (no deref) public void NotNullInstance (object o) { if (o == null) throw new ArgumentNullException ("o"); } static public void NotNullStatic (object o) { if (o == null) throw new ArgumentNullException ("o"); } [Test] public void OnlyCheck () { // parameter is only checked, never dereferenced AssertRuleSuccess ("NotNullInstance"); AssertRuleSuccess ("NotNullStatic"); } public void InvertedNotNullInstance (object o) { if (null == o) throw new ArgumentNullException ("o"); } static public void InvertedNotNullStatic (object o) { if (null == o) throw new ArgumentNullException ("o"); } [Test] public void OnlyCheckInverted () { // parameter is only checked, never dereferenced AssertRuleSuccess ("InvertedNotNullInstance"); AssertRuleSuccess ("InvertedNotNullStatic"); } public int GoodThrowInstance (object o) { if (o == null) throw new ArgumentNullException ("o"); return o.GetHashCode (); } static public int GoodThrowStatic (object o) { if (o == null) throw new ArgumentNullException ("o"); return o.GetHashCode (); } public int GoodAvoidInstance (object o) { return (o == null) ? 0 : o.GetHashCode (); } static public int GoodAvoidStatic (object o) { return (o == null) ? 0 : o.GetHashCode (); } [Test] public void AllCheck () { // a null check is done and throws AssertRuleSuccess ("GoodThrowInstance"); AssertRuleSuccess ("GoodThrowStatic"); // a null check is done and avoid the dereference AssertRuleSuccess ("GoodAvoidInstance"); AssertRuleSuccess ("GoodAvoidStatic"); } public int InvertedGoodThrowInstance (object o) { if (null == o) throw new ArgumentNullException ("o"); return o.GetHashCode (); } static public int InvertedGoodThrowStatic (object o) { if (null == o) throw new ArgumentNullException ("o"); return o.GetHashCode (); } public int InvertedGoodAvoidInstance (object o) { return (null == o) ? 0 : o.GetHashCode (); } static public int InvertedGoodAvoidStatic (object o) { return (null == o) ? 0 : o.GetHashCode (); } [Test] public void AllInvertedCheck () { // a null check is done and throws AssertRuleSuccess ("InvertedGoodThrowInstance"); AssertRuleSuccess ("InvertedGoodThrowStatic"); // a null check is done and avoid the dereference AssertRuleSuccess ("InvertedGoodAvoidInstance"); AssertRuleSuccess ("InvertedGoodAvoidStatic"); } public int BadAvoidInstance (object o) { return (o != null) ? 0 : o.GetHashCode (); } [Test] [Ignore ("Remainder: By design this rule reports *lack* if null checks not [in]valid null checks")] public void BadCheck () { // a null check is done but does not prevent the dereference AssertRuleSuccess ("BadAvoidInstance"); } // ignore ? always or only if NotNull is public too ? public int IgnoreInstanceCheck (object o) { NotNullInstance (o); return o.GetHashCode (); } static public int IgnoreStaticCheck (object o) { NotNullStatic (o); return o.GetHashCode (); } [Test] public void PotentiallyDelegatedNullCheck () { // since parameters is used in a method call before being dereferenced // we assume that: // (a) the method called does the null check - and we'll even check this if the method is visible // (b) it's a method specific for doing the null check test // and we wont report this as a defect (too many false positives) AssertRuleSuccess ("IgnoreInstanceCheck"); AssertRuleSuccess ("IgnoreStaticCheck"); } public int CheckThruLocal (object o) { // null check using local object local = o; if (local == null) throw new ArgumentNullException ("o"); // dereference argument return o.GetHashCode (); } // 'dtk' as an enum and i as a valuetype don't need to be checked public int CheckMixedParameters (DateTimeKind dtk, int i, string s, object o) { if (o == null) throw new ArgumentNullException ("o"); // 's' is used without a null check if (i < s.Length) return dtk.GetHashCode (); else return o.GetHashCode (); } [Test] public void MissingCheck () { // parameter is checked indirectly but dereferenced directly AssertRuleFailure ("CheckThruLocal", 1); AssertRuleFailure ("CheckMixedParameters", 1); } private object obj; private int code; public object ObjectGood { get { return obj; } set { obj = value; // value is checked against null before being used code = (value == null) ? 0 : value.GetHashCode (); } } public object ObjectGoodInverted { get { return obj; } set { obj = value; // value is checked against null before being used code = (null == value) ? 0 : value.GetHashCode (); } } public object ObjectBad { get { return obj; } set { obj = value; // no null check *and* value is dereferenced inside the method code = value.GetHashCode (); } } public int HashCode { get { return obj == null ? code : obj.GetHashCode (); } set { // value type code = value.GetHashCode (); obj = null; } } [Test] public void InstanceProperties () { // getter does not apply because it has no parameter AssertRuleDoesNotApply ("get_ObjectGood"); AssertRuleSuccess ("set_ObjectGood"); AssertRuleSuccess ("set_ObjectGoodInverted"); // getter does not apply because it has no parameter AssertRuleDoesNotApply ("get_ObjectBad"); AssertRuleFailure ("set_ObjectBad", 1); // getter does not apply because it has no parameter AssertRuleDoesNotApply ("get_HashCode"); AssertRuleSuccess ("set_HashCode"); } static object obj_static; static int code_static; static public object StaticObjectGood { get { return obj_static; } set { obj_static = value; // value is checked against null before being used code_static = (value == null) ? 0 : value.GetHashCode (); } } static public object StaticObjectGoodInverted { get { return obj_static; } set { obj_static = value; // value is checked against null before being used code_static = (null == value) ? 0 : value.GetHashCode (); } } static public object StaticObjectBad { get { return obj_static; } set { obj_static = value; // no null check *and* value is dereferenced inside the method code_static = value.GetHashCode (); } } static public int StaticHashCode { get { return obj_static == null ? code_static : obj_static.GetHashCode (); } set { // value type code_static = value.GetHashCode (); obj_static = null; } } [Test] public void StaticProperties () { // getter does not apply because it has no parameter AssertRuleDoesNotApply ("get_StaticObjectGood"); AssertRuleSuccess ("set_StaticObjectGood"); AssertRuleSuccess ("set_StaticObjectGoodInverted"); // getter does not apply because it has no parameter AssertRuleDoesNotApply ("get_StaticObjectBad"); AssertRuleFailure ("set_StaticObjectBad", 1); // getter does not apply because it has no parameter AssertRuleDoesNotApply ("get_StaticHashCode"); AssertRuleSuccess ("set_StaticHashCode"); } public class ClassContainer : IEquatable { public ClassContainer Container; public int ValueType; public ClassContainer (ClassContainer c) { // no check if 'c' is null Container = c.Container; ValueType = c.ValueType; } public bool Equals (ClassContainer other) { if (other == null) return false; return (Container.Equals (other.Container) && (ValueType == other.ValueType)); } } public struct StructContainer { // a struct cannot contain itself public object Container; public int ValueType; public StructContainer (StructContainer c) { // no need to check for 'c' since it can't be null Container = c.Container; ValueType = c.ValueType; } public override bool Equals (object obj) { // problem if cast is invalid StructContainer other = (StructContainer) obj; return (Container.Equals (other.Container) && (ValueType == other.ValueType)); } public override int GetHashCode () { return base.GetHashCode (); } } [Test] public void Fields () { AssertRuleFailure (".ctor", 1); AssertRuleSuccess ("Equals"); AssertRuleSuccess (".ctor"); AssertRuleSuccess ("Equals"); } // constrained to struct == valuetype public class Bitmask where T : struct, IConvertible { ulong mask; // missing null check, since it's a Bitmap, not T public bool IsSubsetOf (Bitmask bitmask) { return ((mask & bitmask.mask) == mask); } // no need for null check (T is constrained to ValueType) public void SetUp (T bit) { Console.WriteLine (bit.ToInt32 (null)); } } [Test] public void Generics () { AssertRuleFailure> ("IsSubsetOf", 1); AssertRuleSuccess> ("SetUp"); } public int AccessInstanceArrayBad (object[] array) { return array [0].GetHashCode (); } public int AccessInstanceArrayGood (object [] array) { if (array == null) throw new ArgumentNullException ("array"); return array [0].GetHashCode (); } public int AccessInstanceArrayGoodInverted (object [] array) { if (null == array) throw new ArgumentNullException ("array"); return array [0].GetHashCode (); } static public int AccessStaticArrayBad (int [] array) { return array [0] + array [1]; } static public int AccessStaticArrayGood (int [] array) { if (array == null) throw new ArgumentNullException ("array"); return array [0] + array [1]; } static public int AccessStaticArrayGoodInverted (int [] array) { if (null == array) throw new ArgumentNullException ("array"); return array [0] + array [1]; } [Test] public void Array () { AssertRuleSuccess ("AccessInstanceArrayGood"); AssertRuleSuccess ("AccessInstanceArrayGoodInverted"); AssertRuleFailure ("AccessInstanceArrayBad", 1); AssertRuleSuccess ("AccessStaticArrayGood"); AssertRuleSuccess ("AccessStaticArrayGoodInverted"); AssertRuleFailure ("AccessStaticArrayBad", 1); } public int InstanceGoodRef (ref object obj) { if (obj == null) throw new ArgumentNullException ("obj"); return obj.GetHashCode (); } public int InstanceGoodRefInverted (ref object obj) { if (null == obj) throw new ArgumentNullException ("obj"); return obj.GetHashCode (); } public int InstanceBadRef (ref object obj) { return obj.GetHashCode (); } static public int StaticGoodRef (ref object obj) { if (obj == null) throw new ArgumentNullException ("obj"); return obj.GetHashCode (); } static public int StaticGoodRefInverted (ref object obj) { if (null == obj) throw new ArgumentNullException ("obj"); return obj.GetHashCode (); } static public int StaticBadRef (ref object obj) { return obj.GetHashCode (); } [Test] public void Ref () { AssertRuleSuccess ("InstanceGoodRef"); AssertRuleSuccess ("InstanceGoodRefInverted"); AssertRuleFailure ("InstanceBadRef", 1); AssertRuleSuccess ("StaticGoodRef"); AssertRuleSuccess ("StaticGoodRefInverted"); AssertRuleFailure ("StaticBadRef", 1); } public void LateCheck (string s) { Console.WriteLine (s.Length); if (s != null) Console.WriteLine (s.GetHashCode ()); } public void LateCheckInverted (string s) { Console.WriteLine (s.Length); if (null != s) Console.WriteLine (s.GetHashCode ()); } [Test] public void Late () { AssertRuleFailure ("LateCheck", 1); AssertRuleFailure ("LateCheckInverted", 1); } // adapted from GraphicPathIterator public int Enumerate (ref double [] points, ref byte [] types) { int resultCount = 0; int count = points.Length; if (count != types.Length) throw new ArgumentException ("Invalid arguments passed. Both arrays should have the same length."); return resultCount; } [Test] public void Reference () { AssertRuleFailure ("Enumerate", 2); } static public void GetOut (out string s) { s = "Mono"; } public void ShowOut (out string s) { GetOut (out s); Console.WriteLine (s.Length); } public void ArrayOut (out string[] array, int length) { array = new string [length]; for (int i = 0; i < length; i++) GetOut (out array [i]); Console.WriteLine (array.Length); } [Test] public void OutParameter () { AssertRuleSuccess ("GetOut"); AssertRuleSuccess ("ShowOut"); AssertRuleSuccess ("ArrayOut"); } public class NonGeneric567817 { private IList underlyingCollection; private int ctx; public virtual void Add (string item) { if (item == null) { underlyingCollection.Add (null); return; } else { if (ctx != item.Length) { throw new Exception (); } underlyingCollection.Add (item); } } } public interface Stub { object Context { get; } } public class Generic567817 where TInterface : Stub where TImpl : class, TInterface { List underlyingCollection; object ctx; public virtual void Add (TInterface item) { if (item == null) { underlyingCollection.Add (null); return; } else { if (ctx != item.Context) { throw new Exception (); } underlyingCollection.Add ((TImpl) item); } } } [Test] public void Bug567817 () { AssertRuleSuccess ("Add"); AssertRuleSuccess> ("Add"); } public class GenericClass { public bool Test1 (T fs) where T : Stream { return fs.CanRead; } public bool Test2 (T fs) where T : Stream { if (fs == null) return false; return fs.CanRead; } public bool Test2Equals (T fs) where T : Stream { if (Equals (fs, null)) return false; return fs.CanRead; } public bool Test2EqualsDefault (T fs) where T : Stream { if (Equals (fs, default (Stream))) return false; return fs.CanRead; } public bool Test3 (T fs) where T : Stream { if (fs != null) return fs.CanRead; return false; } public bool Test3Equals (T fs) where T : Stream { if (!Equals (fs, null)) return fs.CanRead; return false; } public bool Test3EqualsDefault (T fs) where T : Stream { if (!Equals (fs, default (Stream))) return fs.CanRead; return false; } } [Test] public void MoreGenericCases () { AssertRuleFailure ("Test1", 1); AssertRuleSuccess ("Test2"); AssertRuleSuccess ("Test2Equals"); AssertRuleSuccess ("Test2EqualsDefault"); AssertRuleSuccess ("Test3"); AssertRuleSuccess ("Test3Equals"); AssertRuleSuccess ("Test3EqualsDefault"); } // test case provided by Iristyle, extracted from // https://github.com/Iristyle/mono-tools/commit/0c5649353619fc76b04ce406193f3e06e8654d69 public void ChecksObjectAndMember (Uri url) { if (null == url) throw new ArgumentNullException ("url"); string requestDetails = null != url && null != url.AbsoluteUri ? String.Format ("URL: {0}{1}", url.AbsoluteUri, Environment.NewLine) : String.Empty; } [Test] public void StaticWithParameter () { AssertRuleSuccess ("ChecksObjectAndMember"); } // test case from Iristyle // https://github.com/Iristyle/mono-tools/commit/d27c6d10ccebde1d1c3d600279fc35802581f266 public void ReassignsRefBeforeCheck (ref object test) { //uncommenting this line makes the test succeed //if (null == test) { throw new ArgumentNullException("test"); } //follow this general pattern because of FxCop false positive on CA1062 //http://connect.microsoft.com/VisualStudio/feedback/details/560099/ca1062-false-positive-with-byref-arguments object testCopy = test; if (null == testCopy) throw new ArgumentNullException ("test"); test = testCopy; } [Test] [Ignore ("by design the rule only checks parameter arguments, not variables, fields, return value...")] public void ParameterAssignedToVariableBeforeCheck () { AssertRuleSuccess ("ReassignsRefBeforeCheck"); } // test case provided by Iristyle - bnc665193 // https://github.com/Iristyle/mono-tools/commit/5afbd0a3ef746ff6fdb3db4e1be53995c1734be4 public void ChecksIsType (Exception ex) { //only non-nulls may pass if (ex is ArgumentException) { ex.ToString (); } } [Test] public void AllowsIsCheck () { AssertRuleSuccess ("ChecksIsType"); } } } TypesWithNativeFieldsShouldBeDisposableTest.cs0000664000175000017500000001510212413742070037447 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit tests for TypesWithNativeFieldsShouldBeDisposableRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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; using System.Runtime.InteropServices; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { class NoNativeFields { int A; object b; } class NativeFieldsImplementsIDisposeable : IDisposable { object A; IntPtr B; public void Dispose () { throw new NotImplementedException (); } } class NativeFieldsExplicit : IDisposable { object A; IntPtr B; void IDisposable.Dispose () { throw new NotImplementedException (); } } class NativeFieldsIntPtr : ICloneable { object A; IntPtr B; public object Clone () { throw new NotImplementedException (); } } class NativeFieldsIntPtrAssigned : ICloneable { object A; IntPtr B; public NativeFieldsIntPtrAssigned () { B = IntPtr.Zero; } public object Clone () { throw new NotImplementedException (); } } class NativeFieldsIntPtrAllocated : ICloneable { object A; IntPtr B; public NativeFieldsIntPtrAllocated () { B = Marshal.AllocCoTaskMem (1); } public object Clone () { throw new NotImplementedException (); } } class NativeFieldsUIntPtr : ICloneable { object A; UIntPtr B; public object Clone () { throw new NotImplementedException (); } } class NativeFieldsUIntPtrAssigned : ICloneable { object A; UIntPtr B; public NativeFieldsUIntPtrAssigned () { B = (UIntPtr) 0x1f00; } public object Clone () { throw new NotImplementedException (); } } class NativeFieldsUIntPtrAllocated : ICloneable { object A; UIntPtr B; [DllImport ("liberty")] extern static UIntPtr Alloc (int x); public NativeFieldsUIntPtrAllocated () { B = Alloc (1); } public object Clone () { throw new NotImplementedException (); } } class NativeFieldsHandleRef : ICloneable { object A; HandleRef B; public object Clone () { throw new NotImplementedException (); } } class NativeFieldsHandleRefAssigned : ICloneable { object A; HandleRef B; public NativeFieldsHandleRefAssigned () { GCHandle handle = GCHandle.Alloc (A, GCHandleType.Pinned); B = new HandleRef (handle, handle.AddrOfPinnedObject ()); } public object Clone () { throw new NotImplementedException (); } } class NativeFieldsHandleRefAllocatedElsewhere: ICloneable { object A; HandleRef B; HandleRef GetHandleReference () { return new HandleRef (A, IntPtr.Zero); } public NativeFieldsHandleRefAllocatedElsewhere () { // fxcop does not trigger on this (or similar cases) B = GetHandleReference (); } public object Clone () { throw new NotImplementedException (); } } abstract class AbstractNativeFields : IDisposable { object A; HandleRef B; public abstract void Dispose (); } abstract class AbstractNativeFields2 : IDisposable { object A; HandleRef B; public abstract void Dispose (); void IDisposable.Dispose () { throw new NotImplementedException (); } } class NativeFieldsArray : ICloneable { object A; IntPtr [] B; public object Clone () { B = new IntPtr [1]; // assignation (newobj+stfld) does not need to to be inside ctor // note: fxcop does not catch this one B [0] = Marshal.AllocCoTaskMem (1); A = B; return A; } } struct StructWithNativeFields { public IntPtr a; public UIntPtr b; public HandleRef c; } class NativeStaticFieldsArray { object A; static UIntPtr [] B; } [TestFixture] public class TypesWithNativeFieldsShouldBeDisposableTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void TestNoNativeFields () { AssertRuleSuccess (); } [Test] public void TestNativeFieldsImplementsIDisposeable () { AssertRuleSuccess (); } [Test] public void TestNativeFieldsExplicit () { AssertRuleSuccess (); } [Test] public void TestNativeFieldsIntPtr () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); } [Test] public void TestNativeFieldsUIntPtr () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); } [Test] public void TestNativeFieldsHandleRef () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); } [Test] public void TestAbstractNativeFields () { AssertRuleFailure (1); AssertRuleFailure (1); } [Test] public void TestNativeFieldsArray () { AssertRuleFailure (1); } [Test] public void TestStructWithNativeFields () { AssertRuleDoesNotApply (); } [Test] public void TestNativeStaticFieldsArray () { AssertRuleSuccess (); } } } ProvideCorrectArgumentsToFormattingMethodsTest.cs0000664000175000017500000002373412413742070040271 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit tests for ProvideCorrectArgumentsToFormattingMethodsRule // // Authors: // Néstor Salceda // Antoine Vandecreme // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; using Tests.Rules.Correctness; namespace Test.Rules.Correctness { [TestFixture] public class ProvideCorrectArgumentsToFormattingMethodsTest : MethodRuleTestFixture { [Test] public void SkipOnBodylessMethodsTest () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } [Test] public void SkipOnEmptyMethodTest () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } class FormattingCases { public void MethodWithBadFormatting (object value) { String.Format ("The value {0} isn't valid"); } public void MethodWithGoodFormatting (object value) { String.Format ("The value {0} isn't valid", value); } public void MethodWithGoodFormattingAndThreeParams (object value1, object value2, object value3) { String.Format ("{0} {1} {2}", value1, value2, value3); } public void MethodWithGoodFormattingAndFiveParams (object value1, object value2, object value3, object value4, object value5) { String.Format ("{0} {1} {2} {3} {4}", value1, value2, value3, value4, value5); } public void MethodWithGoodFormattingAndSomeCalls (object value1, object value2) { String.Format ("{0} {1}", value1.ToString (), value2.ToString ()); } public void MethodWithGoodFormattingAndDateTimes (DateTime dateTime) { String.Format ("'{0:yyyy-MM-dd HH:mm:ss}'", dateTime); } public void MethodWithGoodFormattingAndRepeatedIndexes (object value) { String.Format ("{0} - {0}", value); } public void MethodWithSpecialCharacters (object value) { String.Format ("The {2} '{0}' is not valid in the locked list for this section. The following {3} can be locked: '{1}'", value, value, value, value); } public void MethodWithGoodFormattingButWithMultipleBrackets (int height, int width) { String.Format ("{{Width={0}, Height={1}}}", width, height); } public void MethodWithGoodFormattingLoadingFromLocal () { string message = "The error {0} is not valid"; string val = "Foo"; String.Format (message, val); } public void MethodWithBadFormattingLoadingFromLocal () { string message = "The error {0} is not valid"; string val = "Foo"; String.Format (message); } public void MethodWithoutParameters () { String.Format ("I forget include parameters."); } public void MethodCallingEnumFormat (Type type, object value) { Enum.Format (type, value, "G"); } public void MethodWithGoodFormattingAndArrayParameter () { object [] values = { "value1", "value2", "value3" }; object [] notValues = { "notValue1", "notValue2" }; String.Format ("3 values : {0} {1} {2}", values); } public void MethodWithBadFormattingAndArrayParameter () { object [] notValues = { "notValue1", "notValue2" }; object [] values = { "value1", "value2", "value3" }; String.Format ("3 values : {0} {1} {2}", notValues); } private string GetGoodFormat () { return "{0} - {1}"; } public void MethodCallingMethodToGetGoodFormat () { String.Format (GetGoodFormat (), "value1", "value2"); } public void MethodWithGoodFormattingAndIFormatProvider () { String.Format (new CultureInfo ("en-US"), "Format : {0}", "value"); } public void MethodWithBadFormattingAndIFormatProvider () { String.Format (new CultureInfo ("en-US"), "Format : {0} {1}", "value1"); } public void MethodWithGoodFormattingAndStringResource () { String.Format (Resource.OneParameter, "parameter1"); String.Format (Resource.TwoParameter, "parameter1", "parameter2"); } public void MethodWithBadFormattingAndStringResource () { String.Format (Resource.OneParameter, "parameter1", "parameter2"); String.Format (Resource.TwoParameter, "parameter1"); } } [Test] public void FailOnMethodWithBadFormattingTest () { AssertRuleFailure ("MethodWithBadFormatting", 1); } [Test] public void SuccessOnMethodWithGoodFormattingTest () { AssertRuleSuccess ("MethodWithGoodFormatting"); } [Test] public void SuccessOnMethodWithGoodFormattingAndThreeParamsTest () { AssertRuleSuccess ("MethodWithGoodFormattingAndThreeParams"); } [Test] public void SuccessOnMethodWithGoodFormattingAndFiveParamsTest () { AssertRuleSuccess ("MethodWithGoodFormattingAndFiveParams"); } [Test] public void SuccessOnMethodWithGoodFormattingAndSomeCallsTest () { AssertRuleSuccess ("MethodWithGoodFormattingAndSomeCalls"); } [Test] public void SuccessOnMethodWithGoodFormattingAndDateTimesTest () { AssertRuleSuccess ("MethodWithGoodFormattingAndDateTimes"); } [Test] public void SuccessOnMethodWithGoodFormattingAndRepeatedIndexesTest () { AssertRuleSuccess ("MethodWithGoodFormattingAndRepeatedIndexes"); } [Test] public void SuccessOnMethodWithSpecialCharactersTest () { AssertRuleSuccess ("MethodWithSpecialCharacters"); } [Test] public void SuccessOnMethodWithGoodFormattingButWithMultipleBracketsTest () { AssertRuleSuccess ("MethodWithGoodFormattingButWithMultipleBrackets"); } [Test] public void SuccessOnMethodWithGoodFormattingLoadingFromLocalTest () { AssertRuleSuccess ("MethodWithGoodFormattingLoadingFromLocal"); } [Test] public void FailOnMethodWithBadFormattingLoadingFromLocalTest () { AssertRuleFailure ("MethodWithBadFormattingLoadingFromLocal", 1); } [Test] public void FailOnMethodWithoutParametersTest () { AssertRuleFailure ("MethodWithoutParameters", 1); } [Test] public void SkipOnMethodCallingEnumFormatTest () { AssertRuleSuccess ("MethodCallingEnumFormat"); } [Test] public void SuccessOnMethodWithGoodFormattingAndArrayParameter () { AssertRuleSuccess ("MethodWithGoodFormattingAndArrayParameter"); } [Test] public void FailOnMethodWithBadFormattingAndArrayParameter () { AssertRuleFailure ("MethodWithBadFormattingAndArrayParameter"); } [Test] public void SuccessOnMethodCallingMethodToGetGoodFormat () { AssertRuleSuccess ("MethodCallingMethodToGetGoodFormat"); } [Test] public void SuccessOnMethodWithGoodFormattingAndIFormatProvider () { AssertRuleSuccess ("MethodWithGoodFormattingAndIFormatProvider"); } [Test] public void FailOnMethodWithBadFormattingAndIFormatProvider () { AssertRuleFailure ("MethodWithBadFormattingAndIFormatProvider"); } [Test] public void SuccessOnMethodWithGoodFormattingAndStringResource () { AssertRuleSuccess ("MethodWithGoodFormattingAndStringResource"); } [Test] public void FailOnMethodWithBadFormattingAndStringResource () { AssertRuleFailure ("MethodWithBadFormattingAndStringResource", 2); } string InstanceLocalize (string s) { return s; } void ParseUsingInstanceMethod () { try { throw new NotSupportedException (); } catch (Exception e) { throw new FormatException (String.Format (InstanceLocalize ("{0} {1}"), e.Source, e), e); } } static string StaticLocalize (string s) { return s; } void ParseUsingStaticMethod () { try { throw new NotSupportedException (); } catch (Exception e) { throw new FormatException (String.Format (StaticLocalize ("{0} {1}"), e.Source, e), e); } } [Test] public void NoConstantString () { AssertRuleSuccess ("ParseUsingInstanceMethod"); AssertRuleSuccess ("ParseUsingStaticMethod"); } string GetFormat (string a) { return String.Format ("{{0", a); } string End (string a) { return String.Format ("{", a); } string ConditionalIfString (bool value) { return String.Format ("{0} {1}", value ? "true" : "false", "uho"); } string ConditionalIfCalls (bool value) { return String.Format ("{0} {1}", value ? ConditionalIfString (value) : ConditionalIfString (!value), "uho"); } [Test] public void SpecialCase () { AssertRuleFailure ("GetFormat", 1); AssertRuleFailure ("End", 1); AssertRuleSuccess ("ConditionalIfString"); AssertRuleSuccess ("ConditionalIfCalls"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ProvideValidXmlStringTest.cs0000664000175000017500000001106712413742070034102 0ustar00directhexdirecthex00000000000000// // Unit tests for ProvideValidXmlStringRule // // Authors: // Cedric Vivier // // Copyright (C) 2009 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 NUnit.Framework; using Gendarme.Rules.Correctness; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; using System.Xml; using System.Xml.XPath; namespace Test.Rules.Correctness { class XmlCases { const string good1 = "Robert J. Sawyer"; const string bad1 = "Robert J. Sawyer"; string DoesNotApply1 () { return bad1; } void Success0 () { var doc = new XmlDocument (); doc.LoadXml (""); } void Failure0 () { var doc = new XmlDocument (); doc.LoadXml (""); } void Success1 () { var doc = new XmlDocument (); doc.LoadXml (good1); } void Failure1 () { var doc = new XmlDocument (); doc.LoadXml (bad1); } void Success2 (XmlDocumentFragment doc, string xml) { doc.InnerXml = xml; } void Failure2 (XmlDocumentFragment doc) { doc.InnerXml = bad1; } void Success3 (XPathNavigator nav, string xml) { nav.OuterXml = xml; } void Failure3 (XPathNavigator nav) { nav.OuterXml = bad1; } void Success4 (XPathNavigator nav, string xml) { nav.AppendChild (xml); nav.AppendChild (); nav.AppendChild (nav); nav.InsertAfter (xml); nav.InsertAfter (); nav.InsertAfter (nav); } void Failure4 (XPathNavigator nav) { nav.AppendChild (bad1); } void Failure4b (XPathNavigator nav) { nav.InsertAfter (bad1); } void FailureNull () { var doc = new XmlDocument (); doc.LoadXml (null); doc.InnerXml = null; doc.CreateNavigator ().AppendChild ((string) null); } void FailureEmpty () { var doc = new XmlDocument (); doc.LoadXml (""); doc.InnerXml = ""; doc.CreateNavigator ().AppendChild (string.Empty); } } [TestFixture] public class ProvideValidXmlStringTest : MethodRuleTestFixture { static bool raisedAnalyzeModuleEvent; [SetUp] public void RaiseAnalyzeModuleEvent () { if (raisedAnalyzeModuleEvent) return; raisedAnalyzeModuleEvent = true; ((TestRunner) Runner).OnModule (DefinitionLoader.GetTypeDefinition ().Module); } [Test] public void DoesNotApply0 () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("DoesNotApply1"); } [Test] public void Success0 () { AssertRuleSuccess ("Success0"); } [Test] public void Success1 () { AssertRuleSuccess ("Success1"); } [Test] public void Success2 () { AssertRuleSuccess ("Success2"); } [Test] public void Success3 () { AssertRuleSuccess ("Success3"); } [Test] public void Success4 () { AssertRuleSuccess ("Success4"); } [Test] public void Failure0 () { AssertRuleFailure ("Failure0", 1); } [Test] public void Failure1 () { AssertRuleFailure ("Failure1", 1); } [Test] public void Failure2 () { AssertRuleFailure ("Failure2", 1); } [Test] public void Failure3 () { AssertRuleFailure ("Failure3", 1); } [Test] public void Failure4 () { AssertRuleFailure ("Failure4", 1); AssertRuleFailure ("Failure4b", 1); } [Test] public void FailureNullOrEmpty () { AssertRuleFailure ("FailureNull", 3); AssertRuleFailure ("FailureEmpty", 3); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/Resource.Designer.cs0000664000175000017500000000652212413742070032330 0ustar00directhexdirecthex00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Tests.Rules.Correctness { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resource { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resource() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tests.Rules.Correctness.Resource", typeof(Resource).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// /// Looks up a localized string similar to A string with one parameter : {0}.. /// internal static string OneParameter { get { return ResourceManager.GetString("OneParameter", resourceCulture); } } /// /// Looks up a localized string similar to A string with 2 parameters : {0}, {1}.. /// internal static string TwoParameter { get { return ResourceManager.GetString("TwoParameter", resourceCulture); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/NullDerefTest.cs0000664000175000017500000001166712413742070031530 0ustar00directhexdirecthex00000000000000// // Unit tests for NullDerefRule rule // // Authors: // Jesse Jones // // Copyright (C) 2008 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 System.Reflection; using System.Xml; using System.Xml.Schema; using Gendarme.Framework; using Gendarme.Rules.Correctness; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Correctness { [TestFixture] public class NullDerefTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public class GoodCases { public List CreateListAll (int c) { List result = null; if (c == 0) result = new List (); else result = new List (c); result.Add (1); return result; } public List CreateListIf (int c) // this was a false positive with FAILURE4 { List result = null; if (c == 0) result = new List (); else if (c > 0) result = new List (c); if (result != null) result.Add (1); return result; } public List CreateListIf2 (int c) { List result = null; if (c == 0) result = new List (); else if (c > 0) result = new List (c); if (null != result) result.Add (1); return result; } public List CreateListThrow (int c) { List result = null; if (c == 0) result = new List (); else if (c > 0) result = new List (c); if (result == null) throw new ArgumentException ("c can't be negative!"); result.Add (1); return result; } public List CreateListThrow2 (int c) { List result = null; if (c == 0) result = new List (); else if (c > 0) result = new List (c); if (null == result) throw new ArgumentException ("c can't be negative!"); result.Add (1); return result; } byte AddFiles (string name) // this fails without the EmptyStack fix { if (String.IsNullOrEmpty (name)) return 0; if (name.StartsWith ("@", StringComparison.OrdinalIgnoreCase)) { // note: recursive (can contains @, masks and filenames) using (StreamReader sr = File.OpenText (name.Substring (1))) { while (sr.Peek () >= 0) { AddFiles (sr.ReadLine ()); } } } else if (name.IndexOfAny (new char [] { '*', '?' }) >= 0) { string dirname = Path.GetDirectoryName (name); if (dirname.Length == 0) dirname = "."; // assume current directory string [] files = Directory.GetFiles (dirname, Path.GetFileName (name)); foreach (string file in files) { AddAssembly (file); } } else { AddAssembly (name); } return 0; } void AddAssembly (string filename) { } void Using () { using (Stream stream = new FileStream ("gendarme.xsd", FileMode.Create)) { using (XmlReader reader = XmlReader.Create ("foo")) { while (reader.Read ()){} } } } void TryGetValue (Dictionary d) { object o; if (d.TryGetValue ("hmm", out o)) Console.WriteLine (o.ToString ()); } } public class BadCases { public List CreateList (int c) { List result = null; if (c == 0) result = new List (); else if (c > 0) Console.WriteLine ("len = {0}", result.Count); result.Add (1); return result; } } [Test] public void Test () { // Runner.VerbosityLevel = 3; // AssertRuleSuccess ("AddFiles"); AssertRuleSuccess (); AssertRuleFailure ("CreateList"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/Tests.Rules.Correctness.csproj0000775000175000017500000002037512413742070034366 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {FFB3FC5E-8CC4-4360-87DB-EADC266F82A5} Library Properties Tests.Rules.Correctness Tests.Rules.Correctness 3.5 true v4.0 http://localhost/Tests.Rules.Correctness/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 True True Resource.resx {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {732905E1-1FD4-403A-93DD-EC4CF120091E} Gendarme.Rules.Correctness False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false ResXFileCodeGenerator Resource.Designer.cs Designer mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/DontCompareWithNaNTest.cs0000664000175000017500000001165212413742070033306 0ustar00directhexdirecthex00000000000000// // Unit test for DoNotCompareWithNaNRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class DoNotCompareWithNaNTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } public class SingleCases { public bool EqualityOperatorLeft (float a) { return (Single.NaN == a); } public bool EqualityOperatorRight (float a) { return (a == Single.NaN); } public bool Equality (float a, float b) { // note: ok for this rule (not for another one) return (a == b); } public bool InequalityOperatorLeft (float a) { return (Single.NaN != a); } public bool InequalityOperatorRight (float a) { return (a != Single.NaN); } public bool Inequality (float a, float b) { // note: ok for this rule (not for another one) return (a != b); } public bool NaNEquals (float a) { return Single.NaN.Equals (a); } public bool EqualsNaN (float a) { return a.Equals (Single.NaN); } public bool Equals (float a, float b) { // note: ok for this rule (not for another one) return (a.Equals (b) && b.Equals (a)); } } public class DoubleCases { public bool EqualityOperatorLeft (double a) { return (Double.NaN == a); } public bool EqualityOperatorRight (double a) { return (a == Double.NaN); } public bool Equality (double a, double b) { // note: ok for this rule (not for another one) return (a == b); } public bool InequalityOperatorLeft (double a) { return (Double.NaN != a); } public bool InequalityOperatorRight (double a) { return (a != Double.NaN); } public bool Inequality (double a, double b) { // note: ok for this rule (not for another one) return (a != b); } public bool NaNEquals (double a) { return Double.NaN.Equals (a); } public bool EqualsNaN (double a) { return a.Equals (Double.NaN); } public bool Equals (double a, double b) { // note: ok for this rule (not for another one) return (a.Equals (b) && b.Equals (a)); } } [Test] public void EqualityOperator () { AssertRuleFailure ("EqualityOperatorLeft", 1); AssertRuleFailure ("EqualityOperatorRight", 1); // no LDC_R[4|8] AssertRuleDoesNotApply ("Equality"); AssertRuleFailure ("EqualityOperatorLeft", 1); AssertRuleFailure ("EqualityOperatorRight", 1); // no LDC_R[4|8] AssertRuleDoesNotApply ("Equality"); } [Test] public void InequalityOperator () { AssertRuleFailure ("InequalityOperatorLeft", 1); AssertRuleFailure ("InequalityOperatorRight", 1); // no LDC_R[4|8] AssertRuleDoesNotApply ("Inequality"); AssertRuleFailure ("InequalityOperatorLeft", 1); AssertRuleFailure ("InequalityOperatorRight", 1); // no LDC_R[4|8] AssertRuleDoesNotApply ("Inequality"); } [Test] public void NaNEquals () { AssertRuleFailure ("NaNEquals", 1); AssertRuleFailure ("NaNEquals", 1); } [Test] public void EqualsNaN () { AssertRuleFailure ("EqualsNaN", 1); AssertRuleFailure ("EqualsNaN", 1); } [Test] public void Equals () { AssertRuleDoesNotApply ("Equals"); AssertRuleDoesNotApply ("Equals"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/EnsureLocalDisposalTest.cs0000664000175000017500000002431212413742070033552 0ustar00directhexdirecthex00000000000000// // Unit tests for EnsureLocalDisposalRule // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Xml; using System.Collections.Generic; using NUnit.Framework; using Gendarme.Framework; using Gendarme.Rules.Correctness; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Correctness { class DisposalCases { string foo; StreamReader sr; StreamReader StreamReader { get; set; } string DoesNotApply1 () { //no call/newobj/stloc return foo; } string Success0 () { var o = new object (); return o.ToString (); } void Success1 () { using (var reader = XmlReader.Create ("foo.xml")) { Console.WriteLine (reader.ToString ()); } } void Success2 (string pattern) { using (var reader = XmlReader.Create ("foo.xml")) { Console.WriteLine (reader.ToString ()); StreamReader reader2 = null; try { reader2 = new StreamReader ("bar.xml"); //newobj } catch (InvalidOperationException e) { Console.WriteLine (e.Message); } finally { if (reader2 != null) reader2.Dispose (); } } } void Success3 (IDisposable disposable) { int x = 0; disposable.Dispose (); } void Success4 () { int x = 0; sr = new StreamReader ("bar.xml"); //field } //foreach(enumerator) static string Success5 (IEnumerable strings) { foreach (var s in strings) { if (s.Length > 0) return s; } return null; } //foreach(valuetype_enumerator) || valuetype disposable static string ValueTypeDisposable (List strings) { foreach (var s in strings) { if (s.Length > 0) return s; } return null; } //generator //csc/gmcs for some reason build an IDisposable iterator class that is never disposed static IEnumerable Success6 () { yield return "foo"; yield return "bar"; } void Success7 () { sr = new StreamReader ("bar.xml"); //field } void Success8 () { StreamReader = new StreamReader ("bar.xml"); //property } void Failure0 () { var reader = XmlReader.Create ("foo.xml"); Console.WriteLine (reader.ToString ()); } void Failure1 () { var reader = XmlReader.Create ("foo.xml"); Console.WriteLine (reader.ToString ()); ((IDisposable) reader).Dispose (); //not guaranteed } void Failure2 () { XmlReader reader = null; try { reader = XmlReader.Create ("foo.xml"); Console.WriteLine (reader.ToString ()); } catch (InvalidOperationException e) { Console.WriteLine (e.Message); } ((IDisposable) reader).Dispose (); } void Failure3 () { using (var reader = XmlReader.Create ("foo.xml")) { Console.WriteLine (reader.ToString ()); try { var reader2 = new StreamReader ("bar.xml"); //newobj } finally { ((IDisposable) reader).Dispose (); //reader != reader2 !!! } } } void Failure4 () { var reader = XmlReader.Create ("foo.xml"); reader.ToString (); Success3 (reader); } bool Failure5 () { using (var reader = XmlReader.Create ("foo.xml")) { var reader2 = new StreamReader ("bar.xml"); //newobj var reader3 = new StreamReader ("baz.xml"); //newobj if (reader2.ReadLine () == reader3.ReadLine ()) return true; } return false; } void Failure6 () { var reader = XmlReader.Create ("foo.xml"); reader.ToString (); Success3 (reader); reader = XmlReader.Create ("bar.xml"); } void Failure7 () { new XmlTextReader ("foo.xml"); } void Failure8 () { var xslt = new System.Xml.Xsl.XslCompiledTransform (); xslt.Load (new XmlTextReader ("foo.xml")); } void Failure9 () { var xslt = new System.Xml.Xsl.XslCompiledTransform (); xslt.Load (XmlTextReader.Create ("foo.xml")); } } [TestFixture] public class EnsureLocalDisposalTest : MethodRuleTestFixture { [Test] public void DoesNotApply0 () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } [Test] public void DoesNotApply1 () { AssertRuleDoesNotApply ("DoesNotApply1"); } [Test] public void Success0 () { AssertRuleSuccess ("Success0"); } [Test] public void Success1 () { AssertRuleSuccess ("Success1"); } [Test] public void Success2 () { AssertRuleSuccess ("Success2"); } [Test] public void Success3 () { AssertRuleSuccess ("Success3"); } [Test] public void Success4 () { AssertRuleSuccess ("Success4"); } [Test] public void Success5 () { AssertRuleSuccess ("Success5"); } [Test] public void Success6 () { AssertRuleSuccess ("Success6"); } [Test] public void Success7 () { AssertRuleSuccess ("Success7"); } [Test] public void Success8 () { AssertRuleSuccess ("Success8"); } [Test] public void ValueTypeDisposable () { AssertRuleSuccess ("ValueTypeDisposable"); } [Test] public void Failure0 () { AssertRuleFailure ("Failure0", 1); } [Test] public void Failure1 () { AssertRuleFailure ("Failure1", 1); } [Test] public void Failure2 () { AssertRuleFailure ("Failure2", 1); } [Test] public void Failure3 () { AssertRuleFailure ("Failure3", 1); } [Test] public void Failure4 () { AssertRuleFailure ("Failure4", 1); } [Test] public void Failure5 () { AssertRuleFailure ("Failure5", 2); } [Test] public void Failure6 () { AssertRuleFailure ("Failure6", 2); } [Test] public void Failure7 () { AssertRuleFailure ("Failure7", 1); } [Test] public void Failure8 () { AssertRuleFailure ("Failure8", 1); } [Test] public void Failure9 () { AssertRuleFailure ("Failure9", 1); } // test case based on: // https://github.com/Iristyle/mono-tools/commit/2cccfd0efd406434e1309d0740826ff06d32de20 string FluentTestCase () { using (StringWriter sw = new StringWriter ()) { // while analyzing 'FluentTestCase' we cannot know what's inside // 'NestedFluentCall[Two|Three]' except that they _looks_like_ fluent APIs return NestedFluentCall (sw).ToString () + NestedFluentCallTwo (sw).ToString () + NestedFluentCallThree (sw).ToString (); } } StringWriter NestedFluentCall (StringWriter stringWriter) { // same instance is returned and does not need to be disposed (the caller does it) return stringWriter; } StringWriter NestedFluentCallTwo (StringWriter stringWriter) { // a new instance is being returned and someone should be disposing it // without source code or (good) documentation it behaves exactly like // the previous method StringWriter sw = new StringWriter (); sw.Write (stringWriter); return sw; } StringWriter NestedFluentCallThree (StringWriter stringWriter) { // really bad code to show that we cannot determine with 100% exactitude // what some methods returns to us if (stringWriter.GetHashCode () % 2 == 1) return NestedFluentCall (stringWriter); else return NestedFluentCallTwo (stringWriter); } [Test] public void FluentApi () { AssertRuleSuccess ("FluentTestCase"); } // adapted (without locals variants) from https://bugzilla.novell.com/show_bug.cgi?id=666403 void OutParameter1 (out StreamReader stream) { var new_stream = new StreamReader ("baz.xml"); //out param stream = new_stream; } bool OutParameter2 (out StreamReader stream) { stream = new StreamReader ("baz.xml"); //out param, no locals return true; } [Test] public void OutParameters () { AssertRuleSuccess ("OutParameter1"); AssertRuleSuccess ("OutParameter2"); } class SomeClassThatContainsADisposableProperty { public StreamReader Reader { get; set; } } void OtherInstanceProperty1 (SomeClassThatContainsADisposableProperty someObj) { var reader = new StreamReader ("foobaz.xml"); someObj.Reader = reader; //property in param } void OtherInstanceProperty2 (SomeClassThatContainsADisposableProperty someObj) { someObj.Reader = new StreamReader ("foobaz.xml"); //property in param, no locals } [Test] public void OtherInstance () { AssertRuleSuccess ("OtherInstanceProperty1"); AssertRuleSuccess ("OtherInstanceProperty2"); } StreamReader ReturnIDisposable1 () { var ret = new StreamReader ("baz.xml"); //return value return ret; } StreamReader ReturnIDisposable2 () { return new StreamReader ("baz.xml"); //return value, no locals } [Test] public void ReturnValue () { // csc 10 (without /o optimize) will fail this as it introduce extra compiler generated locals #if __MonoCS__ AssertRuleSuccess ("ReturnIDisposable1"); #endif AssertRuleSuccess ("ReturnIDisposable2"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/ProvideValidXPathExpressionTest.cs0000664000175000017500000001377612413742070035270 0ustar00directhexdirecthex00000000000000// // Unit tests for ProvideValidXPathExpressionRule // // Authors: // Cedric Vivier // // Copyright (C) 2009 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 NUnit.Framework; using Gendarme.Rules.Correctness; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; using System.Xml; using System.Xml.XPath; namespace Test.Rules.Correctness { class XPathCases { const string good1 = "//book/@title"; const string bad1 = "\\book/@title"; string DoesNotApply1 () { return bad1; } void Success0 () { var xpath = XPathExpression.Compile ("/book[@npages = 100]/@title"); } void Failure0 () { var xpath = XPathExpression.Compile ("/book[@npages == 100]/@title"); } void Success1 () { var xpath = XPathExpression.Compile (good1); } void Failure1 () { var xpath = XPathExpression.Compile (bad1); } void Success2 () { var xpath = XPathExpression.Compile ("/book[@npages = 100]/@title", null); } void Success3 (string expression) { var xpath = XPathExpression.Compile (expression); } void Success4 (string expression) { var xnav = new XmlDocument ().CreateNavigator (); xnav.Compile (expression); } void Failure4 () { var xnav = new XmlDocument ().CreateNavigator (); xnav.Compile (bad1); } void Success5 (XmlDocument document) { document.SelectNodes (good1); document.SelectNodes (good1, null); } void Failure5 (XmlDocument document) { document.SelectNodes (bad1); document.SelectNodes (bad1, null); } void Success6 (XmlDocument document) { document.SelectSingleNode (good1); document.SelectSingleNode (good1, null); } void Failure6 (XmlDocument document) { document.SelectSingleNode (bad1); document.SelectSingleNode (bad1, null); } void Success7 (string expression) { var xnav = new XmlDocument ().CreateNavigator (); xnav.Evaluate (expression); var xpe = XPathExpression.Compile (good1); xnav.Evaluate (xpe); } void Failure7 () { var xnav = new XmlDocument ().CreateNavigator (); xnav.Evaluate (bad1); } void Success8 (string expression) { var xnav = new XmlDocument ().CreateNavigator (); xnav.Select (expression); xnav.SelectSingleNode (expression); var xpe = XPathExpression.Compile (good1); xnav.Select (xpe); xnav.SelectSingleNode (xpe); } void Failure8 () { var xnav = new XmlDocument ().CreateNavigator (); xnav.Select (bad1); xnav.SelectSingleNode (bad1); } void FailureNull () { var xpath = XPathExpression.Compile (null); var xnav = new XmlDocument ().CreateNavigator (); xnav.Evaluate ((string) null); } void FailureEmpty () { var xpath = XPathExpression.Compile (""); var xnav = new XmlDocument ().CreateNavigator (); xnav.Select (string.Empty); } } [TestFixture] public class ProvideValidXPathExpressionTest : MethodRuleTestFixture { static bool raisedAnalyzeModuleEvent; [SetUp] public void RaiseAnalyzeModuleEvent () { if (raisedAnalyzeModuleEvent) return; raisedAnalyzeModuleEvent = true; ((TestRunner) Runner).OnModule (DefinitionLoader.GetTypeDefinition ().Module); } [Test] public void DoesNotApply0 () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("DoesNotApply1"); } [Test] public void Success0 () { AssertRuleSuccess ("Success0"); } [Test] public void Success1 () { AssertRuleSuccess ("Success1"); } [Test] public void Success2 () { AssertRuleSuccess ("Success2"); } [Test] public void Success3 () { AssertRuleSuccess ("Success3"); } [Test] public void Success4 () { AssertRuleSuccess ("Success4"); } [Test] public void Success5 () { AssertRuleSuccess ("Success5"); } [Test] public void Success6 () { AssertRuleSuccess ("Success6"); } [Test] public void Success7 () { AssertRuleSuccess ("Success7"); } [Test] public void Success8 () { AssertRuleSuccess ("Success8"); } [Test] public void Failure0 () { AssertRuleFailure ("Failure0", 1); } [Test] public void Failure1 () { AssertRuleFailure ("Failure1", 1); } [Test] public void Failure4 () { AssertRuleFailure ("Failure4", 1); } [Test] public void Failure5 () { AssertRuleFailure ("Failure5", 2); } [Test] public void Failure6 () { AssertRuleFailure ("Failure6", 2); } [Test] public void Failure7 () { AssertRuleFailure ("Failure7", 1); } [Test] public void Failure8 () { AssertRuleFailure ("Failure8", 2); } [Test] public void FailureNullOrEmpty () { AssertRuleFailure ("FailureNull", 2); AssertRuleFailure ("FailureEmpty", 2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/DeclareEventsExplicitlyTest.cs0000664000175000017500000000464112413742070034435 0ustar00directhexdirecthex00000000000000// // Unit tests for DeclareEventsExplicitlyRule // // Authors: // Sebastien Pouliot // // 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 Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Tests.Rules.Correctness { [TestFixture] public class DeclareEventsExplicitlyTest : TypeRuleTestFixture { struct StructInstanceCorrect { public event EventHandler MyEvent; } struct StructInstanceIncorrect { public EventHandler MyEvent; } class GenericClassStaticCorrect { public static event EventHandler MyEvent; } class GenericClassStaticIncorect { public static EventHandler MyEvent; public event EventHandler MyEvent2; } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Enum); // interface cannot define fields AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void Success () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Failure () { AssertRuleFailure (1); AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/CallingEqualsWithNullArgTest.cs0000664000175000017500000001107112413742070034502 0ustar00directhexdirecthex00000000000000// // Unit tests for CallingEqualsWithNullArgRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class CallingEqualsWithNullArgTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public class CallToEqualsWithNullArg { public static void Main (string [] args) { CallToEqualsWithNullArg c = new CallToEqualsWithNullArg (); c.Equals (null); } } [Test] public void CallToEqualsWithNullArgTest () { AssertRuleFailure ("Main", 1); } public class CallingEqualsWithNonNullArg { public static void Main (string [] args) { CallingEqualsWithNonNullArg c = new CallingEqualsWithNonNullArg (); CallingEqualsWithNonNullArg c1 = new CallingEqualsWithNonNullArg (); c.Equals (c1); c1 = null; // ensure an LDNULL instruction is inside the method } } [Test] public void CallingEqualsWithNonNullArgTest () { AssertRuleSuccess ("Main"); } public class CallingEqualsOnEnum { enum Days { Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday }; public bool Equals (Enum e) { if (e == null) return false; else return e.GetType () == typeof (Days); } public void PassingArgNullInEquals () { Type e = typeof (Days); e.Equals (null); } public void NotPassingNullArgInEquals () { Type e = typeof (Days); Type e1 = typeof (Days); e.Equals (e1); e1 = null; // ensure an LDNULL instruction is inside the method } } [Test] public void CallingEqualsOnEnumTest () { AssertRuleFailure ("PassingArgNullInEquals", 1); AssertRuleSuccess ("NotPassingNullArgInEquals"); } struct structure { public bool Equals (structure s) { return s.GetType () == typeof (structure); } } public class CallingEqualsOnStruct { public void PassingNullArgument () { structure s = new structure (); s.Equals (null); } public void PassingNonNullArg () { structure s = new structure (); structure s1 = new structure (); s.Equals (s1); } } [Test] public void CallingEqualsOnStructTest () { AssertRuleFailure ("PassingNullArgument", 1); // there's no LDNULL in the method, so the rule skip the analysis AssertRuleDoesNotApply ("PassingNonNullArg"); } public class CallingEqualsOnArray { int [] a = new int [] {1, 2, 3}; public bool Equals (int [] b) { if (b == null) return false; else return a.Length == b.Length; } public void PassingNullArg () { int [] b = new int [] {1, 2, 3}; b.Equals (null); } public void PassingNonNullArg () { int [] b = new int [] {1, 2, 3}; b.Equals (a); b = null; } } [Test] public void CallingEqualsOnArrayTest () { AssertRuleFailure ("PassingNullArg", 1); AssertRuleSuccess ("PassingNonNullArg"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/DoNotRoundIntegersTest.cs0000664000175000017500000002072012413742070033372 0ustar00directhexdirecthex00000000000000// // Unit test for DoNotRoundIntegersRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Framework; using Gendarme.Rules.Correctness; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class DoNotRoundIntegersTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } // [decimal|double] Ceiling ([decimal|double]) public decimal CeilingIntegerDecimal (int x) { return Math.Ceiling ((decimal) x); } public double CeilingIntegerDouble (int x) { return Math.Ceiling ((double) x); } public decimal CeilingFloatDecimal (float f) { return Math.Ceiling ((decimal) f); } public double CeilingFloatDouble (float f) { return Math.Ceiling (f); } public decimal CeilingDoubleDecimal (double d) { return Math.Ceiling ((decimal) d); } public double CeilingDoubleDouble (double d) { return Math.Ceiling ((double) d); } [Test] public void Ceiling () { Assert.AreEqual (1d, Math.Ceiling ((double) 1), "Ceiling(double)"); Assert.AreEqual (1m, Math.Ceiling ((decimal) 1), "Ceiling(decimal)"); AssertRuleFailure ("CeilingIntegerDecimal", 1); AssertRuleFailure ("CeilingIntegerDouble", 1); AssertRuleSuccess ("CeilingFloatDecimal"); AssertRuleSuccess ("CeilingFloatDouble"); AssertRuleSuccess ("CeilingDoubleDecimal"); AssertRuleSuccess ("CeilingDoubleDouble"); } // [decimal|double] Floor ([decimal|double]) private int x = 1; private double d = 3.14d; private float f = 42f; public decimal FloorIntegerDecimal () { return Math.Floor ((decimal) x); } public double FloorIntegerDouble () { return Math.Floor ((double) x); } public decimal FloorFloatDecimal () { return Math.Floor ((decimal) f); } public double FloorFloatDouble () { return Math.Floor (f); } public decimal FloorDoubleDecimal () { return Math.Floor ((decimal) d); } public double FloorDoubleDouble () { return Math.Floor ((double) d); } [Test] public void Floor () { Assert.AreEqual (1d, Math.Floor ((double) 1), "Floor(double)"); Assert.AreEqual (1m, Math.Floor ((decimal) 1), "Floor(decimal)"); AssertRuleFailure ("FloorIntegerDecimal", 1); AssertRuleFailure ("FloorIntegerDouble", 1); AssertRuleSuccess ("FloorFloatDecimal"); AssertRuleSuccess ("FloorFloatDouble"); AssertRuleSuccess ("FloorDoubleDecimal"); AssertRuleSuccess ("FloorDoubleDouble"); } // [decimal | double] Round ([decimal | double] [,Int32] [,MidpointRounding]) static int sx = 1; static float sf = 42f; static double sd = 3.14d; public static decimal RoundIntegerDecimal () { return Math.Round ((decimal) sx, 2); } public static double RoundIntegerDouble () { return Math.Round ((double) sx, MidpointRounding.AwayFromZero); } public static decimal RoundFloatDecimal () { return Math.Round ((decimal) sf, 1, MidpointRounding.ToEven); } public static double RoundFloatDouble () { return Math.Round (sf, 0); } public static decimal RoundDoubleDecimal () { return Math.Round ((decimal) sd, 2, MidpointRounding.AwayFromZero); } public static double RoundDoubleDouble () { return Math.Round ((double) sd, 1, MidpointRounding.ToEven); } [Test] public void Round () { Assert.AreEqual (1d, Math.Round ((double) 1), "Round(double)"); Assert.AreEqual (1m, Math.Round ((decimal) 1), "Round(decimal)"); AssertRuleFailure ("RoundIntegerDecimal", 1); AssertRuleFailure ("RoundIntegerDouble", 1); AssertRuleSuccess ("RoundFloatDecimal"); AssertRuleSuccess ("RoundFloatDouble"); AssertRuleSuccess ("RoundDoubleDecimal"); AssertRuleSuccess ("RoundDoubleDouble"); } // [decimal|double] Truncate ([decimal|double]) public decimal TruncateIntegerDecimal () { int x = 1; return Math.Truncate ((decimal) x); } public double TruncateIntegerDouble () { int x = 1; return Math.Truncate ((double) x); } public decimal TruncateFloatDecimal () { float f = 42f; return Math.Truncate ((decimal) f); } public double TruncateFloatDouble () { float f = 42f; return Math.Truncate (f); } public decimal TruncateDoubleDecimal () { double d = 3.14d; return Math.Truncate ((decimal) d); } public double TruncateDoubleDouble () { double d = 3.14d; return Math.Truncate ((double) d); } [Test] public void Truncate () { Assert.AreEqual (1d, Math.Truncate ((double) 1), "Truncate(double)"); Assert.AreEqual (1m, Math.Truncate ((decimal) 1), "Truncate(decimal)"); AssertRuleFailure ("TruncateIntegerDecimal", 1); AssertRuleFailure ("TruncateIntegerDouble", 1); AssertRuleSuccess ("TruncateFloatDecimal"); AssertRuleSuccess ("TruncateFloatDouble"); AssertRuleSuccess ("TruncateDoubleDecimal"); AssertRuleSuccess ("TruncateDoubleDouble"); } public double UnsignedLong (ulong l) { return Math.Ceiling ((double) l); } public double ChainAllByte (byte small) { double a = Math.Truncate (Math.Round (Math.Floor (Math.Ceiling ((double) small)))); double b = Math.Round (Math.Floor (Math.Ceiling (Math.Truncate ((double) small)))); double c = Math.Floor (Math.Ceiling (Math.Truncate (Math.Round ((double) small)))); double d = Math.Ceiling (Math.Truncate (Math.Round (Math.Floor ((double) small)))); return a + b + c + d; } public double ChainFloatingPoint (string s) { return Math.Floor (Double.Parse (s)); } public decimal ChainDecimal (string s) { return Math.Round (Decimal.Parse (s), 2); } public decimal ChainChainDecimal (string s) { return Math.Ceiling (ChainDecimal (s)); } [Test] public void Others () { Assert.AreEqual (1.0, UnsignedLong (1), "UnsignedLong"); AssertRuleFailure ("UnsignedLong", 1); Assert.AreEqual (4.0, ChainAllByte (1), "ChainAllByte"); AssertRuleFailure ("ChainAllByte", 4); Assert.AreEqual (3.0, ChainFloatingPoint ((3.14).ToString ()), "ChainFloatingPoint"); AssertRuleSuccess ("ChainFloatingPoint"); Assert.AreEqual (3.14m, ChainDecimal ((3.1415).ToString ()), "ChainDecimal"); AssertRuleSuccess ("ChainDecimal"); Assert.AreEqual (4m, ChainChainDecimal ((3.1415).ToString ()), "ChainChainDecimal"); AssertRuleSuccess ("ChainChainDecimal"); } // test case provided by Richard Birkby internal sealed class FalsePositive8 { public decimal Run () { GetType (); int x = 5; return Math.Round (x * 0.5M); } } [Test] public void DecimalResult () { AssertRuleSuccess ("Run"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/MethodCanBeMadeStaticTest.cs0000664000175000017500000000467512413742070033721 0ustar00directhexdirecthex00000000000000// // Unit tests for MethodCanBeMadeStatic rule // // Authors: // Jb Evain // // Copyright (C) 2007 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.Diagnostics; using Gendarme.Framework; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Correctness { [TestFixture] public class MethodCanBeMadeStaticTest : MethodRuleTestFixture { public class Item { public int Foo () { return 42; } public int _bar; public int Bar () { return _bar = 42; } public static int Baz () { return 42; } public virtual void Gazonk () { } public void OnItemBang (object sender, EventArgs ea) { } } [Test] public void TestGoodCandidate () { AssertRuleFailure ("Foo"); Assert.AreEqual (1, Runner.Defects.Count, "Count"); } [Test] public void TestNotGoodCandidate () { AssertRuleSuccess ("Bar"); AssertRuleDoesNotApply ("Baz"); AssertRuleDoesNotApply ("Gazonk"); AssertRuleDoesNotApply ("OnItemBang"); Assert.AreEqual (0, Runner.Defects.Count, "Count"); } [Conditional ("DO_NOT_DEFINE")] void WriteLine (string s) { Console.WriteLine (s); } [Test] public void ConditionalCode () { AssertRuleDoesNotApply ("WriteLine"); } } } AvoidMethodsWithSideEffectsInConditionalCodeTest.cs0000664000175000017500000001437012413742070040360 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test#define CONTRACTS_FULL #define SOME_DEFINE // // Unit test for AvoidMethodsWithSideEffectsInConditionalCodeRule // // Authors: // Jesse Jones // // (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Correctness; using NUnit.Framework; using System; using System.Diagnostics; using System.Diagnostics.Contracts; using System.Runtime.InteropServices; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace System.Diagnostics.Contracts { [Serializable] [AttributeUsage (AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = false)] public sealed class PureAttribute : Attribute { } public static class Contract { public static bool Foo (bool predicate) { return predicate; } } } namespace Test.Rules.Correctness { [TestFixture] public class AvoidMethodsWithSideEffectsInConditionalCodeTest : MethodRuleTestFixture { internal sealed class TestCases { // Anything can be used with non-conditionally compiled methods. public void Good1 (bool data) { NonConditionalCall (PureIdentity (data)); NonConditionalCall (NonPureIdentity (data)); } // PureAttribute methods can be used with conditional code. public void Good2 (bool data) { ConditionalCall (PureIdentity (data)); } // Getters can be used with conditional code. public void Good3 (ActivationContext context) { ConditionalCall (context.Form); } // Operators can be used with conditional code. public void Good4 (DateTime x, TimeSpan y) { ConditionalCall (x + y); } // All Contract methods can be used with conditional code. public void Good5 (bool data) { ConditionalCall (Contract.Foo (data)); } // All System.String methods can be used with conditional code. public void Good6 (string data) { ConditionalCall (data.GetHashCode ()); } // Predicate can be used with conditional code. public void Good7 (Predicate predicate, int x) { ConditionalCall (predicate (x)); } // PureAttribute delegates can be used with conditional code. public void Good8 (PureDelegate d, bool data) { ConditionalCall (d (data)); } // Dictionary`2::ContainsKey can be used with conditional code. public void Good9 (System.Collections.Generic.Dictionary d, string name) { ConditionalCall (d.ContainsKey (name)); } // Non-pure methods cannot be used with conditional code. public void Bad1 (bool data) { ConditionalCall (NonPureIdentity (data)); } // Method calls outside the assembly being tested resolve properly. public void Bad2 (bool data) { Trace.Assert (NonPureIdentity (data) != null); } // Non-pure delegates cannot be used with conditional code. public void Bad3 (NonPureDelegate d, bool data) { ConditionalCall (d (data)); } // Dictionary`2::Remove cannot be used with conditional code. public void Bad4 (System.Collections.Generic.Dictionary d, string name) { ConditionalCall (d.Remove (name)); } // Make sure contracts code is reported at the correct confidence. public void High1 (bool data) { ConditionalCall (NonPureIdentity (data)); } public void High2 (bool data) { ContractsCall (NonPureIdentity (data)); } public void Low (bool data) { OtherCall (NonPureIdentity (data)); } [Conditional ("DEBUG")] public void ConditionalCall (object data) { } [Conditional ("CONTRACTS_FULL")] public void ContractsCall (object data) { } [Conditional ("SOME_DEFINE")] public void OtherCall (object data) { } public void NonConditionalCall (object data) { } [Pure] public delegate bool PureDelegate (bool data); public delegate bool NonPureDelegate (bool data); [Pure] private object PureIdentity (object data) { return data; } private object NonPureIdentity (object data) { return data; } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } [Test] public void Cases () { AssertRuleSuccess ("Good1"); AssertRuleSuccess ("Good2"); AssertRuleSuccess ("Good3"); AssertRuleSuccess ("Good4"); AssertRuleSuccess ("Good5"); AssertRuleSuccess ("Good6"); AssertRuleSuccess ("Good7"); AssertRuleSuccess ("Good8"); AssertRuleSuccess ("Good9"); AssertRuleFailure ("Bad1"); AssertRuleFailure ("Bad2"); AssertRuleFailure ("Bad3"); AssertRuleFailure ("Bad4"); } [Test] public void Confidences () { AssertRuleFailure ("High1"); Assert.AreEqual (Confidence.High, Runner.Defects [0].Confidence, "High1-Confidence-High"); AssertRuleFailure ("High2"); Assert.AreEqual (Confidence.High, Runner.Defects [0].Confidence, "High2-Confidence-High"); AssertRuleFailure ("Low"); Assert.AreEqual (Confidence.Low, Runner.Defects [0].Confidence, "Low-Confidence-Low"); } } } TypesWithDisposableFieldsShouldBeDisposableTest.cs0000664000175000017500000001564012413742070040315 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit tests for TypesWithDisposableFieldsShouldBeDisposableRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // Copyright (C) 2008, 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 Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { class Disposable : IDisposable { public void Dispose () { throw new NotImplementedException (); } } class NoDisposeableFields { int A; object b; } class DisposeableFieldsImplementsIDisposeable : IDisposable { object A; Disposable B; public DisposeableFieldsImplementsIDisposeable () { B = new Disposable (); } public void Dispose () { throw new NotImplementedException (); } } class DisposeableFieldsImplementsIDisposeableCorrectly : IDisposable { object A; Disposable B; public DisposeableFieldsImplementsIDisposeableCorrectly () { B = new Disposable (); } public void Dispose () { B.Dispose (); // not really correct but Dispose is called :) } } class DisposeableFieldsExplicit : IDisposable { object A; Disposable B; void IDisposable.Dispose () { throw new NotImplementedException (); } } abstract class DisposeableFieldsImplementsIDisposeableAbstract : IDisposable { object A; Disposable B; public void Dispose (object asd) { B.Dispose (); } public abstract void Dispose (); } abstract class DisposeableFieldsImplementsIDisposeableAbstractAssigned : IDisposable { object A; Disposable B; protected DisposeableFieldsImplementsIDisposeableAbstractAssigned () { B = new Disposable (); } public abstract void Dispose (); } public class DisposeableFieldsNeverAssigned : ICloneable { object A; Disposable B; public object Clone () { throw new NotImplementedException (); } } public class DisposeableFieldsNullAssigned : ICloneable { object A; Disposable B; public DisposeableFieldsNullAssigned () { A = null; B = null; } public object Clone () { throw new NotImplementedException (); } } public class DisposeableFieldsAssigned : ICloneable { object A; Disposable B; public DisposeableFieldsAssigned () { A = null; B = new Disposable (); } public object Clone () { throw new NotImplementedException (); } } class DisposeableFieldsReferenced : ICloneable { object A; Disposable B; public DisposeableFieldsReferenced (Disposable instance) { A = null; B = instance; } public object Clone () { throw new NotImplementedException (); } } class DisposeableFieldsArray : ICloneable { object A; Disposable [] B; public object Clone () { throw new NotImplementedException (); } } class DisposeableFieldsArrayAssigned : ICloneable { object A; Disposable [] B; public object Clone () { // the array itself is not not IDisposable B = new Disposable [10]; A = B; return A; } } class DisposeableFieldsArrayMembers : ICloneable { object A; Disposable [] B; public object Clone () { B = new Disposable [1]; // assignation (newobj+stfld) does not need to to be inside ctor // note: fxcop does not catch this one B [0] = new Disposable (); A = B; return A; } } struct StructWithDisposeableFields { Disposable a; object b; public StructWithDisposeableFields (object obj) { b = obj; a = new Disposable (); } } class DisposeableStaticFieldsArray { object A; static Disposable [] B; static DisposeableStaticFieldsArray () { B = new Disposable [1]; B [0] = new Disposable (); } } // test case from https://bugzilla.novell.com/show_bug.cgi?id=671029 interface ISession : IDisposable { void Query (string s); } class SomeRepository { ISession session; public SomeRepository (ISession session) { this.session = session; } public void DoSomeQuery () { session.Query ("whatever"); } } [TestFixture] public class TypesWithDisposableFieldsShouldBeDisposableTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void TestNoDisposeableFields () { AssertRuleSuccess (); } [Test] public void TestDisposeableFieldsImplementsIDisposeable () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void TestDisposeableFieldsExplicit () { AssertRuleSuccess (); } [Test] public void TestDisposeableFieldsImplementsIDisposeableAbstract () { AssertRuleFailure (1); AssertRuleFailure (2); } [Test] public void TestDisposeableFields () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); } [Test] public void TestDisposeableFieldsArray () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); } [Test] public void TestStructWithDisposeableFields () { AssertRuleDoesNotApply (); } [Test] public void TestDisposeableStaticFieldsArray () { AssertRuleSuccess (); } [Test] public void Bug671029 () { AssertRuleSuccess (); } } } AvoidCodeWithSideEffectsInConditionalCodeTest.cs0000664000175000017500000000744112413742070037630 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit test for AvoidCodeWithSideEffectsInConditionalCodeRule // // Authors: // Jesse Jones // // (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using System.Diagnostics; using Mono.Cecil; using Gendarme.Framework.Rocks; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Correctness { [TestFixture] public class AvoidCodeWithSideEffectsInConditionalCodeTest : MethodRuleTestFixture { internal sealed class TestCases { // Anything can be used with non-conditionally compiled methods. public void Good1 (int data) { NonConditionalCall (++data == 1); NonConditionalCall (data = 100); } // Most expressions are OK with conditional code. public void Good2 (int data) { ConditionalCall (data + 1); ConditionalCall (data > 0 ? 100 : 2); ConditionalCall (new string ('x', 32)); ConditionalCall ("data " + data); data = 100; ConditionalCall (data); ++data; ConditionalCall (data); } // Increment, decrement, and assign can't be used. public void Bad1 (int data) { ConditionalCall (++data); ConditionalCall (data++); ConditionalCall (--data); ConditionalCall (data--); ConditionalCall (data = 10); } // Can't write to locals. public void Bad2 (Dictionary d) { string local; if (!d.TryGetValue (1, out local)) local = "foo"; ConditionalCall (local = "bar"); } // Can't write to instance fields. public void Bad3 () { ConditionalCall (instance_data = 10); } // Can't write to static fields. public void Bad4 () { ConditionalCall (class_data = 10); } [Conditional ("DEBUG")] public void ConditionalCall (object data) { } public void NonConditionalCall (object data) { } private int instance_data; private static int class_data; } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } [Test] public void Cases () { AssertRuleSuccess ("Good1"); AssertRuleSuccess ("Good2"); AssertRuleFailure ("Bad1", 5); // Bad2 can "avoid to fail" if debugging symbols are not found - that includes not being // able to load Mono.Cecil.Pdb.dll (on Windows / CSC) or Mono.Cecil.Mdb.dll (xMCS) MethodDefinition md = DefinitionLoader.GetMethodDefinition ("Bad2"); if (md.DeclaringType.Module.HasSymbols) AssertRuleFailure (md); AssertRuleFailure ("Bad3"); AssertRuleFailure ("Bad4"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/Makefile.am0000664000175000017500000000022112413742070030475 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Correctness.csproj Resource.resx Resource.Designer.cs DISTCLEANFILES = Makefile.in all: ReviewCastOnIntegerMultiplicationTest.cs0000664000175000017500000002132712413742070036370 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit test for ReviewCastOnIntegerMultiplicationRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class ReviewCastOnIntegerMultiplicationTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no MUL AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } // a multiplication result is either an [U]Int32 or [U]Int64 type // // Operands Result Test Case Notes // ---------------------------------------------------------------------------------- // Sbyte * Sbyte Int32 NoProblem No overflow possible // Byte * Byte Int32 NoProblem No overflow possible // Int16 * Int16 Int32 NoProblem No overflow possible // UInt16 * UInt16 Int32 CastIntoInt64 Overflow possible [1] // Int32 * Int32 Int32 CastIntoInt64 Overflow possible [1] // UInt32 * UInt32 UInt32 CastIntoUInt64 Overflow possible [2] // Int64 * Int64 Int64 CannotCast Overflow possible [3] // UInt64 * UInt64 UInt64 CannotCast Overflow possible [3] // // [1] casting operands, *not* the result, into a [U]Int64 will solve the potential overflow // [2] casting operands, *not* the result, into a UInt64 will solve the potential overflow // [3] result may overflow, casting to a bigger size is not possible (or would not solve the issue), but you can use 'checked' to get an exception. int MulSByte (sbyte a, sbyte b) { // no conv* instruction is needed return a * b; } int MulByte (byte a, byte b) { // no conv* instruction is needed (even with the unneeded cast) return (int) a * b; } int MulInt16 (short a, short b) { // no conv* instruction is needed (even with the unneeded cast) return (int) (a * b); } [Test] public void NoProblem () { Assert.IsTrue (SByte.MaxValue * SByte.MaxValue <= Int32.MaxValue, "SByte*SByte"); AssertRuleSuccess ("MulSByte"); Assert.IsTrue (Byte.MaxValue * Byte.MaxValue <= Int32.MaxValue, "Byte*Byte"); AssertRuleSuccess ("MulByte"); Assert.IsTrue (Int16.MaxValue * Int16.MaxValue <= Int32.MaxValue, "Int16*Int16"); AssertRuleSuccess ("MulInt16"); } long BadMulUInt16 (ushort a, ushort b) { // ldarg.1 ldarg.2 mul conv.i8 return unchecked (a * b); } long GoodMulUInt16 (ushort a, ushort b) { // ldarg.1 conv.i8 ldarg.2 conv.i8 mul return unchecked ((long) a * b); } long BadMulInt32 (int a, int b) { // ldarg.1 ldarg.2 mul conv.i8 return unchecked (a * b); } long GoodMulInt32 (int a, int b) { // ldarg.1 conv.i8 ldarg.2 conv.i8 mul return unchecked ((long) a * b); } long CheckedBadMulInt32 (int a, int b) { // ldarg.1 ldarg.2 mul conv.i8 return a * b; } long CheckedGoodMulInt32 (int a, int b) { // ldarg.1 conv.i8 ldarg.2 conv.i8 mul return (long) a * b; } [Test] public void CastIntoInt64 () { unchecked { // since UInt16 * UInt16 is not garanteed to fit in a Int32... Assert.IsTrue ((long) UInt16.MaxValue * UInt16.MaxValue <= Int64.MaxValue, "UInt16*UInt16"); // ... people will often cast the result into an Int64 Assert.AreEqual (-131071, BadMulUInt16 (UInt16.MaxValue, UInt16.MaxValue), "BadMulInt16"); AssertRuleFailure ("BadMulUInt16", 1); Assert.AreEqual (4294836225, GoodMulUInt16 (UInt16.MaxValue, UInt16.MaxValue), "GoodMulInt16"); AssertRuleSuccess ("GoodMulUInt16"); // since Int32 * Int32 is not garanteed to fit in a [U]Int32... Assert.IsTrue ((long) Int32.MaxValue * Int32.MaxValue <= Int64.MaxValue, "Int32*Int32"); // ... people will *very* often cast the result into an Int64 Assert.AreEqual (1, BadMulInt32 (Int32.MaxValue, Int32.MaxValue), "BadMulInt32"); AssertRuleFailure ("BadMulInt32", 1); Assert.AreEqual (4611686014132420609, GoodMulInt32 (Int32.MaxValue, Int32.MaxValue), "GoodMulInt32"); AssertRuleSuccess ("GoodMulInt32"); AssertRuleFailure ("CheckedBadMulInt32", 1); AssertRuleSuccess ("CheckedGoodMulInt32"); } } ulong BadMulUInt32 (uint a, uint b) { // ldarg.1 ldarg.2 mul conv.u8 return unchecked (a * b); } ulong GoodMulUInt32 (uint a, uint b) { // ldarg.1 conv.u8 ldarg.2 conv.u8 mul return unchecked ((ulong) a * b); } ulong CheckedBadMulUInt32 (uint a, uint b) { // ldarg.1 ldarg.2 mul conv.u8 return a * b; } ulong CheckedGoodMulUInt32 (uint a, uint b) { // ldarg.1 conv.u8 ldarg.2 conv.u8 mul return (ulong) a * b; } [Test] public void CastIntoUInt64 () { unchecked { // since UInt32 * UInt32 is not garanteed to fit in a Int64... Assert.IsTrue ((ulong) UInt32.MaxValue * UInt32.MaxValue <= UInt64.MaxValue, "UInt32*UInt32"); // ... people will often cast the result into an UInt64 Assert.AreEqual (1, BadMulUInt32 (UInt32.MaxValue, UInt32.MaxValue), "BadMulInt32"); AssertRuleFailure ("BadMulUInt32", 1); Assert.AreEqual (18446744065119617025, GoodMulUInt32 (UInt32.MaxValue, UInt32.MaxValue), "GoodMulInt32"); AssertRuleSuccess ("GoodMulUInt32"); AssertRuleFailure ("CheckedBadMulUInt32", 1); AssertRuleSuccess ("CheckedGoodMulUInt32"); } } long MulInt64 (long a, long b) { return unchecked (a * b); } long CheckedMulInt64 (long a, long b, ref bool exception) { try { exception = false; checked { return a * b; } // mul.ovf } catch (OverflowException) { exception = true; return 0; } } ulong MulUInt64 (ulong a, ulong b) { return unchecked (a * b); } ulong CheckedUMulInt64 (ulong a, ulong b, ref bool exception) { try { exception = false; checked { return a * b; } // mul.ovf.un } catch (OverflowException) { exception = true; return 0; } } [Test] public void CannotCast () { unchecked { Assert.AreEqual (1, MulInt64 (Int64.MaxValue, Int64.MaxValue), "Int64*Int64"); AssertRuleSuccess ("MulInt64"); // note: casting a long into ulong would not solve the issue either Assert.AreEqual (1, MulUInt64 ((ulong)Int64.MaxValue, (ulong)Int64.MaxValue), "UInt64*Int64"); Assert.AreEqual (1, MulUInt64 (UInt64.MaxValue, UInt64.MaxValue), "UInt64*UInt64"); AssertRuleSuccess ("MulUInt64"); bool exception = false; Assert.AreEqual (0, CheckedMulInt64 (Int64.MaxValue, Int64.MaxValue, ref exception), "Checked-Int64*Int64"); Assert.IsTrue (exception, "Exception-Int64*Int64"); exception = false; Assert.AreEqual (0, CheckedUMulInt64 (UInt64.MaxValue, UInt64.MaxValue, ref exception), "Checked-UInt64*UInt64"); Assert.IsTrue (exception, "Exception-UInt64*UInt64"); AssertRuleSuccess ("CheckedUMulInt64"); } } public long MulDoubleIntToLong (double a, int b) { return (long) (a * b); } [Test] public void FloatingPoint () { AssertRuleSuccess ("MulDoubleIntToLong"); } } } AttributeStringLiteralsShouldParseCorrectlyTest.cs0000664000175000017500000002720512413742070040457 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit tests for AttributeStringLiteralShouldParseCorrectlyRule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Correctness; using Mono.Cecil; using Test.Rules.Fixtures; using Test.Rules.Definitions; using Test.Rules.Helpers; using NUnit.Framework; namespace Test.Rules.Correctness { [AttributeUsage (AttributeTargets.All)] public class ValidSince : Attribute { public ValidSince (string assemblyVersion) { } } [AttributeUsage (AttributeTargets.All)] public class Reference : Attribute { public Reference (string url) { } } [AttributeUsage (AttributeTargets.All)] public class Uses : Attribute { public Uses (string guid) { } } [TestFixture] public class AttributeStringLiteralsShouldParseCorrectlyMethodTest : MethodRuleTestFixture { [Test] public void SkipOnAttributelessMethodsTest () { AssertRuleSuccess (SimpleMethods.EmptyMethod); } [ValidSince ("1.0.0.0")] [Reference ("http://www.mono-project.com/Gendarme")] [Uses ("00000101-0000-0000-c000-000000000046")] public void WellAttributedMethod () { } [Test] public void SuccessOnWellAttributedMethodTest () { AssertRuleSuccess ("WellAttributedMethod"); } [ValidSince ("foo")] [Reference ("bar")] [Uses ("0")] public void BadAttributedMethod () { } [Test] public void FailOnBadAttributedMethodTest () { AssertRuleFailure ("BadAttributedMethod", 3); } public void WellParameterAttributedMethod ( [ValidSince ("1.0.0.0")] [Reference ("http://www.mono-project.com/Gendarme")] [Uses ("00000101-0000-0000-c000-000000000046")] int x) { } [Test] public void SuccessOnWellParameterAttributedMethodTest () { AssertRuleSuccess ("WellParameterAttributedMethod"); } public void BadParameterAttributedMethod ( [ValidSince ("foo")] [Reference ("bar")] [Uses ("0")] int x) { } [Test] public void FailOnBadParameterAttributedMethodTest () { AssertRuleFailure ("BadParameterAttributedMethod", 3); } [return:ValidSince ("1.0.0.0")] [return:Reference ("http://www.mono-project.com/Gendarme")] [return:Uses ("00000101-0000-0000-c000-000000000046")] public void WellReturnParameterAttributedMethod () { } [Test] public void SuccessOnWellReturnParameterAttributedMethodTest () { AssertRuleSuccess ("WellReturnParameterAttributedMethod"); } [return:ValidSince ("foo")] [return:Reference ("bar")] [return:Uses ("0")] public void BadReturnParameterAttributedMethod () { } [Test] public void FailOnBadReturnParameterAttributedMethodTest () { AssertRuleFailure ("BadReturnParameterAttributedMethod"); } public void WellGenericParameterAttributedMethod<[ValidSince ("1.0.0.0"), Reference ("http://www.mono-project.com/Gendarme"), Uses ("00000101-0000-0000-c000-000000000046")] T> () { } [Test] public void SuccessOnWellGenericParameterAttributedMethodTest () { AssertRuleSuccess ("WellGenericParameterAttributedMethod"); } public void BadGenericParameterAttributedMethod<[ValidSince ("foo"), Reference ("bar"), Uses ("0")] T> () { } [Test] public void FailOnBadGenericParameterAttributedMethodTest () { AssertRuleFailure ("BadGenericParameterAttributedMethod", 3); } } [TestFixture] public class AttributeStringLiteralsShouldParseCorrectlyTypeTest : TypeRuleTestFixture { [Test] public void SkipOnAttributelessTypesTest () { AssertRuleSuccess (SimpleTypes.Class); } [ValidSince ("1.0.0.0")] [Reference ("http://www.mono-project.com/Gendarme")] [Uses ("00000101-0000-0000-c000-000000000046")] class WellAttributedClass { } [Test] public void SuccessOnWellAttributedClassTest () { AssertRuleSuccess (); } [ValidSince ("foo")] [Reference ("bar")] [Uses ("0")] class BadAttributedClass { } [Test] public void FailOnBadAttributedClassTest () { AssertRuleFailure (3); } class WellAttributedClassWithFields { [ValidSince ("1.0.0.0")] [Reference ("http://www.mono-project.com/Gendarme")] [Uses ("00000101-0000-0000-c000-000000000046")] object obj; } [Test] public void SuccessOnWellAttributedClassWithFieldsTest () { AssertRuleSuccess (); } class BadAttributedClassWithFields { [ValidSince ("foo")] [Reference ("bar")] [Uses ("0")] int foo; } [Test] public void FailOnBadAttributedClassWithFieldsTest () { AssertRuleFailure (3); } class ClassWithWellAttributedProperty { [ValidSince ("1.0.0.0")] [Reference ("http://www.mono-project.com/Gendarme")] [Uses ("00000101-0000-0000-c000-000000000046")] public int Property { get { return 0; } } } [Test] public void SuccessOnClassWithWellAttributedPropertyTest () { AssertRuleSuccess (); } class ClassWithBadAttributedProperty { [ValidSince ("foo")] [Reference ("bar")] [Uses ("0")] public int Property { get { return 0; } } } [Test] public void FailOnClassWithBadAttributedPropertyTest () { AssertRuleFailure (3); } class ClassWithWellAttributedEvent { [ValidSince ("1.0.0.0")] [Reference ("http://www.mono-project.com/Gendarme")] [Uses ("00000101-0000-0000-c000-000000000046")] event EventHandler customEvent; } [Test] public void SuccessOnClassWithWellAttributedEventTest () { AssertRuleSuccess (); } class ClassWithBadAttributedEvent { [ValidSince ("foo")] [Reference ("bar")] [Uses ("0")] event EventHandler customEvent; } [Test] public void FailOnClassWithBadAttributedEventTest () { AssertRuleFailure (3); } class ClassWithWellAttributedGenericParameter<[ValidSince ("1.0.0.0"), Reference ("http://www.mono-project.com/Gendarme"), Uses ("00000101-0000-0000-c000-000000000046")] T> { } [Test] public void SuccessOnClassWithWellAttributedGenericParameterTest () { AssertRuleSuccess> (); } class ClassWithBadAttributedGenericParameter<[ValidSince ("foo"), Reference ("bar"), Uses ("0")] T> { } [Test] public void FailOnClassWithBadAttributedGenericParameterTest () { AssertRuleFailure> (3); } } [TestFixture] public class AttributeStringLiteralsShouldParseCorrectlyAssemblyTest : AssemblyRuleTestFixture{ static void AddStringArgument (CustomAttribute attribute, AssemblyDefinition assembly, string str) { attribute.ConstructorArguments.Add ( new CustomAttributeArgument (assembly.MainModule.TypeSystem.String, str)); } private AssemblyDefinition GenerateFakeAssembly (string version, string url, string guid) { AssemblyDefinition definition = DefinitionLoader.GetAssemblyDefinition (this.GetType ()); CustomAttribute attribute = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor", new Type[] {typeof (string)})); AddStringArgument (attribute, definition, version); definition.CustomAttributes.Add (attribute); attribute = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor", new Type[] {typeof (string)})); AddStringArgument (attribute, definition, url); definition.CustomAttributes.Add (attribute); attribute = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor", new Type[] {typeof (string)})); AddStringArgument (attribute, definition, guid); definition.CustomAttributes.Add (attribute); return definition; } private AssemblyDefinition GenerateFakeModuleAnnotatedAssembly (string version, string url, string guid) { AssemblyDefinition definition = DefinitionLoader.GetAssemblyDefinition (this.GetType ()); ModuleDefinition module = ModuleDefinition.CreateModule ("test", ModuleKind.NetModule); definition.Modules.Add (module); CustomAttribute attribute = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor", new Type[] {typeof (string)})); AddStringArgument (attribute, definition, version); module.CustomAttributes.Add (attribute); attribute = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor", new Type[] {typeof (string)})); AddStringArgument (attribute, definition, url); module.CustomAttributes.Add (attribute); attribute = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor", new Type[] {typeof (string)})); AddStringArgument (attribute, definition, guid); module.CustomAttributes.Add (attribute); return definition; } [TearDown] public void TearDown () { AssemblyDefinition definition = DefinitionLoader.GetAssemblyDefinition (this.GetType ()); foreach (CustomAttribute attribute in new ArrayList (definition.CustomAttributes)) { //We only revert our changes on assembly. if (String.Compare (attribute.AttributeType.FullName, "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute") != 0) definition.CustomAttributes.Remove (attribute); } for (int index = 0; index < definition.Modules.Count; index++) { if (String.Compare (definition.Modules[index].Name, "test") == 0) definition.Modules.Remove (definition.Modules[index]); } } [Test] public void SuccessOnWellAttributedAssemblyTest () { AssertRuleSuccess (GenerateFakeAssembly ("1.0.0.0", "http://www.mono-project.com/Gendarme", "00000101-0000-0000-c000-000000000046")); } [Test] public void FailOnBadAttributedAssemblyTest () { AssertRuleFailure (GenerateFakeAssembly ("foo", "bar", "0"), 3); } [Test] public void SuccessOnWellAttributedModuleTest () { AssertRuleSuccess (GenerateFakeModuleAnnotatedAssembly ("1.0.0.0", "http://www.mono-project.com/Gendarme", "00000101-0000-0000-c000-000000000046")); } [Test] public void FailOnBadAttributedModuleTest () { AssertRuleFailure (GenerateFakeModuleAnnotatedAssembly ("foo", "bar", "0"), 3); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/DoNotRecurseInEqualityTest.cs0000664000175000017500000001151312413742070034217 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotRecurseInEqualityRule // // Authors: // Jesse Jones // // Copyright (C) 2008 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using System.Security; using System.Security.Permissions; using Gendarme.Rules.Correctness; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Helpers; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class DoNotRecurseInEqualityTest : MethodRuleTestFixture { private sealed class GoodCase { public static bool operator== (GoodCase lhs, GoodCase rhs) { if (object.ReferenceEquals (lhs, rhs)) return true; if ((object) lhs == null || (object) rhs == null) return false; return lhs.Name == rhs.Name && lhs.Address == rhs.Address; } public static bool operator!= (GoodCase lhs, GoodCase rhs) { return !(lhs == rhs); } public void Recurses () { Recurses(); // this belongs to BadRecursiveInvocationRule, not DoNotRecurseInEqualityRule } public string Name {get; set;} public string Address {get; set;} } private sealed class BadEquality { public static bool operator== (BadEquality lhs, BadEquality rhs) { if (object.ReferenceEquals (lhs, rhs)) return true; if (lhs == null || rhs == null) return false; return lhs.Name == rhs.Name && lhs.Address == rhs.Address; } public static bool operator!= (BadEquality lhs, BadEquality rhs) { return !(lhs == rhs); } public string Name {get; set;} public string Address {get; set;} } private sealed class BadInequality { public static bool operator== (BadInequality lhs, BadInequality rhs) { if (object.ReferenceEquals (lhs, rhs)) return true; if ((object) lhs == null || (object) rhs == null) return false; return lhs.Name == rhs.Name && lhs.Address == rhs.Address; } public static bool operator!= (BadInequality lhs, BadInequality rhs) { if (object.ReferenceEquals (lhs, rhs)) return false; if (lhs != null && rhs != null) return true; return lhs.Name != rhs.Name || lhs.Address != rhs.Address; } public string Name {get; set;} public string Address {get; set;} } private sealed class BadGenericEquality { public static bool operator== (BadGenericEquality lhs, BadGenericEquality rhs) { if (object.ReferenceEquals (lhs, rhs)) return true; if (lhs == null || rhs == null) return false; return lhs.Name.Equals(rhs.Name) && lhs.Address.Equals(rhs.Address); } public static bool operator!= (BadGenericEquality lhs, BadGenericEquality rhs) { return !(lhs == rhs); } public T Name {get; set;} public T Address {get; set;} } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply ("Recurses"); } [Test] public void Test () { AssertRuleSuccess ("op_Equality"); AssertRuleSuccess ("op_Inequality"); AssertRuleFailure ("op_Equality", 2); AssertRuleSuccess ("op_Inequality"); AssertRuleSuccess ("op_Equality"); AssertRuleFailure ("op_Inequality", 2); } [Test] public void GenericsTest () { Type type = typeof (BadGenericEquality<>); TypeDefinition td = DefinitionLoader.GetTypeDefinition (type); MethodDefinition md = DefinitionLoader.GetMethodDefinition (td, "op_Equality", null); AssertRuleFailure (md, 2); md = DefinitionLoader.GetMethodDefinition (td, "op_Inequality", null); AssertRuleSuccess (md); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test/Resource.resx0000664000175000017500000001345212413742070031145 0ustar00directhexdirecthex00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 A string with one parameter : {0}. A string with 2 parameters : {0}, {1}. DisposableFieldsShouldBeDisposedTest.cs0000664000175000017500000002076212413742070036122 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Test// // Unit tests for DisposableFieldsShouldBeDisposedRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // Copyright (C) 2008, 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; using System.ComponentModel; using System.Runtime.CompilerServices; using Gendarme.Rules.Correctness; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Correctness { [TestFixture] public class DisposableFieldsShouldBeDisposedTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Interface); // SimpleTypes.Class does not implement IDisposable AssertRuleDoesNotApply (SimpleTypes.Class); // [GeneratedCode] AssertRuleDoesNotApply (SimpleTypes.GeneratedType); } abstract class AbstractDisposable : IDisposable { abstract public void Dispose (); } abstract class AbstractExplicitDisposable : IDisposable { void IDisposable.Dispose () { throw new NotImplementedException (); } } [Test] public void Abstract () { AssertRuleSuccess (); AssertRuleSuccess (); } class FalsePositive : IDisposable { int A; object[] b; public void Dispose () //no warning { throw new NotImplementedException (); } } [Test] public void TestFalsePositive () { AssertRuleSuccess (); } class Disposable : IDisposable { public Disposable A; public virtual void Dispose () //no warning { A.Dispose (); } } [Test] public void TestDisposable () { AssertRuleSuccess (); } class ExtendsDispose : Disposable, IDisposable { public override void Dispose () //warning: should call base { } } class ExtendsExplictDispose : Disposable, IDisposable { void IDisposable.Dispose () //warning: should call base { } } class ExtendsExternalDispose : Disposable, IDisposable { // can't use DllImport here since we can't declare Dispose as static [MethodImpl (MethodImplOptions.InternalCall)] extern public override void Dispose (); } class ExtendsExternalDisposeBool : Disposable, IDisposable { public override void Dispose () { Dispose (true); } // can't use DllImport here since we can't declare Dispose as static [MethodImpl (MethodImplOptions.InternalCall)] extern public void Dispose (bool dispose); } [Test] public void TestExtendsDispose () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } class ExtendsDisposeCallsBase : Disposable, IDisposable { public override void Dispose () //no warning { base.Dispose (); } } [Test] public void TestExtendsDisposeCallsBase () { AssertRuleSuccess (); } class ExtendsDispose2 : Disposable, IDisposable { public Disposable B; void Dispose () //warn: should dispose B { base.Dispose (); } } [Test] public void TestExtendsDispose2 () { AssertRuleFailure (1); } class DisposeableFieldsCorrect : IDisposable { object A; Disposable B; public void Dispose () //no warning { B.Dispose (); } } [Test] public void TestDisposeableFieldsCorrect () { AssertRuleSuccess (); } class MultipleDisposeableFieldsCorrect : IDisposable { object A; Disposable B; Disposable C; public void Dispose () //no warning { B.Dispose (); C.Dispose (); } } [Test] public void TestMultipleDisposeableFieldsCorrect () { AssertRuleSuccess (); } class DisposeableFieldsIncorrect : IDisposable { object A; Disposable B; public void Dispose () //warn { A = B; int f = B.GetHashCode (); } } [Test] public void TestDisposeableFieldsIncorrect () { AssertRuleFailure (1); } class DisposeableFieldsDisposePattern : IDisposable { object A; Disposable B; public void Dispose () //warn { A = B; Dispose (true); } private void Dispose (bool disposing) { B.Dispose (); } } [Test] public void TestDisposeableFieldsDisposePattern () { AssertRuleSuccess (); } class DisposeableFieldsExplicit : IDisposable { object A; Disposable B; void IDisposable.Dispose () { B.Dispose (); } } [Test] public void TestDisposeableFieldsExplicit () { AssertRuleSuccess (); } class DisposeableFieldsTwoCorrect : IDisposable { object A; Disposable B; void IDisposable.Dispose () { B.Dispose (); } void Dispose () { B.Dispose (); } } [Test] public void TestDisposeableFieldsTwoCorrect () { AssertRuleSuccess (); } class DisposeableFieldsTwoIncorrect : IDisposable { object A; Disposable B; void IDisposable.Dispose () { } void Dispose () { B.Dispose (); } } [Test] public void TestDisposeableFieldsTwoIncorrect () { AssertRuleFailure (1); } class DisposeableFieldsWithStaticExplicit : IDisposable { object A; Disposable B; static Disposable C; void IDisposable.Dispose () { B.Dispose (); } } [Test] public void TestDisposeableFieldsWithStaticExplicit () { AssertRuleSuccess (); } class DelegatedInsideDispose : IDisposable { static BackgroundWorker worker = new BackgroundWorker (); Disposable B; public DelegatedInsideDispose () { B = new Disposable (); } public void Dispose () { worker.DoWork += delegate (object o, DoWorkEventArgs e) { B.Dispose (); }; worker.RunWorkerAsync (); } } [Test] [Ignore ("rule cannot be certain the delegate will be called")] public void TestDelegatedInsideDispose () { AssertRuleSuccess (); } class DelegatedOutsideDispose : IDisposable { static BackgroundWorker worker = new BackgroundWorker (); Disposable B; public DelegatedOutsideDispose () { B = new Disposable (); worker.DoWork += delegate (object o, DoWorkEventArgs e) { B.Dispose (); }; } public void Dispose () { worker.RunWorkerAsync (); } } [Test] [Ignore ("rule cannot be certain which and if the delegate will be called")] public void TestDelegatedOutsideDispose () { AssertRuleSuccess (); } // test case provided by Guillaume Gautreau public class AutomaticProperties : IDisposable { // this is not a field, source wise, but the compiler will generated one // that Gendarme will notice public IDisposable TestField { get; set; } public void Dispose () { this.Dispose (true); GC.SuppressFinalize (this); } protected virtual void Dispose (bool disposing) { if (disposing) { if (this.TestField != null) { this.TestField.Dispose (); } } } } [Test] public void AutomaticProperties_BackingField () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/UseValueInPropertySetterRule.cs0000664000175000017500000001007312413742070033663 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.UseValueInPropertySetterRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // Copyright (C) 2007-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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule ensures all setter properties uses the value argument passed to the property. /// /// /// Bad example: /// /// public bool Active { /// get { /// return active; /// } /// // this can take a long time to figure out if the default value for active /// // is false (since most people will use the property to set it to true) /// set { /// active = true; /// } /// } /// /// /// /// Good example: /// /// public bool Active { /// get { /// return active; /// } /// set { /// active = value; /// } /// } /// /// [Problem ("This property setter doesn't use 'value'.")] [Solution ("The setter should use 'value' or, if unneeded, you should consider removing the setter to reduce possible confusion.")] public class UseValueInPropertySetterRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // avoid checking all methods unless the type has some properties Runner.AnalyzeType += delegate (object o, RunnerEventArgs e) { Active = e.CurrentType.HasProperties; }; } public RuleResult CheckMethod (MethodDefinition method) { //Skip the test, instead of flooding messages //in stubs or empty setters. if (!method.HasBody) return RuleResult.DoesNotApply; // rule applies to setters methods if (!method.IsSetter) return RuleResult.DoesNotApply; // rule applies bool flow = false; bool empty = true; foreach (Instruction instruction in method.Body.Instructions) { ParameterDefinition pd = instruction.GetParameter (method); if (pd != null) { empty = false; if (pd.Index == 0) // value return RuleResult.Success; continue; } switch (instruction.OpCode.Code) { // check if the IL simply throws an exception case Code.Throw: if (!flow) return RuleResult.Success; empty = false; break; case Code.Nop: break; case Code.Ret: flow = true; break; default: empty = false; // lots of thing can occurs before the throw // e.g. loading the string (ldstr) // or calling a method to translate this string FlowControl fc = instruction.OpCode.FlowControl; flow |= ((fc != FlowControl.Next) && (fc != FlowControl.Call)); // but as long as the flow continue uninterruped to the throw // we consider this a simple throw break; } } if (empty) return RuleResult.Success; Runner.Report (method, Severity.High, Confidence.Total); return RuleResult.Failure; } } } AvoidMethodsWithSideEffectsInConditionalCodeRule.cs0000664000175000017500000002754612413742070037442 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness// // Gendarme.Rules.Correctness.AvoidMethodsWithSideEffectsInConditionalCodeRule // // Authors: // Jesse Jones // // (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; using System; using System.Collections.Generic; using System.Globalization; namespace Gendarme.Rules.Correctness { /// /// A number of System methods are conditionally compiled on #defines. /// For example, System.Diagnostics.Trace::Assert is a no-op if TRACE /// is not defined and System.Diagnostics.Debug::Write is a no-op if DEBUG /// is not defined. /// /// When calling a conditionally compiled method care should be taken to /// avoid executing code which has visible side effects. The reason is that /// the state of the program should generally not depend on the value of /// a define. If it does it is all too easy to create code which, for example, /// works in DEBUG but fails or behaves differently in release. /// /// Methods which have no visible side effects are termed pure methods. /// Certain System methods and delegates (such as System.String and /// System.Predicate<T>) are assumed to be pure. If you want to /// use a method which is not known to be pure in a conditionally compiled /// method call then you'll need to decorate it with PureAttribute (see the /// examples below). /// /// Note that it is OK to disable this rule for defects where the define will /// always be set (now and in the future), if the program's state really /// should be affected by the define (e.g. a LINUX define), or the impure /// method should be decorated with PureAttribute but it is not under /// your control. /// /// /// Bad example: /// /// using System.Collections.Generic; /// using System.Linq; /// using System.Runtime.Diagnostics; /// /// internal sealed class Worker { /// private Dictionary<string, Job> jobs; /// /// private bool IsValid (Job job) /// { /// return job != null && job.PartId > 0; /// } /// /// private void Process (string name, Job job) /// { /// // This is OK because IsValid has no side effects (although the rule /// // won't know that unless we decorate IsValid with PureAttribute). /// Trace.Assert (IsValid (job), job + " is not valid"); /// /// // This is potentially very bad: if release builds now (or in the future) /// // don't define TRACE the job won't be removed from our list in release. /// Trace.Assert (jobs.Remove (job), "couldn't find job " + name); /// /// job.Execute (); /// } /// } /// /// /// /// Good example: /// /// using System.Collections.Generic; /// using System.Linq; /// using System.Runtime.Diagnostics; /// /// // note: in FX4 (and later) this attribute is defined in System.Runtime.Diagnostics.Contracts /// [Serializable] /// [AttributeUsage (AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = false)] /// public sealed class PureAttribute : Attribute { /// } /// /// internal sealed class Worker { /// private Dictionary<string, Job> jobs; /// /// [Pure] /// private bool IsValid (Job job) /// { /// return job != null && job.PartId > 0; /// } /// /// private void Process (string name, Job job) /// { /// // IsValid is decorated with PureAttribute so the rule won't complain /// // when we use it within Trace.Assert. /// Trace.Assert (IsValid (job), job + " is not valid"); /// /// bool removed = jobs.Remove (job); /// Trace.Assert (removed, "couldn't find job " + name); /// /// job.Execute (); /// } /// } /// /// [Problem ("A conditionally compiled method is being called, but uses the result of a non-pure method as an argument.")] [Solution ("If the non-pure method has no visible side effects then decorate it with PureAttribute. If it does have side effects then rewrite the code so that the method is not called.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidMethodsWithSideEffectsInConditionalCodeRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.Success; Log.WriteLine (this); Log.WriteLine (this, "---------------------------------------"); Log.WriteLine (this, method); foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference target = ins.Operand as MethodReference; string define = ConditionalOn (target); if (define != null) { Log.WriteLine (this, "call to {0} method at {1:X4}", define, ins.Offset); MethodReference impure = FindImpurity (method, ins); if (impure != null) { string mesg = String.Format (CultureInfo.InvariantCulture, "{0}::{1} is conditionally compiled on {2} but uses the impure {3}::{4}", target.DeclaringType.Name, target.Name, define, impure.DeclaringType.Name, impure.Name); Log.WriteLine (this, mesg); Confidence confidence = GetConfidence (define); Runner.Report (method, ins, Severity.High, confidence, mesg); } } break; } } return Runner.CurrentRuleResult; } internal static Confidence GetConfidence (string define) { Confidence confidence; switch (define) { case "DEBUG": case "CONTRACTS_FULL": confidence = Confidence.High; break; case "CONTRACTS_PRECONDITIONS": confidence = Confidence.Normal; break; default: confidence = Confidence.Low; break; } return confidence; } internal static string ConditionalOn (MethodReference mr) { MethodDefinition method = mr.Resolve (); if ((method == null) || !method.HasCustomAttributes) return null; foreach (CustomAttribute attr in method.CustomAttributes) { // ConditionalAttribute has a single ctor taking a string value // http://msdn.microsoft.com/en-us/library/system.diagnostics.conditionalattribute.conditionalattribute.aspx // any attribute without arguments can be skipped if (!attr.HasConstructorArguments) continue; if (StringConstructor.Matches (attr.Constructor)) { if (attr.AttributeType.IsNamed ("System.Diagnostics", "ConditionalAttribute")) { return (string) attr.ConstructorArguments [0].Value; } } } return null; } // This is like the TraceBack rock except that it continues traversing backwards // until it finds an instruction which does not pop any values off the stack. This // allows us to check all of the instructions used to compute the method's // arguments. internal static Instruction FullTraceBack (IMethodSignature method, Instruction end) { Instruction first = end.TraceBack (method); while (first != null && first.GetPopCount (method) > 0) { first = first.TraceBack (method); } return first; } #region Private Methods private MethodReference FindImpurity (IMethodSignature method, Instruction end) { MethodReference impure = null; Instruction ins = FullTraceBack (method, end); if (ins != null) { Log.WriteLine (this, "checking args for call at {0:X4} starting at {1:X4}", end.Offset, ins.Offset); while (ins.Offset < end.Offset && impure == null) { if (ins.OpCode.Code == Code.Call || ins.OpCode.Code == Code.Callvirt) { MethodReference candidate = ins.Operand as MethodReference; if (!IsPure (candidate)) return candidate; } ins = ins.Next; } } return impure; } private bool IsPure (MethodReference mr) { MethodDefinition method = mr.Resolve (); if (method != null) { TypeDefinition type = method.DeclaringType; string type_name = type.GetFullName (); string method_name = method.Name; // getters if (method.IsGetter) return true; // System.String, System.Type, etc methods if (types_considered_pure.Contains (type_name)) return true; // Equals, GetHashCode, Contains, etc if (methods_considered_pure.Contains (method_name)) return true; // operators if (method_name.StartsWith ("op_", StringComparison.Ordinal) && method_name != "op_Implicit" && method_name != "op_Explicit") return true; // Contract methods (skip namespace) if (type_name == "System.Diagnostics.Contracts.Contract") return true; // System.Predicate and System.Comparison if (type_name.StartsWith ("System.Predicate`1", StringComparison.Ordinal)) return true; if (type_name.StartsWith ("System.Comparison`1", StringComparison.Ordinal)) return true; // delegate invocation if (MethodSignatures.Invoke.Matches (method)) { if (type.HasCustomAttributes) { if (HasPureAttribute (type.CustomAttributes)) { return true; } } } // PureAttribute if (method.HasCustomAttributes) { if (HasPureAttribute (method.CustomAttributes)) { return true; } } return false; } // If we can't resolve the method we have to assume it's OK to call. Log.WriteLine (this, "couldn't resolve {0} call: assuming it is pure", mr); return true; } // Note that we don't want to use ContainsType because we need to ignore // the namespace (at least until it lands in System.Diagnostics). static bool HasPureAttribute (IList attrs) { foreach (CustomAttribute attr in attrs) { if (attr.AttributeType.Name == "PureAttribute") { return true; } } return false; } #endregion #region Fields private static readonly MethodSignature StringConstructor = new MethodSignature (".ctor", "System.Void", new string [] {"System.String"}); private static HashSet types_considered_pure = new HashSet { "System.Math", "System.Object", "System.String", "System.Type", "System.IO.Path", "System.Linq.Enumerable", }; private static HashSet methods_considered_pure = new HashSet { "AsReadOnly", "BinarySearch", "Clone", "Contains", "ContainsKey", "ContainsValue", "ConvertAll", "Equals", "Exists", "Find", "FindAll", "FindIndex", "FindLast", "FindLastIndex", "GetByIndex", "GetHashCode", "IndexOfKey", "IndexOfValue", "IsProperSubsetOf", "IsProperSupersetOf", "IsSubsetOf", "IsSupersetOf", "IndexOf", "LastIndexOf", "Overlaps", "Peek", "ToArray", "ToDictionary", "ToList", "ToString", "TryGetValue", "TrueForAll", }; #endregion } } FinalizersShouldCallBaseClassFinalizerRule.cs0000664000175000017500000000742712413742070036347 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness// // Gendarme.Rules.Correctness.FinalizersShouldCallBaseClassFinalizerRule // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { /// /// This rule is used to warn the developer that a finalizer does not call the base class /// finalizer. In C#, this is enforced by compiler but some .NET languages (like IL) /// may allow such behavior. /// /// /// Bad example (IL): /// /// .assembly extern mscorlib /// { /// .ver 1:0:5000:0 /// .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) /// } /// .class public auto ansi beforefieldinit BadFinalizer extends [mscorlib]System.Object /// { /// .method family virtual hidebysig instance void Finalize() cil managed /// { /// // no base call so rule will fire here /// } /// } /// /// /// /// Good example (C#): /// /// public class GoodFinalizer { /// ~GoodFinalizer () /// { /// // C# compiler will insert base.Finalize () call here /// // so any compiler-generated code will be valid /// } /// } /// /// [Problem ("The finalizer for this type does not call the base class finalizer.")] [Solution ("Since your language does not do this automatically, like C#, add a call to the base type finalizer just before the finalizer exits.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Usage", "CA2220:FinalizersShouldCallBaseClassFinalizer")] public class FinalizersShouldCallBaseClassFinalizerRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // handle System.Object (which can't call base class) if (type.BaseType == null) return RuleResult.DoesNotApply; MethodDefinition finalizer = type.GetMethod (MethodSignatures.Finalize); if (finalizer == null) // no finalizer found return RuleResult.DoesNotApply; if (IsBaseFinalizeCalled (finalizer)) return RuleResult.Success; Runner.Report (finalizer, Severity.Critical, Confidence.Total); return RuleResult.Failure; } private static bool IsBaseFinalizeCalled (MethodDefinition finalizer) { if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (finalizer))) return false; foreach (Instruction current in finalizer.Body.Instructions) { switch (current.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference mr = (current.Operand as MethodReference); if ((mr != null) && mr.IsFinalizer ()) return true; break; } } return false; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/Makefile.am0000664000175000017500000000613712413742070027572 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AttributeStringLiteralsShouldParseCorrectlyRule.cs \ AvoidCodeWithSideEffectsInConditionalCodeRule.cs \ AvoidConstructorsInStaticTypesRule.cs \ AvoidFloatingPointEqualityRule.cs \ AvoidMethodsWithSideEffectsInConditionalCodeRule.cs \ DeclareEventsExplicitlyRule.cs \ DoNotRecurseInEqualityRule.cs \ BadRecursiveInvocationRule.cs \ CallingEqualsWithNullArgRule.cs \ CheckParametersNullityInVisibleMethodsRule.cs \ DisposableFieldsShouldBeDisposedRule.cs \ DoNotRoundIntegersRule.cs \ DontCompareWithNaNRule.cs \ EnsureLocalDisposalRule.cs \ FinalizersShouldCallBaseClassFinalizerRule.cs \ FloatComparisonRule.cs \ ReviewInconsistentIdentityRule.cs \ MethodCanBeMadeStaticRule.cs \ ProvideCorrectArgumentsToFormattingMethodsRule.cs \ ProvideCorrectRegexPatternRule.cs \ ProvideValidXmlStringRule.cs \ ProvideValidXPathExpressionRule.cs \ ReviewCastOnIntegerDivisionRule.cs \ ReviewCastOnIntegerMultiplicationRule.cs \ ReviewDoubleAssignmentRule.cs \ ReviewSelfAssignmentRule.cs \ ReviewUselessControlFlowRule.cs \ ReviewUseOfInt64BitsToDoubleRule.cs \ ReviewUseOfModuloOneOnIntegersRule.cs \ TypesShouldBeDisposableBaseRule.cs \ TypesWithDisposableFieldsShouldBeDisposableRule.cs \ TypesWithNativeFieldsShouldBeDisposableRule.cs \ UseNoInliningWithGetCallingAssemblyRule.cs \ UseValueInPropertySetterRule.cs EXTRA_TESTS_OPTIONS += -r:System.Configuration -d:DEBUG -resource:Test/Resources.resources,Tests.Rules.Correctness.Resource.resources EXTRA_DIST += Test/Resource.resx tests_resource_resx = Test/Resource.resx tests_resource_prefix_resx = $(addprefix $(srcdir)/, $(tests_resource_resx)) Test/Resources.resources: $(tests_resource_resx) resgen2 -usesourcepath -compile $(tests_resource_resx),Test/Resources.resources; EXTRA_TESTS_DEPS = Test/Resources.resources tests_sources = \ AttributeStringLiteralsShouldParseCorrectlyTest.cs \ AvoidCodeWithSideEffectsInConditionalCodeTest.cs \ AvoidConstructorsInStaticTypesTest.cs \ AvoidFloatingPointEqualityTest.cs \ AvoidMethodsWithSideEffectsInConditionalCodeTest.cs \ DeclareEventsExplicitlyTest.cs \ DoNotRecurseInEqualityTest.cs \ BadRecursiveInvocationTest.cs \ CallingEqualsWithNullArgTest.cs \ CheckParametersNullityInVisibleMethodsTest.cs \ DisposableFieldsShouldBeDisposedTest.cs \ DontCompareWithNaNTest.cs \ DoNotRoundIntegersTest.cs \ EnsureLocalDisposalTest.cs \ FinalizersShouldCallBaseClassFinalizerTest.cs \ ReviewInconsistentIdentityTest.cs \ MethodCanBeMadeStaticTest.cs \ ProvideCorrectArgumentsToFormattingMethodsTest.cs \ ProvideCorrectRegexPatternTest.cs \ ProvideValidXmlStringTest.cs \ ProvideValidXPathExpressionTest.cs \ Resource.Designer.cs \ ReviewCastOnIntegerDivisionTest.cs \ ReviewCastOnIntegerMultiplicationTest.cs \ ReviewDoubleAssignmentTest.cs \ ReviewSelfAssignmentTest.cs \ ReviewUselessControlFlowTest.cs \ ReviewUseOfInt64BitsToDoubleTest.cs \ ReviewUseOfModuloOneOnIntegersTest.cs \ TypesWithDisposableFieldsShouldBeDisposableTest.cs \ TypesWithNativeFieldsShouldBeDisposableTest.cs \ UseNoInliningWithGetCallingAssemblyTest.cs \ UseValueInPropertySetterTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/AvoidConstructorsInStaticTypesRule.cs0000664000175000017500000001077112413742070035073 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.AvoidConstructorsInStaticTypesRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // Copyright (C) 2007-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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { // note: this rule is similar to Gendarme.Rules.Design.ConsiderUsingStaticTypeRule // but is also applicable to the 1.x runtime (hidding the default ctor was still // the correct way of handling this back then). The goal is to make this ctor // non-visible so people can't instantiate it (e.g. by mistake) /// /// This rule checks for types that contain only static members and fires if the type /// contains a visible /// instance constructor. This was a common mistake in the 1.x framework /// because C# adds a default, public, constructor if no other constructors are provided. /// Code using the framework 2.0 (and later) should change this type, if possible, into a /// static type. /// /// /// Bad example: /// /// // it is possible to instantiate this class since the /// // C# compiler adds a default, public, constructor /// public class Class { /// public static void Method () /// { /// } /// } /// /// /// /// Good example: /// /// public class Class { /// // this class cannot be instantiated /// private Class () /// { /// } /// /// public static void Method () /// { /// } /// } /// /// [Problem ("This type (and ancestors) contains only static fields and methods but has a visible, non static, constructor.")] [Solution ("You should remove the visible constructor to make sure this type cannot be instantiated, or if using 2.0+, change it to a static type.")] [FxCopCompatibility ("Microsoft.Design", "CA1053:StaticHolderTypesShouldNotHaveConstructors")] public class AvoidConstructorsInStaticTypesRule : Rule, ITypeRule { static bool IsAllStatic (TypeDefinition type) { if (type == null) return false; if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) { // let's the default ctor pass (since it's always here for 1.x code) if (!method.IsStatic && method.HasParameters) return false; } else { if (!method.IsStatic) return false; } } } if (type.HasFields) { foreach (FieldDefinition field in type.Fields) { if (!field.IsStatic) return false; } } if (type.BaseType.IsNamed ("System", "Object")) return true; return IsAllStatic (type.BaseType.Resolve ()); } public RuleResult CheckType (TypeDefinition type) { // rule applies only if the type isn't: an enum, an interface, a struct, a delegate or compiler generated if (type.IsEnum || type.IsInterface || type.IsValueType || type.IsDelegate () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // it also does not apply if the type is static (2.0+ only) if (type.IsStatic ()) return RuleResult.DoesNotApply; if (!IsAllStatic (type)) return RuleResult.Success; // rule applies! foreach (MethodDefinition ctor in type.Methods) { if (ctor.IsConstructor && !ctor.IsStatic && ctor.IsVisible ()) { Runner.Report (ctor, Severity.Low, Confidence.High); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Correctness/TypesShouldBeDisposableBaseRule.cs0000664000175000017500000001013612413742070034242 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Correctness.TypesShouldBeDisposableBaseRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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.Collections.Generic; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Correctness { public abstract class TypesShouldBeDisposableBaseRule : Rule, ITypeRule { protected TypesShouldBeDisposableBaseRule () { FieldCandidates = new HashSet (); } protected HashSet FieldCandidates { get; private set; } protected abstract string AbstractTypeMessage { get; } protected abstract string TypeMessage { get; } protected abstract string AbstractDisposeMessage { get; } static bool IsAbstract (MethodDefinition method) { return ((method != null) && (method.IsAbstract)); } protected abstract void CheckMethod (MethodDefinition method, bool abstractWarning); protected abstract bool FieldTypeIsCandidate (TypeDefinition type); public RuleResult CheckType (TypeDefinition type) { // that will cover interfaces, delegates too if (!type.HasFields) return RuleResult.DoesNotApply; // rule doesn't apply to enums, interfaces, structs, delegates or generated code if (type.IsEnum || type.IsValueType || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; MethodDefinition explicitDisposeMethod = null; MethodDefinition implicitDisposeMethod = null; bool abstractWarning = false; if (type.Implements ("System", "IDisposable")) { implicitDisposeMethod = type.GetMethod (MethodSignatures.Dispose); explicitDisposeMethod = type.GetMethod (MethodSignatures.DisposeExplicit); if (IsAbstract (implicitDisposeMethod) || IsAbstract (explicitDisposeMethod)) { abstractWarning = true; } else { return RuleResult.Success; } } FieldCandidates.Clear (); foreach (FieldDefinition field in type.Fields) { // we can't dispose static fields in IDisposable if (field.IsStatic) continue; TypeDefinition fieldType = field.FieldType.GetElementType ().Resolve (); if (fieldType == null) continue; if (FieldTypeIsCandidate (fieldType)) FieldCandidates.Add (field); } // if there are fields types that implements IDisposable if (type.HasMethods && (FieldCandidates.Count > 0)) { // check if we're assigning new object to them foreach (MethodDefinition method in type.Methods) { CheckMethod (method, abstractWarning); } } // Warn about possible confusion if the Dispose methods are abstract if (IsAbstract (implicitDisposeMethod)) Runner.Report (implicitDisposeMethod, Severity.Medium, Confidence.High, AbstractDisposeMessage); return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Stfld); mask.Set (Code.Stelem_Ref); Console.WriteLine (mask); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/0000775000175000017500000000000012642235742024766 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/GendarmeRule.cs0000664000175000017500000000344512413742070027666 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Gendarme.GendarmeRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Gendarme { abstract public class GendarmeRule : Rule { public override void Initialize (IRunner runner) { base.Initialize (runner); // If the assembly doesn't reference Gendarme.Framework then it // obviously is not a Gendarme Rules assembly Runner.AnalyzeModule += (object o, RunnerEventArgs e) => { Active = e.CurrentAssembly.References ("Gendarme.Framework"); }; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Gendarme.Rules.Gendarme.csproj0000775000175000017500000001145212413742070032543 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {619CDBD4-D89E-47E1-9A82-0F194A665D48} Library Properties Gendarme.Rules.Gendarme Gendarme.Rules.Gendarme v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Gendarme.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 ..\..\console\bin\Release\Gendarme.Rules.Gendarme.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/UseCorrectSuffixRule.cs0000664000175000017500000000554212413742070031407 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Gendarme.UseCorrectSuffixRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Gendarme { /// /// Types implementing IRule should have the "Rule" suffix, while other types /// are not allowed to have this suffix. /// /// /// Bad example (rule type does not have a suffix): /// /// public class ReviewSomething : Rule, IMethodRule { /// // rule code /// } /// /// /// /// Bad example (non-rule type has a suffix): /// /// public class SomeRule { /// // class code /// } /// /// /// /// Good example: /// /// public class ReviewSomethingRule : Rule, IMethodRule { /// // rule code /// } /// /// [Problem ("Types implementing IRule should have the 'Rule' suffix. Other types should not have this suffix.")] [Solution ("Change type name to follow this rule.")] public class UseCorrectSuffixRule : GendarmeRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { bool endsWithRule = type.Name.EndsWith ("Rule", StringComparison.Ordinal); bool implementsIRule = type.Implements ("Gendarme.Framework", "IRule"); if (implementsIRule && !endsWithRule) Runner.Report (type, Severity.Medium, Confidence.High, "Type implements IRule but does not end with the 'Rule'"); else if (!implementsIRule && endsWithRule) Runner.Report (type, Severity.Medium, Confidence.High, "Type does not implement IRule but ends with the 'Rule'"); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Makefile.in0000664000175000017500000006535312642235731027045 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Gendarme ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ GendarmeRule.cs \ DefectsMustBeReportedRule.cs \ DoNotThrowExceptionRule.cs \ MissingEngineDependencyRule.cs \ ReviewAttributesOnRulesRule.cs \ UseCorrectSuffixRule.cs tests_sources = \ DefectsMustBeReportedTest.cs \ DoNotThrowExceptionTest.cs \ MissingEngineDependencyTest.cs \ ReviewAttributesOnRulesTest.cs \ UseCorrectSuffixTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Gendarme/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Gendarme/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/MissingEngineDependencyRule.cs0000664000175000017500000001142312413742070032675 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Gendarme.MissingEngineDependencyRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Gendarme { /// /// Rules should not use engines' features without subscribing to them /// using EngineDependency attribute because it will not work unless /// another rule has subscribed to the same engine. /// /// /// Bad example: /// /// class BadRule : Rule, IMethodRule { /// public RuleResult CheckMethod (MethodDefinition method) /// { /// if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) /// return RuleResult.DoesNotApply; /// // rule code /// } /// } /// /// /// /// Good example: /// /// [EngineDependency (typeof (OpCodeEngine))] /// class BadRule : Rule, IMethodRule { /// public RuleResult CheckMethod (MethodDefinition method) /// { /// if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) /// return RuleResult.DoesNotApply; /// // rule code /// } /// } /// /// [Problem ("Rules uses engines' features without subscribing to it, thus these features will not work correctly.")] [Solution ("Add EngineDependency attribute to the rule.")] [EngineDependency (typeof (OpCodeEngine))] public class MissingEngineDependencyRule : GendarmeRule, ITypeRule { HashSet engines = new HashSet { "Gendarme.Framework.Engines.OpCodeEngine", "Gendarme.Framework.Engines.NamespaceEngine" }; private HashSet declaredEngines = new HashSet (); public RuleResult CheckType (TypeDefinition type) { if (!type.HasMethods) return RuleResult.DoesNotApply; GetEngineDependencyValue (type); foreach (MethodDefinition method in type.Methods) { if (!method.HasBody || !OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) continue; foreach (Instruction instruction in method.Body.Instructions) { MethodReference m = (instruction.Operand as MethodReference); if (m == null) continue; TypeReference dtype = m.DeclaringType; // short-cut to avoid FullName - will work as long as all Engines comes from the same namespace (otherwise remove it) if (dtype.Namespace != "Gendarme.Framework.Engines") continue; string declaringType = dtype.GetFullName (); if (!engines.Contains (declaringType) || declaredEngines.Contains (declaringType)) continue; Runner.Report (method, instruction, Severity.High, Confidence.High, "An engine " + declaringType + " is being used without type being subscribed to it with EngineDependency attribute."); } } return Runner.CurrentRuleResult; } private void GetEngineDependencyValue (TypeDefinition type) { declaredEngines.Clear (); TypeDefinition td = type; while (declaredEngines.Count < engines.Count) { if (td.HasCustomAttributes) foreach (CustomAttribute attribute in td.CustomAttributes) { if (!attribute.HasConstructorArguments || !attribute.AttributeType.IsNamed ("Gendarme.Framework", "EngineDependencyAttribute")) continue; object value = attribute.ConstructorArguments [0].Value; MemberReference mr = (value as MemberReference); declaredEngines.Add (mr == null ? value.ToString () : mr.GetFullName ()); } if (td.BaseType == null) break; TypeDefinition baseType = td.BaseType.Resolve (); if (baseType == null) break; td = baseType; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/DefectsMustBeReportedRule.cs0000664000175000017500000000671612413742070032352 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Gendarme.DefectsMustBeReportedRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Gendarme { /// /// This rule checks if at least one method in types implementing /// IRule is calling Runner.Report. /// /// /// Bad example: /// /// public class BadRule : Rule, ITypeRule /// { /// public RuleResult CheckType (TypeDefinition type) /// { /// return RuleResult.Failure; /// } /// } /// /// /// /// Good example: /// /// public class BadRule : Rule, ITypeRule /// { /// public RuleResult CheckType (TypeDefinition type) /// { /// Runner.Report(type, Severity.Low, Confidence.Total); /// return RuleResult.Failure; /// } /// } /// /// /// /// This rule checks if Runner.Report is called directly anywhere in rules' methods but it does not /// check if it being called in the base type or somewhere else, so some false positives are possible. [Problem ("Gendarme rule does not call Runner.Report, so found failures will not appear in Gendarme report.")] [Solution ("Add Runner.Report call")] [EngineDependency (typeof (OpCodeEngine))] public class DefectsMustBeReportedRule : GendarmeRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.IsAbstract || !type.HasMethods || !type.Implements ("Gendarme.Framework", "IRule")) return RuleResult.DoesNotApply; foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor || !method.HasBody || !OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) continue; foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.FlowControl != FlowControl.Call) continue; MethodReference m = (instruction.Operand as MethodReference); if (m == null || (m.Name != "Report")) continue; if (m.DeclaringType.IsNamed ("Gendarme.Framework", "IRunner")) return RuleResult.Success; } } // we have not found a call, so report failure Runner.Report (type, Severity.High, Confidence.Normal); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/0000775000175000017500000000000012642235742025705 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/MissingEngineDependencyTest.cs0000664000175000017500000001002512413742070033621 0ustar00directhexdirecthex00000000000000// // Test.Rules.Gendarme.MissingEngineDependencyTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Rules.Gendarme; using Gendarme.Framework; using Gendarme.Framework.Engines; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Gendarme { [TestFixture] public class MissingEngineDependencyTest : TypeRuleTestFixture { class GoodNoEngines : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { int a = 0; Console.WriteLine (a.ToString ()); return RuleResult.Success; } } [EngineDependency (typeof (OpCodeEngine))] class GoodEngineType : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { var a = OpCodeEngine.GetBitmask (SimpleMethods.EmptyMethod); return RuleResult.Success; } } [EngineDependency ("Gendarme.Framework.Engines.OpCodeEngine")] class GoodEngineString : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { var a = OpCodeEngine.GetBitmask (SimpleMethods.EmptyMethod); return RuleResult.Success; } } [EngineDependency ("Gendarme.Framework.Engines.OpCodeEngine")] [EngineDependency (typeof (NamespaceEngine))] class GoodOpCodeAndNamespaceEngines : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { var a = OpCodeEngine.GetBitmask (SimpleMethods.EmptyMethod); var b = NamespaceEngine.Exists ("TestNamespace"); return RuleResult.Success; } } class BadNoEngineDefined { public void DoSomething () { var a = OpCodeEngine.GetBitmask (SimpleMethods.EmptyMethod); var b = NamespaceEngine.Exists ("TestNamespace"); } } [EngineDependency (typeof (OpCodeEngine))] class BadOnlyOneEngine { public void DoSomething () { var a = OpCodeEngine.GetBitmask (SimpleMethods.EmptyMethod); var b = NamespaceEngine.Exists ("TestNamespace"); } } class GoodInherited : GoodEngineType { public void DoSomethingNew () { var a = OpCodeEngine.GetBitmask (SimpleMethods.EmptyMethod); } } class BadOnlyOneInherited : GoodEngineType { public void DoSomethingNew () { var a = OpCodeEngine.GetBitmask (SimpleMethods.EmptyMethod); var b = NamespaceEngine.Exists ("TestNamespace"); } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Enum); // no methods } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (2); AssertRuleFailure (1); AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/Tests.Rules.Gendarme.csproj0000775000175000017500000001213112413742070033035 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {C329FF89-4C07-4D72-AF5B-70B10670CB36} Library Properties Tests.Rules.Gendarme Tests.Rules.Gendarme v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {619CDBD4-D89E-47E1-9A82-0F194A665D48} Gendarme.Rules.Gendarme False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/Makefile.in0000664000175000017500000003141512642235731027754 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Gendarme/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Gendarme.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Gendarme/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Gendarme/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/DefectsMustBeReportedTest.cs0000664000175000017500000000461712413742070033277 0ustar00directhexdirecthex00000000000000// // Tests.Rules.Gendarme.DefectsMustBeReportedTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Gendarme; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Gendarme { [TestFixture] public class DefectsMustBeReportedTest : TypeRuleTestFixture { class GoodRule : Rule { public void Test () { Runner.Report (null, Severity.Critical, Confidence.Total); } } class GoodRuleTwoMethods : Rule { public void Test () { } private void Report () { Runner.Report (null, Severity.Audit, Confidence.Low); } } class BadRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { return RuleResult.Failure; } } abstract class DoesNotApplyAbstract : Rule { public void Test () { } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (); } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/UseCorrectSuffixTest.cs0000664000175000017500000000356412413742070032340 0ustar00directhexdirecthex00000000000000// // Test.Rules.Gendarme.UseCorrectSuffixTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Rules.Gendarme; using Gendarme.Framework; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Gendarme { [TestFixture] public class UseCorrectSuffixTest : TypeRuleTestFixture { class GoodRule : Rule { } class BadRuel : Rule { } class BadTypeRule { } class GoodType { } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (); AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/DoNotThrowExceptionTest.cs0000664000175000017500000000727512413742070033026 0ustar00directhexdirecthex00000000000000// // Test.Rules.Gendarme.DoNotThrowExceptionTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Gendarme; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Gendarme { [TestFixture] public class DoNotThrowExceptionTest : MethodRuleTestFixture { public DoNotThrowExceptionTest () { FireEvents = true; } class NotRule { public void DoSomething () { throw new DivideByZeroException (); } } class GoodRule1 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { return RuleResult.Success; } } class GoodRule2 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { return RuleResult.Success; } private int property_value; [System.ComponentModel.Description ("Description")] public int RuleProperty { get { return property_value; } set { if (value < 0) throw new ArgumentException ("Minimum value for RuleProperty is 0", "RuleProperty"); property_value = value; } } } class BadRule1 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new ArgumentException ("method"); } } class BadRule2 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { return RuleResult.Success; } private int property_value; public int RuleProperty { get { return property_value; } set { if (value < 0) throw new ArgumentException ("Minimum value for RuleProperty is 0", "RuleProperty"); property_value = value; } } [System.ComponentModel.Description ("Description")] private int RulePrivateProperty { get { return property_value; } set { if (value < 0) throw new ArgumentException ("Minimum value for RuleProperty is 0", "RuleProperty"); property_value = value; } } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("DoSomething"); } [Test] public void DoesNotThrowExceptions () { AssertRuleSuccess ("CheckMethod"); AssertRuleSuccess ("set_RuleProperty"); // such properties setters will be called in a runner } [Test] public void ThrowsExceptions () { AssertRuleFailure ("CheckMethod", 1); AssertRuleFailure ("set_RuleProperty", 1); AssertRuleFailure ("set_RulePrivateProperty", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/Makefile.am0000664000175000017500000000015312413742070027731 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Gendarme.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Test/ReviewAttributesOnRulesTest.cs0000664000175000017500000002447412413742070033720 0ustar00directhexdirecthex00000000000000// // Test.Rules.Gendarme.ReviewAttributesOnRulesTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.ComponentModel; using Mono.Cecil; using Gendarme.Rules.Gendarme; using Gendarme.Framework; using Gendarme.Framework.Engines; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Gendarme { [TestFixture] public class ReviewAttributesOnRulesTest : TypeRuleTestFixture { class Case1 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] class Case2 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem (null)] class Case3 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Solution ("")] class Case4 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("")] [Solution (null)] class Case5 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution (null)] class Case6 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] class Case7 { } [Problem ("Problem description")] [Solution ("Solution description")] class Case8 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } abstract class Case9 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] abstract class Case10 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } class Case11 : Case10 { } [Test] public void ProblemSolution () { AssertRuleFailure (1); // required attributes missing AssertRuleFailure (1); // Solution attribute missing AssertRuleFailure (2); // null argument and Solution attribute missing AssertRuleFailure (2); // empty string argument and Problem attribute missing AssertRuleFailure (2); // null and empty string arguments AssertRuleFailure (1); // null argument on Solution attribute AssertRuleFailure (2); // two attributes are used on non-rule AssertRuleSuccess (); // concrete rule has both attributes with correct arguments AssertRuleSuccess (); // abstract rule has no attributes AssertRuleSuccess (); // abstract rule has both required attributes AssertRuleSuccess (); // concrete rule inherits attributes from abstract rule } [Problem ("Problem description")] [Solution ("Solution description")] [FxCopCompatibility ("", null)] class Case12 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] [FxCopCompatibility ("Microsoft.Test", "12345")] class Case13 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] [FxCopCompatibility ("Microsoft.Test", "CA12345")] class Case14 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] [FxCopCompatibility ("Microsoft.Test", "CA1234")] class Case15 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [FxCopCompatibility ("Microsoft.Test", "CA1234:RuleName")] class Case16 { } [Problem ("Problem description")] [Solution ("Solution description")] [FxCopCompatibility ("Microsoft.Test", "CA1234:RuleName")] class Case17 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Test] public void FxCopCompatibility () { AssertRuleFailure (1); // arguments has null or empty string values AssertRuleFailure (1); // second argument has wrong format AssertRuleFailure (1); // second argument has wrong format AssertRuleFailure (1); // second argument has correct format but no FxCop rule name is provided AssertRuleFailure (1); // attribute used on non-rule AssertRuleSuccess (); // arguments have correct formats and FxCop rule name is provided } [EngineDependency (typeof (OpCodeEngine))] class Case18 { } [Problem ("Problem description")] [Solution ("Solution description")] [EngineDependency ("")] class Case19 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] [EngineDependency (typeof (ReviewAttributesOnRulesRule))] class Case20 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] [EngineDependency (typeof (OpCodeEngine))] class Case21 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] [EngineDependency ("Gendarme.Framework.Engines.OpCodeEngine")] class Case22 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Test] public void EngineDependency () { AssertRuleFailure (1); // attribute used on non-rule AssertRuleFailure (1); // empty string argument AssertRuleFailure (1); // argument does not inherit from Engine AssertRuleSuccess (); // argument type inherit from Engine AssertRuleSuccess (); // non-empty string argument provided } [DocumentationUri ("http://www.mono-project.com/Gendarme")] class Case23 { } [Problem ("Problem description")] [Solution ("Solution description")] [DocumentationUri ("http://www.mono-project.com/Gendarme")] class Case24 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Test] public void DocumentationUri () { AssertRuleFailure (1); // attribute used on non-rule AssertRuleSuccess (); // attribute used on rule } [Problem ("Problem description")] [Solution ("Solution description")] [System.ComponentModel.Description ("Description")] [DefaultValue (null)] class Case25 : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } class Case26 { [System.ComponentModel.Description ("Description")] [DefaultValue (null)] public int Property { get; set; } } [Problem ("Problem description")] [Solution ("Solution description")] class Case27 : Rule, IMethodRule { [System.ComponentModel.Description ("")] [DefaultValue (null)] public int Property { get; set; } public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] class Case28 : Rule, IMethodRule { [System.ComponentModel.Description ("Description")] [DefaultValue (null)] private int Property { get; set; } public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Problem ("Problem description")] [Solution ("Solution description")] class Case29 : Rule, IMethodRule { [System.ComponentModel.Description ("Description")] [DefaultValue (42)] public int Property { get; set; } public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Test] public void DescriptionDefaultValue () { AssertRuleFailure (2); // two attributes used in wrong place (on rule) AssertRuleFailure (2); // two attributes used in wrong place (on non-rule property) AssertRuleFailure (1); // Description argument is an empty string AssertRuleFailure (2); // two attributes used on private property AssertRuleSuccess (); // both attributes are used in correct place and Desciprion argument is not empty } [Test] public void Runner () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/Makefile.am0000664000175000017500000000061012413742070027010 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ GendarmeRule.cs \ DefectsMustBeReportedRule.cs \ DoNotThrowExceptionRule.cs \ MissingEngineDependencyRule.cs \ ReviewAttributesOnRulesRule.cs \ UseCorrectSuffixRule.cs tests_sources = \ DefectsMustBeReportedTest.cs \ DoNotThrowExceptionTest.cs \ MissingEngineDependencyTest.cs \ ReviewAttributesOnRulesTest.cs \ UseCorrectSuffixTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/DoNotThrowExceptionRule.cs0000664000175000017500000000721612413742070032072 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Gendarme.DoNotThrowExceptionRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Gendarme { /// /// This rule finds Gendarme rules that throw exceptions because runner's behavior /// in case of rule throwing an exception is undefined. /// /// /// Bad example: /// /// public class ExampleRule : Rule, IMethodRule { /// public RuleResult CheckMethod (MethodDefinition method) /// { /// if (method == null) /// throw new ArgumentNullException ("method"); /// // other rule logic /// } /// } /// /// /// /// Good example: /// /// public class ExampleRule : Rule, IMethodRule { /// public RuleResult CheckMethod (MethodDefinition method) /// { /// // method is not null by contract /// return RuleResult.Success; /// } /// } /// /// [Problem ("Gendarme rules should not throw exceptions because runners behaviour in this case is undefined.")] [Solution ("Change the code so that it catches exceptions or does not throw them at all.")] [EngineDependency (typeof (OpCodeEngine))] public class DoNotThrowExceptionRule : GendarmeRule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeType += (object sender, RunnerEventArgs e) => { Active = e.CurrentType.Implements ("Gendarme.Framework", "IRule"); }; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!OpCodeEngine.GetBitmask (method).Get (Code.Throw)) return RuleResult.Success; if (method.IsSetter && method.IsPublic) { PropertyDefinition property = method.GetPropertyByAccessor (); if (property.HasAttribute ("System.ComponentModel", "DescriptionAttribute")) return RuleResult.Success; } foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.Code != Code.Throw) continue; if (!instruction.Previous.Is (Code.Newobj)) continue; MethodReference m = (instruction.Previous.Operand as MethodReference); if (m == null) continue; TypeReference type = m.DeclaringType; if (type.Inherits ("System", "Exception")) Runner.Report (method, instruction, Severity.Medium, Confidence.High); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Gendarme/ReviewAttributesOnRulesRule.cs0000664000175000017500000002421212413742070032757 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Gendarme.ReviewAttributesOnRulesRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.RegularExpressions; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Gendarme { /// /// This rule checks if attribute usage match the following rules: /// /// /// [Problem] and [Solution] attributes /// should be used on rules only, every concrete rule must have both /// attributes (or inherit them), and their arguments cannot be null or empty /// /// /// /// [FxCopCompatibility] attribute /// should be used on rules only, its arguments cannot be null or empty, /// and second argument should match this format: AB1234:FxCopRuleName /// /// /// [EngineDependency] attribute /// should be used on rules only, its argument cannot be null or empty, /// and its argument should inherit from Gendarme.Framework.Engine /// /// /// [DocumentationUri] attribute /// should be used on rules only /// /// /// [Description] and [DefaultValue] attributes /// should be used on rules' public properties only, /// Description attribute argument cannot be null or empty /// /// /// [Problem ("Attributes should be correctly placed and have correct values provided in their arguments")] [Solution ("Change the code so that it satisfies attribute usage rules")] public class ReviewAttributesOnRulesRule : GendarmeRule, ITypeRule { Dictionary> attributes; Dictionary typeIsRule = new Dictionary (); public ReviewAttributesOnRulesRule () { attributes = new Dictionary> { {"Gendarme.Framework.ProblemAttribute", CheckProblemAndSolutionAttributes}, {"Gendarme.Framework.SolutionAttribute", CheckProblemAndSolutionAttributes}, {"Gendarme.Framework.FxCopCompatibilityAttribute", CheckFxCopCompatibilityAttribute}, {"Gendarme.Framework.EngineDependencyAttribute", CheckEngineDependencyAttribute}, {"Gendarme.Framework.DocumentationUriAttribute", CheckIfAttributeUsedOnRule}, {"System.ComponentModel.DescriptionAttribute", CheckDescriptionAttribute}, {"System.ComponentModel.DefaultValueAttribute", CheckIfAttributeUsedOnRulesProperty}, }; } public RuleResult CheckType (TypeDefinition type) { CheckAttributes (type); if (type.HasMethods) foreach (MethodDefinition method in type.Methods) CheckAttributes (method); if (type.HasProperties) foreach (PropertyDefinition property in type.Properties) CheckAttributes (property); if (type.HasFields) foreach (FieldDefinition field in type.Fields) CheckAttributes (field); // finally check if this is a rule and either has all required attributes // or inherits from a type that has all required attributes CheckIfRuleHasAllRequiredAttributes (type); return Runner.CurrentRuleResult; } private void CheckIfRuleHasAllRequiredAttributes (TypeDefinition type) { if (!type.IsAbstract && IsRule (type)) { bool foundSolution = false; bool foundProblem = false; TypeDefinition td = type; while (!foundSolution || !foundProblem) { if (td.HasCustomAttributes) foreach (CustomAttribute attribute in td.CustomAttributes) { TypeReference atype = attribute.AttributeType; if (atype.Namespace != "Gendarme.Framework") continue; string name = atype.Name; if (name == "SolutionAttribute") foundSolution = true; else if (name == "ProblemAttribute") foundProblem = true; } TypeReference tr = td.BaseType; if (tr == null) break; TypeDefinition resolved = tr.Resolve (); if (resolved == null) break; td = resolved; } if (!foundProblem || !foundSolution) Runner.Report (type, Severity.High, Confidence.High, "Rules should have both Problem and Solution attributes"); } } private void CheckAttributes (ICustomAttributeProvider provider) { if (!provider.HasCustomAttributes) return; foreach (CustomAttribute attribute in provider.CustomAttributes) { var attributeTypeName = attribute.AttributeType.GetFullName (); Action f; if (attributes.TryGetValue (attributeTypeName, out f)) f (attribute, provider); } } private bool IsRule (TypeReference type) { var typeName = type.GetFullName (); bool result; if (!typeIsRule.TryGetValue (typeName, out result)) { result = type.Implements ("Gendarme.Framework", "IRule"); typeIsRule [typeName] = result; } return result; } private void CheckProblemAndSolutionAttributes (CustomAttribute attribute, ICustomAttributeProvider provider) { CheckIfAttributeUsedOnRule (attribute, provider); CheckIfStringArgumentsAreNotNullOrEmpty (attribute, provider); } private void CheckFxCopCompatibilityAttribute (CustomAttribute attribute, ICustomAttributeProvider provider) { CheckIfAttributeUsedOnRule (attribute, provider); if (!CheckIfStringArgumentsAreNotNullOrEmpty (attribute, provider)) return; // check if second argument has correct format if (!attribute.HasConstructorArguments) return; var attributeTypeName = attribute.AttributeType.GetFullName (); var argumentValue = attribute.ConstructorArguments [1].Value.ToString (); var length = argumentValue.Length; if (!((length == 6 || (length > 8 && argumentValue [6] == ':')) && Char.IsLetter (argumentValue [0]) && Char.IsLetter(argumentValue[1]) && Char.IsDigit(argumentValue[2]) && Char.IsDigit(argumentValue[3]) && Char.IsDigit(argumentValue[4]) && Char.IsDigit(argumentValue[5]))) Runner.Report (provider, Severity.Medium, Confidence.High, attributeTypeName + " second argument should match the followint format: XX9999:Name"); else if (length == 6) Runner.Report (provider, Severity.Medium, Confidence.High, attributeTypeName + " second argument should contain both rule ID and name"); } private void CheckEngineDependencyAttribute (CustomAttribute attribute, ICustomAttributeProvider provider) { TypeDefinition td = (provider as TypeDefinition); if (td == null || !(IsRule (td) || td.Implements ("Gendarme.Framework", "IRunner"))) Runner.Report (td, Severity.Medium, Confidence.High, "[EngineDependency] can only be used on rules and runners"); CheckIfStringArgumentsAreNotNullOrEmpty (attribute, provider); if (!attribute.HasConstructorArguments) return; var argument = attribute.ConstructorArguments [0]; // if possible, check if argument type implements IEngine if (argument.Type.IsNamed ("System", "Type")) { TypeReference tr = (argument.Value as TypeReference); if (tr == null || !tr.Inherits ("Gendarme.Framework", "Engine")) // IEngine does not exist yet Runner.Report (provider, Severity.Medium, Confidence.High, "EngineDependency attribute argument should implement IEngine interface"); } } private void CheckDescriptionAttribute (CustomAttribute attribute, ICustomAttributeProvider provider) { CheckIfStringArgumentsAreNotNullOrEmpty (attribute, provider); CheckIfAttributeUsedOnRulesProperty (attribute, provider); } private void CheckIfAttributeUsedOnRule (ICustomAttribute attribute, ICustomAttributeProvider provider) { TypeDefinition td = (provider as TypeDefinition); if (td == null || !IsRule (td)) Runner.Report (td, Severity.Medium, Confidence.High, attribute.AttributeType.GetFullName () + " can be used on rules only"); } private void CheckIfAttributeUsedOnRulesProperty (ICustomAttribute attribute, ICustomAttributeProvider provider) { PropertyDefinition property = (provider as PropertyDefinition); if (property == null || !IsRule (property.DeclaringType) || !property.GetMethod.IsPublic || !property.SetMethod.IsPublic) Runner.Report (provider, Severity.High, Confidence.High, attribute.AttributeType.GetFullName () + " should be used only on rules' public properties"); } // returns true when all arguments are fine, false otherwise private bool CheckIfStringArgumentsAreNotNullOrEmpty (CustomAttribute attribute, ICustomAttributeProvider provider) { if (!attribute.HasConstructorArguments) return true; foreach (CustomAttributeArgument argument in attribute.ConstructorArguments) { if (!argument.Type.IsNamed ("System", "String")) continue; if (String.IsNullOrEmpty ((string) argument.Value)) { Runner.Report (provider, Severity.Medium, Confidence.High, attribute.AttributeType.GetFullName () + " argument cannot be null or empty"); return false; } } return true; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/0000775000175000017500000000000012642235743025561 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/ChangeLog0000664000175000017500000000756612413742070027341 0ustar00directhexdirecthex000000000000002010-06-04 Sebastien Pouliot * DoNotReduceTypeSecurityOnMethodsRule.cs: * DoNotExposeMethodsProtectedByLinkDemandRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-04-29 Sebastien Pouliot * DoNotExposeMethodsProtectedByLinkDemandRule.cs: Apply PreferEmpty InstanceOverNullRule (self-test) 2009-07-07 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2008-12-13 Jesse Jones * ReviewSuppressUnmanagedCodeSecurityUsageRule.cs: Fix AnalyzeModule so that it activates the rule properly when multiple assemblies or modules are being checked. 2008-12-06 Sebastien Pouliot * DoNotExposeFieldsInSecuredTypeRule.cs: Use HasFields * DoNotReduceTypeSecurityOnMethodsRule.cs: Use HasSecurityDeclarations 2008-12-01 Sebastien Pouliot * AddMissingTypeInheritanceDemandRule.cs: Use HasSecurityDeclarations * DoNotExposeFieldsInSecuredTypeRule.cs: Use HasSecurityDeclarations * DoNotExposeMethodsProtectedByLinkDemandRule.cs: Use HasSecurityDeclarations * DoNotReduceTypeSecurityOnMethodsRule.cs: Use HasSecurityDeclarations * ReviewNonVirtualMethodWithInheritanceDemandRule.cs: Use HasSecurityDeclarations * ReviewSealedTypeWithInheritanceDemandRule.cs: Use HasSecurityDeclarations * SecureGetObjectDataOverridesRule.cs: Use HasSecurityDeclarations 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Security.Cas.mdp: * Gendarme.Rules.Security.Cas.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Security.Cas.xml, doc/Gendarme.Rules.Security.Cas: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-14 Sebastien Pouliot * AddMissingTypeInheritanceDemandRule.cs: Add XML documentation. * DoNotExposeFieldsInSecuredTypeRule.cs: Add XML documentation. * DoNotExposeMethodsProtectedByLinkDemandRule.cs: Use OpCodeEngine. Add XML documentation. * DoNotExposeMethodsProtectedByLinkDemandTest.cs: Remove. * DoNotReduceTypeSecurityOnMethodsRule.cs: Add XML documentation. * ReviewSealedTypeWithInheritanceDemandRule.cs: Complete rename. Add XML documentation. * ReviewSuppressUnmanagedCodeSecurityUsageRule.cs: Add XML documentation. * SecureGetObjectDataOverridesRule.cs: Add XML documentation. Remove unneeded using clauses. 2008-09-10 Sebastien Pouliot * Gendarme.Rules.Security.Cas.mdp: New. Add MD project file. 2008-08-25 Sebastien Pouliot * AddMissingTypeInheritanceDemandRule.cs, DoNotExposeFieldsInSecuredTypeRule.cs, DoNotExposeMethodsProtectedByLinkDemandRule.cs, DoNotReduceTypeSecurityOnMethodsRule.cs, ReviewNonVirtualMethodWithInheritanceDemandRule.cs, ReviewSealedTypeWithInheritanceDemandRule.cs, SecureGetObjectDataOverridesTest.cs: Moved, and renamed, from Gendarme.Rules.Security 2008-08-25 Sebastien Pouliot * ReviewSuppressUnmanagedCodeSecurityUsageRule.cs: New. Rule that suggest reviewing type and methods decorated with [SuppressUnmanaged CodeSecurityUsage]. Since this, generally, can't be fixed this rule returns the new Severity.Audit level (i.e. below Low). * Makefile.am: New. Build file. ReviewSealedTypeWithInheritanceDemandRule.cs0000664000175000017500000000643412413742070036220 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas// // Gendarme.Rules.Security.SealedTypeWithInheritanceDemandRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Security.Cas { /// /// This rule checks for sealed types that have InheritanceDemand declarative /// security applied to them. Since those types cannot be inherited from the /// InheritanceDemand will never be executed by the runtime. Check if the permission /// is required and, if so, change the SecurityAction to the correct one. Otherwise /// remove the permission. /// /// /// Bad example: /// /// [SecurityPermission (SecurityAction.InheritanceDemand, Unrestricted = true)] /// public sealed class Bad { /// } /// /// /// /// Good example (non sealed): /// /// [SecurityPermission (SecurityAction.InheritanceDemand, Unrestricted = true)] /// public class Good { /// } /// /// /// /// Good example (LinkDemand): /// /// [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] /// public sealed class Good { /// } /// /// /// Before Gendarme 2.2 this rule was part of Gendarme.Rules.Security and named SealedTypeWithInheritanceDemandRule. [Problem ("This sealed type has an InheritanceDemand that the runtime will never execute.")] [Solution ("Review the InheritanceDemand on this type and either remove it or change its SecurityAction to, probably, a LinkDemand.")] public class ReviewSealedTypeWithInheritanceDemandRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // 1 - this applies only to sealed types if (!type.IsSealed) return RuleResult.DoesNotApply; // 2 - the type must have an InheritanceDemand if (!type.HasSecurityDeclarations) return RuleResult.DoesNotApply; foreach (SecurityDeclaration declsec in type.SecurityDeclarations) { if (declsec.Action == SecurityAction.InheritDemand) { Runner.Report (type, Severity.Low, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/DoNotExposeFieldsInSecuredTypeRule.cs0000664000175000017500000000725412413742070034742 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Security.Cas.DoNotExposeFieldsInSecuredTypeRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security.Cas { /// /// The rule checks for types that are secured by Demand or LinkDemand /// but also expose visible fields. Access to these fields is not covered by the /// declarative demands, opening potential security holes. /// /// /// Bad example: /// /// [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] /// public class Bad { /// } /// /// /// /// Good example (InheritanceDemand): /// /// [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] /// [SecurityPermission (SecurityAction.InheritanceDemand, ControlThread = true)] /// public class Correct { /// } /// /// /// /// Good example (sealed): /// /// [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] /// public sealed class Correct { /// } /// /// /// Before Gendarme 2.2 this rule was part of Gendarme.Rules.Security and named TypeExposeFieldsRule. [Problem ("This type is secured by [Link]Demand but exposes some visible fields.")] [Solution ("Remove the (unsecured) visible fields, turn them into (secured) properties or reduce their access.")] [FxCopCompatibility ("Microsoft.Security", "CA2112:SecuredTypesShouldNotExposeFields")] public class DoNotExposeFieldsInSecuredTypeRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule apply only to types protected by either a Demand or a LinkDemand (i.e. SecurityDeclaration) // that have fields and are visible outside the assembly if (!type.HasSecurityDeclarations || !type.HasFields || !type.IsVisible ()) return RuleResult.DoesNotApply; bool demand = false; foreach (SecurityDeclaration declsec in type.SecurityDeclarations) { switch (declsec.Action) { case Mono.Cecil.SecurityAction.Demand: case Mono.Cecil.SecurityAction.LinkDemand: demand = true; break; } } if (!demand) return RuleResult.DoesNotApply; // *** ok, the rule applies! *** // type shouldn't have any visible fields foreach (FieldDefinition field in type.Fields) { if (field.IsVisible ()) { Runner.Report (field, Severity.Critical, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/SecureGetObjectDataOverridesRule.cs0000664000175000017500000001103012413742070034415 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Security.Cas.SecureGetObjectDataOverridesRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Globalization; using System.Security; using System.Security.Permissions; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security.Cas { /// /// This rule fires if a type implements System.Runtime.Serialization.ISerializable /// but the GetObjectData method is not protected with a Demand or /// LinkDemand for SerializationFormatter. /// /// /// Bad example: /// /// public class Bad : ISerializable { /// public override void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// } /// } /// /// /// /// Good example: /// /// public class Good : ISerializable { /// [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)] /// public override void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// } /// } /// /// /// Before Gendarme 2.2 this rule was part of Gendarme.Rules.Security. [Problem ("The method is not protected correctly against a serialization attack.")] [Solution ("A security Demand for SerializationFormatter should be added to protect the method.")] public class SecureGetObjectDataOverridesRule : Rule, ITypeRule { private const string NotFound = "No [Link]Demand was found."; static PermissionSet _ruleSet; static PermissionSet RuleSet { get { if (_ruleSet == null) { SecurityPermission sp = new SecurityPermission (SecurityPermissionFlag.SerializationFormatter); _ruleSet = new PermissionSet (PermissionState.None); _ruleSet.AddPermission (sp); } return _ruleSet; } } public RuleResult CheckType (TypeDefinition type) { // rule applies only to types that implements ISerializable if (!type.Implements ("System.Runtime.Serialization", "ISerializable")) return RuleResult.DoesNotApply; MethodDefinition method = type.GetMethod (MethodSignatures.GetObjectData); if (method == null) return RuleResult.DoesNotApply; // *** ok, the rule applies! *** // is there any security applied ? if (!method.HasSecurityDeclarations) { Runner.Report (method, Severity.High, Confidence.Total, NotFound); return RuleResult.Failure; } // the SerializationFormatter must be a subset of the one (of the) demand(s) bool demand = false; foreach (SecurityDeclaration declsec in method.SecurityDeclarations) { switch (declsec.Action) { case Mono.Cecil.SecurityAction.Demand: case Mono.Cecil.SecurityAction.NonCasDemand: case Mono.Cecil.SecurityAction.LinkDemand: case Mono.Cecil.SecurityAction.NonCasLinkDemand: demand = true; if (!RuleSet.IsSubsetOf (declsec.ToPermissionSet ())) { string message = String.Format (CultureInfo.InvariantCulture, "{0} is not a subset of {1} permission set", "SerializationFormatter", declsec.Action); Runner.Report (method, Severity.High, Confidence.Total, message); } break; } } // there was no [NonCas][Link]Demand but other actions are possible if (!demand) Runner.Report (method, Severity.High, Confidence.Total, NotFound); return Runner.CurrentRuleResult; } } } ReviewNonVirtualMethodWithInheritanceDemandRule.cs0000664000175000017500000000516312413742070037421 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas// // Gendarme.Rules.Security.Cas.ReviewNonVirtualMethodWithInheritanceDemandRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Collections; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Security.Cas { // TODO: Shouldn't this rule have a summary? [Problem ("This non-virtual method has an InheritanceDemand that the runtime will never execute.")] [Solution ("Review the InheritanceDemand on this method and either remove it or change its SecurityAction to, probably, a LinkDemand.")] public class ReviewNonVirtualMethodWithInheritanceDemandRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // this rule apply only to methods with an inheritance demand if (!method.HasSecurityDeclarations) return RuleResult.DoesNotApply; bool inherit = false; foreach (SecurityDeclaration declsec in method.SecurityDeclarations) { switch (declsec.Action) { case SecurityAction.InheritDemand: case SecurityAction.NonCasInheritance: inherit = true; break; } } if (!inherit) return RuleResult.DoesNotApply; // *** ok, the rule applies! *** // InheritanceDemand doesn't make sense on methods that cannot be overriden if (method.IsVirtual) return RuleResult.Success; // Severity.Low -> code works, it just won't get called. Problematic if the wrong action was choosen Runner.Report (method, Severity.Low, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Makefile.in0000664000175000017500000006632612642235732027641 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Security.Cas ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AddMissingTypeInheritanceDemandRule.cs \ DoNotExposeFieldsInSecuredTypeRule.cs \ DoNotExposeMethodsProtectedByLinkDemandRule.cs \ DoNotReduceTypeSecurityOnMethodsRule.cs \ ReviewNonVirtualMethodWithInheritanceDemandRule.cs \ ReviewSealedTypeWithInheritanceDemandRule.cs \ ReviewSuppressUnmanagedCodeSecurityUsageRule.cs \ SecureGetObjectDataOverridesRule.cs \ SecurityDeclarationRocks.cs tests_sources = \ AddMissingTypeInheritanceDemandTest.cs \ DoNotExposeFieldsInSecuredTypeTest.cs \ DoNotExposeMethodsProtectedByLinkDemandTest.cs \ DoNotReduceTypeSecurityOnMethodsTest.cs \ ReviewNonVirtualMethodWithInheritanceDemandTest.cs \ ReviewSealedTypeWithInheritanceDemandTest.cs \ ReviewSuppressUnmanagedCodeSecurityUsageTest.cs \ SecureGetObjectDataOverridesTest.cs \ SecurityDeclarationRocksTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Security.Cas/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Security.Cas/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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: ReviewSuppressUnmanagedCodeSecurityUsageRule.cs0000664000175000017500000000742012413742070037012 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas// // Gendarme.Rules.Security.Cas.ReviewSuppressUnmanagedCodeSecurityUsageRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security.Cas { /// /// This rule fires if a type or method is decorated with the [SuppressUnmanagedCodeSecurity] /// attribute. This attribute reduces the security checks done when executing unmanaged code and its /// usage should be reviewed to confirm that no exploitable security holes are present. /// /// /// Example: /// /// [SuppressUnmanagedCodeSecurity] /// public class Safe { /// [DllImport ("User32.dll")] /// static extern Boolean MessageBeep (UInt32 beepType); /// } /// /// /// This is an Audit rule. As such it does not check for valid or invalid patterns but warns about a specific problem that needs to be reviewed by someone. [Problem ("This type or method is decorated with [SuppressUnmanagedCodeSecurity] which reduce the number of security checks done when unmanaged code is called.")] [Solution ("Ensure that use of this attribute does not compromise the security of the application.")] [FxCopCompatibility ("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")] public class ReviewSuppressUnmanagedCodeSecurityUsageRule : Rule, ITypeRule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference [SuppressUnmanagedCodeSecurityAttribute] // then it's not being used inside it Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Security", "SuppressUnmanagedCodeSecurityAttribute"); })); }; } // The [SuppressUnmanagedCodeSecurity] attribute applies to // Classes, Interfaces, Delegates (ITypeRule) and Methods (IMethodRule) public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum) return RuleResult.DoesNotApply; if (!type.HasAttribute ("System.Security", "SuppressUnmanagedCodeSecurityAttribute")) return RuleResult.Success; Runner.Report (type, Severity.Audit, Confidence.Total); return RuleResult.Failure; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasAttribute ("System.Security", "SuppressUnmanagedCodeSecurityAttribute")) return RuleResult.Success; Runner.Report (method, Severity.Audit, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Gendarme.Rules.Security.Cas.csproj0000664000175000017500000001337412413742070034131 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {237A273E-BCAF-42DB-9DE5-1697B016C648} Library Properties Gendarme.Rules.Security.Cas Gendarme.Rules.Security.Cas v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Security.Cas.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Security.Cas.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/SecurityDeclarationRocks.cs0000664000175000017500000001333412413742070033063 0ustar00directhexdirecthex00000000000000// // SecurityDeclarationRocks.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.Security; using SSP = System.Security.Permissions; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security.Cas { static public class SecurityDeclarationRocks { public static PermissionSet ToPermissionSet (this SecurityDeclaration self) { if (self == null) throw new ArgumentNullException ("self"); PermissionSet set; if (TryProcessPermissionSetAttribute (self, out set)) return set; return CreatePermissionSet (self); } static bool TryProcessPermissionSetAttribute (SecurityDeclaration declaration, out PermissionSet set) { set = null; if (!declaration.HasSecurityAttributes) return false; var attributes = declaration.SecurityAttributes; if (attributes.Count != 1) return false; var security_attribute = attributes [0]; var attribute_type = security_attribute.AttributeType; if (attribute_type.Name != "PermissionSetAttribute" || attribute_type.Namespace != "System.Security.Permissions") return false; var attribute = new SSP.PermissionSetAttribute ((SSP.SecurityAction) declaration.Action); foreach (var named_argument in security_attribute.Properties) { object value = named_argument.Argument.Value; switch (named_argument.Name) { case "Unrestricted": attribute.Unrestricted = (bool) value; break; case "UnicodeEncoded": attribute.UnicodeEncoded = (bool) value; break; case "XML": attribute.XML = (string) value; break; case "Name": attribute.Name = (string) value; break; case "File": attribute.File = (string) value; break; case "Hex": attribute.Hex = (string) value; break; default: throw new NotImplementedException (named_argument.Name); } } set = attribute.CreatePermissionSet (); return true; } static PermissionSet CreatePermissionSet (SecurityDeclaration declaration) { var set = new PermissionSet (SSP.PermissionState.None); foreach (var attribute in declaration.SecurityAttributes) { var permission = CreatePermission (declaration, attribute); set.AddPermission (permission); } return set; } static IPermission CreatePermission (SecurityDeclaration declaration, SecurityAttribute attribute) { TypeReference atype = attribute.AttributeType; string name = atype.FullName; // most of the permissions resides inside mscorlib.dll Type attribute_type = Type.GetType (name); if (attribute_type == null) { // but not all of them, so we need to try harder :-) TypeDefinition rtype = atype.Resolve (); AssemblyDefinition ad = rtype == null ? atype.Module.Assembly : rtype.Module.Assembly; attribute_type = Type.GetType (name + ", " + ad.FullName); } if (attribute_type == null) throw new ArgumentException ("attribute"); var security_attribute = CreateSecurityAttribute (attribute_type, declaration); if (security_attribute == null) throw new InvalidOperationException (); CompleteSecurityAttribute (security_attribute, attribute); return security_attribute.CreatePermission (); } static void CompleteSecurityAttribute (SSP.SecurityAttribute security_attribute, SecurityAttribute attribute) { if (attribute.HasFields) CompleteSecurityAttributeFields (security_attribute, attribute); if (attribute.HasProperties) CompleteSecurityAttributeProperties (security_attribute, attribute); } static void CompleteSecurityAttributeFields (SSP.SecurityAttribute security_attribute, ICustomAttribute attribute) { var type = security_attribute.GetType (); foreach (var named_argument in attribute.Fields) type.GetField (named_argument.Name).SetValue (security_attribute, named_argument.Argument.Value); } static void CompleteSecurityAttributeProperties (SSP.SecurityAttribute security_attribute, ICustomAttribute attribute) { var type = security_attribute.GetType (); foreach (var named_argument in attribute.Properties) type.GetProperty (named_argument.Name).SetValue (security_attribute, named_argument.Argument.Value, null); } static SSP.SecurityAttribute CreateSecurityAttribute (Type attribute_type, SecurityDeclaration declaration) { SSP.SecurityAttribute security_attribute; try { security_attribute = (SSP.SecurityAttribute) Activator.CreateInstance ( attribute_type, new object [] { (SSP.SecurityAction) declaration.Action }); } catch (MissingMethodException) { security_attribute = (SSP.SecurityAttribute) Activator.CreateInstance (attribute_type, new object [0]); } return security_attribute; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test/0000775000175000017500000000000012642235743026500 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test/ChangeLog0000664000175000017500000000162312413742070030244 0ustar00directhexdirecthex000000000000002008-09-14 Sebastien Pouliot * ReviewSealedTypeWithInheritanceDemandTest.cs: Complete rename. 2008-09-10 Sebastien Pouliot * Test.Rules.Security.Cas.mdp: New. Add MD project file. 2008-08-25 Sebastien Pouliot * AddMissingTypeInheritanceDemandTest.cs, DoNotExposeFieldsInSecuredTypeTest.cs, DoNotExposeMethodsProtectedByLinkDemandTest.cs, DoNotReduceTypeSecurityOnMethodsTest.cs, ReviewNonVirtualMethodWithInheritanceDemandTest.cs, ReviewSealedTypeWithInheritanceDemandTest.cs, SecureGetObjectDataOverridesTest.cs: Moved, and renamed, from Gendarme.Rules.Security. Most upgrade to the new syntax for unit tests. 2008-08-25 Sebastien Pouliot * ReviewSuppressUnmanagedCodeSecurityUsageTest.cs: New. Unit tests for ReviewSuppressUnmanagedCodeSecurityUsageRule. * Makefile.am: New. Build file. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test/SecurityDeclarationRocksTest.cs0000664000175000017500000000432512413742070034642 0ustar00directhexdirecthex00000000000000// // Unit tests for SecurityDeclarationRocks // // Authors: // Sebastien Pouliot // // 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; using System.Security; using SSP = System.Security.Permissions; using NUnit.Framework; using Test.Rules.Helpers; using Mono.Cecil; using Gendarme.Rules.Security.Cas; namespace Tests.Rules.Security.Cas { [SSP.PermissionSet (SSP.SecurityAction.InheritanceDemand, Unrestricted = true, UnicodeEncoded = true)] public abstract class UnrestrictedTrue { } [SSP.PermissionSet (SSP.SecurityAction.InheritanceDemand, Unrestricted = false)] public abstract class UnrestrictedFalse { } [TestFixture] public class SecurityDeclarationRocksTest { [Test] public void Unrestricted_Boolean () { TypeDefinition t = DefinitionLoader.GetTypeDefinition (); PermissionSet ps = t.SecurityDeclarations [0].ToPermissionSet (); Assert.IsTrue (ps.IsUnrestricted (), "IsUnrestricted"); t = DefinitionLoader.GetTypeDefinition (); ps = t.SecurityDeclarations [0].ToPermissionSet (); Assert.IsFalse (ps.IsUnrestricted (), "!IsUnrestricted"); } } } ReviewSuppressUnmanagedCodeSecurityUsageTest.cs0000664000175000017500000000605412413742070037743 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test// // Unit tests for ReviewSuppressUnmanagedCodeSecurityUsageRule // // Authors: // Sebastien Pouliot // // 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; using System.Security; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Security.Cas; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Tests.Rules.Security.Cas { [TestFixture] public class ReviewSuppressUnmanagedCodeSecurityUsageTypeTest : TypeRuleTestFixture { [Test] public void Enum () { AssertRuleDoesNotApply (SimpleTypes.Enum); } // class [SuppressUnmanagedCodeSecurity] class SuppressedClass { } class NormalClass { } [Test] public void Class () { AssertRuleFailure (1); AssertRuleSuccess (); } // interface [SuppressUnmanagedCodeSecurity] interface SuppressedInterface { } interface NormalInterface { } [Test] public void Interface () { AssertRuleFailure (1); AssertRuleSuccess (); } // delegate [SuppressUnmanagedCodeSecurity] delegate bool SuppressedDelegate (int x); delegate bool NormalDelegate (int x); [Test] public void Delegate () { AssertRuleFailure (1); AssertRuleSuccess (); } } [TestFixture] public class ReviewSuppressUnmanagedCodeSecurityUsageMethodTest : MethodRuleTestFixture { [SuppressUnmanagedCodeSecurity] private void GoCallUnmanagedCodeAlotOfTimes () { } private void GoCallUnmanagedCodeAfewTimes () { } [Test] public void Test () { AssertRuleFailure ("GoCallUnmanagedCodeAlotOfTimes", 1); AssertRuleSuccess ("GoCallUnmanagedCodeAfewTimes"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test/Makefile.in0000664000175000017500000003144612642235732030553 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Security.Cas/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Security.Cas.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Security.Cas/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Security.Cas/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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: ReviewNonVirtualMethodWithInheritanceDemandTest.cs0000664000175000017500000001156612413742070040354 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test// // Unit tests for ReviewNonVirtualMethodWithInheritanceDemandRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-2006,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; using System.Collections.Specialized; using System.Reflection; using System.Runtime.Serialization; using System.Security.Permissions; using SSP = System.Security.Permissions; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Security.Cas; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Security.Cas { [TestFixture] public class ReviewNonVirtualMethodWithInheritanceDemandTest { public abstract class AbstractMethodsClass { [SecurityPermission (SSP.SecurityAction.InheritanceDemand, ControlAppDomain = true)] public abstract void Abstract (); } public class VirtualMethodsClass: AbstractMethodsClass { public override void Abstract () { } [SecurityPermission (SSP.SecurityAction.InheritanceDemand, ControlAppDomain = true)] public virtual void Virtual () { } } public class NoVirtualMethodsClass { [SecurityPermission (SSP.SecurityAction.InheritanceDemand, ControlAppDomain = true)] public void Method () { } [SecurityPermission (SSP.SecurityAction.InheritanceDemand, ControlAppDomain = true)] static public void StaticMethod () { } } public abstract class NotInheritanceDemandClass { [SecurityPermission (SSP.SecurityAction.LinkDemand, ControlAppDomain = true)] public abstract void Asbtract (); [SecurityPermission (SSP.SecurityAction.Demand, ControlAppDomain = true)] public virtual void Virtual () { } [SecurityPermission (SSP.SecurityAction.LinkDemand, ControlAppDomain = true)] public void Method () { } [SecurityPermission (SSP.SecurityAction.Demand, ControlAppDomain = true)] static public void StaticMethod () { } } private IMethodRule rule; private TestRunner runner; private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new ReviewNonVirtualMethodWithInheritanceDemandRule (); runner = new TestRunner (rule); } private TypeDefinition GetTest (string name) { string fullname = "Test.Rules.Security.Cas.ReviewNonVirtualMethodWithInheritanceDemandTest/" + name; return assembly.MainModule.GetType (fullname); } [Test] public void AbstractMethods () { TypeDefinition type = GetTest ("AbstractMethodsClass"); foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) continue; Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), method.ToString ()); } } [Test] public void VirtualMethods () { TypeDefinition type = GetTest ("VirtualMethodsClass"); foreach (MethodDefinition method in type.Methods) { switch (method.Name) { case "Abstract": Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckMethod (method), method.Name); break; case "Virtual": Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), method.Name); break; } } } [Test] public void NoVirtualMethods () { TypeDefinition type = GetTest ("NoVirtualMethodsClass"); foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) continue; Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), method.ToString ()); } } [Test] public void NotInheritanceDemand () { TypeDefinition type = GetTest ("NotInheritanceDemandClass"); foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) continue; Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckMethod (method), method.ToString ()); } } } } AddMissingTypeInheritanceDemandTest.cs0000664000175000017500000001000512413742070035743 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test// // Unit tests for AddMissingTypeInheritanceDemandRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Security.Permissions; using Gendarme.Rules.Security.Cas; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Security.Cas { [TestFixture] public class AddMissingTypeInheritanceDemandTest : TypeRuleTestFixture { [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] class NonVisibleClass { public NonVisibleClass () { } } [Test] public void NonVisible () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] public sealed class SealedClass { public SealedClass () { } } [Test] public void Sealed () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] public class LinkDemandClass { public LinkDemandClass () { } } [Test] public void LinkDemand () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] public class LinkDemandVirtualMethodClass { public LinkDemandVirtualMethodClass () { } public virtual void Virtual () { } } [Test] public void LinkDemandVirtualMethod () { AssertRuleFailure (1); } [EnvironmentPermission (SecurityAction.InheritanceDemand, Unrestricted = true)] public class InheritanceDemandClass { public InheritanceDemandClass () { } public virtual void Virtual () { } } [Test] public void InheritanceDemand () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] [EnvironmentPermission (SecurityAction.InheritanceDemand, Unrestricted = true)] public class NoIntersectionClass { public NoIntersectionClass () { } } [Test] public void NoIntersection () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] [EnvironmentPermission (SecurityAction.InheritanceDemand, Unrestricted = true)] public class NoIntersectionVirtualMethodClass { public NoIntersectionVirtualMethodClass () { } public virtual void Virtual () { } } [Test] public void NoIntersectionVirtualMethod () { AssertRuleFailure (1); } [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)] [SecurityPermission (SecurityAction.InheritanceDemand, Unrestricted = true)] public class IntersectionClass { public IntersectionClass () { } public virtual void Virtual () { } } [Test] public void Intersection () { AssertRuleSuccess (); } } } DoNotExposeMethodsProtectedByLinkDemandTest.cs0000664000175000017500000000673312413742070037440 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test// // Unit tests for DoNotExposeMethodsProtectedByLinkDemandRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-2006, 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; using System.Security.Permissions; using Gendarme.Rules.Security.Cas; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Security.Cas { [TestFixture] public class DoNotExposeMethodsProtectedByLinkDemandTest : MethodRuleTestFixture { public class BaseClass { [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)] public virtual void VirtualMethod () { } [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)] protected void ProtectedMethod () { } } public class SubsetInheritClass: BaseClass { [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] public override void VirtualMethod () { base.VirtualMethod (); } [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] public void CallProtectedMethod () { base.ProtectedMethod (); } } [Test] public void SubsetInherit () { AssertRuleSuccess ("VirtualMethod"); AssertRuleSuccess ("CallProtectedMethod"); } public class NotASubsetInheritClass: BaseClass { [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] public override void VirtualMethod () { base.VirtualMethod (); } [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] public void CallProtectedMethod () { base.ProtectedMethod (); } } [Test] public void NotASubsetInherit () { AssertRuleFailure ("VirtualMethod", 1); AssertRuleFailure ("VirtualMethod", 1); } public class SubsetCallClass { [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] public void Method () { new BaseClass ().VirtualMethod (); } } [Test] public void SubsetCall () { AssertRuleSuccess ("Method"); } public class NotASubsetCallClass { [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] public void Method () { new BaseClass ().VirtualMethod (); } } [Test] public void NotASubsetCall () { AssertRuleFailure ("Method", 1); } } } ReviewSealedTypeWithInheritanceDemandTest.cs0000664000175000017500000000530612413742070037144 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test// // Unit tests for SealedTypeWithInheritanceDemandRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-2006,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; using System.Security.Permissions; using Gendarme.Rules.Security.Cas; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Security.Cas { [TestFixture] public class ReviewSealedTypeWithInheritanceDemandTest : TypeRuleTestFixture { [SecurityPermission (System.Security.Permissions.SecurityAction.InheritanceDemand, Unrestricted = true)] class NonSealedClass { public NonSealedClass () { } } [Test] public void NonSealed () { AssertRuleDoesNotApply (); } sealed class SealedClassWithoutSecurity { public SealedClassWithoutSecurity () { } } [Test] public void SealedWithoutSecurity () { AssertRuleDoesNotApply (); } [SecurityPermission (System.Security.Permissions.SecurityAction.LinkDemand, Unrestricted = true)] sealed class SealedClassWithoutInheritanceDemand { public SealedClassWithoutInheritanceDemand () { } } [Test] public void SealedWithoutInheritanceDemand () { AssertRuleSuccess (); } [SecurityPermission (System.Security.Permissions.SecurityAction.InheritanceDemand, Unrestricted = true)] sealed class SealedClassWithInheritanceDemand { public SealedClassWithInheritanceDemand () { } } [Test] public void SealedWithInheritanceDemand () { AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test/Tests.Rules.Security.Cas.csproj0000664000175000017500000001267712413742070034435 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {519B054B-07A5-43B7-9846-DA7C33A09F4A} Library Properties Tests.Rules.Security.Cas Tests.Rules.Security.Cas v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {237A273E-BCAF-42DB-9DE5-1697B016C648} Gendarme.Rules.Security.Cas False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true DoNotReduceTypeSecurityOnMethodsTest.cs0000664000175000017500000000753512413742070036200 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test// // Unit tests for DoNotReduceTypeSecurityOnMethodsRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Security.Permissions; using Gendarme.Rules.Security.Cas; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Security.Cas { [TestFixture] public class DoNotReduceTypeSecurityOnMethodsTest : TypeRuleTestFixture { public class NoSecurityClass { public NoSecurityClass () { } } [Test] public void NoSecurity () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] public class LinkDemandClass { public LinkDemandClass () { } [EnvironmentPermission (SecurityAction.LinkDemand, Unrestricted = true)] public void Method () { } } [Test] public void LinkDemand () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.InheritanceDemand, ControlThread = true)] public class InheritanceDemandClass { public InheritanceDemandClass () { } [EnvironmentPermission (SecurityAction.InheritanceDemand, Unrestricted = true)] public void Method () { } } [Test] public void InheritanceDemand () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.Assert, ControlThread = true)] public class AssertNotSubsetClass { public AssertNotSubsetClass () { } [EnvironmentPermission (SecurityAction.Assert, Unrestricted = true)] public void Method () { } } [Test] public void AssertNotSubset () { AssertRuleFailure (1); } [SecurityPermission (SecurityAction.Demand, ControlThread = true)] public class DemandSubsetClass { public DemandSubsetClass () { } [SecurityPermission (SecurityAction.Demand, ControlThread = true)] public void Method () { } } [Test] public void DemandSubset () { AssertRuleSuccess (); } [SecurityPermission (SecurityAction.Deny, Unrestricted = true)] public class DenyNotSubsetClass { public DenyNotSubsetClass () { } [SecurityPermission (SecurityAction.Deny, ControlThread = true)] public void Method () { } } [Test] public void DenyNotSubset () { AssertRuleFailure (1); } [SecurityPermission (SecurityAction.PermitOnly, ControlThread = true)] public class PermitOnlySubsetClass { public PermitOnlySubsetClass () { } [SecurityPermission (SecurityAction.PermitOnly, Unrestricted = true)] public void Method () { } } [Test] public void PermitOnlySubset () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test/Makefile.am0000664000175000017500000000015612413742070030526 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Security.Cas.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test/DoNotExposeFieldsInSecuredTypeTest.cs0000664000175000017500000000636212413742070035670 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotExposeFieldsInSecuredTypeRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Security.Permissions; using Gendarme.Rules.Security.Cas; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Security { [TestFixture] public class DoNotExposeFieldsInSecuredTypeTest : TypeRuleTestFixture { [SecurityPermission (System.Security.Permissions.SecurityAction.InheritanceDemand, Unrestricted = true)] class NonVisibleClass { public object Field = new object (); public NonVisibleClass () { } } [Test] public void NonVisible () { AssertRuleDoesNotApply (); } public class NoSecurityClass { public object Field = new object (); public NoSecurityClass () { } } [Test] public void NoSecurity () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.Deny, Unrestricted = true)] public class NoDemandClass { public object Field = new object (); public NoDemandClass () { } } [Test] public void NoDemand () { AssertRuleDoesNotApply (); } [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] public class NoVisibleFieldClass { private object Field = new object (); internal string FieldToo = String.Empty; public NoVisibleFieldClass () { } } [Test] public void NoVisibleField () { AssertRuleSuccess (); } [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] public class LinkDemandWithFieldClass { public object Field = new object (); public LinkDemandWithFieldClass () { } } [Test] public void LinkDemandWithField () { AssertRuleFailure (1); } [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] public class DemandWithFieldClass { public object Field = new object (); public DemandWithFieldClass () { } } [Test] public void DemandWithField () { AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Test/SecureGetObjectDataOverridesTest.cs0000664000175000017500000001143712413742070035357 0ustar00directhexdirecthex00000000000000// // Unit tests for SecureGetObjectDataOverridesRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Runtime.Serialization; using System.Security.Permissions; using Gendarme.Rules.Security.Cas; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Security.Cas { [TestFixture] public class SecureGetObjectDataOverridesTest : TypeRuleTestFixture { [Serializable] public class SerializableClass { } public class ISerializableClass : ISerializable { public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { } } public class InheritISerializableClass : ISerializableClass { public override void GetObjectData (SerializationInfo info, StreamingContext context) { } } public class InheritISerializableWithoutOverrideClass : ISerializableClass { public InheritISerializableWithoutOverrideClass () { } } public class LinkDemandClass: ISerializable { [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)] public void GetObjectData (SerializationInfo info, StreamingContext context) { } } public class AlternateSyntaxLinkDemandClass : ISerializable { [SecurityPermission (SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public void GetObjectData (SerializationInfo info, StreamingContext context) { } } public class InheritanceDemandClass: ISerializable { [SecurityPermission (SecurityAction.InheritanceDemand, SerializationFormatter = true)] public void GetObjectData (SerializationInfo info, StreamingContext context) { } } public class AlternateSyntaxInheritanceDemandClass : ISerializable { [SecurityPermission (SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public void GetObjectData (SerializationInfo info, StreamingContext context) { } } public class DemandClass: ISerializable { [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)] public void GetObjectData (SerializationInfo info, StreamingContext context) { } } public class AlternateSyntaxDemandClass : ISerializable { [SecurityPermission (SecurityAction.Demand, Flags = SecurityPermissionFlag.SerializationFormatter)] public void GetObjectData (SerializationInfo info, StreamingContext context) { } } public class DemandWrongPermissionClass: ISerializable { [SecurityPermission (SecurityAction.Demand, ControlAppDomain = true)] public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Test] public void SerializableWithoutGetObjectData () { // there's no GetObjectData method here so the test does not apply AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } [Test] public void GetObjectDataWithoutDemand () { AssertRuleFailure (); AssertRuleFailure (); } [Test] public void GetObjectDataWithSerializationFormatterDemand () { AssertRuleSuccess (); AssertRuleSuccess (); // not enough AssertRuleFailure (); } [Test] public void GetObjectDataWithSerializationFormatterDemand_UsingFlags () { AssertRuleSuccess (); AssertRuleSuccess (); // not enough AssertRuleFailure (); } [Test] public void GetObjectDataWithWrongDemand () { AssertRuleFailure (); } } } DoNotExposeMethodsProtectedByLinkDemandRule.cs0000664000175000017500000001274712413742070036513 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas// // Gendarme.Rules.Security.Cas.DoNotExposeMethodsProtectedByLinkDemandRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005, 2007-2008, 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; using System.Security; using System.Security.Permissions; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security.Cas { /// /// This rule checks for visible methods that are less protected (i.e. lower security /// requirements) than the method they call. If the called methods are protected by a /// LinkDemand then the caller can be used to bypass security checks. /// /// /// Bad example: /// /// public class BaseClass { /// [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] /// public virtual void VirtualMethod () /// { /// } /// } /// /// public class Class : BaseClass { /// // bad since a caller with only ControlAppDomain will be able to call the base method /// [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)] /// public override void VirtualMethod () /// { /// base.VirtualMethod (); /// } /// } /// /// /// /// Good example (InheritanceDemand): /// /// public class BaseClass { /// [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)] /// public virtual void VirtualMethod () /// { /// } /// } /// /// public class Class : BaseClass { /// // ok since this permission cover the base class permission /// [SecurityPermission (SecurityAction.LinkDemand, Unrestricted = true)] /// public override void VirtualMethod () /// { /// base.VirtualMethod (); /// } /// } /// /// /// Before Gendarme 2.2 this rule was part of Gendarme.Rules.Security and named MethodCallWithSubsetLinkDemandRule. [Problem ("This method is less protected than some of the methods it calls.")] [Solution ("Ensure that the LinkDemand on this method is a superset of any LinkDemand present on called methods.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")] public class DoNotExposeMethodsProtectedByLinkDemandRule : Rule, IMethodRule { static PermissionSet Empty = new PermissionSet (PermissionState.None); private static PermissionSet GetLinkDemand (ISecurityDeclarationProvider method) { foreach (SecurityDeclaration declsec in method.SecurityDeclarations) { switch (declsec.Action) { case Mono.Cecil.SecurityAction.LinkDemand: case Mono.Cecil.SecurityAction.NonCasLinkDemand: return declsec.ToPermissionSet (); } } return Empty; } private static bool Check (ISecurityDeclarationProvider caller, ISecurityDeclarationProvider callee) { // 1 - look if the callee has a LinkDemand PermissionSet calleeLinkDemand = GetLinkDemand (callee); if (calleeLinkDemand.Count == 0) return true; // 2 - Ensure the caller requires a superset (or the same) permissions return calleeLinkDemand.IsSubsetOf (GetLinkDemand (caller)); } public RuleResult CheckMethod (MethodDefinition method) { // #1 - rule apply only if the method has a body (e.g. p/invokes, icalls don't) // otherwise we don't know what it's calling if (!method.HasBody) return RuleResult.DoesNotApply; // #2 - rule apply to methods are publicly accessible // note that the type doesn't have to be public (indirect access) if (!method.IsVisible ()) return RuleResult.DoesNotApply; // #3 - avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // *** ok, the rule applies! *** // #4 - look for every method we call foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodDefinition callee = (ins.Operand as MethodDefinition); if (callee == null) continue; // 4 - and if it has security, ensure we don't reduce it's strength if (callee.HasSecurityDeclarations && !Check (method, callee)) { Runner.Report (method, ins, Severity.High, Confidence.High); } break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/Makefile.am0000664000175000017500000000153412413742070027610 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AddMissingTypeInheritanceDemandRule.cs \ DoNotExposeFieldsInSecuredTypeRule.cs \ DoNotExposeMethodsProtectedByLinkDemandRule.cs \ DoNotReduceTypeSecurityOnMethodsRule.cs \ ReviewNonVirtualMethodWithInheritanceDemandRule.cs \ ReviewSealedTypeWithInheritanceDemandRule.cs \ ReviewSuppressUnmanagedCodeSecurityUsageRule.cs \ SecureGetObjectDataOverridesRule.cs \ SecurityDeclarationRocks.cs tests_sources = \ AddMissingTypeInheritanceDemandTest.cs \ DoNotExposeFieldsInSecuredTypeTest.cs \ DoNotExposeMethodsProtectedByLinkDemandTest.cs \ DoNotReduceTypeSecurityOnMethodsTest.cs \ ReviewNonVirtualMethodWithInheritanceDemandTest.cs \ ReviewSealedTypeWithInheritanceDemandTest.cs \ ReviewSuppressUnmanagedCodeSecurityUsageTest.cs \ SecureGetObjectDataOverridesTest.cs \ SecurityDeclarationRocksTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/AddMissingTypeInheritanceDemandRule.cs0000664000175000017500000001125012413742070035076 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Security.Cas.AddMissingTypeInheritanceDemandRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Collections; using System.Security; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security.Cas { /// /// The rule checks for types that are not sealed but have a LinkDemand. /// In this case the type should also have an InheritanceDemand for the same /// permissions. An alternative is to seal the type. /// /// /// Bad example: /// /// [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] /// public class Bad { /// } /// /// /// /// Good example (InheritanceDemand): /// /// [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] /// [SecurityPermission (SecurityAction.InheritanceDemand, ControlThread = true)] /// public class Correct { /// } /// /// /// /// Good example (sealed): /// /// [SecurityPermission (SecurityAction.LinkDemand, ControlThread = true)] /// public sealed class Correct { /// } /// /// /// Before Gendarme 2.2 this rule was part of Gendarme.Rules.Security and named TypeLinkDemandRule. [Problem ("The type isn't sealed and has a LinkDemand. It should also have an InheritanceDemand for the same permissions.")] [Solution ("Add an InheritanceDemand for the same permissions (as the LinkDemand) or seal the class.")] [FxCopCompatibility ("Microsoft.Security", "CA2126:TypeLinkDemandsRequireInheritanceDemands")] public class AddMissingTypeInheritanceDemandRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule apply only to types that // - are not sealed; // - have a LinkDemand (so some security declarations); and // - are visible outside the current assembly if (type.IsSealed || !type.HasSecurityDeclarations || !type.IsVisible ()) return RuleResult.DoesNotApply; PermissionSet link = null; PermissionSet inherit = null; // rule apply to types with a LinkDemand foreach (SecurityDeclaration declsec in type.SecurityDeclarations) { switch (declsec.Action) { case Mono.Cecil.SecurityAction.LinkDemand: case Mono.Cecil.SecurityAction.NonCasLinkDemand: link = declsec.ToPermissionSet (); break; case Mono.Cecil.SecurityAction.InheritDemand: case Mono.Cecil.SecurityAction.NonCasInheritance: inherit = declsec.ToPermissionSet (); break; } } // no LinkDemand == no problem if (link == null) return RuleResult.DoesNotApply; // rule apply if there are virtual methods defined bool virt = false; foreach (MethodDefinition method in type.Methods) { // ensure that the method is declared in this type (i.e. not in a parent) if (method.IsVirtual && ((method.DeclaringType as TypeDefinition) == type)) virt = true; } // no virtual method == no problem if (!virt) return RuleResult.DoesNotApply; // *** ok, the rule applies! *** // Ensure the LinkDemand is a subset of the InheritanceDemand if (inherit == null) { // LinkDemand without InheritanceDemand Runner.Report (type, Severity.High, Confidence.High, "LinkDemand is present but no InheritanceDemand is specified."); } else if (!link.IsSubsetOf (inherit)) { Runner.Report (type, Severity.High, Confidence.High, "LinkDemand is not a subset of InheritanceDemand."); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security.Cas/DoNotReduceTypeSecurityOnMethodsRule.cs0000664000175000017500000001273012413742070035321 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Security.Cas.DoNotReduceTypeSecurityOnMethodsRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Security; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Security.Cas { /// /// This rule checks for types that have declarative security permission which aren't a /// subset of the security permission of some of their methods. /// /// /// Bad example: /// /// [SecurityPermission (SecurityAction.Assert, ControlThread = true)] /// public class NotSubset { /// [EnvironmentPermission (SecurityAction.Assert, Unrestricted = true)] /// public void Method () /// { /// } /// } /// /// /// /// Good example: /// /// [SecurityPermission (SecurityAction.Assert, ControlThread = true)] /// public class Subset { /// [SecurityPermission (SecurityAction.Assert, Unrestricted = true)] /// public void Method () /// { /// } /// } /// /// /// Before Gendarme 2.2 this rule was part of Gendarme.Rules.Security and named TypeIsNotSubsetOfMethodSecurityRule. [Problem ("This type has a declarative security permission that isn't a subset of the security on some of it's methods.")] [Solution ("Ensure that the type security is a subset of any method security. This rule doesn't apply for LinkDemand an Inheritance demands as both the type and methods security will be executed.")] [FxCopCompatibility ("Microsoft.Security", "CA2114:MethodSecurityShouldBeASupersetOfType")] public class DoNotReduceTypeSecurityOnMethodsRule : Rule, ITypeRule { private PermissionSet assert; private PermissionSet deny; private PermissionSet permitonly; private PermissionSet demand; private bool RuleDoesAppliesToType (ISecurityDeclarationProvider type) { assert = null; deny = null; permitonly = null; demand = null; // #1 - this rules apply if type has security permissions if (!type.HasSecurityDeclarations) return false; bool apply = false; // #2 - this rules doesn't apply to LinkDemand (both are executed) // and to InheritanceDemand (both are executed at different time). foreach (SecurityDeclaration declsec in type.SecurityDeclarations) { switch (declsec.Action) { case Mono.Cecil.SecurityAction.Assert: assert = declsec.ToPermissionSet (); apply = true; break; case Mono.Cecil.SecurityAction.Deny: deny = declsec.ToPermissionSet (); apply = true; break; case Mono.Cecil.SecurityAction.PermitOnly: permitonly = declsec.ToPermissionSet (); apply = true; break; case Mono.Cecil.SecurityAction.Demand: demand = declsec.ToPermissionSet (); apply = true; break; } } return apply; } public RuleResult CheckType (TypeDefinition type) { // rule applies only if type has security declarations if (!RuleDoesAppliesToType (type)) return RuleResult.DoesNotApply; // *** ok, the rule applies! *** // ensure that method-level security doesn't replace type-level security // with a subset of the original check foreach (MethodDefinition method in type.Methods) { if (!method.HasSecurityDeclarations) continue; foreach (SecurityDeclaration declsec in method.SecurityDeclarations) { switch (declsec.Action) { case Mono.Cecil.SecurityAction.Assert: if (assert == null) continue; if (!assert.IsSubsetOf (declsec.ToPermissionSet ())) Runner.Report (method, Severity.High, Confidence.Total, "Assert"); break; case Mono.Cecil.SecurityAction.Deny: if (deny == null) continue; if (!deny.IsSubsetOf (declsec.ToPermissionSet ())) Runner.Report (method, Severity.High, Confidence.Total, "Deny"); break; case Mono.Cecil.SecurityAction.PermitOnly: if (permitonly == null) continue; if (!permitonly.IsSubsetOf (declsec.ToPermissionSet ())) Runner.Report (method, Severity.High, Confidence.Total, "PermitOnly"); break; case Mono.Cecil.SecurityAction.Demand: case Mono.Cecil.SecurityAction.NonCasDemand: if (demand == null) continue; if (!demand.IsSubsetOf (declsec.ToPermissionSet ())) Runner.Report (method, Severity.High, Confidence.Total, "Demand"); break; } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/common.make0000664000175000017500000000555212413742070022561 0ustar00directhexdirecthex00000000000000include ../../options.make SUBDIRS=Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner=../../bin/gendarme.exe framework=../../bin/Gendarme.Framework.dll common_tests=../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) rules_build_sources += $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/0000775000175000017500000000000012642235743026062 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/ChangeLog0000664000175000017500000001624012413742070027627 0ustar00directhexdirecthex000000000000002010-05-16 Sebastien Pouliot * DeserializeOptionalFieldRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule. * MarkAllNonSerializableFieldsRule.cs: Fix typo 2009-08-19 Jesse Jones * DeserializeOptionalFieldRule.cs: Edited the rule description. 2009-07-07 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-01-28 Jb Evain * CallBaseMethodsOnISerializableTypesRule.cs: in InheritsFromISerializableImplementation: handle types with a null BaseType. 2008-12-13 Jesse Jones * UseCorrectSignatureForSerializationMethodsRule.cs, DeserializeOptionalFieldRule.cs: Fix AnalyzeModule so that it activates the rule properly when multiple assemblies or modules are being checked. 2008-12-06 Sebastien Pouliot * DeserializeOptionalFieldRule.cs: Use HasFields, HasMethods and HasCustomAttributes * ImplementISerializableCorrectlyRule.cs: Use HasFields and HasParameters * MarkAllNonSerializableFieldsRule.cs: Use HasFields * UseCorrectSignatureForSerializationMethodsRule.cs: Use HasCustomAttributes 2008-11-22 Sebastien Pouliot * DeserializeOptionalFieldRule.cs: Enable the rule only when [OptionalField] is used/referenced inside a module (quite rare). * UseCorrectSignatureForSerializationMethodsRule.cs: Enabled the rule only when one of the On[Des|S]erializ[ed|ing]Attribute type is referenced in the module (quite rare). 2008-11-07 Sebastien Pouliot * MarkEnumerationsAsSerializableRule.cs: New. Rule to suggest to mark all enumerations as serializable (since they are) to improve source code readability. * Makefile.am: Add rule and tests to the build. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Serialization.mdp: * Gendarme.Rules.Serialization.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-21 Sebastien Pouliot * CallBaseMethodsOnISerializableTypesRule.cs: Avoid specialization of CheckCallingBaseMethod parameters (self-test). 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Serialization.xml, doc/Gendarme.Rules.Serialization: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-10-13 Sebastien Pouliot * CallBaseMethodsOnISerializableTypesRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use OpCodeEngine to avoid processing methods that don't have any call[virt] inside them. * DeserializeOptionalFieldRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * ImplementISerializableCorrectlyRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Rework logic to use the TraceBack rock and to handle all cases when GetObjectData is not present. * MarkAllNonSerializableFieldsRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * MissingSerializableAttributeOnISerializableTypeRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use shorter overload for Runner.Report. * MissingSerializationConstructorRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * UseCorrectSignatureForSerializationMethodsRule.cs: Add XML documentation and [FxCopCompatibility] attribute. 2008-08-11 Sebastien Pouliot * MarkAllNonSerializableFieldsRule.cs: Fix case where we can't resolve a field's type. 2008-07-11 Nestor Salceda * ImplementISerializableCorrectlyRule.cs: Change the foreach loop for an inverted for loop. Change the order of evaluation in order to achieve a bit more of performance. Make clearer the message errors. 2008-07-11 Nestor Salceda * ImplementISerializableCorrectlyRule.cs: New. Rule for ensuring the correct implementation of the ISerializable interface. It also makes sure you use the [NonSerialized] attribute if you aren't serializing a field. * Gendarme.Rules.Serialization.mdp: Update MD project file. * Makefile.am: Add rule/test to the build. 2008-07-09 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-09 Nestor Salceda * CallBaseMethodsOnISerializableTypesRule.cs: New. Rule for checking the correct implementation (calling the base methods) of the custom serialization. * Gendarme.Rules.Serialization.mdp: Update MD project file. * Makefile.am: Add rule/test to the build. 2008-07-08 Sebastien Pouliot * Makefile.am: Rebuild if the framework has changed. 2008-07-04 Nestor Salceda * MarkAllNonSerializableFieldsRule.cs: Skip the static fields. 2008-07-04 Nestor Salceda * MarkAllNonSerializableFieldsRule.cs: Inline the const strings for reporting warnings. 2008-07-04 Nestor Salceda * MarkAllNonSerializableFieldsRule.cs: New. Rule that checks that all fields in a serializable class are also serializable. * Gendarme.Rules.Serialization.mdp: Update MD project file. * Makefile.am: Add rule/test to the build. 2008-04-08 Nestor Salceda * MissingSerializableAttributeOnISerializableTypeRule.cs: Replace "[Serialization]" with "[Serializable]". 2008-04-08 Nestor Salceda * MissingSerializableAttributeOnISerializableTypeRule.cs: Improving the comprehension of the solution. 2008-02-17 Sebastien Pouliot * MissingSerializableAttributeOnISerializableTypeRule.cs: Does not apply to delegates. 2008-02-16 Sebastien Pouliot * MissingSerializableAttributeOnISerializableTypeRule.cs: Avoid NRE on ISerializable itself. Also make the rule a bit faster by ignoring all interfaces. 2008-02-16 Sebastien Pouliot * DeserializeOptionalFieldRule.cs: New. Rule to check that fields marked with [OptionalField] are deserialized correctly. * MissingSerializableAttributeOnISerializableTypeRule.cs: New. Rule that checks that types implementing ISerializable are also marked with a [Serializable] attribute. * MissingSerializationConstructorRule.cs: New. Rule to ensure the constructor required for ISerializable is present (since interfaces can't force you to declare ctors) * UseCorrectSignatureForSerializationMethodsRule.cs: New. Rule to ensure the correct signature is using when using the [de]serialization attributes. * Gendarme.Rules.Serialization.mdp: New. MonoDevelop project file. * Makefile.am: New. Build rules and tests. CallBaseMethodsOnISerializableTypesRule.cs0000664000175000017500000001174212413742070036133 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization// // Gendarme.Rules.Serialization.CallBaseMethodsOnISerializableTypesRule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.Serialization { /// /// This rule checks types that implement the System.ISerializable interface /// and fires if either the serialization constructor or the GetObjectData /// method does not call it's base type, potentially breaking the serialization /// process. /// /// /// Bad example: /// /// [Serializable] /// public class Base : ISerializable { /// // ... /// } /// /// [Serializable] /// public class Bad : Base { /// int value; /// /// protected BadDerived (SerializationInfo info, StreamingContext context) /// { /// value = info.GetInt32 ("value"); /// } /// /// public override void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// info.AddValue ("value", value); /// } /// } /// /// /// /// Good example: /// /// [Serializable] /// public class Base : ISerializable { /// // ... /// } /// /// [Serializable] /// public class Good : Base { /// int value; /// /// protected BadDerived (SerializationInfo info, StreamingContext context) : base (info, context) /// { /// value = info.GetInt32 ("value"); /// } /// /// public override void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// info.AddValue ("value", value); /// base.GetObjectData (info, context); /// } /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("You are overriding the GetObjectData method or serialization constructor but you aren't calling the base methods, and may not be serializing/deserializing the fields of the base type.")] [Solution ("Call the base method or constructor from your own code.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Usage", "CA2236:CallBaseClassMethodsOnISerializableTypes")] public class CallBaseMethodsOnISerializableTypesRule : Rule, ITypeRule { private static bool InheritsFromISerializableImplementation (TypeDefinition type) { TypeDefinition current = type.BaseType != null ? type.BaseType.Resolve () : null; if (current == null || current.IsNamed ("System", "Object")) return false; if (current.IsSerializable && current.Implements ("System.Runtime.Serialization", "ISerializable")) return true; return InheritsFromISerializableImplementation (current); } private void CheckCallingBaseMethod (TypeReference type, MethodSignature methodSignature) { MethodDefinition method = type.GetMethod (methodSignature); if (method == null) return; // Perhaps should report that doesn't exist the method (only with ctor). // is there any Call or Callvirt instructions in the method if (OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) { // in this case we check further foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.FlowControl != FlowControl.Call) continue; MethodReference operand = (MethodReference) instruction.Operand; TypeReference tr = operand.DeclaringType; if (methodSignature.Matches (operand) && type.Inherits (tr.Namespace, tr.Name)) return; } } Runner.Report (method, Severity.High, Confidence.High); } public RuleResult CheckType (TypeDefinition type) { if (!InheritsFromISerializableImplementation (type)) return RuleResult.DoesNotApply; CheckCallingBaseMethod (type, MethodSignatures.SerializationConstructor); CheckCallingBaseMethod (type, MethodSignatures.GetObjectData); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/DeserializeOptionalFieldRule.cs0000664000175000017500000001401212413742070034141 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Serialization.DeserializeOptionalFieldRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Serialization { /// /// This rule will fire if a type has fields marked with [OptionalField], but does /// not have methods decorated with the [OnDeserialized] or [OnDeserializing] /// attributes. This is a problem because the binary deserializer does not actually construct /// objects (it uses System.Runtime.Serialization.FormatterServices.GetUninitializedObject /// instead). So, if binary deserialization is used the optional field(s) will be zeroed instead /// of properly initialized. /// This rule only applies to assemblies compiled with the .NET framework version 2.0 /// (or later). /// /// /// Bad example: /// /// [Serializable] /// public class ClassWithOptionalField { /// [OptionalField] /// private int optional; /// } /// /// /// /// Good example: /// /// [Serializable] /// public class ClassWithOptionalField { /// // Normally the (compiler generated) default constructor will /// // initialize this. The default constructor will be called by the /// // XML and Soap deserializers, but not the binary serializer. /// [OptionalField] /// private int optional = 1; /// /// // This will be called immediately after the object is /// // deserialized. /// [OnDeserializing] /// private void OnDeserializing (StreamingContext context) /// { /// optional = 1; /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("Some fields are marked with [OptionalField] but the type does not provide special deserialization routines.")] [Solution ("Add a deserialization routine, marked with [OnDeserialized], and re-compute the correct value for the optional fields.")] [FxCopCompatibility ("Microsoft.Usage", "CA2239:ProvideDeserializationMethodsForOptionalFields")] public class DeserializeOptionalFieldRule : Rule, ITypeRule { private const string MessageOptional = "Optional fields '{0}' is not deserialized."; private const string MessageSerializable = "Optional fields '{0}' in non-serializable type."; public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += (object o, RunnerEventArgs e) => { Active = // the [OptionalField] and deserialization attributes are only available // since fx 2.0 so there's no point to execute it on every methods if the // assembly target runtime is earlier than 2.0 e.CurrentModule.Runtime >= TargetRuntime.Net_2_0 && // if the module does not have a reference to System.Runtime.Serialization.OptionalFieldAttribute // then nothing will be reported by this rule (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Runtime.Serialization", "OptionalFieldAttribute"); }) ); }; } public RuleResult CheckType (TypeDefinition type) { // [OptionalField] is usable only if the type has fields if (!type.HasFields) return RuleResult.DoesNotApply; // look in methods for a deserialization candidates bool deserialized_candidate = false; bool deserializing_candidate = false; if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor || !method.HasCustomAttributes) continue; if (method.HasAttribute ("System.Runtime.Serialization", "OnDeserializedAttribute")) deserialized_candidate = true; if (method.HasAttribute ("System.Runtime.Serialization", "OnDeserializingAttribute")) deserializing_candidate = true; if (deserialized_candidate && deserializing_candidate) break; } } // check if we found some optional fields, if none then it's all ok foreach (FieldDefinition field in type.Fields) { if (field.HasAttribute ("System.Runtime.Serialization", "OptionalFieldAttribute")) { if (type.IsSerializable) { // report if we didn't find a deserialization method if (!deserialized_candidate || !deserializing_candidate) { // Medium since it's possible that the optional fields don't need to be re-computed string s = String.Format (CultureInfo.InvariantCulture, MessageOptional, field.Name); Runner.Report (field, Severity.Medium, Confidence.High, s); } } else { // [OptionalField] without [Serializable] is a bigger problem string s = String.Format (CultureInfo.InvariantCulture, MessageSerializable, field.Name); Runner.Report (field, Severity.Critical, Confidence.High, s); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Makefile.in0000664000175000017500000006617712642235732030146 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Serialization ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ CallBaseMethodsOnISerializableTypesRule.cs \ DeserializeOptionalFieldRule.cs \ ImplementISerializableCorrectlyRule.cs \ MarkAllNonSerializableFieldsRule.cs \ MarkEnumerationsAsSerializableRule.cs \ MissingSerializableAttributeOnISerializableTypeRule.cs \ MissingSerializationConstructorRule.cs \ UseCorrectSignatureForSerializationMethodsRule.cs tests_sources = \ CallBaseMethodsOnISerializableTypesTest.cs \ DeserializeOptionalFieldTest.cs \ MarkAllNonSerializableFieldsTest.cs \ MarkEnumerationsAsSerializableTest.cs \ MissingSerializableAttributeOnISerializableTypeTest.cs \ MissingSerializationConstructorTest.cs \ UseCorrectSignatureForSerializationMethodsTest.cs \ ImplementISerializableCorrectlyTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Serialization/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Serialization/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Gendarme.Rules.Serialization.csproj0000775000175000017500000001330312413742070034726 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {44885D5E-B99D-4C56-BC85-F652F11DABDC} Library Properties Gendarme.Rules.Serialization Gendarme.Rules.Serialization v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 1591 1570 ..\..\console\bin\Debug\Gendarme.Rules.Serialization.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Serialization.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/MarkEnumerationsAsSerializableRule.cs0000664000175000017500000000474412413742070035341 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Serialization.MarkEnumerationsAsSerializableRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Serialization { /// /// This rule warns when it founds an enum that is not decorated with /// a [Serializable] attribute. Enums, even without the attribute, /// are always serializable. Marking them as such makes the source code more readable. /// /// /// Bad example: /// /// public enum Colors { /// Black, /// White /// } /// /// /// /// Good example: /// /// [Serializable] /// public enum Colors { /// Black, /// White /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("An enumeration, even if not decorated with [Serializable], is always serializable.")] [Solution ("For better source code readability always decorate enumerations with [Serializable].")] public class MarkEnumerationsAsSerializableRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (!type.IsEnum) return RuleResult.DoesNotApply; if (type.IsSerializable) return RuleResult.Success; Runner.Report (type, Severity.Low, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/MarkAllNonSerializableFieldsRule.cs0000664000175000017500000000757612413742070034724 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Serialization.MarkAllNonSerializableFieldsRule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; namespace Gendarme.Rules.Serialization { /// /// This rule checks for serializable types, i.e. decorated with the [Serializable] /// attribute, and checks to see if all its fields are serializable as well. If not the rule will /// fire unless the field is decorated with the [NonSerialized] attribute. /// The rule will also warn if the field type is an interface as it is not possible, /// before execution time, to know for certain if the type can be serialized or not. /// /// /// Bad example: /// /// class NonSerializableClass { /// } /// /// [Serializable] /// class SerializableClass { /// NonSerializableClass field; /// } /// /// /// /// Good example: /// /// class NonSerializableClass { /// } /// /// [Serializable] /// class SerializableClass { /// [NonSerialized] /// NonSerializableClass field; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This type is Serializable, but contains fields that aren't serializable which can cause runtime errors when instances are serialized.")] [Solution ("Make sure you are marking all non-serializable fields with the NonSerialized attribute or implement custom serialization.")] [FxCopCompatibility ("Microsoft.Usage", "CA2235:MarkAllNonSerializableFields")] public class MarkAllNonSerializableFieldsRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // if type is not serializable or has not any fields or does not implements a custom serialization if (!type.IsSerializable || !type.HasFields || type.Implements ("System.Runtime.Serialization", "ISerializable")) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { if (!field.IsNotSerialized && !field.IsStatic) { TypeDefinition fieldType = field.FieldType.Resolve (); if (fieldType == null) continue; if (fieldType.IsInterface) { string msg = String.Format (CultureInfo.InvariantCulture, "Serialization of interface {0} as field {1} unknown until runtime", fieldType, field.Name); Runner.Report (field, Severity.Critical, Confidence.Low, msg); continue; } if (!fieldType.IsEnum && !fieldType.IsSerializable) { string msg = String.Format (CultureInfo.InvariantCulture, "The field {0} isn't serializable.", field.Name); Runner.Report (field, Severity.Critical, Confidence.High, msg); } } } return Runner.CurrentRuleResult; } } } UseCorrectSignatureForSerializationMethodsRule.cs0000664000175000017500000001267612413742070037657 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization// // Gendarme.Rules.Serialization.MissingSerializationConstructorRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Serialization { /// /// This rule checks for methods which use the serialization attributes: /// [OnSerializing, OnDeserializing, OnSerialized, OnDeserialized]. You must /// ensure that these methods have the correct signature. They should be private, /// return void and have a single parameter of type StreamingContext. /// Failure to have the right signature can, in some circumstances, make your assembly /// unusable at runtime. /// /// /// Bad example: /// /// [Serializable] /// public class Bad { /// [OnSerializing] /// public bool Serializing (StreamingContext context) /// { /// } /// } /// /// /// /// Good example: /// /// [Serializable] /// public class BadClass { /// [OnSerializing] /// private void Serializing (StreamingContext context) /// { /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("The method has the wrong signature, it should return System.Void and have a single parameter of type 'System.Runtime.Serialization.StreamingContext' and be private.")] [Solution ("Fix the method signature to match the runtime requirements.")] [FxCopCompatibility ("Microsoft.Usage", "CA2238:ImplementSerializationMethodsCorrectly")] public class UseCorrectSignatureForSerializationMethodsRule : Rule, IMethodRule { private const string NotSerializableText = "The type of this method is not marked as [Serializable]."; private const string WrongSignatureText = "The method has the wrong signature, it should return System.Void and have a single parameter of type 'System.Runtime.Serialization.StreamingContext' and be private."; public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = // the attributes are only available since fx 2.0 so there's no point // to execute it on every methods if the assembly target runtime is // earlier than 2.0 e.CurrentModule.Runtime >= TargetRuntime.Net_2_0 && // if the module does not have a reference to any of the attributes // then nothing will be reported by this rule (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return IsSerializationAttribute (tr); })); }; } static bool IsSerializationAttribute (TypeReference type) { if (type.Namespace != "System.Runtime.Serialization") return false; switch (type.Name) { case "OnSerializingAttribute": case "OnSerializedAttribute": case "OnDeserializingAttribute": case "OnDeserializedAttribute": return true; default: return false; } } static bool HasAnySerializationAttribute (ICustomAttributeProvider method) { if (!method.HasCustomAttributes) return false; foreach (CustomAttribute ca in method.CustomAttributes) { if (IsSerializationAttribute (ca.AttributeType)) return true; } return false; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply to constructor or to methods without custom attributes if (method.IsConstructor || !method.HasCustomAttributes) return RuleResult.DoesNotApply; // marked with any of On[Des|S]erializ[ed|ing]Attribute ? if (!HasAnySerializationAttribute (method)) return RuleResult.DoesNotApply; // rule apply! // if the type is not marked as [Serializable] then warn that this code is useless bool serializable = (method.DeclaringType as TypeDefinition).IsSerializable; if (!serializable) Runner.Report (method, Severity.Critical, Confidence.Total, NotSerializableText); // check if the method signature is correct, return if it is if (MethodSignatures.SerializationEventHandler.Matches (method)) return Runner.CurrentRuleResult; // but report an error if the signature isn't valid Runner.Report (method, Severity.Critical, Confidence.Total, WrongSignatureText); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test/0000775000175000017500000000000012642235743027001 5ustar00directhexdirecthex00000000000000CallBaseMethodsOnISerializableTypesTest.cs0000664000175000017500000001310712413742070037057 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test// // Unit tests for CallBaseMethodsOnISerializableTypesRule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Rules.Serialization; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Serialization { [TestFixture] public class CallBaseMethodsOnISerializableTypesTest : TypeRuleTestFixture { [Serializable] class Base : ISerializable { int myValue; public Base () { } protected Base (SerializationInfo info, StreamingContext context) { myValue = info.GetInt32 ("myValue"); } public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("myValue", myValue); } } [Serializable] class BadDerived : Base { int otherValue; protected BadDerived (SerializationInfo info, StreamingContext context) { otherValue = info.GetInt32 ("otherValue"); } public override void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("otherValue", otherValue); } } [Serializable] class GoodDerived : Base { int otherValue; protected GoodDerived (SerializationInfo info, StreamingContext context) : base (info, context) { otherValue = info.GetInt32 ("otherValue"); } public override void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("otherValue", otherValue); base.GetObjectData (info, context); } } [Serializable] class GoodDerivedOnlyInConstructor : Base { int otherValue; protected GoodDerivedOnlyInConstructor (SerializationInfo info, StreamingContext context) : base (info, context) { otherValue = info.GetInt32 ("otherValue"); } public override void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("otherValue", otherValue); } } [Serializable] class GoodDerivedOnlyInGetObjectData : Base { int otherValue; protected GoodDerivedOnlyInGetObjectData (SerializationInfo info, StreamingContext context) { otherValue = info.GetInt32 ("otherValue"); } public override void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("otherValue", otherValue); base.GetObjectData (info, context); } } [Serializable] class DefaultSerialization { } [Serializable] class Derived : Base { protected Derived (SerializationInfo info, StreamingContext context) : base (info, context) { } } //See the ArgumentException - SystemException - Exception [Serializable] class ThirdGeneration : Derived { int otherValue; protected ThirdGeneration (SerializationInfo info, StreamingContext context) : base (info, context) { otherValue = info.GetInt32 ("otherValue"); } public override void GetObjectData (SerializationInfo info, StreamingContext context) { base.GetObjectData (info, context); info.AddValue ("otherValue", otherValue); } } [Test] public void SkipOnCanonicalScenariosTest () { AssertRuleDoesNotApply (SimpleTypes.Class); } [Test] public void SkipOnDefaultSerializationTest () { AssertRuleDoesNotApply (); } [Test] public void SkipOnBaseTest () { AssertRuleDoesNotApply (); } [Test] public void SuccessOnGoodDerivedTest () { AssertRuleSuccess (); } [Test] public void FailOnBadDerivedTest () { AssertRuleFailure (2); } [Test] public void SuccessOnMultipleLevelDerivedTest () { AssertRuleSuccess (); } [Test] public void FailOnGoodDerivedOnlyInConstructorTest () { AssertRuleFailure (1); } [Test] public void FailOnGoodDerivedOnlyInGetObjectDataTest () { AssertRuleFailure (1); } class NoSerializationConstructor : Base { public override void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Test] public void NoSerializationConstructorTest () { AssertRuleFailure (1); } class MiddleMan : Base { } class Top : MiddleMan { protected Top (SerializationInfo info, StreamingContext context) { } public override void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Test] public void InheritanceTest () { AssertRuleFailure (2); } } } MissingSerializableAttributeOnISerializableTypeTest.cs0000664000175000017500000000537312413742070041534 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test// // Unit tests for MissingSerializableAttributeOnISerializableTypeRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.Serialization; using Gendarme.Rules.Serialization; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Serialization { [Serializable] public class ClassWithAttributeOnly { } public class ClassWithoutAttribute : ISerializable { public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Serializable] public class ClassWithAttribute : ISerializable { public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { } } // this class is not [Serializable] public class InheritFromISerializableClass : ClassWithAttribute { } [Serializable] public class SerializableInheritFromISerializableClass : ClassWithAttribute { } [TestFixture] public class MissingSerializableAttributeOnISerializableTypeTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } [Test] public void Success () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Failure () { AssertRuleFailure (1); AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test/ChangeLog0000664000175000017500000000521512413742070030546 0ustar00directhexdirecthex000000000000002008-11-07 Sebastien Pouliot * MarkEnumerationsAsSerializableTest.cs: New. Unit tests for MarkEnumerationsAsSerializableRule 2008-11-07 Alan McGovern * Tests.Rules.Serialization.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-13 Sebastien Pouliot * ImplementISerializableCorrectlyTest.cs: Add test case when GetObjectData is not present. This can means new fields were introduced and needs to be serialized (or not, e.g. no fields or static fields). 2008-08-29 Sebastien Pouliot * CallBaseMethodsOnISerializableTypesTest.cs: Add more coverage. * MissingSerializationConstructorTest.cs: Use newer, shorter, syntax for unit tests. Add more coverage. * MissingSerializableAttributeOnISerializableTypeTest.cs: Use newer, shorter, syntax for unit tests. Add more coverage. * UseCorrectSignatureForSerializationMethodsTest.cs: Use newer, shorter, syntax for unit tests. Add more coverage. 2008-08-29 Sebastien Pouliot * DeserializeOptionalFieldTest.cs: Use newer, shorter, syntax for unit tests. 2008-08-11 Nestor Salceda * ImplementISerializableCorrectlyTest.cs: New. Unit tests for ImplementISerializableCorrectlyRule. * Test.Rules.Serialization.mdp: Update MD project file. 2008-07-09 Nestor Salceda * CallBaseMethodsOnISerializableTypesTest.cs: New. Unit tests for CallBaseMethodsOnISerializableTypesRule. * Test.Rules.Serialization.mdp: Update MD project file. 2008-07-04 Nestor Salceda * MarkAllNonSerializableFieldsTest.cs: Add test for the serialization of static fields. 2008-07-04 Nestor Salceda * MarkAllNonSerializableFieldsTest.cs: New. Unit tests for MarkAllNonSerializableFieldsRule. * Test.Rules.Serialization.mdp: Update MD project file. 2008-05-11 Andres G. Aragoneses * Test.Rules.Serialization.mdp: Fix references. 2008-02-17 Sebastien Pouliot * MissingSerializableAttributeOnISerializableTypeTest.cs: Add test cases for inheritance and for delegates. 2008-02-16 Sebastien Pouliot * DeserializeOptionalFieldTest.cs: New. unit tests. * MissingSerializableAttributeOnISerializableTypeTest.cs: New. unit tests. * MissingSerializationConstructorTest.cs: New. unit tests. * UseCorrectSignatureForSerializationMethodsTest.cs: New. unit tests. * Makefile.am: New. * Test.Rules.Serialization.mdp: New. MonoDevelop project file. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test/Makefile.in0000664000175000017500000003145312642235732031052 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Serialization/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Serialization.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Serialization/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Serialization/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test/Tests.Rules.Serialization.csproj0000775000175000017500000001364712413742070035240 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {558A9250-105A-4C6A-999D-1C1F85F4CB05} Library Properties Tests.Rules.Serialization Tests.Rules.Serialization v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {44885D5E-B99D-4C56-BC85-F652F11DABDC} Gendarme.Rules.Serialization False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true MissingSerializationConstructorTest.cs0000664000175000017500000000647112413742070036526 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test// // Unit tests for MissingSerializationConstructorRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.Serialization; using Gendarme.Rules.Serialization; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Serialization { [Serializable] public class ClassWithoutConstructor : ISerializable { public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Serializable] public class UnsealedClassWrongCtorVisibility : ISerializable { public UnsealedClassWrongCtorVisibility (SerializationInfo info, StreamingContext context) { } public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Serializable] public sealed class SealedClassWrongCtorVisibility : ISerializable { protected SealedClassWrongCtorVisibility (SerializationInfo info, StreamingContext context) { } public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Serializable] public class PerfectUnsealedClass : ISerializable { protected PerfectUnsealedClass (SerializationInfo info, StreamingContext context) { } public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Serializable] public sealed class PerfectSealedClass : ISerializable { private PerfectSealedClass (SerializationInfo info, StreamingContext context) { } public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [TestFixture] public class MissingSerializationConstructorTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (); } [Test] public void Success () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Failure () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } } } UseCorrectSignatureForSerializationMethodsTest.cs0000664000175000017500000000717012413742070040577 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test// // Unit tests for UseCorrectSignatureForSerializationMethodsRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.Serialization; using Gendarme.Rules.Serialization; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Serialization { [Serializable] public class BadClass { [OnSerializing] public void Serializing (StreamingContext context) { // bad visibility, should be private } /* this compiles but nunit cause an exception when calling System.Reflection.Assembly.GetExportedTypes() */ #if false [OnSerialized] private void Serialized (SerializationInfo info) { // bad parameter type } [OnDeserializing] private void Deserializing (SerializationInfo info, StreamingContext context) { // bad parameter types (count) } [OnDeserialized] private bool Deserializing (StreamingContext context) { // bad return value return false; } #endif } [Serializable] public class OkClass { [OnSerializing, OnDeserializing] private void Lizing (StreamingContext context) { } [OnSerialized, OnDeserialized] private void Lized (StreamingContext context) { } } public class NotSerializableClass { [OnSerializing, OnDeserializing] private void Lizing (StreamingContext context) { } [OnSerialized, OnDeserialized] private void Lized (StreamingContext context) { } } [TestFixture] public class UseCorrectSignatureForSerializationMethodsTest : MethodRuleTestFixture { [OnSerializing] private void Serializing (StreamingContext context) { // method is ok but it's type is not [Serializable] } [Test] public void DoesNotApply () { // constructor (default) AssertRuleDoesNotApply (".ctor"); // method without a serialization attribute AssertRuleDoesNotApply ("DoesNotApply"); } [Test] public void Ok () { AssertRuleSuccess ("Lizing"); AssertRuleSuccess ("Lized"); } [Test] public void BadSignatures () { AssertRuleFailure ("Serializing", 1); #if false AssertRuleFailure ("Serialized", 1); AssertRuleFailure ("Deserializing", 1); AssertRuleFailure ("OnDeserialized", 1); #endif } [Test] public void NotSerializable () { AssertRuleFailure ("Lizing", 1); AssertRuleFailure ("Lized", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test/DeserializeOptionalFieldTest.cs0000664000175000017500000000616212413742070035077 0ustar00directhexdirecthex00000000000000// // Unit tests for DeserializeOptionalFieldRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.Serialization; using Gendarme.Rules.Serialization; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Serialization { [Serializable] public class ClassWithOptionalFieldAndBothDeserializationAttributes { [OptionalField] private int optional = 1; [OnDeserialized] private void Deserialized (StreamingContext context) { optional = 0; } [OnDeserializing] private void OnDeserializing (StreamingContext context) { optional = 0; } } [Serializable] public class ClassWithOptionalFieldAndOnDeserializingAttributes { [OptionalField] private int optional = 1; [OnDeserializing] private void OnDeserializing (StreamingContext context) { optional = 0; } } [Serializable] public class ClassWithOptionalFieldAndOnDeserializedAttributes { [OptionalField] private int optional = 1; [OnDeserialized] private void OnDeserialized (StreamingContext context) { optional = 0; } } [Serializable] public class ClassWithOptionalField { [OptionalField] private int optional; } [Serializable] public class ClassWithoutOptionalField { private int optional; } // we should warn that the type is *not* [Serializable] public class NonSerializableClassWithOptionalField { [OptionalField] private int optional; } [TestFixture] public class DeserializeOptionalFieldTest : TypeRuleTestFixture { [Test] public void Success () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Failure () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } } } ImplementISerializableCorrectlyTest.cs0000664000175000017500000002126412413742070036367 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test// // Unit tests for ImplementISerializableCorrectlyRule // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2008 Néstor Salceda // 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; using System.Runtime.Serialization; using Gendarme.Rules.Serialization; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Serialization { [TestFixture] public class ImplementISerializableCorrectlyTest : TypeRuleTestFixture { [Serializable] class AutomaticSerialization { } [Serializable] class ImplementationWithNonSerialized : ISerializable { int foo; [NonSerialized] string bar; protected ImplementationWithNonSerialized (SerializationInfo info, StreamingContext context) { foo = info.GetInt32 ("foo"); } public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("foo", foo); } } [Serializable] class ImplementationWithoutNonSerialized : ISerializable { int foo; string bar; protected ImplementationWithoutNonSerialized (SerializationInfo info, StreamingContext context) { foo = info.GetInt32 ("foo"); } public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("foo", foo); } } [Serializable] class TrickyImplementationWithoutNonSerialized : ISerializable { int foo; string bar; protected TrickyImplementationWithoutNonSerialized (SerializationInfo info, StreamingContext context) { foo = info.GetInt32 ("foo"); } private void AddValue (string name, object value) { } public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("foo", foo); AddValue ("bar", bar); } } [Serializable] class ImplementationWithout2NonSerializedFields : ISerializable { int foo; string bar; object myObject; protected ImplementationWithout2NonSerializedFields (SerializationInfo info, StreamingContext context) { foo = info.GetInt32 ("foo"); } public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("foo", foo); } } [Test] public void SkipOnCanonicalScenariosTest () { AssertRuleDoesNotApply (SimpleTypes.Class); } [Test] public void SkipOnAutomaticSerializationTest () { AssertRuleDoesNotApply (); } [Test] public void SuccessOnImplementationWithNonSerializedTest () { AssertRuleSuccess (); } [Test] public void FailOnImplementationWithoutNonSerializedTest () { AssertRuleFailure (1); } [Test] public void FailOnTrickyImplementationWithoutNonSerializedTest () { AssertRuleFailure (); } [Test] public void FailOnImplementationWithout2NonSerializedFieldsTest () { AssertRuleFailure (2); } [Serializable] class SerializableWithoutVirtualMethod : ISerializable { public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Serializable] sealed class SealedSerializableWithoutVirtualMethod : ISerializable { public void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Serializable] class SerializableWithVirtualMethod : ISerializable { public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Serializable] class SerializableWithOverridenMethod : SerializableWithVirtualMethod { public override void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Test] public void FailOnSerializableWithoutVirtualMethodTest () { AssertRuleFailure (1); } [Test] public void SuccessOnSealedSerializableWithoutVirtualMethodTest () { AssertRuleSuccess (); } [Test] public void SuccessOnSerializableWithVirtualMethodTest () { AssertRuleSuccess (); } [Test] public void SuccessOnSerializableWithOverridenMethodTest () { AssertRuleSuccess (); } [Serializable] class SerializableWithConstsAndStatic : ISerializable { const int Result = 42; static int Foo = 50; protected SerializableWithConstsAndStatic (SerializationInfo info, StreamingContext context) { } public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { } } [Test] public void SuccessOnSerializableWithConstsAndStaticTest () { AssertRuleSuccess (); } [Serializable] class SerializableThroughProperties : ISerializable { int foo; public SerializableThroughProperties () { } protected SerializableThroughProperties (SerializationInfo info, StreamingContext context) { if (info.GetBoolean ("special")) foo = info.GetInt32 ("foo"); else foo = 0; } int Foo { get { return foo; } } bool Special { get { return true; } } public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("foo", Foo); info.AddValue ("special", Special); } } [Test] public void SuccessOnSerializableThroughPropertiesTest () { AssertRuleSuccess (); } [Serializable] class SerializableThroughPropertiesAndOneNonSerialized : ISerializable { int foo; int bar; protected SerializableThroughPropertiesAndOneNonSerialized (SerializationInfo info, StreamingContext context) { foo = info.GetInt32 ("foo"); } int Foo { get { return foo; } } public virtual void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("foo", Foo); } } [Test] public void FailOnSerializableThroughPropertiesAndOneNonSerializedTest () { AssertRuleFailure (1); } [Serializable] sealed class OperatingSystem : ISerializable { private System.PlatformID _platform; private Version _version; private string _servicePack = String.Empty; public void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("_platform", _platform); info.AddValue ("_version", _version); info.AddValue ("_servicePack", _servicePack); } } [Test] public void SuccessOnOperatingSystemTest () { AssertRuleSuccess (); } [Serializable] sealed class AddValueWithMoreParameters : ISerializable { int foo; public void GetObjectData (SerializationInfo info, StreamingContext context) { info.AddValue ("foo", foo, typeof (int)); } } [Test] public void SuccessOnAddValueWithMoreParametersTest () { AssertRuleSuccess (); } [Serializable] class InheritWithNewInstanceFields : SerializableThroughProperties { object field_to_be_serialized; int more_field_to_be_serialized; } [Serializable] class InheritWithNewStaticFields : SerializableThroughProperties { static InheritWithNewStaticFields Empty; } [Serializable] class InheritWithoutNewFields : SerializableThroughProperties { } [Test] public void InheritFromISerializableType () { AssertRuleFailure (2); AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test/Makefile.am0000664000175000017500000000016012413742070031022 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Serialization.csproj DISTCLEANFILES = Makefile.in all: MarkEnumerationsAsSerializableTest.cs0000664000175000017500000000537112413742070036206 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test// // Unit tests for MarkEnumerationsAsSerializableRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Rules.Serialization; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Serialization { [TestFixture] public class MarkEnumerationsAsSerializableTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } enum NonSerializableEnum { One, Two } [Serializable] enum SerializableEnum { One, Two } [Test] public void Reflection () { // always report true since enums are ALWAYS serializable Assert.IsTrue (typeof (NonSerializableEnum).IsSerializable, "NonSerializableEnum"); Assert.IsTrue (typeof (SerializableEnum).IsSerializable, "SerializableEnum"); } [Test] public void Cecil () { // Cecil reports what being set on the type, not how the runtime treats it TypeDefinition nse = DefinitionLoader.GetTypeDefinition (); Assert.IsFalse (nse.IsSerializable, "NonSerializableEnum"); TypeDefinition se = DefinitionLoader.GetTypeDefinition (); Assert.IsTrue (se.IsSerializable, "SerializableEnum"); } [Test] public void Good () { AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Test/MarkAllNonSerializableFieldsTest.cs0000664000175000017500000001115012413742070035632 0ustar00directhexdirecthex00000000000000// // Unit tests for MarkAllNonSerializableFieldsRule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.Serialization; using Gendarme.Rules.Serialization; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Serialization { [TestFixture] public class MarkAllNonSerializableFieldsTest : TypeRuleTestFixture { class NonSerializableClass { } [Serializable] class SerializableClass { } [Serializable] class SerializableWithoutMarks { NonSerializableClass nonSerializableClass; NonSerializableClass nonSerializableClass1; } [Serializable] class SerializableWithMarks { [NonSerialized] NonSerializableClass nonSerializableClass; } [Serializable] class SerializableWithSerializableFields { SerializableClass serializableClass; } class NonSerializableWithInnerClass { [Serializable] class Serializable { } } [Serializable] class CustomSerializationClass : ISerializable { NonSerializableClass nonSerializable; public void GetObjectData (SerializationInfo info, StreamingContext context) { } } enum Values { Foo, Bar } [Serializable] class SerializableWithEnumClass { Values values; } [Serializable] class SerializableWithInterfaceClass { IList List = new ArrayList (); } [Serializable] class SerializableWithStaticFieldsClass { static NonSerializableClass nonSerializable; } [Test] public void SkipOnNonSerializableClassesTest () { AssertRuleDoesNotApply (); } [Test] public void FailOnSerializableClassWithoutMarksTest () { AssertRuleFailure (2); } [Test] public void SuccessOnSerializableClassWithMarksTest () { AssertRuleSuccess (); } [Test] public void SuccessOnSerializableClassWithSerializableFieldsTest () { AssertRuleSuccess (); } [Test] public void SkipOnNonSerializableWithInnerClassTest () { AssertRuleDoesNotApply (); } [Test] public void SkipOnCustomSerializationClassTest () { //If you are doing a custom serialization there aren't //need to warn developers about the NonSerialized //fields, because the runtime usess the GetObjectData //method in order to retrieve the object state. AssertRuleDoesNotApply (); //But, perhaps if you still marks the fields, you will //help others to understand better your code. // //Take a look at System.Collections.Generic.LinkedList //by example } [Test] public void SuccessOnSerializableWithEnumClassTest () { AssertRuleSuccess (); } [Test] public void FailOnSerializableWithInterfaceClassTest () { //The SerializableAttribute can't be applied to an //interface, and we can only check the polimorphism in //run-time. //The chosen behaviour is warn. //And the solution could be: // * Use the class instead of the interface. // * Mark it, as NonSerializable // * Use custom serialization AssertRuleFailure (); //Perhaps a better analysis could try to look for the //concrete class, but it couldn't have a 100% of success //because the polimorphism is resolved at run-time. } [Test] public void SuccessOnSerializableWithStaticFieldsClassTest () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/MissingSerializationConstructorRule.cs0000664000175000017500000001134112413742070035646 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Serialization.MissingSerializationConstructorRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Serialization { /// /// This rule checks for types that implement System.ISerializable but don't provide a /// serialization constructor. The constructor is required in order to make the type /// serializeable but cannot be enforced by the interface. /// The serialization constructor should be private for sealed types and /// protected for unsealed types. /// /// /// Bad example: /// /// [Serializable] /// public class Bad : ISerializable { /// public void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// } /// } /// /// /// /// Good example (sealed): /// /// [Serializable] /// public sealed class Good : ISerializable { /// private ClassWithConstructor (SerializationInfo info, StreamingContext context) /// { /// } /// /// public void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// } /// } /// /// /// /// Good example: /// /// [Serializable] /// public class Good : ISerializable { /// protected ClassWithConstructor (SerializationInfo info, StreamingContext context) /// { /// } /// /// public void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("The required constructor for ISerializable is not present in this type.")] [Solution ("Add a (private for sealed, protected otherwise) serialization constructor for this type.")] [FxCopCompatibility ("Microsoft.Usage", "CA2229:ImplementSerializationConstructors")] public class MissingSerializationConstructorRule : Rule, ITypeRule { // localizable private const string NoSerializationCtorText = "The required constructor for ISerializable is not present in this type."; private const string CtorSealedTypeText = "The serialization constructor should be private since this type is sealed."; private const string CtorUnsealedTypeText = "The serialization constructor should be protected (family) since this type is not sealed."; public RuleResult CheckType (TypeDefinition type) { // rule does not apply to interfaces, delegates or types that does not implement ISerializable if (type.IsInterface || type.IsDelegate () || !type.Implements ("System.Runtime.Serialization", "ISerializable")) return RuleResult.DoesNotApply; // rule applies, only Success or Failure from the point on // check if the type implements the serialization constructor MethodDefinition ctor = type.GetMethod (MethodSignatures.SerializationConstructor); if (ctor == null) { // no serialization ctor Runner.Report (type, Severity.High, Confidence.Total, NoSerializationCtorText); return RuleResult.Failure; } else if (type.IsSealed) { // with ctor: on a sealed type the ctor must be private if (!ctor.IsPrivate) { Runner.Report (type, Severity.Low, Confidence.Total, CtorSealedTypeText); return RuleResult.Failure; } } else { // with ctor: on a unsealed type the ctor must be family if (!ctor.IsFamily) { Runner.Report (type, Severity.Low, Confidence.Total, CtorUnsealedTypeText); return RuleResult.Failure; } } // everything is fine return RuleResult.Success; } } } MissingSerializableAttributeOnISerializableTypeRule.cs0000664000175000017500000000714312413742070040602 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization// // Gendarme.Rules.Serialization.MissingSerializableAttributeOnISerializableTypeRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Serialization { /// /// This rule checks for types that implement System.ISerializable but are /// not decorated with the [Serializable] attribute. Implementing /// System.ISerializable is not enough to make a class serializable as this /// interface only gives you more control over the basic serialization process. /// In order for the runtime to know your type is serializable it must have the /// [Serializable] attribute. /// /// /// Bad example: /// /// // this type cannot be serialized by the runtime /// public class Bad : ISerializable { /// } /// /// /// /// Good example: /// /// [Serializable] /// public class Good : ISerializable { /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("The runtime won't consider this type as serializable unless you add the [Serializable] attribute to its definition.")] [Solution ("Add [Serializable] to the type definition.")] [FxCopCompatibility ("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")] public class MissingSerializableAttributeOnISerializableTypeRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule does not apply to interface (since [Serializable] is not applicable to interfaces) // nor does it apply to delegates if (type.IsInterface || type.IsDelegate ()) return RuleResult.DoesNotApply; // rule does not apply if the type does not implements ISerializable if (!type.Implements ("System.Runtime.Serialization", "ISerializable")) return RuleResult.DoesNotApply; // rule applies only if base type is serializable if (!type.BaseType.IsNamed ("System", "Object")) { TypeDefinition base_type = type.BaseType.Resolve (); // in doubt don't report if ((base_type == null) || !base_type.IsSerializable) return RuleResult.DoesNotApply; } // rule applies, only Success or Failure from the point on // ok if the type has the [Serializable] pseudo-attribute if (type.IsSerializable) return RuleResult.Success; Runner.Report (type, Severity.Critical, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/Makefile.am0000664000175000017500000000140212413742070030103 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ CallBaseMethodsOnISerializableTypesRule.cs \ DeserializeOptionalFieldRule.cs \ ImplementISerializableCorrectlyRule.cs \ MarkAllNonSerializableFieldsRule.cs \ MarkEnumerationsAsSerializableRule.cs \ MissingSerializableAttributeOnISerializableTypeRule.cs \ MissingSerializationConstructorRule.cs \ UseCorrectSignatureForSerializationMethodsRule.cs tests_sources = \ CallBaseMethodsOnISerializableTypesTest.cs \ DeserializeOptionalFieldTest.cs \ MarkAllNonSerializableFieldsTest.cs \ MarkEnumerationsAsSerializableTest.cs \ MissingSerializableAttributeOnISerializableTypeTest.cs \ MissingSerializationConstructorTest.cs \ UseCorrectSignatureForSerializationMethodsTest.cs \ ImplementISerializableCorrectlyTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Serialization/ImplementISerializableCorrectlyRule.cs0000664000175000017500000001661612413742070035524 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Serialization.ImplementISerializableCorrectlyRule // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2008 Néstor Salceda // 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; using System.Collections.Generic; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.Serialization { /// /// This rule checks for types that implement ISerializable. Such types /// serialize their data by implementing GetObjectData. This /// rule verifies that every instance field, not decorated with the [NonSerialized] /// attribute is serialized by the GetObjectData method. This rule will also warn /// if the type is unsealed and the GetObjectData is not virtual. /// /// /// Bad example: /// /// [Serializable] /// public class Bad : ISerializable { /// int foo; /// string bar; /// /// protected Bad (SerializationInfo info, StreamingContext context) /// { /// foo = info.GetInt32 ("foo"); /// } /// /// // extensibility is limited since GetObjectData is not virtual: /// // any type inheriting won't be able to serialized additional fields /// public void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// info.AddValue ("foo", foo); /// // 'bar' is not serialized, if not needed then the field should /// // be decorated with [NotSerialized] /// } /// } /// /// /// /// Good example (virtual and not serialized): /// /// [Serializable] /// public class Good : ISerializable { /// int foo; /// [NotSerialized] /// string bar; /// /// protected Good (SerializationInfo info, StreamingContext context) /// { /// foo = info.GetInt32 ("foo"); /// } /// /// public virtual void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// info.AddValue ("foo", foo); /// } /// } /// /// /// /// Good example (sealed type and serialized): /// /// [Serializable] /// public sealed class Good : ISerializable { /// int foo; /// string bar; /// /// protected Good (SerializationInfo info, StreamingContext context) /// { /// foo = info.GetInt32 ("foo"); /// } /// /// public void GetObjectData (SerializationInfo info, StreamingContext context) /// { /// info.AddValue ("foo", foo); /// info.AddValue ("bar", bar); /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("Although you are implementing the ISerializable interface, there are some fields that aren't going to be serialized and aren't marked with the [NonSerialized] attribute.")] [Solution ("Either add the [NonSerialized] attribute to the field or serialize it. This will help developers better understand your code and make errors easier to find.")] [FxCopCompatibility ("Microsoft.Usage", "CA2240:ImplementISerializableCorrectly")] public class ImplementISerializableCorrectlyRule : Rule, ITypeRule { private HashSet fields = new HashSet (); static private FieldDefinition CheckProperty (MethodDefinition getter) { TypeReference return_type = getter.ReturnType; foreach (Instruction ins in getter.Body.Instructions) { if (ins.OpCode.OperandType != OperandType.InlineField) continue; FieldDefinition field = (ins.Operand as FieldDefinition); if ((field != null) && field.FieldType.IsNamed (return_type.Namespace, return_type.Name)) return field; } return null; } private void CheckSerializedFields (MethodDefinition method) { foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference mr = ins.Operand as MethodReference; if (!mr.HasParameters || (mr.Name != "AddValue") || (mr.Parameters.Count < 2)) continue; // type is sealed so this check is ok if (!mr.DeclaringType.IsNamed ("System.Runtime.Serialization", "SerializationInfo")) continue; // look at the second parameter, which should be (or return) the field Instruction i = ins.TraceBack (method, -2); // if we're boxing then find what's in that box if (i.OpCode.Code == Code.Box) i = i.TraceBack (method); FieldDefinition f = (i.Operand as FieldDefinition); if (f != null) { fields.Remove (f); continue; } MethodDefinition md = (i.Operand as MethodDefinition); if ((md != null) && md.IsGetter && md.HasBody) { f = CheckProperty (md); if (f != null) fields.Remove (f); } break; } } } private void CheckUnusedFieldsIn (TypeDefinition type, MethodDefinition getObjectData) { // build a list of the fields that needs to be serialized foreach (FieldDefinition field in type.Fields) { if (!field.IsNotSerialized && !field.IsStatic) fields.Add (field); } // remove all fields that are serialized CheckSerializedFields (getObjectData); // report all fields that have not been serialized foreach (FieldDefinition field in fields) { Runner.Report (field, Severity.Medium, Confidence.Normal); } fields.Clear (); } public RuleResult CheckType (TypeDefinition type) { if (!type.IsSerializable || !type.Implements ("System.Runtime.Serialization", "ISerializable")) return RuleResult.DoesNotApply; MethodDefinition getObjectData = type.GetMethod (MethodSignatures.GetObjectData); if (getObjectData == null) { // no GetObjectData means that the type's ancestor does the job but // are we introducing new instance fields that need to be serialized ? if (!type.HasFields) return RuleResult.Success; // there are some, but they could be static foreach (FieldDefinition field in type.Fields) { if (!field.IsStatic) Runner.Report (field, Severity.Medium, Confidence.High); } } else { if (type.HasFields) CheckUnusedFieldsIn (type, getObjectData); if (!type.IsSealed && getObjectData.IsFinal) { string msg = "Either seal this type or change GetObjectData method to be virtual"; Runner.Report (getObjectData, Severity.High, Confidence.Total, msg); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/0000775000175000017500000000000012642235743025547 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/ChangeLog0000664000175000017500000002603212413742070027314 0ustar00directhexdirecthex000000000000002010-07-14 Sebastien Pouliot * NewLineLiteralRule.cs: Fix decimal (needs hexadecimal) for control characters. Remove XML doc (used for rules doc only) and avoid a few allocations since we're using a StringBuilder * Makefile.am: Compile tests without optimizations so GMCS won't replace a "" with String.Empty 2010-07-14 Antoine Vandecreme * NewLineLiteralRule.cs: Format specials char to be human readable and XML compliants 2010-06-22 Sebastien Pouliot * MonoCompatibilityReviewRule.cs: Apply AvoidLargeClassesRule 2010-06-15 Sebastien Pouliot * DoNotHardcodePathsRule.cs: * ExitCodeIsLimitedOnUnixRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-04 Sebastien Pouliot * MonoCompatibilityReviewRule.cs: Rename GetLastestLocalDefinition to FindLastestLocalVersion (apply ConsiderConvertingMethodToPropertyRule) 2010-04-18 Sebastien Pouliot * Makefile.am: Avoid -pkg:dotnet since it refers to assemblies that are not always installed by default (it it's pure laziness to use that ;-) 2010-04-14 Sebastien Pouliot * MonoCompatibilityReviewRule.cs: Static-ify Filter and ComparePublicKeyToken methods (make self-test) 2009-12-13 Sebastien Pouliot * MonoCompatibilityReviewRule.cs: Only check calls on assemblies that are covered by MoMA (e.g. don't check Silverlight platform assemblies, user code...) 2009-08-29 Sebastien Pouliot * MonoCompatibilityReviewRule.cs: Added a Version configurable property to select between (local) definition files (e.g. a new gendarme reviewing compoatibility with an older mono). Automatic download of new difinition files when Gendarme is updated (since a new version of mono is likely available). Updated documentation 2009-08-26 Jesse Jones * MonoCompatibilityReviewRule.cs: Edited the description. 2009-07-07 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2008-12-03 Sebastien Pouliot * DoNotHardcodePathsRule.cs: Use HasParameters and avoid calling ToLower before comparing strings. * NewLineLiteralRule.cs: Remove unneeded override on Initialize. 2008-11-18 Sebastien Pouliot * DoNotHardcodePathsRule.cs: Specify StringComparison.Ordinal when calling StartsWith. * MonoCompatibilityReviewRule.cs: Use HashSet instead of Dictionnary for both NotImplementedInternal and MissingInternal since there is no second argument (comments). Avoid calling ToString three times (one per list) on MethodReference (which needs to rebuild the string each time). 2008-11-07 Sebastien Pouliot * ExitCodeIsLimitedOnUnixRule.cs: Clearly specify [Serializable] on the InspectionResult enum (self-test) 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Portability.mdp: * Gendarme.Rules.Portability.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-21 Sebastien Pouliot * MoMAWebService.cs:Remove #pragma (even if from generated code) since I want to enable this across all rules. * MonoCompatibilityReviewRule.cs: Avoid specialization of Read and Check methods parameters (self-test). 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Portability.xml, doc/ns-MoMA.Analyzer.MoMAWebService.xml, doc/MoMA.Analyzer.MoMAWebService, doc/Gendarme.Rules.Portability: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-17 Sebastien Pouliot * DoNotHardcodePathsRule.cs: Add XML documentation. Use OpCodeEngine to avoid executing the rule unless an LDSTR instruction is present. * ExitCodeIsLimitedOnUnixRule.cs: Add XML documentation. Use OpCodeEngine to avoid executing the rule unless Call[virt] instructions are present inside the method. * FeatureRequiresRootPrivilegeOnUnixRule.cs: Add XML documentation. Use OpCodeEngine to avoid executing the rule unless Call[virt] or NewObj instructions are present inside the method. * MonoCompatibilityReviewRule.cs: Add XML documentation. Use OpCodeEngine to avoid executing the rule unless it can reference a type or method not available, or incomplete, inside Mono. * NewLineLiteralRule.cs: Add XML documentation. Use OpCodeEngine to avoid executing the rule unless an LDSTR instruction is present. 2008-08-26 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixRule.cs: Don't check Ping if Process was found earlier (the call goes to a single place). Rename some variables to please rules (self-test). 2008-08-24 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixRule.cs: Override Initialize to be able to detect both Process and Ping. Turn off the rule is both are not used in a module, otherwise just look for the one(s) present. 2008-08-11 Sebastien Pouliot * DoNotHardcodePathsRule.cs: Fix case where we can't resolve the method on which we want to check a parameter name. 2008-08-06 Sebastien Pouliot * DoNotHardcodePathsRule.cs: Remove unused parameters (self-test) 2008-07-12 Sebastien Pouliot * ExitCodeIsLimitedOnUnixRule.cs: Remove unused field (self-test) 2008-07-10 Sebastien Pouliot * DoNotHardcodePathsRule.cs: Fix unused 'msg' (last minute change) and static-ify some methods (self-test). 2008-07-10 Daniel Abramov * DoNotHardcodePathsRule.cs: New rule that looks for hardcoded path strings like 'C:\something.txt' or '/usr/home' and warns the developer that they may break application portability. * Makefile.am, * Gendarme.Rules.Portability.mdp, * Gendarme.Rules.Portability.csproj: Add new rule. 2008-07-10 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-08 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixRule.cs: Simplify logic a bit. Handle the case where Resolve returns null (cannot find the required assemblies) * MonoCompatibilityReviewRule.cs: Dispose as soon as possible. * Makefile.am: Rebuild if the framework has changed. 2008-05-27 Sebastien Pouliot * MonoCompatibilityReviewRule.cs: Whine at the right stream (self-test). 2008-04-06 Sebastien Pouliot * ExitCodeIsLimitedOnUnixRule.cs: Simplify Initialize (using rocks). Don't report a defect if we call a method that returns a byte (since we're sure it's value is ok). 2008-02-15 Sebastien Pouliot * ExitCodeIsLimitedOnUnixRule.cs * FeatureRequiresRootPrivilegeOnUnixRule.cs * MonoCompatibilityReviewRule.cs * NewLineLiteralRule.cs: Updated rules wrt framework changes. 2008-02-12 Sebastien Pouliot * Gendarme.Rules.Portability.xml.in: Fix definition for FeatureRequiresRootPrivilegeOnUnixRule. 2008-02-03 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixRule.cs: Split the checks for Process and Ping out of CheckMethod (and please self-test). 2008-01-29 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixRule.cs: Don't report when analysis the Ping class itself (very special case but useful for Mono itself :) 2008-01-11 Sebastien Pouliot * ExitCodeIsLimitedOnUnixRule.cs: Use new Location ctors. * FeatureRequiresRootPrivilegeOnUnixRule.cs: Use new Location ctors. * MonoCompatibilityReviewRule.cs: Use new Location ctors. * NewLineLiteralRule.cs: Use new Location ctors. 2008-01-02 Sebastien Pouliot * ExitCodeIsLimitedOnUnixRule.cs: Rename InspectionResult[s] * MonoCompatibilityReviewRule.cs: Change some methods to static. 2007-12-29 Sebastien Pouliot * ExitCodeIsLimitedOnUnixRule.cs: New. Rule to detect usage of ExitCode (from Main or Environment.ExitCode / Exit) with values too big for Unix systems. * Gendarme.Rules.Portability.xml.in: Add new rule definition. * Makefile.am: Add new rule/tests to the build. 2007-12-29 Sebastien Pouliot * MonoCompatibilityReviewRule.cs: New. Rule that use MoMA definition files to report possible incompatibilities with Mono (Andreas Noever) * MoMAWebService.cs: New. Wrapper for MoMA web service. * Gendarme.Rules.Portability.xml.in: Add new rule definition. * Gendarme.Rules.Portability.mdp: Add new rule to the MonoDevelop project file. * Makefile.am: Add new rule/tests to the build. 2007-12-26 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixRule.cs: New. Rule that check for the use of features that requires to be root under Linux. * NewLineLiteralRule.cs: Update to use latest best-practice since it's a likely starting point for new rules. * Gendarme.Rules.Portability.xml.in: Add new rule definition. * Gendarme.Rules.Portability.mdp: Add new rule to the MonoDevelop project file. * Makefile.am: Add new rule/tests to the build. 2007-10-07 Sebastien Pouliot * Gendarme.Rules.Portability.mdp: Update project file. 2006-10-15 Sebastien Pouliot * Gendarme.Rules.Portability.xml.in: Update Uri for rules (to generate more useful reports). 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-28 Christian Birkl * Gendarme.Rules.Portability.csproj: Included ChangeLog * NewLineLiteralRule.cs: Migrated untyped IList messages collection to typed MessageCollection class. 2006-09-18 Sebastien Pouliot * NewLineLiteralRule.cs: Update rule to provide location (which results in better reports). 2006-07-31 Sebastien Pouliot * Gendarme.Rules.Portability.mdp: New. Project file for MonoDevelop. 2006-06-13 Sebastien Pouliot * Makefile.am: Use -pkg:mono-nunit to reference nunit assemblies. Added self-test target to promote compliance ;-) 2006-03-17 Sebastien Pouliot * Makefile.am: New. Build Gendarme.Rules.Portability rules and tests. * Gendarme.Rules.Portability.xml.in: New. Configuration for Gendarme. Rules.Portability. * NewLineLiteralRule.cs: New. Rule to check if a method is directly using \r, \n or \r\n instead of Environment.NewLine. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/MonoCompatibilityReviewRule.cs0000664000175000017500000003233512413742070033550 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Portability.MonoCompatibilityReviewRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2007 Andreas Noever // Copyright (C) 2009, 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.Generic; using System.ComponentModel; using System.Globalization; using System.IO; using System.Net; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using ICSharpCode.SharpZipLib.Zip; using MoMA.Analyzer.MoMAWebService; namespace Gendarme.Rules.Portability { /// /// This rule will fire if one of the assemblies being checked contains a call to a .NET /// method which is either not implemented on Mono or partially implemented. It does /// this by downloading a MoMA definitions file under ~/.local/share/Gendarme/ (on UNIX) /// or C:\Documents and Settings\{username}\Local Settings\Application Data\Gendarme /// (on Windows) and checking for calls to the methods therein. The rule will work without /// MoMA but if it does fire it may be useful to download and run MoMA. /// /// By default the rule will use the latest local version available. This can be overriden to use a /// specific, local, version if you want to review compatibility against a specific Mono version. /// You can also manually remove them, now and then, to ensure you are using the latest version. /// Also upgrading Gendarme will try to download a newer version of the definitions files. /// [Problem ("The method is either missing or partially implemented on Mono.")] [Solution ("Review and test the code to ensure that it works properly on Mono. Also delete the definitions.zip to ensure that the latest version is downloaded.")] [EngineDependency (typeof (OpCodeEngine))] public class MonoCompatibilityReviewRule : Rule, IMethodRule { private const string NotImplementedMessage = "{0} is not implemented."; private const string MissingMessage = "{0} is missing from Mono."; private const string TodoMessage = "{0} is marked with a [MonoTODO] attribute: {1}."; private HashSet NotImplementedInternal; //value is unused private HashSet MissingInternal; //value is unused private Dictionary TodoInternal; //value = TODO Description private Version version; private string definitions_folder; public HashSet NotImplemented { get { return NotImplementedInternal; } } public HashSet Missing { get { return MissingInternal; } } public Dictionary ToDo { get { return TodoInternal; } } private string DefinitionsFolder { get { if (definitions_folder == null) { string localAppDataFolder = Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData); definitions_folder = Path.Combine (localAppDataFolder, "Gendarme"); if (!Directory.Exists (definitions_folder)) Directory.CreateDirectory (definitions_folder); } return definitions_folder; } } /// /// The version of Mono against which you wish to review compatibility. /// You need to have this version of the definitions file downloaded in order to use it. /// This is useful if you want to upgrade Gendarme but still want to test compatibility /// against an older version of Mono. /// [Description ("The version of Mono against which you wish to review compatibility.")] public string Version { get { if (version == null) return String.Empty; return version.ToString (); } set { version = new Version (value); string file = GetFileName (version); if (!File.Exists (file)) { version = null; throw new FileNotFoundException ("Cannot find definitions for the requested version.", file); } } } private string GetFileName (Version v) { return Path.Combine (DefinitionsFolder, String.Format (CultureInfo.InvariantCulture, "definitions-{0}.zip", v)); } private Version FindLastestLocalVersion () { string [] def_files = Directory.GetFiles (DefinitionsFolder, "definitions-*.zip"); if (def_files.Length > 1) Array.Sort (def_files); if (def_files.Length == 0) return new Version (); try { string latest = def_files [def_files.Length - 1]; int s = latest.LastIndexOf ("definitions-", StringComparison.Ordinal) + 12; return new Version (latest.Substring (s, latest.Length - s - 4)); // remove .zip } catch (FormatException) { return new Version (); } } private string SelectDefinitionsFile () { Version def_version = version; // nothing specified ? if (def_version == null) { // then we'll use the latest local version available def_version = FindLastestLocalVersion (); // if Gendarme version is newer than the definitions then there's likely something new available if (typeof (IRule).Assembly.GetName ().Version > def_version) { // however we don't want to download a (potentially) unexisting file each time we execute // Gendarme (e.g. a development release, like 2.5.x.x) so we limit this to once per week FileInfo fi = new FileInfo (GetFileName (def_version)); if (!fi.Exists || (fi.CreationTimeUtc < DateTime.UtcNow.AddDays (-7))) def_version = DownloadLatestDefinitions (); } } return GetFileName (def_version); } private void LoadDefinitions (string filename) { if (!File.Exists (filename)) return; using (FileStream fs = File.OpenRead (filename)) using (ZipInputStream zs = new ZipInputStream (fs)) using (StreamLineReader sr = new StreamLineReader (zs)) { ZipEntry ze; while ((ze = zs.GetNextEntry ()) != null) { switch (ze.Name) { case "exception.txt": NotImplementedInternal = Read (sr); break; case "missing.txt": MissingInternal = Read (sr); break; case "monotodo.txt": TodoInternal = ReadWithComments (sr); break; default: break; } } } } static byte [] ecma_key = new byte [] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 }; static byte [] msfinal_key = new byte [] { 0xb0, 0x3f, 0x5f, 0x7f, 0x11, 0xd5, 0x0a, 0x3a }; static byte [] winfx_key = new byte [] { 0x31, 0xbf, 0x38, 0x56, 0xad, 0x36, 0xe4, 0x35 }; static byte [] silverlight_key = new byte [] { 0x7c, 0xec, 0x85, 0xd7, 0xbe, 0xa7, 0x79, 0x8e }; static Version coreclr_runtime = new Version (2, 0, 5, 0); static bool ComparePublicKeyToken (byte [] pkt1, byte [] pkt2) { for (int i = 0; i < 8; i++) { if (pkt1 [i] != pkt2 [i]) return false; } return true; } static bool Filter (AssemblyNameReference anr) { // if the scope is the current assembly, then AssemblyNameReference will be null if (anr == null) return false; // MoMA tracks only assemblies that have "well known" public key tokens byte [] pkt = anr.PublicKeyToken; if ((pkt == null) || (pkt.Length != 8)) return false; switch (pkt [0]) { case 0xb7: // candidate for b77a5c561934e089 which is the ECMA key return ComparePublicKeyToken (ecma_key, pkt); case 0xb0: // candidate for b03f5f7f11d50a3a which is the 'msfinal' key return ComparePublicKeyToken (msfinal_key, pkt); case 0x31: // candidate for 31bf3856ad364e35 which is 'winfx' key - // but some Silverlight assemblies, Microsoft.VisualBasic.dll and // System.ServiceModel.dll, use it too return (ComparePublicKeyToken (winfx_key, pkt) && (anr.Version != coreclr_runtime)); case 0x7c: // candidate for 7cec85d7bea7798e which is used by Silverlight // MoMA does not track Silverlight compatibility return !ComparePublicKeyToken (silverlight_key, pkt); default: return false; } } public override void Initialize (IRunner runner) { base.Initialize (runner); // get the specified or latest definition file available locally *or* // download it if none is present or if gendarme is more recent than the file LoadDefinitions (SelectDefinitionsFile ()); // rule is active only if we have, at least one of, the MoMA files Active = ((NotImplemented != null) || (Missing != null) || (ToDo != null)); // MoMA does not support all frameworks, e.g. Silverlight Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { foreach (AssemblyNameReference anr in e.CurrentModule.AssemblyReferences) { if (Filter (anr)) { Active = true; return; } } Active = false; }; } private Version DownloadLatestDefinitions () { Version v = null; // try to download files from the net try { string definitionsUri; using (MoMASubmit ws = new MoMASubmit ()) { string lastest_def = ws.GetLatestDefinitionsVersion (); int s = lastest_def.LastIndexOf ('/') + 1; int e = lastest_def.IndexOf ('-', s); v = new Version (lastest_def.Substring (s, e - s)); definitionsUri = lastest_def.Split ('|') [2]; } using (WebClient wc = new WebClient ()) { string filename = GetFileName (v); wc.DownloadFile (new Uri (definitionsUri), filename); } } catch (WebException e) { if (Runner.VerbosityLevel > 0) Console.Error.WriteLine (e); } return v; } static char [] buffer = new char [4096]; private static Dictionary ReadWithComments (StreamLineReader reader) { Dictionary dict = new Dictionary (); while (!reader.EndOfStream) { int length = reader.ReadLine (buffer, 0, buffer.Length); int pos = Array.IndexOf (buffer, '-'); string key = new string (buffer, 0, pos); string comment = (buffer [length - 1] == '-') ? null : new string (buffer, pos + 1, length - pos - 1); dict.Add (key, comment); } return dict; } private static HashSet Read (StreamLineReader reader) { HashSet set = new HashSet (); while (!reader.EndOfStream) { int length = reader.ReadLine (buffer, 0, buffer.Length); set.Add (new string (buffer, 0, length)); } return set; } // this correspond to Call, Callvirt, Newobj, Initobj, Ldftn, Ldvirtftn private static OpCodeBitmask mask = new OpCodeBitmask (0x8000000000, 0x4400000000000, 0x0, 0x40060); public RuleResult CheckMethod (MethodDefinition method) { // rule doesn't apply if method has no IL if (!method.HasBody) return RuleResult.DoesNotApply; // check if any instruction refers to methods or types that MoMA could track if (!mask.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // rule applies foreach (Instruction ins in method.Body.Instructions) { // look for any instruction that could use something incomplete if (!mask.Get (ins.OpCode.Code)) continue; // filter calls to assemblies that MoMA likely does not include (e.g. your own code) MethodReference mr = (ins.Operand as MethodReference); if ((mr == null) || !Filter (mr.DeclaringType.Scope as AssemblyNameReference)) continue; // MethodReference.ToString is costly so we do it once for the three checks string callee = mr.GetFullName (); // calling not implemented method is very likely not to work == High if ((NotImplemented != null) && NotImplementedInternal.Contains (callee)) { string message = String.Format (CultureInfo.InvariantCulture, NotImplementedMessage, callee); // confidence is Normal since we can't be sure if MoMA data is up to date Runner.Report (method, ins, Severity.High, Confidence.Normal, message); } // calling missing methods can't work == Critical if ((Missing != null) && Missing.Contains (callee)) { string message = String.Format (CultureInfo.InvariantCulture, MissingMessage, callee); Runner.Report (method, ins, Severity.Critical, Confidence.Normal, message); } // calling todo methods migh work with some limitations == Medium if (ToDo != null) { string value; if (ToDo.TryGetValue (callee, out value)) { string message = String.Format (CultureInfo.InvariantCulture, TodoMessage, callee, value); Runner.Report (method, ins, Severity.Medium, Confidence.Normal, message); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/MoMAWebService.cs0000664000175000017500000001754312413742070030650 0ustar00directhexdirecthex00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:2.0.50727.42 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ // // This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.42. // namespace MoMA.Analyzer.MoMAWebService { using System.Diagnostics; using System.Web.Services; using System.ComponentModel; using System.Web.Services.Protocols; using System; using System.Xml.Serialization; /// [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.Web.Services", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute ()] [System.ComponentModel.DesignerCategoryAttribute ("code")] [System.Web.Services.WebServiceBindingAttribute (Name = "MoMASubmitSoap", Namespace = "http://mono-project.com/MoMASubmit/")] public partial class MoMASubmit : System.Web.Services.Protocols.SoapHttpClientProtocol { private System.Threading.SendOrPostCallback SubmitResultsOperationCompleted; private System.Threading.SendOrPostCallback GetLatestDefinitionsVersionOperationCompleted; private bool useDefaultCredentialsSetExplicitly; /// public MoMASubmit () { this.Url = "http://www.go-mono.com/moma/MoMASubmit.asmx"; if ((this.IsLocalFileSystemWebService (this.Url) == true)) { this.UseDefaultCredentials = true; this.useDefaultCredentialsSetExplicitly = false; } else { this.useDefaultCredentialsSetExplicitly = true; } } public new string Url { get { return base.Url; } set { if ((((this.IsLocalFileSystemWebService (base.Url) == true) && (this.useDefaultCredentialsSetExplicitly == false)) && (this.IsLocalFileSystemWebService (value) == false))) { base.UseDefaultCredentials = false; } base.Url = value; } } public new bool UseDefaultCredentials { get { return base.UseDefaultCredentials; } set { base.UseDefaultCredentials = value; this.useDefaultCredentialsSetExplicitly = true; } } /// public event SubmitResultsCompletedEventHandler SubmitResultsCompleted; /// public event GetLatestDefinitionsVersionCompletedEventHandler GetLatestDefinitionsVersionCompleted; /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute ("http://mono-project.com/MoMASubmit/SubmitResults", RequestNamespace = "http://mono-project.com/MoMASubmit/", ResponseNamespace = "http://mono-project.com/MoMASubmit/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public bool SubmitResults (string results) { object [] results1 = this.Invoke ("SubmitResults", new object [] { results}); return ((bool) (results1 [0])); } /// public void SubmitResultsAsync (string results) { this.SubmitResultsAsync (results, null); } /// public void SubmitResultsAsync (string results, object userState) { if ((this.SubmitResultsOperationCompleted == null)) { this.SubmitResultsOperationCompleted = new System.Threading.SendOrPostCallback (this.OnSubmitResultsOperationCompleted); } this.InvokeAsync ("SubmitResults", new object [] { results}, this.SubmitResultsOperationCompleted, userState); } private void OnSubmitResultsOperationCompleted (object arg) { if ((this.SubmitResultsCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg)); this.SubmitResultsCompleted (this, new SubmitResultsCompletedEventArgs (invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute ("http://mono-project.com/MoMASubmit/GetLatestDefinitionsVersion", RequestNamespace = "http://mono-project.com/MoMASubmit/", ResponseNamespace = "http://mono-project.com/MoMASubmit/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string GetLatestDefinitionsVersion () { object [] results = this.Invoke ("GetLatestDefinitionsVersion", new object [0]); return ((string) (results [0])); } /// public void GetLatestDefinitionsVersionAsync () { this.GetLatestDefinitionsVersionAsync (null); } /// public void GetLatestDefinitionsVersionAsync (object userState) { if ((this.GetLatestDefinitionsVersionOperationCompleted == null)) { this.GetLatestDefinitionsVersionOperationCompleted = new System.Threading.SendOrPostCallback (this.OnGetLatestDefinitionsVersionOperationCompleted); } this.InvokeAsync ("GetLatestDefinitionsVersion", new object [0], this.GetLatestDefinitionsVersionOperationCompleted, userState); } private void OnGetLatestDefinitionsVersionOperationCompleted (object arg) { if ((this.GetLatestDefinitionsVersionCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs) (arg)); this.GetLatestDefinitionsVersionCompleted (this, new GetLatestDefinitionsVersionCompletedEventArgs (invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// public new void CancelAsync (object userState) { base.CancelAsync (userState); } private bool IsLocalFileSystemWebService (string url) { if (((url == null) || (url == string.Empty))) { return false; } System.Uri wsUri = new System.Uri (url); if (((wsUri.Port >= 1024) && (string.Compare (wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) { return true; } return false; } } /// [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.Web.Services", "2.0.50727.42")] public delegate void SubmitResultsCompletedEventHandler (object sender, SubmitResultsCompletedEventArgs e); /// [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.Web.Services", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute ()] [System.ComponentModel.DesignerCategoryAttribute ("code")] public partial class SubmitResultsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object [] results; internal SubmitResultsCompletedEventArgs (object [] results, System.Exception exception, bool cancelled, object userState) : base (exception, cancelled, userState) { this.results = results; } /// public bool Result { get { this.RaiseExceptionIfNecessary (); return ((bool) (this.results [0])); } } } /// [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.Web.Services", "2.0.50727.42")] public delegate void GetLatestDefinitionsVersionCompletedEventHandler (object sender, GetLatestDefinitionsVersionCompletedEventArgs e); /// [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.Web.Services", "2.0.50727.42")] [System.Diagnostics.DebuggerStepThroughAttribute ()] [System.ComponentModel.DesignerCategoryAttribute ("code")] public partial class GetLatestDefinitionsVersionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object [] results; internal GetLatestDefinitionsVersionCompletedEventArgs (object [] results, System.Exception exception, bool cancelled, object userState) : base (exception, cancelled, userState) { this.results = results; } /// public string Result { get { this.RaiseExceptionIfNecessary (); return ((string) (this.results [0])); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Gendarme.Rules.Portability.csproj0000775000175000017500000001451312413742070034104 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {3A220513-3E53-4E13-B25D-2202F79B4C47} Library Properties Gendarme.Rules.Portability Gendarme.Rules.Portability 3.5 true v4.0 http://localhost/Gendarme.Rules.Portability/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 1591 1570 ..\..\console\bin\Debug\Gendarme.Rules.Portability.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Portability.xml AllRules.ruleset False ..\..\wix\Libraries\ICSharpCode.SharpZipLib.dll 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Makefile.in0000664000175000017500000006552512642235732027627 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Portability ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) \ -r:ICSharpCode.SharpZipLib.dll -r:System.Web.Services.dll EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -o- console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ DoNotHardcodePathsRule.cs \ ExitCodeIsLimitedOnUnixRule.cs \ FeatureRequiresRootPrivilegeOnUnixRule.cs \ MoMAWebService.cs \ MonoCompatibilityReviewRule.cs \ NewLineLiteralRule.cs tests_sources = \ DoNotHardcodePathsTest.cs \ ExitCodeIsLimitedOnUnixTest.cs \ FeatureRequiresRootPrivilegeOnUnixTest.cs \ MonoCompatibilityReviewTest.cs \ NewLineLiteralTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Portability/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Portability/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/FeatureRequiresRootPrivilegeOnUnixRule.cs0000664000175000017500000001421012413742070035703 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Portability.FeatureRequiresRootPrivilegeOnUnixRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2007 Andreas Noever // 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; using System.Diagnostics; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Portability { /// /// This rule fires if a feature is used which is, by default, restricted under Unix. /// /// /// System.Net.NetworkInformation.Ping: This type can only be used /// by root on Unix systems. As an alternative you can execute the ping command and /// parse its result. /// /// /// System.Diagnostics.Process: The PriorityClass property can only /// be set to Normal by non-root users. To avoid this problem you can do a /// platform check before assigning a priority. /// /// /// /// /// Bad example: /// /// process.PriorityClass = ProcessPriorityClass.AboveNormal; /// process.Start (); /// /// /// /// Good example: /// /// if (Environment.OSVersion.Platform != PlatformID.Unix) { /// process.PriorityClass = ProcessPriorityClass.AboveNormal; /// } /// process.Start (); /// /// [Problem ("The method uses some features which require 'root' privilege under Unix.")] [Solution ("Make sure your code can work without requiring users to have 'root' privilege.")] [EngineDependency (typeof (OpCodeEngine))] public class FeatureRequiresRootPrivilegeOnUnixRule : Rule, IMethodRule { // includes Call, Callvirt and Newobj private static OpCodeBitmask CallsNew = new OpCodeBitmask (0x8000000000, 0x4400000000000, 0x0, 0x0); // localizable private const string ProcessMessage = "Setting Process.PriorityClass to something else than ProcessPriorityClass.Normal requires root privileges."; private const string PingMessage = "Usage of System.Net.NetworkInformation.Ping requires root privileges."; private bool ping_present = true; private bool process_present = true; public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference either Ping or Process // then it's not being used inside it Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = e.CurrentModule.AnyTypeReference ((TypeReference tr) => { ping_present = tr.IsNamed ("System.Net.NetworkInformation", "Ping"); process_present = tr.IsNamed ("System.Diagnostics", "Process"); // return true to stop looping when both Ping and Process are found return (ping_present && process_present); }); // activate the rule if any (or both) is/are present(s) Active = (ping_present || process_present); }; // note: this ignores on purpose System.dll since there's // no point in reporting the use of both class inside it } //Check for usage of System.Diagnostics.Process.set_PriorityClass private static bool CheckProcessSetPriorityClass (Instruction ins) { MethodReference method = (ins.Operand as MethodReference); if ((method == null) || (method.Name != "set_PriorityClass")) return false; if (!method.DeclaringType.IsNamed ("System.Diagnostics", "Process")) return false; Instruction prev = ins.Previous; //check stack if (prev == null) return false; switch (prev.OpCode.Code) { case Code.Ldc_I4_S: return ((ProcessPriorityClass) (sbyte) prev.Operand != ProcessPriorityClass.Normal); case Code.Ldc_I4: return ((ProcessPriorityClass) prev.Operand != ProcessPriorityClass.Normal); default: return false; } } private static bool CheckPing (Instruction ins) { MethodReference method = (ins.Operand as MethodReference); return ((method != null) && (method.DeclaringType.IsNamed ("System.Net.NetworkInformation", "Ping"))); } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply to methods without IL if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!CallsNew.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { // check for calls (or newobj) if (ins.OpCode.FlowControl != FlowControl.Call) continue; // Check for usage of Process or Ping based on their presence if (process_present && CheckProcessSetPriorityClass (ins)) { // code won't work with default (non-root) users == High Runner.Report (method, ins, Severity.High, Confidence.High, ProcessMessage); } else if (ping_present && CheckPing (ins)) { // code won't work with default (non-root) users == High Runner.Report (method, ins, Severity.High, Confidence.High, PingMessage); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/DoNotHardcodePathsRule.cs0000664000175000017500000003500212413742070032373 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Portability.DoNotHardcodePathsRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Portability { /// /// This rule checks for strings that contain valid paths, either under Unix or /// Windows file systems. Path literals are often not portable across /// operating systems (e.g. different path separators). To ensure correct cross-platform /// functionality they should be replaced by calls to Path.Combine and/or /// Environment.GetFolderPath. /// /// /// Bad example: /// /// void ReadConfig () /// { /// using (FileStream fs = File.Open ("~/.local/share/myapp/user.config")) { /// // read configuration /// } /// } /// /// /// /// Good example: /// /// void ReadConfig () /// { /// string config_file = Environment.GetFolderPath (SpecialFolder.LocalApplicationData); /// config_file = Path.Combine (Path.Combine (config_file, "myapp"), "user.config"); /// using (FileStream fs = File.Open (config_file)) { /// // read configuration /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This string looks like a path that may become invalid if the code is executed on a different operating system.")] [Solution ("Use System.IO.Path and System.Environment to generate paths instead of hardcoding them.")] [EngineDependency (typeof (OpCodeEngine))] public class DoNotHardcodePathsRule : Rule, IMethodRule { // result cache private static Dictionary resultCache = new Dictionary (); // (back)slash counters private int slashes; private int backslashes; // method body being checked private MethodBody method_body; // point counter private int current_score; void AddPoints (int pts) { current_score += pts; // Console.WriteLine ("// added {0} pts", pts); } Confidence? CheckIfStringIsHardcodedPath (Instruction ldstr, string str) { // try to filter out false positives: // count (back)slashes slashes = CountOccurences (str, '/'); backslashes = CountOccurences (str, '\\'); // if there's no (back)slashes, string's not going to cause // any portability problems if (slashes == 0 && backslashes == 0) return null; // file paths don't contain // if (str.Contains ("//")) return null; // don't check XML strings if (str.Contains ("")) return null; // files paths don't usually have more than one dot (in extension) if (CountOccurences (str, '.') > 2) return null; // handle different cases if (CanBeWindowsAbsolutePath (str)) { // whoooaaa! most probably we have a windows absolute path here AddPoints (5); // add points (5 because '*:\*' is less common) backslashes--; // we should't count a backslash in drive letter // process a windows path ProcessWindowsPath (); } else if (CanBeWindowsUNCPath (str)) { AddPoints (4); // add points backslashes -= 2; // go! ProcessWindowsPath (); } else if (CanBeUnixAbsolutePath (str)) { // same for unix AddPoints (2); // add points (2 because '/*' is more common) slashes--; // we shouldn't count a slash in the beginning // process a unix path ProcessUnixProbablyAbsolutePath (str); } else { // since that's not an absolute path, we need to // switch between unix/windows path handlers // depending on what character is more common // ('/' for unix, '\' for windows) if (backslashes > slashes) ProcessWindowsPath (); // like directory\something\.. else if (backslashes < slashes) ProcessUnixPath (); // like directory/something/.. } // process the extension try { ProcessExtension (System.IO.Path.GetExtension (str)); } catch (ArgumentException) { // catch any invalid path character (more common on windows) } // try to guess how the string is used TryGuessUsage (ldstr); // Console.WriteLine ("// total score: {0}", current_score); if (current_score > 13) return Confidence.Total; else if (current_score > 9) return Confidence.High; else if (current_score > 7) return Confidence.Normal; else return null; } static bool CanBeWindowsAbsolutePath (string s) { // true for strings like ?:\* // e.g. 'C:\some\path' or 'D:\something.else" return s [1] == ':' && s [2] == '\\'; } static bool CanBeWindowsUNCPath (string s) { // true for Windows UNC paths // e.g. \\Server\Directory\File return s [0] == '\\' && s [1] == '\\'; } static bool CanBeUnixAbsolutePath (string s) { // true for strings like /* return s [0] == '/'; } void ProcessWindowsPath () { // Console.WriteLine ("// process win path"); // normally, windows paths don't contain slashes if (slashes == 0 && backslashes > 1) AddPoints (2); // the more backslashes there are // the more we are convinced it's a path: if (backslashes > 3) AddPoints (4); else if (backslashes > 1) AddPoints (3); else if (backslashes == 1) AddPoints (2); } void ProcessUnixProbablyAbsolutePath (string path) { // check for common prefixes if (path.StartsWith ("/bin/", StringComparison.Ordinal) || path.StartsWith ("/etc/", StringComparison.Ordinal) || path.StartsWith ("/sbin/", StringComparison.Ordinal) || path.StartsWith ("/dev/", StringComparison.Ordinal) || path.StartsWith ("/lib/", StringComparison.Ordinal) || path.StartsWith ("/usr/", StringComparison.Ordinal) || path.StartsWith ("/tmp/", StringComparison.Ordinal) || path.StartsWith ("/proc/", StringComparison.Ordinal) || path.StartsWith ("/sys/", StringComparison.Ordinal) || path.StartsWith ("/cdrom/", StringComparison.Ordinal) || path.StartsWith ("/home/", StringComparison.Ordinal) || path.StartsWith ("/media/", StringComparison.Ordinal) || path.StartsWith ("/mnt/", StringComparison.Ordinal) || path.StartsWith ("/opt/", StringComparison.Ordinal) || path.StartsWith ("/var/", StringComparison.Ordinal)) AddPoints (4); ProcessUnixPath (); } void ProcessUnixPath () { // Console.WriteLine ("// process ux path"); // normally, unix paths don't contain backslashes (unlike windows) if (backslashes == 0) AddPoints (2); // the more slashes there are // the more we are convinced it's a path: if (slashes > 3) AddPoints (3); else if (slashes > 1) AddPoints (2); else if (slashes == 1) AddPoints (1); } void ProcessExtension (string ext) { // Console.WriteLine ("// process extension"); int length = ext.Length; // now we look at the extension length // NB: extension name also includes a dot (.) if (length < 2 || length > 6) return; if (length == 4) // this is very common for extensions => really good sign :-) AddPoints (4); else AddPoints (3); // less common but still good } void TryGuessUsage (Instruction ldstr) { // Console.WriteLine ("// guess usage"); // here we hope to get some additional points // from further usage analysis // no further usage, good-bye! if (ldstr.Next == null) return; // we handle two cases: // #1: string can be stored into a local variable or field with a well-sounding name* // * - well-sounding == name.Contains ("dir") || name.Contains ("file") || ... if (CheckIfStored (ldstr.Next)) return; // if we reach this point, it means #1 didn't catch anything // now, try option #2: navigate to the closest call(i|virt)? or newobj // and see what we can learn Instruction current = ldstr.Next; // this counter will be used to calculate parameter position int paramOffset = 0; // take next instruction if any until it is call(i|virt)? or newobj while (current != null && !CheckIfMethodOrCtorIsCalled (current, paramOffset)) { current = current.Next; paramOffset++; } } // true == handled // false == unhandled bool CheckIfStored (Instruction afterLdstr) { switch (afterLdstr.OpCode.Code) { case Code.Stfld: // store into field case Code.Stsfld: CheckIdentifier ((afterLdstr.Operand as FieldReference).Name); break; default: if (afterLdstr.IsStoreLocal ()) CheckIdentifier (afterLdstr.GetVariable (method_body.Method).Name); else return false; break; } return true; // handled } // true == handled // false == unhandled bool CheckIfMethodOrCtorIsCalled (Instruction ins, int currentOffset) { switch (ins.OpCode.Code) { case Code.Call: case Code.Calli: case Code.Callvirt: // this is a call MethodReference target = ins.Operand as MethodReference; // this happens sometimes so it's worth checking if (target == null) return true; // we can avoid some false positives by doing additional checks here TypeReference tr = target.DeclaringType; string nameSpace = tr.Namespace; string typeName = tr.Name; string methodName = target.Name; if (nameSpace == "Microsoft.Win32" && typeName.StartsWith ("Registry", StringComparison.Ordinal) // registry keys || (nameSpace.StartsWith ("System.Xml", StringComparison.Ordinal) // xpath expressions && methodName.StartsWith ("Select", StringComparison.Ordinal))) { AddPoints (-42); return true; // handled } // see what we can learn if (target.HasParameters && (target.Parameters.Count == 1) && methodName.StartsWith ("set_", StringComparison.Ordinal)) { // to improve performance, don't Resolve () to call IsSpecialName // this is a setter (in 99% cases) CheckIdentifier (methodName); } else { // we can also check parameter name CheckMethodParameterName (target, currentOffset); } break; case Code.Newobj: // this is a constructor call MethodReference ctor = (MethodReference) ins.Operand; // avoid catching regular expressions if (ctor.DeclaringType.IsNamed ("System.Text.RegularExpressions", "Regex")) AddPoints (-42); break; default: return false; } return true; // handled } void CheckMethodParameterName (MethodReference methodReference, int parameterOffset) { MethodDefinition method = methodReference.Resolve (); if ((method == null) || !method.HasParameters) return; IList pdc = method.Parameters; int parameterIndex = pdc.Count - parameterOffset - 1; // to prevent some uncommon situations if (parameterIndex < 0) return; // parameterOffset is distance in instructions between ldstr and call(i|virt)? ParameterDefinition parameter = pdc [parameterIndex]; // if its name is 'pathy', score some points! CheckIdentifier (parameter.Name); } void CheckIdentifier (string name) { if (IdentifierLooksLikePath (name)) AddPoints (4); } static bool IdentifierLooksLikePath (string name) { // Console.WriteLine ("// analyzing identifier '{0}'", name); return (name.IndexOf ("file", StringComparison.OrdinalIgnoreCase) >= 0) || (name.IndexOf ("dir", StringComparison.OrdinalIgnoreCase) >= 0) || (name.IndexOf ("path", StringComparison.OrdinalIgnoreCase) >= 0); } static int CountOccurences (string str, char c) { // helper method to tell how many times a certain character occurs in the string int n = 0; for (int i = 0; i < str.Length; i++) if (str [i] == c) n++; return n; } Confidence? GetConfidence (Instruction ldstr, string candidate) { // check if string is already in cache Confidence? result; if (resultCache.TryGetValue (candidate, out result)) return result; // process and cache result result = CheckIfStringIsHardcodedPath (ldstr, candidate); resultCache.Add (candidate, result); return result; } public RuleResult CheckMethod (MethodDefinition method) { // if method has no IL, we don't check it if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Ldstr instructions in this method if (!OpCodeEngine.GetBitmask (method).Get (Code.Ldstr)) return RuleResult.DoesNotApply; method_body = method.Body; // enumerate instructions to look for strings foreach (Instruction ins in method_body.Instructions) { // Console.WriteLine ("{0} {1}", ins.OpCode, ins.Operand); if (!ins.Is (Code.Ldstr)) continue; slashes = backslashes = current_score = 0; // check if loaded string is a hardcoded path string candidate = (ins.Operand as string); // don't check too short strings (we do this very earlier to avoid caching the small values) if (candidate.Length < 4) continue; Confidence? conf = GetConfidence (ins, candidate); // if sure enough, report the problem with the candidate string // important as this allows a quick false positive check without checking the source code if (conf.HasValue) { string msg = String.Format (CultureInfo.InvariantCulture, "string \"{0}\" looks quite like a filename.", candidate); Runner.Report (method, ins, Severity.High, conf.Value, msg); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/ExitCodeIsLimitedOnUnixRule.cs0000664000175000017500000001714012413742070033372 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Portability.ExitCodeIsLimitedOnUnixRule // // Authors: // Daniel Abramov // // Copyright (C) 2007 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Portability { /// /// This rule applies to all executable (i.e. EXE) assemblies. Something that many Windows /// developers might not be aware of is that on Unix systems, process exit code must be /// between zero and 255, unlike in Windows where it can be any valid integer value. /// This rule warns if the returned value might be out of range either by: /// /// /// returning an unknown value from int Main(); /// /// /// setting the Environment.ExitCode property; or /// /// /// calling Environment.Exit(exitCode) method. /// /// /// An error is reported in case a number which is definitely out of range is returned /// as an exit code. /// /// /// Bad example: /// /// class MainClass { /// static int Main () /// { /// Environment.ExitCode = 1000; /// Environment.Exit (512); /// return -1; /// } /// } /// /// /// /// Good example: /// /// class MainClass { /// static int Main () /// { /// Environment.ExitCode = 42; /// Environment.Exit (100); /// return 1; /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("The rule detected a value outside the 0-255 range or couldn't be sure of the returned value.")] [Solution ("Review that your return values are all between 0 and 255, this will ensure that they work under both Unix and Windows.")] [EngineDependency (typeof (OpCodeEngine))] public class ExitCodeIsLimitedOnUnixRule : Rule, IAssemblyRule, IMethodRule { [Serializable] private enum InspectionResult { Good, Bad, Unsure } public override void Initialize (IRunner runner) { base.Initialize (runner); // we always want to call CheckAssembly (single call on each assembly) Runner.AnalyzeAssembly += delegate (object o, RunnerEventArgs e) { Active = true; }; // but we want to avoid checking all methods if the Environment type // isn't referenced in a module (big performance difference) Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System", "Environment"); }); }; } private void Report (MethodDefinition method, Instruction ins, InspectionResult result) { switch (result) { case InspectionResult.Good: // should never occur break; case InspectionResult.Bad: Runner.Report (method, ins, Severity.Medium, Confidence.High, "Return value is outside the range of valid values (0-255)."); break; case InspectionResult.Unsure: Runner.Report (method, ins, Severity.Medium, Confidence.Low, "Make sure not to return values that are out of range (0-255)."); break; } } public RuleResult CheckAssembly (AssemblyDefinition assembly) { MethodDefinition entry_point = assembly.EntryPoint; // the rule does not apply if the assembly has no entry point // or if it's entry point has no IL if ((entry_point == null) || !entry_point.HasBody) return RuleResult.DoesNotApply; // the rule does not apply of the entry point returns void // FIXME: entryPoint.ReturnType should not be null with void Main () // either bad unit tests or bug in cecil TypeReference rt = entry_point.ReturnType; if (!rt.IsNamed ("System", "Int32")) return RuleResult.DoesNotApply; Instruction previous = null; foreach (Instruction current in entry_point.Body.Instructions) { switch (current.OpCode.Code) { case Code.Nop: break; case Code.Ret: InspectionResult result = CheckInstruction (previous); if (result == InspectionResult.Good) break; Report (entry_point, current, result); break; default: previous = current; break; } } return Runner.CurrentRuleResult; } private static InspectionResult CheckInstruction (Instruction instruction) { // checks if an instruction loads an inapproriate value onto the stack switch (instruction.OpCode.Code) { case Code.Ldc_I4_M1: // -1 is pushed onto stack return InspectionResult.Bad; case Code.Ldc_I4_0: // small numbers are pushed onto stack -- all OK case Code.Ldc_I4_1: case Code.Ldc_I4_2: case Code.Ldc_I4_3: case Code.Ldc_I4_4: case Code.Ldc_I4_5: case Code.Ldc_I4_6: case Code.Ldc_I4_7: case Code.Ldc_I4_8: return InspectionResult.Good; case Code.Ldc_I4_S: // sbyte ([-128, 127]) - should check >= 0 sbyte b = (sbyte) instruction.Operand; return (b >= 0) ? InspectionResult.Good : InspectionResult.Bad; case Code.Ldc_I4: // normal int - should check whether is within [0, 255] int a = (int) instruction.Operand; return (a >= 0 && a <= 255) ? InspectionResult.Good : InspectionResult.Bad; case Code.Call: case Code.Callvirt: if ((instruction.Operand as MethodReference).ReturnType.IsNamed ("System", "Byte")) return InspectionResult.Good; else return InspectionResult.Unsure; // could be within 0-255 or not default: return InspectionResult.Unsure; } } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if method has no IL if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // go! Instruction previous = null; foreach (Instruction current in method.Body.Instructions) { switch (current.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference calledMethod = (MethodReference) current.Operand; string name = calledMethod.Name; if ((name != "set_ExitCode") && (name != "Exit")) break; if (!calledMethod.DeclaringType.IsNamed ("System", "Environment")) break; InspectionResult result = CheckInstruction (previous); if (result == InspectionResult.Good) break; Report (method, current, result); break; } previous = current; } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/0000775000175000017500000000000012642235743026466 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/ChangeLog0000664000175000017500000000747212413742070030242 0ustar00directhexdirecthex000000000000002010-07-14 Sebastien Pouliot * NewLineLiteralTest.cs: Complete test coverage for rule 2009-12-13 Sebastien Pouliot * MonoCompatibilityReviewTest.cs: Add test cases to ensure we're not analyzing the calls inside the current assembly. 2009-08-29 Sebastien Pouliot * MonoCompatibilityReviewTest.cs: Adjust DeleteDefinitionData since we are now keeping multiple zip files. 2008-11-18 Sebastien Pouliot * MonoCompatibilityReviewTest.cs: Adjust test wrt rule changes. 2008-11-07 Alan McGovern * Tests.Rules.Portability.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-09-17 Sebastien Pouliot * DoNotHardcodePathsTest.cs: Change some tests from Success to DoesNotApply as rules get better to avoid condition where they don't need to be executed. * ExitCodeIsLimitedOnUnixTest.cs: Change some tests from Success to DoesNotApply... * NewLineLiteralTest.cs: Change some tests from Success to DoesNotApply. Comment a case where CSC and [G]MCS do things too differently. 2008-08-27 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixTest.cs: Remove unneeded using clauses. * NewLineLiteralTest.cs: Convert to the new test API and add a bit more coverage. 2008-08-24 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixTest.cs: Convert to the new test API. Add a few more cases to get better unit tests coverage. 2008-08-07 Sebastien Pouliot * DoNotHardcodePathsTest.cs: Add test case from Richard Birkby and my (working) variation. 2008-07-10 Daniel Abramov * DoNotHardcodePathsTest.cs: Unit tests for new rule. * Test.Rules.Portability.mdp, * Tests.Rules.Portability.csproj: Add new rule. 2008-05-11 Andres G. Aragoneses * Test.Rules.Portability.mdp: Fix references. 2008-02-16 Sebastien Pouliot * MonoCompatibilityReviewTest.cs: Use the runner, not the rule, to call CheckMethod (otherwise internal state won't be correct). 2008-02-15 Sebastien Pouliot * ExitCodeIsLimitedOnUnixTest.cs * FeatureRequiresRootPrivilegeOnUnixTest.cs * MonoCompatibilityReviewTest.cs * NewLineLiteralTest.cs: Updated unit tests wrt framework changes. 2007-12-29 Sebastien Pouliot * ExitCodeIsLimitedOnUnixTest.cs: New. Unit tests by Daniel Abramov 2007-12-29 Sebastien Pouliot * NewLineLiteralTest.cs: Remove unused variable (compiler warning). * MonoCompatibilityReviewTest.cs: New. Unit tests by Andreas Noever * Test.Rules.Portability.mdp: Add new test to MonoDevelop project file. 2007-12-26 Sebastien Pouliot * FeatureRequiresRootPrivilegeOnUnixTest.cs: New. Unit tests for FeatureRequiresRootPrivilegeOnUnixRule. * NewLineLiteralTest.cs: Fix namespace and remove unneeded variable. * Test.Rules.Portability.mdp: Add new rule to the MonoDevelop project file. 2007-10-07 Sebastien Pouliot * Test.Rules.Portability.mdp: Update project file. 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-20 Jonathan Chambers * Test.Rules.Portability.csproj: Make reference to nunit.framework not a specific version for portability. 2006-07-31 Sebastien Pouliot * Test.Rules.Portability.mdp: New. Project file for MonoDevelop. * NewLineLiteralTest.cs: Avoid compiler warnings. 2006-03-17 Sebastien Pouliot * NewLineLiteralTest.cs: New. Unit tests for the NewLineLiteralRule. FeatureRequiresRootPrivilegeOnUnixTest.cs0000664000175000017500000001064012413742070036556 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test// // Unit tests for FeatureRequiresRootPrivilegeOnUnixRule // // Authors: // Andreas Noever // // (C) 2007 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Diagnostics; using System.Net.NetworkInformation; using Gendarme.Rules.Portability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Portability { class MyPing : Ping { } //MyPing..ctor calls Ping..ctor, this triggers the rule. class MyProcess : Process { } //Using MyProcess.PriorityClass calls Process.PriorityClass. The property is not virtual. class ProcessLookAlike { public ProcessPriorityClass PriorityClass { get; set; } } [TestFixture] public class FeatureRequiresRootPrivilegeOnUnixTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public void SetPriority () { Process p = new Process (); p.PriorityClass = ProcessPriorityClass.AboveNormal; } public void SetPriorityNormal () { Process p = new Process (); p.PriorityClass = ProcessPriorityClass.Normal; } public void SetMyPriority () { MyProcess p = new MyProcess (); p.PriorityClass = ProcessPriorityClass.AboveNormal; } public void SetLookAlikePriority () { ProcessLookAlike p = new ProcessLookAlike (); p.PriorityClass = ProcessPriorityClass.AboveNormal; } [Test] public void TestSetPriority () { AssertRuleFailure ("SetPriority", 1); AssertRuleFailure ("SetMyPriority", 1); AssertRuleSuccess ("SetPriorityNormal"); AssertRuleSuccess ("SetLookAlikePriority"); } public void SetPriorityUnknown (ProcessPriorityClass priority) { Process p = new Process (); p.PriorityClass = priority; } public void SetPriorityNormalVariable () { ProcessPriorityClass priority = ProcessPriorityClass.Normal; Process p = new Process (); p.PriorityClass = priority; } public void SetPriorityAboveNormalVariable () { ProcessPriorityClass priority = ProcessPriorityClass.AboveNormal; Process p = new Process (); p.PriorityClass = priority; } [Test] public void TestSetPriorityVariable () { AssertRuleSuccess ("SetPriorityNormalVariable"); AssertRuleSuccess ("SetPriorityUnknown"); } [Test] [Ignore ("we don't track variables value")] public void TestSetPriorityAboveVariable () { AssertRuleFailure ("SetPriorityAboveNormalVariable", 1); } public void CreatePing () { new Ping (); } public void UsePing (Ping ping) { // e.g. Ping could be supplied from another assembly // but Gendarme should still flag it's usage inside the analyzed assembly ping.Send ("127.0.0.1"); } [Test] public void TestCreatePing () { AssertRuleFailure ("CreatePing", 1); AssertRuleFailure ("UsePing", 1); } public void CreateObject () { new object (); } [Test] public void TestCreate () { AssertRuleSuccess ("CreateObject"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/NewLineLiteralTest.cs0000664000175000017500000000600712413742070032526 0ustar00directhexdirecthex00000000000000// // Unit tests for NewLineLiteralRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006-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; using Gendarme.Rules.Portability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Portability { [TestFixture] public class NewLineLiteralTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public string GetNewLineLiteral_13 () { return "Hello\nMono"; } public string GetNewLineLiteral_10 () { return "\rHello Mono"; } public string GetNewLineLiteral () { return "Hello Mono\r\n"; } public string Tab () { return "\tHello Mono\r\n"; } public string Control () { return "\xbHello Mono\r\n"; } [Test] public void Bad () { AssertRuleFailure ("GetNewLineLiteral_13", 1); AssertRuleFailure ("GetNewLineLiteral_10", 1); AssertRuleFailure ("GetNewLineLiteral", 1); AssertRuleFailure ("Tab", 1); Assert.IsTrue (Runner.Defects [0].Text.Contains ("\\t"), "visible tab"); AssertRuleFailure ("Control", 1); Assert.IsTrue (Runner.Defects [0].Text.Contains ("\\xb"), "visible 0xb"); } public string GetNewLine () { return String.Concat ("Hello Mono", Environment.NewLine); } public string GetNull () { return null; } public string GetEmpty () { // note: this does a LDSTR with CSC and a LDSFLD String.Empty // with [g]mcs when optimizations are enabled return ""; } [Test] public void Correct () { AssertRuleSuccess ("GetNewLine"); // see note ^^^ AssertRuleSuccess ("GetEmpty"); // no LDSTR instruction (LDNULL is used) AssertRuleDoesNotApply ("GetNull"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/Makefile.in0000664000175000017500000003144312642235732030536 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Portability/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Portability.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Portability/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Portability/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/DoNotHardcodePathsTest.cs0000664000175000017500000001771712413742070033337 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotHardcodePathsRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.IO; using System.Xml; using Gendarme.Framework; using Gendarme.Rules.Portability; using Test.Rules.Definitions; using Test.Rules.Fixtures; using NUnit.Framework; namespace Test.Rules.Portability { #pragma warning disable 169, 219, 414 [TestFixture] public class DoNotHardcodePathsTest : MethodRuleTestFixture { string pagefile; // as a field otherwise the name can lost void TotalConfidence1 () // more than 13 points { // C:\directory\file.sys // drive letter 5 // no slashes 2 // 3-char extension 4 // var name contains 'file' 4 // TOTAL: 15 points pagefile = @"C:\directory\file.sys"; } void TotalConfidence2 () // more than 13 points { // /home/ex/.aMule/Incoming/Blues_Brothers.avi // starts with a slash 2 // starts with /home/ 4 // no backslashes 2 // 4 slashes 3 // 3-char extension 4 // param name contains 'file' 4 // TOTAL: 19 points OpenFile (42, "/home/ex/.aMule/Incoming/Blues_Brothers.avi", "yarr!"); } void OpenFile (int something, string fileName, string somethingElse) { } void TotalConfidence3 () // more than 13 points { // /opt/mono/bin/mono // starts with a slash 2 // starts with /opt/ 4 // no backslashes 2 // 3 slashes 2 // 'file' in param 4 // TOTAL: 14 points System.Diagnostics.Process.Start ("/opt/mono/bin/mono"); } void HighConfidence1 () // 10 to 13 points { // parser/data/English.nbin // no backslashes 2 // 4-char extension 3 // 2 slashes 2 // setter name contains 'path' 4 // TOTAL: 11 points SomePath = "parser/data/English.nbin"; } void HighConfidence2 () // 10 to 13 points { // \\SHARED\Music\Donovan\Mellow_Yellow.mp3 // starts with \\ (UNC) 4 // no slashes 2 // 3 backslashes (except \\) 3 // 3-char extension 4 // TOTAL: 13 points string music = @"\\SHARED\Music\Donovan\Mellow_Yellow.mp3"; throw new NotSupportedException (music); } string SomePath { set { } } Stream NormalConfidence1 () // 8 to 9 points { // bin\Debug\framework.dll // no slashes 2 // two backslashes 3 // 3-char extension 4 // TOTAL: 9 points string output = @"bin\Debug\framework.dll"; return File.OpenWrite (output); } void NormalConfidence2 () // 8 to 9 points { // gendarme/bin/ // no backslashes 2 // two slashes 2 // field name contains 'dir' 4 // TOTAL: 8 points gendarmeDirectory = @"gendarme/bin/"; } private string gendarmeDirectory; string DontReportUris () { string something = "http://somewhere.com/index.php"; return something; } string DontReportSlashlessStrings () { // we do not check strings that contain no (back)slashes // since they can cause no portability problems return "a elbereth gilthoniel.txt"; } void DontReportRegistryKeys () { // they look like paths but they aren't Microsoft.Win32.RegistryKey env = Microsoft.Win32.Registry.LocalMachine .OpenSubKey (@"SYSTEM\CurrentControlSet\Control\Session Manager\Environment", true); } string DontReportXML () { string someXml = ""; return someXml; } string DontReportShortStrings () { string someFile = "/"; return someFile; } string DontReportStringsWithManyDots () { string mimeType = "application/vnd.oasis-open.relax-ng.rnc"; return mimeType; } void DontReportXPath () { System.Xml.XmlDocument doc = null; System.Xml.XmlNode node = doc.SelectSingleNode ("/root/element/anotherelement"); } void DontReportRegexes () { System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex ( @"^\s*" + @"(((?(((\d+>)?[a-zA-Z]?:[^:]*)|([^:]*))):)" + "|())" + "(?(()|([^:]*? )))" + "(?(error|warning)) " + "(?[^:]*):" + "(?.*)$", System.Text.RegularExpressions.RegexOptions.IgnoreCase); } [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no LDSTR instruction AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void FailureTotalConfidence () { AssertRuleFailure ("TotalConfidence1", 1); Assert.AreEqual (Confidence.Total, Runner.Defects [0].Confidence, "1"); AssertRuleFailure ("TotalConfidence2", 1); Assert.AreEqual (Confidence.Total, Runner.Defects [0].Confidence, "2"); AssertRuleFailure ("TotalConfidence3", 1); Assert.AreEqual (Confidence.Total, Runner.Defects [0].Confidence, "3"); } [Test] public void FailureHighConfidence () { AssertRuleFailure ("HighConfidence1", 1); Assert.AreEqual (Confidence.High, Runner.Defects [0].Confidence, "1"); AssertRuleFailure ("HighConfidence2", 1); Assert.AreEqual (Confidence.High, Runner.Defects [0].Confidence, "2"); } [Test] public void FailureNormalConfidence () { AssertRuleFailure ("NormalConfidence1", 1); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "1"); AssertRuleFailure ("NormalConfidence2", 1); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "2"); } [Test] public void IgnoreSomeCases () { AssertRuleSuccess ("DontReportUris"); AssertRuleSuccess ("DontReportSlashlessStrings"); AssertRuleSuccess ("DontReportRegistryKeys"); AssertRuleSuccess ("DontReportXML"); AssertRuleSuccess ("DontReportShortStrings"); AssertRuleSuccess ("DontReportStringsWithManyDots"); AssertRuleSuccess ("DontReportXPath"); AssertRuleSuccess ("DontReportRegexes"); } // test case provided by Richard Birkby internal sealed class FalsePositive5 { public void Run () { GetType (); XmlDocument doc = new XmlDocument (); doc.LoadXml (""); AddVariable ("a/b/c", doc); } private static void AddVariable (string xpath, XmlNode node) { node.SelectSingleNode (xpath); } } internal sealed class Fixed5 { public void Run () { GetType (); XmlDocument doc = new XmlDocument (); doc.LoadXml (""); doc.SelectSingleNode ("b/c/d"); } } [Test] public void XPath () { AssertRuleFailure ("Run", 1); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "1"); AssertRuleSuccess ("Run"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/Tests.Rules.Portability.csproj0000775000175000017500000001417612413742070034410 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {ED4AC7B7-BF77-495E-91F4-720082EDC8E1} Library Properties Tests.Rules.Portability Tests.Rules.Portability 3.5 true v4.0 http://localhost/Tests.Rules.Portability/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full true bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 Component {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {3A220513-3E53-4E13-B25D-2202F79B4C47} Gendarme.Rules.Portability False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/Makefile.am0000664000175000017500000000015612413742070030514 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Portability.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/MonoCompatibilityReviewTest.cs0000664000175000017500000001402212413742070034470 0ustar00directhexdirecthex00000000000000// // Unit tests for MonoCompatibilityReviewRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2007 Andreas Noever // 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.IO; using System.Reflection; using System.Collections.Generic; using Gendarme.Framework; using Gendarme.Rules.Portability; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Portability { [TestFixture] public class MonoCompatibilityReviewTest { private MonoCompatibilityReviewRule rule; private TestRunner runner; private AssemblyDefinition assembly; private TypeDefinition type; public void NotImplemented () { new object ().GetHashCode (); } // name duplication between MoMA definition and local assembly public void NotImplementedLocal () { NotImplemented (); } public void Missing () { new object ().ToString (); } // name duplication between MoMA definition and local assembly public void MissingLocal () { Missing (); } public void TODO () { new object ().GetType (); } // name duplication between MoMA definition and local assembly public void TODOLocal () { TODO (); } public void FalsePositive () { new object ().Equals (null); } [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.Portability.MonoCompatibilityReviewTest"); rule = new MonoCompatibilityReviewRule (); runner = new TestRunner (rule); } [SetUp] public void SetUp () { rule.NotImplemented.Clear (); rule.NotImplemented.Add ("System.Int32 System.Object::GetHashCode()"); rule.NotImplemented.Add ("System.Void Test.Rules.Portability.MonoCompatibilityReviewTest::NotImplementedLocal()"); rule.Missing.Clear (); rule.Missing.Add ("System.String System.Object::ToString()"); rule.Missing.Add ("System.Void Test.Rules.Portability.MonoCompatibilityReviewTest::MissingLocal()"); rule.ToDo.Clear (); rule.ToDo.Add ("System.Type System.Object::GetType()", "TODO"); rule.ToDo.Add ("System.Void Test.Rules.Portability.MonoCompatibilityReviewTest::TODOLocal()", "TODO"); } private MethodDefinition GetTest (string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } Assert.Fail ("Could not find '{0}'.", name); return null; } [Test] public void TestNotImplemented () { MethodDefinition method = GetTest ("NotImplemented"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "NotImplemented failure test"); method = GetTest ("NotImplementedLocal"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "NotImplementedLocal success test"); } [Test] public void TestMissing () { MethodDefinition method = GetTest ("Missing"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "Missing failure test"); method = GetTest ("MissingLocal"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "MissingLocal success test"); } [Test] public void TestTODO () { MethodDefinition method = GetTest ("TODO"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "TODO failure test"); method = GetTest ("TODOLocal"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "TODOLocal success test"); } [Test] public void TestFalsePositive () { MethodDefinition method = GetTest ("FalsePositive"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestOneTimeWarning () { /* //inject some values rule.DownloadException = new System.Net.WebException ("FAIL"); MethodDefinition method = GetTest ("FalsePositive"); MessageCollection result = rule.CheckMethod (method, new MinimalRunner ()); Assert.IsNotNull (result); Assert.AreEqual (1, result.Count); //should only warn once Assert.IsNull (rule.CheckMethod (method, new MinimalRunner ()));*/ } private void DeleteDefinitionData () { string localAppDataFolder = Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData); string definitionsFolder = Path.Combine (localAppDataFolder, "Gendarme"); string[] files = Directory.GetFiles (definitionsFolder, "definitions*.zip"); foreach (string file in files) { File.Delete (file); } } [Test] [Ignore ("This test needs internet access and could be slow.")] public void TestDefinitionDownload () { DeleteDefinitionData (); MonoCompatibilityReviewRule rule = new MonoCompatibilityReviewRule (); rule.Initialize (new TestRunner (rule)); Assert.IsNotNull (rule.Missing, "rule.Missing is not null test"); Assert.IsNotNull (rule.NotImplemented, "rule.NotImplemented is not null test"); Assert.IsNotNull (rule.ToDo, "rule.ToDo is not null test"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Test/ExitCodeIsLimitedOnUnixTest.cs0000664000175000017500000003166212413742070034326 0ustar00directhexdirecthex00000000000000// // Unit tests for ExitCodeIsLimitedOnUnixRule // // Authors: // Daniel Abramov // // Copyright (C) 2007 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Rules.Portability; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Portability { internal class CommonMainClass { } internal class GoodIntMainClass : CommonMainClass { public static int Main (string [] arguments) { if (arguments.Length > 0) return 0; else if (arguments.IsReadOnly) return 255; return 42; } } internal class UnsureIntMainClass : CommonMainClass { public static int Main (string [] arguments) { return arguments.Length; } } internal class TooBigReturnedMainClass : CommonMainClass { public static int Main (string [] arguments) { if (arguments.Length > 0) return 0; else if (arguments.IsReadOnly) return 256; // too big! return 42; } } internal class MinusOneReturnedMainClass : CommonMainClass { public static int Main (string [] arguments) { if (arguments.Length > 0) return -1; // bad else if (arguments.IsReadOnly) return 255; return 42; } } internal class SmallNegativeReturnedMainClass : CommonMainClass { public static int Main (string [] arguments) { if (arguments.Length > 0) return 42; else if (arguments.IsReadOnly) return -10; // bad return 77; } } internal class BigNegativeReturnedMainClass : CommonMainClass { public static int Main (string [] arguments) { if (arguments.Length > 0) return 42; else if (arguments.IsReadOnly) return -100000; // bad return 77; } } internal class EnvSetExitCodeTester { public void EmptyMethod () { } public void SetGoodExitCode () { Environment.ExitCode = 0; Environment.ExitCode = 255; } public void SetMinusOneExitCode () { Environment.ExitCode = 5; Environment.ExitCode = -1; // bad Environment.ExitCode = 42; } public void SetSmallNegativeExitCode () { Environment.ExitCode = 10; Environment.ExitCode = -42; // bad Environment.ExitCode = 100; } public void SetTooBigExitCode () { Environment.ExitCode = 7; Environment.ExitCode = 12345; // bad Environment.ExitCode = 3; } public void SetUnsureExitCode () { Environment.ExitCode = 3; Environment.ExitCode = new Random ().Next (1024); // unsure Environment.ExitCode = 96; } } internal class EnvExitTester { public void EmptyMethod () { } public void ExitWithGoodExitCode () { Environment.Exit (0); Environment.Exit (255); } public void ExitWithMinusOneExitCode () { Environment.Exit (5); Environment.Exit (-1); // bad Environment.Exit (42); } public void ExitWithSmallNegativeExitCode () { Environment.Exit (10); Environment.Exit (-42); // bad Environment.Exit (100); } public void ExitWithTooBigExitCode () { Environment.Exit (7); Environment.Exit (12345); // bad Environment.Exit (3); } public void ExitWithUnsureExitCode () { Environment.Exit (3); Environment.Exit (new Random ().Next (1024)); // unsure Environment.Exit (96); } } [TestFixture] public class ExitCodeIsLimitedOnUnixTest { private ExitCodeIsLimitedOnUnixRule rule; private TestRunner runner; private AssemblyDefinition assembly; private AssemblyDefinition voidMainAssembly; private TypeDefinition envSetExitCodeTester; private TypeDefinition envExitTester; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new ExitCodeIsLimitedOnUnixRule (); runner = new TestRunner (rule); // generate void Main () assembly voidMainAssembly = CreateAssembly ("GoodAssembly", ModuleKind.Console); TypeDefinition goodMainClass = new TypeDefinition ("", "MainClass", TypeAttributes.Class | TypeAttributes.Public, voidMainAssembly.MainModule.TypeSystem.Object); MethodDefinition goodMain = new MethodDefinition ("Main", MethodAttributes.Static | MethodAttributes.Private, voidMainAssembly.MainModule.TypeSystem.Void); goodMainClass.Methods.Add (goodMain); voidMainAssembly.MainModule.Types.Add (goodMainClass); voidMainAssembly.EntryPoint = goodMain; // inject there EnvExitCodeTester and EnvExitTester (their methods must be in executable in order to be checked) envSetExitCodeTester = Inject (assembly.MainModule.GetType ("Test.Rules.Portability.EnvSetExitCodeTester"), voidMainAssembly); Assert.IsNotNull (envSetExitCodeTester); envExitTester = Inject (assembly.MainModule.GetType ("Test.Rules.Portability.EnvExitTester"), voidMainAssembly); Assert.IsNotNull (envExitTester); } static AssemblyDefinition CreateAssembly (string name, ModuleKind kind) { return AssemblyDefinition.CreateAssembly (new AssemblyNameDefinition (name, new Version ()), name, kind); } // horrible hack, pretend to inject a fully loaded type in another assembly static TypeDefinition Inject (TypeDefinition type, AssemblyDefinition target) { var module = ModuleDefinition.ReadModule ( type.Module.FullyQualifiedName, new ReaderParameters { ReadingMode = ReadingMode.Immediate }); type = module.GetType (type.FullName); foreach (var method in type.Methods) { // load the method body var _ = method.Body; } module.Types.Remove (type); target.MainModule.Types.Add (type); return type; } private AssemblyDefinition GetAssemblyAndInject () where TInjectedType : CommonMainClass { // return executable assembly with predefined entry point - Main () of TInjectedType string fullClassName = typeof (TInjectedType).FullName; AssemblyDefinition ass = CreateAssembly (typeof (TInjectedType).Name + "Assembly", ModuleKind.Console); TypeDefinition mainClass = Inject (assembly.MainModule.GetType (fullClassName), ass); ass.EntryPoint = GetMethod (mainClass, "Main"); return ass; } private MethodDefinition GetMethod (TypeDefinition type, string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } return null; } private MethodDefinition GetMethodForEnvSetExitCodeTest (string name) { return GetMethod (envSetExitCodeTester, name); } private MethodDefinition GetMethodForEnvExitTest (string name) { return GetMethod (envExitTester, name); } [Test] public void TestVoidMainAssembly () { Assert.AreEqual (RuleResult.DoesNotApply, rule.CheckAssembly (voidMainAssembly)); } [Test] public void TestGoodIntMainAssembly () { Assert.AreEqual (RuleResult.Success, runner.CheckAssembly (GetAssemblyAndInject ())); } [Test] public void TestUnsureIntMainAssembly () { Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject ()), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.Low, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestTooBigReturnedAssembly () { Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject ()), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestMinusOneReturnedAssembly () { Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject ()), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestSmallNegativeReturnedAssembly () { Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject ()), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvSetBadExitCodeFromNonExecutable () { // get method from this assembly, not generated one Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethod (assembly.MainModule.GetType ("Test.Rules.Portability.EnvSetExitCodeTester"), "SetTooBigExitCode"))); } [Test] public void TestNoEnvSetExitCode () { Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("EmptyMethod"))); } [Test] public void TestEnvSetGoodExitCode () { Assert.AreEqual (RuleResult.Success, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetGoodExitCode"))); } [Test] public void TestEnvSetMinusOneExitCode () { Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetMinusOneExitCode")), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvSetSmallNegativeExitCode () { Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetSmallNegativeExitCode")), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvSetTooBigExitCode () { Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetTooBigExitCode")), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvSetUnsureExitCode () { Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvSetExitCodeTest ("SetUnsureExitCode")), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.Low, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvExitWithBadExitCodeFromNonExecutable () { // get method from this assembly, not generated one Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethod (assembly.MainModule.GetType ("Test.Rules.Portability.EnvExitTester"), "ExitWithTooBigExitCode"))); } [Test] public void TestNoEnvExit () { Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckMethod (GetMethodForEnvExitTest ("EmptyMethod"))); } [Test] public void TestEnvExitWithGoodExitCode () { Assert.AreEqual (RuleResult.Success, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithGoodExitCode"))); } [Test] public void TestEnvExitWithMinusOneExitCode () { Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithMinusOneExitCode")), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvExitWithSmallNegativeExitCode () { Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithSmallNegativeExitCode")), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvExitWithTooBigExitCode () { Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithTooBigExitCode")), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.High, runner.Defects [0].Confidence, "Confidence"); } [Test] public void TestEnvExitWithUnsureExitCode () { Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (GetMethodForEnvExitTest ("ExitWithUnsureExitCode")), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); Assert.AreEqual (Confidence.Low, runner.Defects [0].Confidence, "Confidence"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/NewLineLiteralRule.cs0000664000175000017500000001004612413742070031575 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Portability.NewLineLiteralRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006-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; using System.Globalization; using System.Text; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Portability { /// /// This rule warns if methods, including properties, are using the literal /// \r and/or \n for new lines. This isn't portable across operating systems. /// To ensure correct cross-platform functionality they should be replaced by /// System.Environment.NewLine. /// /// /// Bad example: /// /// Console.WriteLine ("Hello,\nYou should be using Gendarme!"); /// /// /// /// Good example: /// /// Console.WriteLine ("Hello,{0}You must be using Gendarme!", Environment.NewLine); /// /// [Problem ("The method uses literals for new lines (e.g. \\r\\n) which isn't portable across operating systems.")] [Solution ("Replace the literals with Environment.NewLine.")] [EngineDependency (typeof (OpCodeEngine))] public class NewLineLiteralRule : Rule, IMethodRule { private static char[] InvalidChar = { '\r', '\n' }; public RuleResult CheckMethod (MethodDefinition method) { // methods can be empty (e.g. p/invoke declarations) if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Ldstr instructions in this method if (!OpCodeEngine.GetBitmask (method).Get (Code.Ldstr)) return RuleResult.DoesNotApply; // rule applies foreach (Instruction ins in method.Body.Instructions) { // look for a string load if (ins.OpCode.Code != Code.Ldstr) continue; // check the string being referenced by the instruction string s = (ins.Operand as string); if (String.IsNullOrEmpty (s)) continue; if (s.IndexOfAny (InvalidChar) >= 0) { Runner.Report (method, ins, Severity.Low, Confidence.High, FormatStringForDisplay (s)); } } return Runner.CurrentRuleResult; } // Format the string to looks like in the C# source code // For example the character \x01 is converted to the "\x01" string // This operation avoid crash with special characters when applying the XSL // transform to produce the html report private static string FormatStringForDisplay (string value) { StringBuilder result = new StringBuilder ("Found string: \""); foreach (char c in value) { if (!Char.IsControl (c)) { result.Append (c); continue; } // make the invalid char visible on output if (c == '\n') result.Append ("\\n"); else if (c == '\r') result.Append ("\\r"); else if (c == '\t') result.Append ("\\t"); else result.Append ("\\x").Append (((short) c).ToString ("x", CultureInfo.InvariantCulture)); } return result.Append ("\".").ToString (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Portability/Makefile.am0000664000175000017500000000101312413742070027566 0ustar00directhexdirecthex00000000000000include ../common.make EXTRA_RULES_OPTIONS += -r:ICSharpCode.SharpZipLib.dll -r:System.Web.Services.dll rules_sources = \ DoNotHardcodePathsRule.cs \ ExitCodeIsLimitedOnUnixRule.cs \ FeatureRequiresRootPrivilegeOnUnixRule.cs \ MoMAWebService.cs \ MonoCompatibilityReviewRule.cs \ NewLineLiteralRule.cs EXTRA_TESTS_OPTIONS += -o- tests_sources = \ DoNotHardcodePathsTest.cs \ ExitCodeIsLimitedOnUnixTest.cs \ FeatureRequiresRootPrivilegeOnUnixTest.cs \ MonoCompatibilityReviewTest.cs \ NewLineLiteralTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/0000775000175000017500000000000012642235742025365 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/DoNotDestroyStackTraceRule.cs0000664000175000017500000001704712413742070033110 0ustar00directhexdirecthex00000000000000// // DoNotDestroyStackTraceRule // // Copyright (C) 2008, 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.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Gendarme.Rules.Exceptions.Impl; namespace Gendarme.Rules.Exceptions { /// /// This rule will fire if a catch handler throws the exception it caught. What it should /// do instead is rethrow the original exception (e.g. use throw instead of /// throw ex). This is helpful because rethrow preserves the stacktrace of the /// original exception. /// /// /// Bad example: /// /// try { /// Int32.Parse ("Broken!"); /// } /// catch (Exception ex) { /// Assert.IsNotNull (ex); /// throw ex; /// } /// /// /// /// Good example: /// /// try { /// Int32.Parse ("Broken!"); /// } /// catch (Exception ex) { /// Assert.IsNotNull (ex); /// throw; /// } /// /// /// Prior to Gendarme 2.0 this rule was named DontDestroyStackTraceRule. [Problem ("A catch block throws the exception it caught which destroys the original stack trace.")] [Solution ("Use 'throw;' instead of 'throw ex;'")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Usage", "CA2200:RethrowToPreserveStackDetails")] public class DoNotDestroyStackTraceRule : Rule, IMethodRule { // all branches instructions except leave[_s] static OpCodeBitmask branches = new OpCodeBitmask (0xFFFFFC0000000000, 0xF, 0x0, 0x0); private List warned_offsets_in_method = new List (); public RuleResult CheckMethod (MethodDefinition method) { // rule only applies to methods with IL and exceptions handlers if (!method.HasBody || !method.Body.HasExceptionHandlers) return RuleResult.DoesNotApply; // and when the IL contains a Throw instruction (Rethrow is fine) OpCodeBitmask mask = OpCodeEngine.GetBitmask (method); if (!mask.Get (Code.Throw)) return RuleResult.DoesNotApply; // we can use a faster code path when no branches are present in the method if (mask.Intersect (branches)) { Branches (method); } else { Branchless (method); } warned_offsets_in_method.Clear (); return Runner.CurrentRuleResult; } private void Branchless (MethodDefinition method) { // Current stack position: 0 = top of stack int exStackPos = 0; // Local variable position: -1 = not stored in local variable int localVarPos = -1; foreach (ExceptionHandler eh in method.Body.ExceptionHandlers) { if (eh.HandlerType != ExceptionHandlerType.Catch) continue; ProcessCatchBlock (eh.HandlerStart, eh.HandlerEnd, method, ref exStackPos, ref localVarPos); } } private void ProcessCatchBlock (Instruction first, Instruction last, MethodDefinition method, ref int exStackPos, ref int localVarPos) { Instruction cur = null; while (cur != last) { if (cur == null) cur = first; else cur = cur.Next; // Rethrown exception - no problem! if (cur.Is (Code.Rethrow)) return; if (cur.IsStoreLocal ()) { int varIndex = cur.GetVariable (method).Index; if (exStackPos == 0) { // Storing argument on top of stack in local variable reference localVarPos = varIndex; exStackPos = -1; } else if (localVarPos != -1 && varIndex == localVarPos) // Writing over orignal exception... localVarPos = -1; } else if (localVarPos != -1 && cur.IsLoadLocal ()) { int varIndex = cur.GetVariable (method).Index; if (varIndex == localVarPos) // Loading exception from local var back onto stack exStackPos = 0; } else if (cur.Is (Code.Throw) && exStackPos == 0) { // If our original exception is on top of the stack, // we're rethrowing it.This is deemed naughty... if (!warned_offsets_in_method.Contains (cur.Offset)) { Runner.Report (method, cur, Severity.Critical, Confidence.High); warned_offsets_in_method.Add (cur.Offset); } return; } else if (exStackPos != -1) { // If we're still on the stack, track our position after // this instruction int numPops = cur.GetPopCount (method); if (exStackPos < numPops) { // Popped ex off of stack exStackPos = -1; } else { int numPushes = cur.GetPushCount (); exStackPos += numPushes - numPops; } } } } private void Branches (MethodDefinition method) { ExecutionPathFactory epf = new ExecutionPathFactory (); foreach (ExceptionHandler eh in method.Body.ExceptionHandlers) { if (eh.HandlerType != ExceptionHandlerType.Catch) continue; var list = epf.CreatePaths (eh.HandlerStart, eh.HandlerEnd); if (list.Count == 0) { Runner.Report (method, eh.HandlerStart, Severity.Medium, Confidence.Normal, "Handler too complex for analysis"); } else { foreach (ExecutionPathCollection catchPath in list) ProcessCatchPath (catchPath, method); } } } private void ProcessCatchPath (IEnumerable catchPath, MethodDefinition method) { // Track original exception (top of stack at start) through to the final // return (be it throw, rethrow, leave, or leave.s) // Current stack position: 0 = top of stack int exStackPos = 0; // Local variable position: -1 = not stored in local variable int localVarPos = -1; foreach (ExecutionBlock block in catchPath) { ProcessCatchBlock (block.First, block.Last, method, ref exStackPos, ref localVarPos); } } #if false public void Bitmask () { OpCodeBitmask branches = new OpCodeBitmask (); branches.Set (Code.Beq); branches.Set (Code.Beq_S); branches.Set (Code.Bge); branches.Set (Code.Bge_S); branches.Set (Code.Bge_Un); branches.Set (Code.Bge_Un_S); branches.Set (Code.Bgt); branches.Set (Code.Bgt_S); branches.Set (Code.Bgt_Un); branches.Set (Code.Bgt_Un_S); branches.Set (Code.Ble); branches.Set (Code.Ble_S); branches.Set (Code.Ble_Un); branches.Set (Code.Ble_Un_S); branches.Set (Code.Blt); branches.Set (Code.Blt_S); branches.Set (Code.Blt_Un); branches.Set (Code.Blt_Un_S); branches.Set (Code.Bne_Un); branches.Set (Code.Bne_Un_S); branches.Set (Code.Br); branches.Set (Code.Br_S); branches.Set (Code.Brfalse); branches.Set (Code.Brfalse_S); branches.Set (Code.Brtrue); branches.Set (Code.Brtrue_S); Console.WriteLine (branches); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/ChangeLog0000664000175000017500000003665312413742070027145 0ustar00directhexdirecthex000000000000002010-06-22 Sebastien Pouliot * UseObjectDisposedExceptionRule.cs: Apply AvoidLargeClassesRule 2010-06-13 Sebastien Pouliot * UseObjectDisposedExceptionRule.cs: Fis bitmask to include Newobj since the rule could applies if the method's IL contains this instruction 2010-06-13 Sebastien Pouliot * DoNotThrowInUnexpectedLocationRule.cs: * InstantiateArgumentExceptionCorrectlyRule.cs: * UseObjectDisposedExceptionRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-09 Sebastien Pouliot * DoNotThrowInUnexpectedLocationRule.cs: Remove InitType hack on use the AnalyzeType event from the runner. Extract AreCastsOk from (too large) ProcessMethod. Rename fields with same prefix 2010-06-04 Sebastien Pouliot * DoNotDestroyStackTraceRule.cs: * InstantiateArgumentExceptionCorrectlyRule.cs: * MissingExceptionConstructorsRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-05-08 Sebastien Pouliot * DontSwallowErrorsCatchingNonspecificExceptionsRule.cs: Turn IsForbiddenTypeInCatches into a static method (self test) 2010-05-02 Sebastien Pouliot * Gendarme.Rules.Exceptions.csproj: Remove deleted files from project * DoNotSwallowErrorsCatchingNonSpecificExceptionsRule.cs: Use OpCodeEngine to detect 'rethrow' instruction and skip ThrowsGeneralException. Quick out using HasExceptionHandlers instead of using Count (which would allocate a collection if empty). 2010-05-01 Sebastien Pouliot * DoNotThrowInUnexpectedLocationRule.cs: Quick-out optimization in HasCatchBlock using method.Body.HasExceptionHandlers. Split huge PreflightMethod and reduce the number of checks required to get a match (or not). Remove collections (and associated memory allocations) 2010-05-01 Sebastien Pouliot * DoNotDestroyStackTraceRule.cs: Quick-out optimization using method.Body.HasExceptionHandlers. Simplify and reduce memory allocations. * Makefile.am: Remove Impl/ExceptionBlockParser.cs and Impl/ SEH*.cs from the build 2010-01-28 Sebastien Pouliot * DoNotThrowInUnexpectedLocationTest.cs: Document the addition of the TryParse method. 2010-01-27 Sebastien Pouliot * DoNotThrowInUnexpectedLocationTest.cs: Add TryParse as a location where exceptions should never be thrown. Fix unbox by adding unbox.any opcode. Do not use a OpCodeBitmask for a single opcode (ckfinite). Avoid creating equalityComparerEquals and equalityComparerHashCode for each new type. 2010-01-21 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorRule.cs: Apply Avoid RepetitiveCallsToPropertiesRule * DoNotThrowInUnexpectedLocationRule.cs: Apply MethodCanBeMadeStatic Rule * MissingExceptionConstructorsRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule * UseObjectDisposedExceptionRule.cs: Apply MethodCanBeMadeStaticRule 2010-01-04 Sebastien Pouliot * DoNotThrowInUnexpectedLocationRule.cs: Fix bitmask to include Code.Unbox_Any. This will fix unit tests under both Mono 2.6 and MS .NET (unbox was likely used in earlier Mono releases) 2010-01-04 Sebastien Pouliot * InstantiateArgumentExceptionCorrectlyRule.cs: Fix bug #567995 for indexers. Also reduce to Severity.Low (won't be shown by default) the usage of "value" in properties (since it's somewhat popular even if unhelpful as a name). 2009-07-24 Jesse Jones * MissingExceptionConstructorsRule.cs: Rewrote the description. 2009-07-03 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-03-15 Jesse Jones * UseObjectDisposedExceptionRule.cs, Makefile.am: Added new rule. 2009-01-10 Jesse Jones * DoNotThrowInUnexpectedLocationRule.cs: Fixed an assert which broke when the code was switched from Mono.Cecil.Cil.Code.ToString to Mono.Cecil.Cil.OpCode.Name. 2008-12-30 Jesse Jones * DoNotThrowInUnexpectedLocationRule.cs: Added. 2008-12-30 Sebastien Pouliot * InstantiateArgumentExceptionCorrectlyRule.cs: Make sure the strings are always compared ordinally - to remove any culture specific differences on metadata item names. 2008-12-14 Sebastien Pouliot * DontSwallowErrorsCatchingNonspecificExceptionsRule.cs: Patch received from Gonzalo that fix #458173. No test case yet (for unit tests). 2008-12-06 Sebastien Pouliot * AvoidThrowingBasicExceptionsRule.cs: CSC dislike (CS1570) mixing // comment, on a new line, inside a block of /// 2008-11-30 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorRule.cs: Use HasParameters * InstantiateArgumentExceptionCorrectlyRule.cs: Use HasParameters * MissingExceptionConstructorsRule.cs: Use HasParameters 2008-11-18 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorRule.cs: Specify StringComparison.Ordinal when calling EndsWith. 2008-11-07 Sebastien Pouliot * SEHHandlerType.cs: Clearly specify [Serializable] on enum (self-test) 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Exceptions.mdp: * Gendarme.Rules.Exceptions.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-28 Sebastien Pouliot * InstantiateArgumentExceptionCorrectlyRule.cs: Ignore method without parameters unless it's a special name (e.g. a property). Fix yield/iterator and "check here delegate throw" cases. 2008-10-17 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorRule.cs, AvoidThrowingBasicExceptionsRule.cs, DoNotThrowReservedExceptionRule.cs, InstantiateArgumentExceptionCorrectlyRule.cs: A few fixes to XML docs so it looks better on the wiki. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Exceptions.Impl.xml, doc/ns-Gendarme.Rules.Exceptions.xml, doc/Gendarme.Rules.Exceptions, doc/Gendarme.Rules.Exceptions.Impl: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-17 Sebastien Pouliot * DoNotDestroyStackTraceRule.cs: Fix wrt API change for ExecutionPathFactory. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-15 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorRule.cs, AvoidThrowingBasicExceptionsRule.cs, DoNotDestroyStackTraceRule.cs, DoNotThrowReservedExceptionRule.cs, DontSwallowErrorsCatchingNonspecificExceptionsRule.cs, ExceptionShouldBeVisibleRule.cs, InstantiateArgumentExceptionCorrectlyRule.cs, MissingExceptionConstructorsRule.cs: Add XML documentation. * SEHHandlerType.cs: Change XML documentation into normal comments. 2008-09-06 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorRule.cs: Use OpCodeEngine to skip methods that don't use the Newobj instruction. * AvoidThrowingBasicExceptionsRule.cs: Add FxCopCompatibility for CA2201. * DoNotDestroyStackTraceRule.cs: Use OpCodeEngine to skip methods that don't use the Throw instruction. Add FxCopCompatibility for CA2200. Use shorter Runner.Report override. Remove unneeded Initialize method. * DoNotThrowReservedExceptionRule.cs: Add FxCopCompatibility for CA2201. * DontSwallowErrorsCatchingNonspecificExceptionsRule.cs: Add FxCopCompatibility for CA1031. Use shorter Runner.Report override. Return DoesNotApply if no exception block is present in the method. * ExceptionShouldBeVisibleRule.cs: Add FxCopCompatibility for CA1064. Remove unneeded constant and use shorter Runner.Report override. * InstantiateArgumentExceptionCorrectlyRule.cs: Use OpCodeEngine to skip methods that don't use the Newobj instruction. Change logic to use TraceBack and work on all constructors. Add FxCopCompatibility for CA2208. * MissingExceptionConstructorsRule.cs: Add FxCopCompatibility for CA1032. * NewExceptionRule.cs: Use OpCodeEngine to skip methods that don't use the Newobj instruction. 2008-08-16 Néstor Salceda * Makefile.am: Build all the tests. 2008-08-15 Néstor Salceda * InstantiateArgumentExceptionCorrectlyRule.cs: New. Rule to check the correct instantiation of ArgumentException and derived. * Makefile.am: Add rule and tests to the build. 2008-07-10 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-08 Sebastien Pouliot * Makefile.am: Rebuild if the framework has changed. 2008-06-29 Sebastien Pouliot * DoNotDestroyStackTraceRule.cs: Simplify using InstructionRocks. 2008-06-25 Sebastien Pouliot * AvoidThrowingBasicExceptionsRule.cs: Extract common code into NewExceptionRule abstract class. * DoNotThrowReservedExceptionRule.cs: New. Rule to check if reserved exceptions types are created inside methods. * NewExceptionRule.cs: New. Abstract base class for both AvoidThrowingBasicExceptionsRule and DoNotThrowReservedExceptionRule * Gendarme.Rules.Exceptions.mdp: Update MD project file. * Makefile.am: Add rule and tests to the build. 2008-05-26 Daniel Abramov * AvoidThrowingBasicExceptions.cs: New. Rule to ensure that specific types of exceptions are used instead of basic ones. * Gendarme.Rules.Exceptions.mdp, Gendarme.Rules.Exceptions.csproj: Add rule to project files. * Makefile.am: Add rule and tests to the build. 2008-05-19 Andres G. Aragoneses * DoNotDestroyStackTraceRule.cs: Revert r103436 (the last case wasn't checked this way), definitely I need some sleep... 2008-05-19 Andres G. Aragoneses * DoNotDestroyStackTraceRule.cs: Tiny optimization. I would become nuts if this is not correct because it's so simple (however I cannot test it because of some exception http://monoport.com/12016 I'm getting... :-? Probably I need SVN mono). 2008-05-11 Andres G. Aragoneses * Gendarme.Rules.Exceptions.mdp: Fix references. 2008-05-04 Sebastien Pouliot * DoNotDestroyStackTraceRule.cs: More refactoring. Use Initialize to void_reference. Reuse executionPaths collection. Adjust to SHE changes. 2008-05-04 Sebastien Pouliot * DoNotDestroyStackTraceRule.cs: Adapt to SEH* changes. * ISEHCatchBlock.cs, ISEHGuardedBlock.cs, ISEHHandlerBlock.cs: Removed interfaces. * Makefile.am: Remove unneeded/removed files. 2008-05-04 Sebastien Pouliot * MissingExceptionConstructorsRule.cs: Refactor to reduce complexity and size of the CheckType method (self-test). 2008-05-02 Sebastien Pouliot * DoNotDestroyStackTraceRule.cs: Refactor to avoid 2 defects (long and complex methods) in self-test. Smaller IL size for GetVarIndex. 2008-04-26 Sebastien Pouliot * MissingExceptionConstructorsRule.cs: New. Check if every exception type provides the basic four consructors. * Makefile.am: Add rule and tests to the build. 2008-04-26 Sebastien Pouliot * ExceptionShouldBeVisibleRule.cs: New. Check that exception inheriting from base exception types are visible. * Makefile.am: Add rule and tests to the build. 2008-04-06 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorRule.cs: New. Rule to check if exception derived from ArgumentException are created with some useful information (i.e. not the default constructor). * Gendarme.Rules.Exceptions.mdp: Add rule to MD project file. * Makefile.am: Add rule and tests to the build. 2008-04-06 Sebastien Pouliot * DontDestroyStackTraceRule.cs: Rename to DoNotDestroyStackTraceRule. Rename ExecutionPath to *Collection. 2008-02-16 Sebastien Pouliot * DontSwallowErrorsCatchingNonspecificExceptionsRule.cs: Rename parameter to match interface parameter name. 2008-02-15 Sebastien Pouliot * DoNotDestroyStackTraceRule.cs: (renamed from DontDestroyStackTrace.cs) * DontSwallowErrorsCatchingNonspecificExceptionsRule.cs: Updated rules wrt framework changes. * Makefile.am: Adjusted for file name changes. 2008-01-11 Sebastien Pouliot * DontDestroyStackTrace.cs: Use new Location ctors. Change some methods to static. * DontSwallowErrorsCatchingNonspecificExceptionsRule.cs: Don't create MessageCollection until needed. Use new Location ctors. Change a method to static. 2007-11-29 Sebastien Pouliot * DontDestroyStackTrace.cs: Don't use a static field (it fails a rule) as the rules are reusable and created only a single time by runners. 2007-10-07 Sebastien Pouliot * Gendarme.Rules.Exceptions.mdp: Update project file. 2007-10-04 Nestor Salceda * Gendarme.Rules.Exceptions.mdp, Test.Rules.Exceptions.mdp: Added DontSwallowErrorsCatchingNonspecificExceptions rule, and the respective unit test to the MonoDevelop project file. 2007-09-29 Nestor Salceda * Gendarme.Rules.Exceptions.xml.in: Added Uri for DontSwallowErrorsCatchingNonspecificExceptionsRule. 2007-09-24 Nestor Salceda * DontSwallowErrorsCatchingNonspecificExceptionsRule.cs: Change rule name for adhere to coding guidelines. With this change, the rule information in the xml file will be shown. 2007-09-01 Nestor Salceda * Gendarme.Rules.Exceptions.xml.in: Added the rule information for DontSwallowErrorsCatchingNonSpecificExceptions rule in the xml file. 2007-09-01 Nestor Salceda * Makefile.am: Added the sources of new rule and unit tests. * DontSwallowErrorsCatchingNonspecificExceptionsRule.cs: New. Rule for check error swallowing. 2006-10-15 Sebastien Pouliot * Gendarme.Rules.Exceptions.xml.in: Update Uri for rules (to generate more useful reports). 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-28 Christian Birkl * Gendarme.Rules.Exceptions.csproj: Included ChangeLog * DontDestroyStackTrace.cs: Migrated untyped IList messages collection to typed MessageCollection class. 2006-08-15 Russell Morris * DontDestroyStackTrace.cs: Fix possible NRE when processing invalid IL. http://blog.russellsprojects.com/?p=3 2006-07-31 Sebastien Pouliot * Gendarme.Rules.Exceptions.mdp: New. Project file for MonoDevelop. 2006-06-19 Russell Morris * Initial import of exception-management rule assembly AvoidArgumentExceptionDefaultConstructorRule.cs0000664000175000017500000001017612413742070036662 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions// // Gendarme.Rules.Exceptions.AvoidArgumentExceptionDefaultConstructorRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Exceptions { /// /// This rule checks that every System.ArgumentException, /// System.ArgumentNullException, System.ArgumentOutOfRangeException, or /// System.DuplicateWaitObjectException exception created is provided with some /// useful information about the exception being thrown, minimally the parameter name. /// /// /// Bad example: /// /// public void Add (object key, object value) /// { /// if ((obj == null) || (key == null)) { /// throw new ArgumentNullException (); /// } /// Inner.Add (key, value); /// } /// /// /// /// Good example: /// /// public void Add (object key, object value) /// { /// if (key == null) { /// throw new ArgumentNullException ("key"); /// } /// if (obj == value) { /// throw new ArgumentNullException ("value"); /// } /// Inner.Add (key, value); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method creates an ArgumentException (or derived class) but does not supply any useful information, such as the argument name, to it.")] [Solution ("Provide more information when creating the exception.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidArgumentExceptionDefaultConstructorRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule only applies to methods with IL if (!method.HasBody) return RuleResult.DoesNotApply; // and when the IL contains a NewObj instruction if (!OpCodeEngine.GetBitmask (method).Get (Code.Newobj)) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { // look where the exception was created (which might be very far from where it's actually thrown) if (ins.OpCode.Code != Code.Newobj) continue; // check if the ctor used is the default, parameter-less, one MethodReference ctor = (ins.Operand as MethodReference); if (ctor.HasParameters) continue; TypeReference type = ctor.DeclaringType; string name = type.Name; if (type.Namespace == "System") { // most common cases switch (name) { case "ArgumentException": case "ArgumentNullException": case "ArgumentOutOfRangeException": case "DuplicateWaitObjectException": Runner.Report (method, ins, Severity.Medium, Confidence.Total, type.GetFullName ()); continue; } } if (name.EndsWith ("Exception", StringComparison.Ordinal)) { if (type.Inherits ("System", "ArgumentException")) Runner.Report (method, ins, Severity.Medium, Confidence.Total, type.GetFullName ()); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/ExceptionShouldBeVisibleRule.cs0000664000175000017500000000672412413742070033450 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.ExceptionShouldBeVisibleRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Exceptions { // TODO: This rule will not work very well for assemblies without externally visible types. // It might be worthwhile to record the problematic exceptions and report them during // teardown only if an externally visible type was found in the assembly. /// /// This rule checks for non-visible exceptions which derive directly from /// the most basic exceptions: System.Exception, System.ApplicationException /// or System.SystemException. Those basic exceptions, being visible, will be the /// only information available to the API consumer - but do not contain enough data to be /// useful. /// /// /// Bad example: /// /// internal class GeneralException : Exception { /// } /// /// /// /// Good example (visibility): /// /// public class GeneralException : Exception { /// } /// /// /// /// Good example (base class): /// /// internal class GeneralException : ArgumentException { /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This exception is not public and its base class does not provide enough information to be useful.")] [Solution ("Change the exception's visibility to public, inherit from another exception, or ignore the defect.")] [FxCopCompatibility ("Microsoft.Design", "CA1064:ExceptionsShouldBePublic")] public class ExceptionShouldBeVisibleRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { TypeReference btype = type.BaseType; if (btype == null) return RuleResult.DoesNotApply; // rule apply only to type that inherits from the base exceptions if (btype.Namespace != "System") return RuleResult.DoesNotApply; string name = btype.Name; if ((name != "Exception") && (name != "SystemException") && (name != "ApplicationException")) return RuleResult.DoesNotApply; if (type.IsAbstract || type.IsVisible ()) return RuleResult.Success; Runner.Report (type, Severity.High, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/AvoidThrowingBasicExceptionsRule.cs0000664000175000017500000000601412413742070034326 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.AvoidThrowingBasicExceptionsRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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 Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Exceptions { /// /// This rule checks for methods that create basic exceptions like System.Exception, /// System.ApplicationException or System.SystemException. Those exceptions /// do not provide enough information about the error to be helpful to the consumer /// of the library. /// /// /// Bad example: /// /// public void Add (object obj) /// { /// if (obj == null) { /// throw new Exception (); /// } /// Inner.Add (obj); /// } /// /// /// /// Good example: /// /// public void Add (object obj) /// { /// if (obj == null) { /// throw new ArgumentNullException ("obj"); /// } /// Inner.Add (obj); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method creates (and probably throws) an exception of Exception, ApplicationException or SystemException type.")] [Solution ("Try to use a more specific exception type. If none of existing types meet your needs, create a custom exception class that inherits from System.Exception or any appropriate descendant of it.")] [FxCopCompatibility ("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] public class AvoidThrowingBasicExceptionsRule : NewExceptionsRule { protected override bool CheckException (TypeReference type) { if ((type == null) || (type.Namespace != "System")) return false; string name = type.Name; return ((name == "Exception") || (name == "ApplicationException") || (name == "SystemException")); } protected override Severity Severity { get { return Severity.Medium; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/NewExceptionRule.cs0000664000175000017500000000571112413742070031151 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.NewExceptionsRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Exceptions { [EngineDependency (typeof (OpCodeEngine))] abstract public class NewExceptionsRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference any of these types, don't analyze it // (unless this is corlib itself since they're defined in it :-) Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return CheckException (tr); })); }; } abstract protected bool CheckException (TypeReference type); abstract protected Severity Severity { get; } public RuleResult CheckMethod (MethodDefinition method) { // if method has no IL, the rule doesn't apply if (!method.HasBody) return RuleResult.DoesNotApply; // and when the IL contains a NewObj instruction if (!OpCodeEngine.GetBitmask (method).Get (Code.Newobj)) return RuleResult.DoesNotApply; // look for newobj instructions foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.Code != Code.Newobj) continue; // obtain a reference to the constructor's type TypeReference ctype = (ins.Operand as MethodReference).DeclaringType; // report a defect if an offending exception type is found if (CheckException (ctype)) Runner.Report (method, ins, Severity, Confidence.High, ctype.Name); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Makefile.in0000664000175000017500000006664712642235731027453 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Exceptions ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AvoidArgumentExceptionDefaultConstructorRule.cs \ AvoidThrowingBasicExceptionsRule.cs \ DoNotDestroyStackTraceRule.cs \ DoNotThrowInNonCatchClausesRule.cs \ DoNotThrowInUnexpectedLocationRule.cs \ DoNotThrowReservedExceptionRule.cs \ DontSwallowErrorsCatchingNonspecificExceptionsRule.cs \ ExceptionShouldBeVisibleRule.cs \ Impl/ExecutionBlock.cs \ Impl/ExecutionPath.cs \ Impl/ExecutionPathFactory.cs \ InstantiateArgumentExceptionCorrectlyRule.cs \ MissingExceptionConstructorsRule.cs \ NewExceptionRule.cs \ UseObjectDisposedExceptionRule.cs tests_sources = \ AvoidArgumentExceptionDefaultConstructorTest.cs \ AvoidThrowingBasicExceptionsTest.cs \ DoNotThrowInNonCatchClausesTest.cs \ DoNotThrowInUnexpectedLocationTest.cs \ DontDestroyStackTraceTest.cs \ DontSwallowErrorsCatchingNonspecificExceptionsTest.cs \ DoNotThrowReservedExceptionTest.cs \ ExceptionShouldBeVisibleTest.cs \ MissingExceptionConstructorsTest.cs \ InstantiateArgumentExceptionCorrectlyTest.cs \ UseObjectDisposedExceptionTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Exceptions/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Exceptions/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Impl/0000775000175000017500000000000012642235742026266 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Impl/ExecutionPath.cs0000664000175000017500000000115312413742070031366 0ustar00directhexdirecthex00000000000000using System; using System.Collections.Generic; using System.Linq; using Mono.Cecil.Cil; namespace Gendarme.Rules.Exceptions.Impl { internal sealed class ExecutionPathCollection : List { public ExecutionPathCollection () { } private ExecutionPathCollection (IEnumerable coll) { foreach (ExecutionBlock block in coll) Add (block.Clone ()); } public bool Contains (Instruction instruction) { return this.Any (block => block.Contains (instruction)); } public ExecutionPathCollection Clone () { return new ExecutionPathCollection (this); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Impl/ExecutionBlock.cs0000664000175000017500000000170212413742070031524 0ustar00directhexdirecthex00000000000000using System; using Mono.Cecil.Cil; namespace Gendarme.Rules.Exceptions.Impl { internal sealed class ExecutionBlock { private Instruction firstInstruction; private Instruction lastInstruction; public ExecutionBlock () { } public Instruction First { get { return firstInstruction; } set { firstInstruction = value; } } public Instruction Last { get { return lastInstruction; } set { lastInstruction = value; } } public bool Contains (Instruction instruction) { if (firstInstruction == null || lastInstruction == null || firstInstruction.Offset > lastInstruction.Offset) { return false; } else { return ((instruction.Offset >= firstInstruction.Offset) && (instruction.Offset <= lastInstruction.Offset)); } } public ExecutionBlock Clone () { ExecutionBlock other = new ExecutionBlock (); other.First = firstInstruction; other.Last = lastInstruction; return other; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Impl/ExecutionPathFactory.cs0000664000175000017500000000474012413742070032723 0ustar00directhexdirecthex00000000000000using System; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.Exceptions.Impl { internal sealed class ExecutionPathFactory { const int MaxLimit = 1000; public ExecutionPathFactory () { } public IList CreatePaths (Instruction start, Instruction end) { if (start == null) throw new ArgumentNullException ("start"); List paths = new List (); CreatePathHelper (start, end, new ExecutionPathCollection (), paths); // we were not able to build all code paths within a reasonable amount of memory if (paths.Count >= MaxLimit) paths.Clear (); return paths; } private void CreatePathHelper (Instruction start, Instruction end, ExecutionPathCollection path, List completedPaths) { if (completedPaths.Count >= MaxLimit) return; ExecutionBlock curBlock = new ExecutionBlock (); curBlock.First = start; Instruction cur = start; bool stop = false; do { switch (cur.OpCode.FlowControl) { case FlowControl.Branch: case FlowControl.Cond_Branch: if (cur.OpCode == OpCodes.Switch) { Instruction[] targetOffsets = (Instruction[])cur.Operand; foreach (Instruction target in targetOffsets) { if (!path.Contains (target)) { curBlock.Last = cur; path.Add (curBlock); CreatePathHelper (target, end, path.Clone (), completedPaths); } } stop = true; } else if (cur.OpCode == OpCodes.Leave || cur.OpCode == OpCodes.Leave_S) { curBlock.Last = cur; path.Add (curBlock); completedPaths.Add (path); stop = true; break; } else { Instruction target = (Instruction)cur.Operand; if (!path.Contains (target)) { curBlock.Last = cur; path.Add (curBlock); CreatePathHelper (target, end, path.Clone (), completedPaths); } if (!path.Contains (cur.Next)) { curBlock = new ExecutionBlock (); curBlock.First = cur.Next; } else { stop = true; } } break; case FlowControl.Throw: case FlowControl.Return: curBlock.Last = cur; path.Add (curBlock); completedPaths.Add (path); stop = true; break; } if (cur.Next != null && cur != end && !stop) cur = cur.Next; else stop = true; } while (!stop); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/DoNotThrowReservedExceptionRule.cs0000664000175000017500000000565412413742070034175 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.DoNotThrowReservedExceptionRule // // Authors: // Sebastien Pouliot // // 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 Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Exceptions { /// /// This rule will fire if an System.ExecutionEngineException, System.IndexOutOfRangeException, /// NullReferenceException, or System.OutOfMemoryException class is /// instantiated. These exceptions are for use by the runtime and should not be thrown by /// user code. /// /// /// Bad example: /// /// public void Add (object obj) /// { /// if (obj == null) { /// throw new NullReferenceException ("obj"); /// } /// Inner.Add (obj); /// } /// /// /// /// Good example: /// /// public void Add (object obj) /// { /// if (obj == null) { /// throw new ArgumentNullException ("obj"); /// } /// Inner.Add (obj); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method creates an ExecutionEngineException, IndexOutOfRangeException, NullReferenceException, or OutOfMemoryException.")] [Solution ("Throw an exception which is not reserved by the runtime.")] [FxCopCompatibility ("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] public class DoNotThrowReservedExceptionRule : NewExceptionsRule { protected override bool CheckException (TypeReference type) { if (type == null) return false; switch (type.Name) { case "ExecutionEngineException": case "IndexOutOfRangeException": case "NullReferenceException": case "OutOfMemoryException": return (type.Namespace == "System"); default: return false; } } protected override Severity Severity { get { return Severity.High; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/UseObjectDisposedExceptionRule.cs0000664000175000017500000002133312413742070033774 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.UseObjectDisposedExceptionRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Exceptions { /// /// It's usually a very bad idea to attempt to use an object after it has been /// disposed. Doing so may lead to crashes in native code or any number of /// other problems. In order to prevent this, and to report the problem in /// a clear way, classes should throw System.ObjectDisposedException from /// public methods if the object has been disposed. /// /// Note that there are some methods which should not throw ObjectDisposedException. /// This includes constructors, finalizers, Equals, GetHashCode, ToString, and Dispose. /// /// /// Bad example: /// /// internal sealed class WriteStuff : IDisposable /// { /// public WriteStuff (TextWriter writer) /// { /// this.writer = writer; /// } /// /// // Objects are generally not in a useable state after being disposed so /// // their public methods should throw ObjectDisposedException. /// public void Write (string message) /// { /// writer.Write (message); /// } /// /// public void Dispose () /// { /// if (!disposed) { /// writer.Dispose (); /// disposed = true; /// } /// } /// /// private bool disposed; /// private TextWriter writer; /// } /// /// /// /// Good example: /// /// internal sealed class WriteStuff : IDisposable /// { /// public WriteStuff (TextWriter writer) /// { /// this.writer = writer; /// } /// /// // In general all public methods should throw ObjectDisposedException /// // if Dispose has been called. /// public void Write (string message) /// { /// if (disposed) { /// throw new ObjectDisposedException (GetType ().Name); /// } /// /// writer.Write (message); /// } /// /// public void Dispose () /// { /// if (!disposed) { /// writer.Dispose (); /// disposed = true; /// } /// } /// /// private bool disposed; /// private TextWriter writer; /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("A method of an IDisposable type does not throw System.ObjectDisposedException.")] [Solution ("Throw ObjectDisposedException if the object has been disposed.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class UseObjectDisposedExceptionRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // Don't want to count the code generated by yield statements. if (method.IsGeneratedCode ()) return RuleResult.DoesNotApply; if (Preflight (method)) { Log.WriteLine (this); Log.WriteLine (this, "-----------------------------------------"); Log.WriteLine (this, method); call_using_this = false; field_access_using_this = false; creates_exception = false; has_dispose_check = false; CheckBody (method); if ((call_using_this || field_access_using_this) && !creates_exception) { if (!has_dispose_check) { Runner.Report (method, Severity.Medium, Confidence.High); } } } return Runner.CurrentRuleResult; } private void CheckBody (MethodDefinition method) { TypeReference type = method.DeclaringType; string nspace = type.Namespace; string name = type.Name; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference target = (MethodReference) ins.Operand; if (!call_using_this) { MethodDefinition callee = target.Resolve (); if (callee != null) { if (!callee.IsPublic && !callee.IsStatic) { if (callee.DeclaringType.IsNamed (nspace, name)) { Instruction instance = ins.TraceBack (method); if (instance != null && instance.OpCode.Code == Code.Ldarg_0) { Log.WriteLine (this, "found non-public this call at {0:X4}", ins.Offset); call_using_this = true; } } } } } // Special case for helper methods like CheckIfClosedThrowDisposed or // CheckObjectDisposedException. if (!has_dispose_check) { string tname = target.Name; if (tname.Contains ("Check") && tname.Contains ("Dispose")) { Log.WriteLine (this, "found dispose check at {0:X4}", ins.Offset); has_dispose_check = true; } } break; case Code.Ldfld: case Code.Stfld: case Code.Ldflda: if (!field_access_using_this) { FieldReference field = (FieldReference) ins.Operand; if (field.DeclaringType.IsNamed (nspace, name)) { Instruction instance = ins.TraceBack (method); if (instance != null && instance.OpCode.Code == Code.Ldarg_0) { Log.WriteLine (this, "found field access at {0:X4}", ins.Offset); field_access_using_this = true; } } } break; case Code.Newobj: if (!creates_exception) { MethodReference ctor = (MethodReference) ins.Operand; if (ctor.DeclaringType.IsNamed ("System", "ObjectDisposedException")) { Log.WriteLine (this, "creates exception at {0:X4}", ins.Offset); creates_exception = true; } } break; } } } // Skip methods which we don't want to examine in detail. Note that this // will skip methods which don't call a method or touch a field. This is done // to eliminate annoying cases like methods that do nothing but throw // something like a not implemented exception. static bool Preflight (MethodDefinition method) { bool needs = false; if (method.IsPublic) { if (OpCodeEngine.GetBitmask (method).Intersect (CallsAndFields)) { if (method.DeclaringType.Implements ("System", "IDisposable")) { if (AllowedToThrow (method)) { needs = true; } } } } return needs; } // Note that auto-setters are considered to be generated code so we won't // make it this far for them. static bool AllowedToThrow (MethodDefinition method) { if (method.IsConstructor) return false; if (MethodSignatures.Finalize.Matches (method)) return false; if (method.IsGetter) return false; if (method.IsAddOn || method.IsRemoveOn || method.IsFire) return false; if (Equals1.Matches (method)) return false; if (MethodSignatures.GetHashCode.Matches (method)) return false; if (MethodSignatures.ToString.Matches (method)) return false; if (Close.Matches (method)) return false; if (method.Name == "Dispose") return false; return true; } #if false private void Bitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Call); mask.Set (Code.Callvirt); mask.Set (Code.Ldfld); mask.Set (Code.Ldflda); mask.Set (Code.Stfld); mask.Set (Code.Newobj); Console.WriteLine (mask); } #endif private static readonly OpCodeBitmask CallsAndFields = new OpCodeBitmask (0x8000000000, 0x704400000000000, 0x0, 0x0); private static readonly MethodSignature Equals1 = new MethodSignature ("Equals", "System.Boolean", new string [1]); private static readonly MethodSignature Close = new MethodSignature ("Close", "System.Void", new string [0]); private bool call_using_this; private bool field_access_using_this; private bool creates_exception; private bool has_dispose_check; } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/DoNotThrowInUnexpectedLocationRule.cs0000664000175000017500000004565112413742070034624 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.DoNotThrowInUnexpectedLocationRule // // Authors: // Jesse Jones // Sebastien Pouliot // // Copyright (C) 2008 Jesse Jones // 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.Globalization; using System.Text; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace Gendarme.Rules.Exceptions { /// /// There are a number of methods which have constraints on the exceptions /// which they may throw. This rule checks the following methods: /// /// /// Property getters - properties should work very much /// like fields: they should execute very quickly and, in general, should /// not throw exceptions. However they may throw System.InvalidOperationException, /// System.NotSupportedException, or an exception derived from these. /// Indexed getters may also throw System.ArgumentException or /// System.Collections.Generic.KeyNotFoundException. /// /// /// Event accessors - in general events should not throw /// when adding or removing a handler. However they may throw /// System.InvalidOperationException, System.NotSupportedException, /// System.ArgumentException, or an exception derived from these. /// /// /// Object.Equals and IEqualityComparer<T>.Equals - should /// not throw. In particular they should do something sensible when passed /// null arguments or unexpected types. /// /// /// Object.GetHashCode - should not throw or the object /// will not work properly with dictionaries and hash sets. /// /// /// IEqualityComparer<T>.GetHashCode - may throw /// System.ArgumentException. /// /// /// Object.ToString - these are called by the debugger to display /// objects and are also often used with printf style debugging so they should /// not change the object's state and should not throw. /// /// /// static constructors - should very rarely throw. If they /// do throw then the type will not be useable within that application /// domain. /// /// /// finalizers - should not throw. If they do (as of .NET 2.0) /// the process will be torn down. /// /// /// IDisposable.Dispose - should not throw. If they do /// it's much harder to guarantee that objects clean up properly. /// /// /// Dispose (bool) - should not throw because that makes /// it very difficult to clean up objects and because they are often /// called from a finalizer. /// /// /// operator== and operator!= - should not throw. In particular /// they should do something sensible when passed null arguments or /// unexpected types. /// /// /// implicit cast operators - should not throw. These methods /// are called implicitly so it tends to be quite surprising if they throw /// exceptions. /// /// /// TryParse methods - should not throw. These methods /// are designed to be executed without having to catch multiple exceptions /// (unlike the Parse methods). /// /// /// Note that the rule does not complain if a method throws /// System.NotImplementedException because /// DoNotForgetNotImplementedMethodsRule will flag them. Also the rule /// may fire with anonymous types with gmcs versions prior to 2.2, see /// [https://bugzilla.novell.com/show_bug.cgi?id=462622] for more details. /// /// /// Bad example: /// /// public override bool Equals (object obj) /// { /// if (obj == null) { /// return false; /// } /// /// Customer rhs = (Customer) obj; // throws if obj is not a Customer /// return name == rhs.name; /// } /// /// /// /// Good example: /// /// public override bool Equals (object obj) /// { /// Customer rhs = obj as Customer; /// if (rhs == null) { /// return false; /// } /// /// return name == rhs.name; /// } /// /// /// This rule is available since Gendarme 2.4 // http://msdn.microsoft.com/en-us/library/bb386039.aspx [Problem ("A method throws an exception it should not.")] [Solution ("Change the code so that it does not throw, throws a legal exception, or traps exceptions.")] [FxCopCompatibility ("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")] [EngineDependency (typeof (OpCodeEngine))] public sealed class DoNotThrowInUnexpectedLocationRule : Rule, IMethodRule { private static readonly OpCodeBitmask Throwers = new OpCodeBitmask (0x0, 0x80C8000000000000, 0x3FC17FC000001FF, 0x0); private static readonly OpCodeBitmask OverflowThrowers = new OpCodeBitmask (0x0, 0x8000000000000000, 0x3FC07F8000001FF, 0x0); private static readonly OpCodeBitmask Casts = new OpCodeBitmask (0x0, 0x48000000000000, 0x400000000, 0x0); private static readonly string [][] GetterExceptions = new string [][] { new string [] { "System", "InvalidOperationException" }, new string [] { "System", "NotSupportedException"} }; private static readonly string [][] IndexerExceptions = new string [][] { new string [] { "System", "InvalidOperationException" }, new string [] { "System", "NotSupportedException" }, new string [] { "System", "ArgumentException" }, new string [] { "System.Collections.Generic", "KeyNotFoundException" } }; private static readonly string [][] EventExceptions = new string [][] { new string [] { "System", "InvalidOperationException" }, new string [] { "System", "NotSupportedException" }, new string [] { "System", "ArgumentException" } }; private static readonly string [][] HashCodeExceptions = new string [][] { new string [] { "System", "ArgumentException" } }; private static bool CheckAttributes (MethodReference method, MethodAttributes attrs) { MethodDefinition md = method.Resolve (); return ((md == null) || ((md.Attributes & attrs) == attrs)); } private static MethodSignature EqualityComparer_Equals = new MethodSignature ("Equals", "System.Boolean", new string [2], (method) => (CheckAttributes (method, MethodAttributes.Public))); private static MethodSignature EqualityComparer_GetHashCode = new MethodSignature ("GetHashCode", "System.Int32", new string [1], (method) => (CheckAttributes (method, MethodAttributes.Public))); private static readonly MethodSignature GetTypeSig = new MethodSignature ("GetType", "System.Type", new string [0], (method) => (CheckAttributes (method, MethodAttributes.Public))); private MethodSignature equals_signature; private MethodSignature hashcode_signature; private string [][] allowedExceptions; private Severity severity; private bool is_equals; public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeType += delegate (object sender, RunnerEventArgs e) { if (e.CurrentType.Implements ("System.Collections.Generic", "IEqualityComparer`1")) { equals_signature = EqualityComparer_Equals; hashcode_signature = EqualityComparer_GetHashCode; } else { equals_signature = null; hashcode_signature = null; } }; } static bool HasCatchBlock (MethodBody body) { if (!body.HasExceptionHandlers) return false; foreach (ExceptionHandler handler in body.ExceptionHandlers) { if (handler.HandlerType == ExceptionHandlerType.Catch) return true; } return false; } private string PreflightMethod (MethodDefinition method) { if (method.IsSpecialName) { return PreflightSpecialNameMethod (method); } else if (method.IsVirtual) { return PreflightVirtualMethod (method); } else if (method.HasParameters && (method.Name == "Dispose")) { IList pdc = method.Parameters; if ((pdc.Count == 1) && pdc [0].ParameterType.IsNamed ("System", "Boolean")) return "Dispose (bool)"; } else if (MethodSignatures.TryParse.Matches (method)) { return "TryParse"; } return String.Empty; } private string PreflightSpecialNameMethod (MethodDefinition method) { if (method.IsConstructor && method.IsStatic) return "Static constructors"; string name = method.Name; if (name == "get_Item") { severity = Severity.Medium; allowedExceptions = IndexerExceptions; return "Indexed getters"; } else if (method.IsGetter) { severity = Severity.Medium; allowedExceptions = GetterExceptions; return "Property getters"; } else if (method.IsAddOn || method.IsRemoveOn) { severity = Severity.Medium; allowedExceptions = EventExceptions; return "Event accessors"; } else if (MethodSignatures.op_Equality.Matches (method)) { return "operator=="; } else if (MethodSignatures.op_Inequality.Matches (method)) { return "operator!="; } else if (name == "op_Implicit") { return "Implicit cast operators"; } return String.Empty; } private string PreflightVirtualMethod (MethodDefinition method) { if (MethodSignatures.ToString.Matches (method)) { return "Object.ToString"; // these names should match those used within the rule description } else if (MethodSignatures.Equals.Matches (method)) { is_equals = true; return "Object.Equals"; } else if (MethodSignatures.GetHashCode.Matches (method)) { return "Object.GetHashCode"; } else if (MethodSignatures.Finalize.Matches (method)) { return "Finalizers"; } else if (MethodSignatures.Dispose.Matches (method) || MethodSignatures.DisposeExplicit.Matches (method)) { if (method.DeclaringType.Implements ("System", "IDisposable")) return "IDisposable.Dispose"; } else if (equals_signature != null && equals_signature.Matches (method)) { return "IEqualityComparer.Equals"; } else if (hashcode_signature != null && hashcode_signature.Matches (method)) { allowedExceptions = HashCodeExceptions; return "IEqualityComparer.GetHashCode"; } return String.Empty; } // It's not always apparent why the code throws so we'll try to explain // the reason here (for example foreach can generate castclass or unbox // instructions and assemblies compiled with checked arithmetic can // throw even if the code doesn't explicitly use an arithmetic operator). static string ExplainThrow (Instruction ins) { switch (ins.OpCode.Code) { case Code.Castclass: return String.Format (CultureInfo.InvariantCulture, " (cast to {0})", ((TypeReference) ins.Operand).Name); case Code.Throw: // this one is obvious return string.Empty; case Code.Unbox: case Code.Unbox_Any: return String.Format (CultureInfo.InvariantCulture, " (unbox from {0})", ((TypeReference) ins.Operand).Name); case Code.Ckfinite: return " (the expression will throw if the value is a NAN or an infinity)"; default: Debug.Assert (ins.OpCode.Name.Contains (".ovf"), "expected an overflow opcode, not " + ins.OpCode.Name); return " (checked arithmetic is being used)"; } } static bool AreCastsOk (Instruction ins) { switch (ins.OpCode.Code) { case Code.Isinst: return true; case Code.Call: case Code.Callvirt: return GetTypeSig.Matches (ins.Operand as MethodReference); default: return false; } } private void ProcessMethod (MethodDefinition method, string methodLabel) { bool casts_are_ok = false; foreach (Instruction ins in method.Body.Instructions) { if (is_equals && !casts_are_ok) casts_are_ok = AreCastsOk (ins); Code code = ins.OpCode.Code; if (Throwers.Get (code)) { // A few instructions are bad to the bone. if (code == Code.Ckfinite) { Report (method, ins, methodLabel); // If the instruction is castclass or unbox then we may have a // problem, but only within Object.Equals (casts occur way too // often to flag them everywhere, but it's common mistake to // cast the Equals argument without an is or GetType check). } else if (Casts.Get (code)) { if (is_equals && !casts_are_ok) Report (method, ins, methodLabel); // If the instruction is a checked math instruction then we have // a problem, but only in GetHashCode methods (they are // potential problems elsewhere but the likelihood of an actual // problem is much higher in hash code methods and there are // too many defects if we flag them everywhere). } else if (OverflowThrowers.Get (code)) { if (method.Name == "GetHashCode") Report (method, ins, methodLabel); // If the instruction is a throw, } else if (code == Code.Throw) { // and is throwing NotImplementedException then it is OK (this // is a fairly common case and we'll let DoNotForgetNotImplementedMethodsRule // handle it). if (ins.Previous.Is (Code.Newobj)) { MethodReference mr = (MethodReference) ins.Previous.Operand; TypeReference tr = mr.DeclaringType; if (tr.IsNamed ("System", "NotImplementedException") || tr.Inherits ("System", "NotImplementedException")) continue; } // If the method doesn't allow any exceptions then we have a // problem. if (allowedExceptions == null) Report (method, ins, methodLabel); // If the throw does not one of the enumerated exceptions (or // a subclass) then we have a problem. else if (ins.Previous.Is (Code.Newobj)) { TypeReference type = (ins.Previous.Operand as MethodReference ).DeclaringType; bool allowed = false; foreach (string[] entry in allowedExceptions) { if (type.IsNamed (entry [0], entry [1])) allowed = true; } if (!allowed) { foreach (string [] entry in allowedExceptions) { if (type.Inherits (entry [0], entry [1])) { allowed = true; break; } } } if (!allowed) Report (method, ins, methodLabel); } } } } } private void Report (MethodDefinition method, Instruction ins, string methodLabel) { string mesg; if (allowedExceptions == null) { mesg = String.Format (CultureInfo.InvariantCulture, "{0} should not throw{1}.", methodLabel, ExplainThrow (ins)); } else { StringBuilder sb = new StringBuilder (); sb.Append (methodLabel).Append (" should only throw "); for (int i = 0; i < allowedExceptions.Length; i++) { string [] entry = allowedExceptions [i]; sb.Append (entry [0]).Append ('.').Append (entry [1]); if (i < allowedExceptions.Length - 1) sb.Append (", "); } sb.Append (" or a subclass").Append (ExplainThrow (ins)).Append ('.'); mesg = sb.ToString (); } Log.WriteLine (this, "{0:X4}: {1}", ins.Offset, mesg); Runner.Report (method, ins, severity, Confidence.High, mesg); } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!Throwers.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; if (!HasCatchBlock (method.Body)) { // default severity for (most) methods severity = Severity.High; // by default no exceptions are allowed allowedExceptions = null; // special case for Equals is_equals = false; string method_label = PreflightMethod (method); if (method_label.Length > 0) { Log.WriteLine (this); Log.WriteLine (this, "-------------------------------------------"); Log.WriteLine (this, method); ProcessMethod (method, method_label); } } return Runner.CurrentRuleResult; } #if false // Note that none of these instructions throw an exception that is // ever allowed. private static readonly Code [] AlwaysBad = new Code [] { Code.Ckfinite, // throws ArithmeticException }; private static readonly Code [] Casts = new Code [] { Code.Castclass, // throws InvalidCastException Code.Unbox, // throws InvalidCastException or NullReferenceException Code.Unbox_Any, // throws InvalidCastException or NullReferenceException }; private static readonly Code [] Overflow = new Code [] { Code.Add_Ovf, // throws OverflowException Code.Mul_Ovf, Code.Sub_Ovf, Code.Add_Ovf_Un, Code.Mul_Ovf_Un, Code.Sub_Ovf_Un, Code.Conv_Ovf_I1_Un, Code.Conv_Ovf_I2_Un, Code.Conv_Ovf_I4_Un, Code.Conv_Ovf_I8_Un, Code.Conv_Ovf_U1_Un, Code.Conv_Ovf_U2_Un, Code.Conv_Ovf_U4_Un, Code.Conv_Ovf_U8_Un, Code.Conv_Ovf_I_Un, Code.Conv_Ovf_U_Un, Code.Conv_Ovf_I1, Code.Conv_Ovf_U1, Code.Conv_Ovf_I2, Code.Conv_Ovf_U2, Code.Conv_Ovf_I4, Code.Conv_Ovf_U4, Code.Conv_Ovf_I8, Code.Conv_Ovf_U8, Code.Conv_Ovf_I, Code.Conv_Ovf_U, }; public void GenerateBitmask () { OpCodeBitmask throwers = new OpCodeBitmask (); OpCodeBitmask alwaysBad = new OpCodeBitmask (); OpCodeBitmask overflow = new OpCodeBitmask (); OpCodeBitmask casts = new OpCodeBitmask (); foreach (Code code in AlwaysBad) { throwers.Set (code); alwaysBad.Set (code); } foreach (Code code in Casts) { casts.Set (code); throwers.Set (code); } throwers.Set (Code.Throw); foreach (Code code in Overflow) { throwers.Set (code); overflow.Set (code); } Console.WriteLine ("throwers: {0}", throwers); Console.WriteLine ("alwaysBad: {0}", alwaysBad); Console.WriteLine ("overflow: {0}", overflow); Console.WriteLine ("casts: {0}", casts); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Gendarme.Rules.Exceptions.csproj0000664000175000017500000001473412413742070033544 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {BDDBA1F9-061B-45BE-86B5-98571F7B0383} Library Properties Gendarme.Rules.Exceptions Gendarme.Rules.Exceptions 3.5 true v4.0 http://localhost/Gendarme.Rules.Exceptions/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Exceptions.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 ..\..\console\bin\Release\Gendarme.Rules.Exceptions.xml 1591 1570 AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/InstantiateArgumentExceptionCorrectlyRule.cs0000664000175000017500000001674512413742070036306 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.InstantiateArgumentExceptionCorrectlyRule // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2008 Néstor Salceda // Copyright (C) 2008,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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Exceptions { /// /// This rule will fire if the arguments to the System.ArgumentException, /// System.ArgumentNullException, System.ArgumentOutOfRangeException, /// and System.DuplicateWaitObjectException constructors are used incorrectly. /// This is a common mistake because the position of the parameterName argument /// is not consistent across these types. /// /// /// Bad example: /// /// public void Show (string s) /// { /// if (s == null) { /// // the first argument should be the parameter name /// throw new ArgumentNullException ("string is null", "s"); /// } /// if (s.Length == 0) { /// // the second argument should be the parameter name /// return new ArgumentException ("s", "string is empty"); /// } /// Console.WriteLine (s); /// } /// /// /// /// Good example: /// /// public void Show (string s) /// { /// if (s == null) { /// throw new ArgumentNullException ("s", "string is null"); /// } /// if (s.Length == 0) { /// return new ArgumentException ("string is empty", "s"); /// } /// Console.WriteLine (s); /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("This method throws ArgumentException (or derived) exceptions without specifying an existing parameter name. This can hide useful information to developers.")] [Solution ("Fix the exception parameters to use the correct parameter name (or make sure the parameters are in the right order).")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly")] public class InstantiateArgumentExceptionCorrectlyRule : Rule, IMethodRule { static bool MatchesAnyParameter (MethodReference method, string operand) { if (operand == null) return false; // for most getter and setter the property name is used if (method.IsProperty ()) { if (String.Compare (method.Name, 4, operand, 0, operand.Length, StringComparison.Ordinal) == 0) return true; // but we continue looking for parameters (e.g. indexers) unless it's the generic 'value' string if (operand == "value") return false; } // note: we already know there are Parameters for this method is we got here foreach (ParameterDefinition parameter in method.Parameters) { if (parameter.Name == operand) return true; } return false; } private void Report (MethodDefinition method, Instruction ins, string name) { Severity severity = ((name == "value") && method.IsProperty () && !method.Name.EndsWith ("value", StringComparison.InvariantCultureIgnoreCase)) ? Severity.Low : Severity.High; Runner.Report (method, ins, severity, Confidence.Normal); } private void CheckArgumentException (IMethodSignature ctor, Instruction ins, MethodDefinition method) { // OK public ArgumentException () if (!ctor.HasParameters) return; // OK public ArgumentException (string message) IList pdc = ctor.Parameters; if (pdc.Count < 2) return; // OK public ArgumentException (string message, Exception innerException) if (!pdc [1].ParameterType.IsNamed ("System", "String")) return; // CHECK public ArgumentException (string message, string paramName) // CHECK public ArgumentException (string message, string paramName, Exception innerException) Instruction call = ins.TraceBack (method, -1); string name = call.Operand as string; if (MatchesAnyParameter (method, name)) return; Report (method, ins, name); } // ctors are identical for ArgumentNullException, ArgumentOutOfRangeException and DuplicateWaitObjectException private void CheckOtherExceptions (IMethodSignature constructor, Instruction ins, MethodDefinition method) { // OK public ArgumentNullException () if (!constructor.HasParameters) return; // OK protected ArgumentNullException (SerializationInfo info, StreamingContext context) // OK public ArgumentNullException (string message, Exception innerException) IList pdc = constructor.Parameters; if ((pdc.Count == 2) && !pdc [1].ParameterType.IsNamed ("System", "String")) return; // CHECK public ArgumentNullException (string paramName) // CHECK public ArgumentNullException (string paramName, string message) Instruction call = ins.TraceBack (method, 0); // call will be null if there is branching logic in the selection of a message - just fon't check in this case if (call == null) return; string name = call.Operand as string; if (MatchesAnyParameter (method, name)) return; Report (method, ins, name); } public RuleResult CheckMethod (MethodDefinition method) { // if method has no IL, the rule doesn't apply if (!method.HasBody) return RuleResult.DoesNotApply; // don't process methods without parameters unless it's a special method (e.g. a property) // this cover cases like "if (x == null) CallLocalizedThrow();" and the inner type compilers // generates for yield/iterator (a field is used) if (!method.IsSpecialName && !method.HasParameters) return RuleResult.DoesNotApply; // and when the IL contains a NewObj instruction if (!OpCodeEngine.GetBitmask (method).Get (Code.Newobj)) return RuleResult.DoesNotApply; foreach (Instruction current in method.Body.Instructions) { if (current.OpCode.Code != Code.Newobj) continue; MethodReference ctor = (current.Operand as MethodReference); TypeReference type = ctor.DeclaringType; if (type.Namespace != "System") continue; switch (type.Name) { case "ArgumentException": CheckArgumentException (ctor, current, method); break; case "ArgumentNullException": case "ArgumentOutOfRangeException": case "DuplicateWaitObjectException": CheckOtherExceptions (ctor, current, method); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/0000775000175000017500000000000012642235742026304 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/UseObjectDisposedExceptionTest.cs0000664000175000017500000001076012413742070034725 0ustar00directhexdirecthex00000000000000// // Unit tests for UseObjectDisposedExceptionRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public sealed class UseObjectDisposedExceptionTest : MethodRuleTestFixture { internal sealed class Good1 : IDisposable { // Has a throw. public void Write (string message) { if (disposed) throw new ObjectDisposedException (GetType ().Name); DoSomething (); } // Doesn't call any members or touch any fields. public void WriteA (string message) { Console.WriteLine ("fee fie fum"); } // Simple forwarder. public void WriteB (string message) { Write (message + '\n'); } // Does not need a throw. public void Dispose () { DoSomething (); } public event EventHandler Closed; // These are not public. internal void Write2 (string message) { DoSomething (); } protected void Write3 (string message) { DoSomething (); } private void Write4 (string message) { DoSomething (); } internal bool disposed; private void DoSomething () { } } internal sealed class Good2 { // Not disposable. public void Write (string message) { DoSomething (); } private void DoSomething () { } } // None of these methods should throw ObjectDisposedException. internal sealed class Good3 : IDisposable { // OK to just call a static method. public void Write (string message) { DoStaticSomething (); } // OK to call a non-this method. public void Write (Good3 other, string message) { other.Write (message); } // OK to access non-this field. public void Write (Good3 other) { Console.WriteLine (other.flag); } // Special case for methods which use a helper to throw // ObjectDisposedException. public void Write2 () { CheckIfClosedThrowDisposed (); DoSomething (); } public void Close () { DoSomething (); } public void Dispose () { } internal bool disposed; public void Write3 (string message) { if (disposed) throw new ObjectDisposedException (GetType ().Name); DoSomething (); } private void CheckIfClosedThrowDisposed () { if (disposed) throw new ObjectDisposedException (GetType ().Name); } private void DoSomething () { } private static void DoStaticSomething () { } internal bool flag; } internal sealed class Bad1 : IDisposable { // Missing throw. public void Write (string message) { DoSomething (); } // Missing throw. public bool Flag { set { flag = value; } } public void Dispose () { DoSomething (); } internal bool disposed; private void DoSomething () { } private bool flag; } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } [Test] public void Test () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure ("Write"); AssertRuleFailure ("set_Flag"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/ChangeLog0000664000175000017500000001326512413742070030056 0ustar00directhexdirecthex000000000000002010-06-09 Sebastien Pouliot * DoNotThrowInUnexpectedLocationTest.cs: Instruct TestRunner to fire Analyze* events 2010-05-01 Sebastien Pouliot * DontDestroyStackTraceTest.cs: Add test case with an empty method and one where the exception local is overwritten by another exception 2010-01-27 Sebastien Pouliot * DoNotThrowInUnexpectedLocationTest.cs: Add test cases for every locations and all opcodes - except ckfinite which, afaik, is never generated from the C# compiler. 2010-01-04 Sebastien Pouliot * InstantiateArgumentExceptionCorrectlyTest.cs: Add test case for indexers and be more precise (check severity) for "value". 2009-03-15 Jesse Jones * UseObjectDisposedExceptionTest.cs: Added new rule. 2009-02-15 Sebastien Pouliot * DoNotThrowInUnexpectedLocationTest.cs: TestFixture must be public 2008-12-30 Jesse Jones * DoNotThrowInUnexpectedLocationTest.cs: Added. 2008-12-30 Sebastien Pouliot * DontSwallowErrorsCatchingNonspecificExceptionsTest.cs: Add a few test cases with goto and conditionals to (unsuccessfully) find a root cause for #458173 (but we already have a workaround in place). * InstantiateArgumentExceptionCorrectlyTest.cs: Add a few test cases to simulate (unsuccessfully again) a reported false positive. 2008-11-07 Alan McGovern * Tests.Rules.Exceptions.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-28 Sebastien Pouliot * InstantiateArgumentExceptionCorrectlyTest.cs: Add two test cases. One where yield/iterator is being used (this construct an inner type where the exception is throw, based on a field, in a MoveNext() parameter-less method). Second one where a check is done locally but the exception is throw elsewhere (e.g. to share localization logic). 2008-09-06 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorTest.cs: Change result for methods that do not create objects (DoesNotApply). * AvoidThrowingBasicExceptionsTest.cs: Change result for methods that do not create objects (DoesNotApply). * DontDestroyStackTraceTest.cs: Update to the new, short, unit test syntax. Add more tests for better coverage. * DontSwallowErrorsCatchingNonspecificExceptionsTest.cs: Update to the new, short, unit test syntax. * InstantiateArgumentExceptionCorrectlyTest.cs: Add test cases for method returning all targeted exceptions (from all constructors). Remove Ignore from one test. Add more test for properties. 2008-08-16 Néstor Salceda * InstantiateArgumentExceptionCorrectlyTest.cs: Added a test for the false positive found when the message is loaded from a local. 2008-08-15 Néstor Salceda * InstantiateArgumentExceptionCorrectlyTest.cs: New. Unit tests for InstantiateArgumentExceptionCorrectlyRule. 2008-06-25 Sebastien Pouliot * DoNotThrowReservedExceptionTest.cs: New. Unit tests for DoNotThrowReservedExceptionRule. * Test.Rules.Exceptions.mdp: Update MD project file. 2008-05-26 Daniel Abramov * AvoidThrowingBasicExceptionsTest.cs: New. Unit tests for AvoidThrowingBasicExceptionsRule. * Test.Rules.Exceptions.mdp, Tests.Rules.Exceptions.csproj: Update project files. 2008-04-26 Sebastien Pouliot * MissingExceptionConstructorsTest.cs: New. Unit tests for MissingExceptionConstructorsRule. 2008-04-26 Sebastien Pouliot * ExceptionShouldBeVisibleTest.cs: New. Unit tests for ExceptionShouldBeVisibleRule. 2008-04-06 Sebastien Pouliot * AvoidArgumentExceptionDefaultConstructorTest.cs: New. Unit tests for AvoidArgumentExceptionDefaultConstructorRule. * Test.Rules.Exceptions.mdp: Add tests to MD project file. 2008-04-06 Sebastien Pouliot * DontDestroyStackTraceTest.cs: Rename to DoNotDestroyStackTrace [Rule|Test] 2008-02-15 Sebastien Pouliot * DontDestroyStackTraceTest.cs: (renamed from TestPatterns.cs) * DontSwallowErrorsCatchingNonspecificExceptionsTest.cs: Update unit tests wrt framework changes. 2007-10-07 Sebastien Pouliot * Test.Rules.Exeptions.mdp: Update project file. 2007-09-24 Nestor Salceda * DontSwallowErrorsCatchingNonspecificExceptionsTest.cs: Change rule name for adhere to coding guidelines. With this change, the rule information in the xml file will be shown. 2007-09-01 Nestor Salceda * DontSwallowErrorsCatchingNonspecificExceptionsTest.cs: New. Unit tests for DontSwallowErrorsCatchingNonSpecificExceptionsRule. 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-28 Christian Birkl * TestPatterns.cs: Migrated untyped IList messages collection to typed MessageCollection class. 2006-09-20 Jonathan Chambers * Test.Rules.Exeptions.csproj: Make reference to nunit.framework not a specific version for portability. 2006-07-31 Sebastien Pouliot * Test.Rules.Exeptions.mdp: New. Project file for MonoDevelop. * TestPatterns.cs: Renamed namespace and class to match other existing unit tests. Fixed some compiler warnings. 2006-06-19 Russell Morris * Initial import of exception-management rule assembly mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/DontDestroyStackTraceTest.cs0000664000175000017500000001341012413742070033706 0ustar00directhexdirecthex00000000000000// // Unit Test for DontDestroyStackTraceTest Rule // // 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; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public class DoNotDestroyStackTraceTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void ThrowOriginalEx () { try { Int32.Parse("Broken!"); } catch (Exception ex) { // Throw exception immediately. // This should trip the DontDestroyStackTrace rule. throw ex; } } [Test] public void TestThrowOriginalEx () { AssertRuleFailure ("ThrowOriginalEx", 1); } public void ThrowOriginalExWithJunk () { try { Int32.Parse ("Broken!"); } catch (Exception ex) { int j = 0; for (int k=0; k<10; k++) { // throw some junk into the catch block, to ensure that j += 10; Console.WriteLine (j); } // This should trip the DontDestroyStackTrace rule, because we're // throwing the original exception. throw ex; } } [Test] public void TestThrowOriginalExWithJunk () { AssertRuleFailure ("ThrowOriginalExWithJunk", 1); } public void RethrowOriginalEx () { try { Int32.Parse ("Broken!"); } catch (Exception ex) { // avoid compiler warning Assert.IsNotNull (ex); // This should NOT trip the DontDestroyStackTrace rule, because we're // rethrowing the original exception. throw; } } [Test] public void TestRethrowOriginalEx () { // no throw instruction is present in this method (its a rethrow) AssertRuleDoesNotApply ("RethrowOriginalEx"); } public void ThrowOriginalExAndRethrowWithJunk () { int i = 0; try { i = Int32.Parse ("Broken!"); } catch (Exception ex) { int j = 0; for (int k=0; k<10; k++) { // throw some junk into the catch block, to ensure that j += 10; Console.WriteLine (j); if ((i % 1234) > 56) { // This should trip DontDestroyStackTraceRule, because we're // throwing the original exception. throw ex; } } // More junk - just to ensure that alternate paths through // this catch block end up at a throw and a rethrow throw; } } [Test] public void TestThrowOriginalExAndRethrowWithJunk () { AssertRuleFailure ("ThrowOriginalExAndRethrowWithJunk", 1); } public void RethrowOriginalExAndThrowWithJunk () { int i = 0; try { i = Int32.Parse ("Broken!"); } catch (Exception ex) { int j = 0; for (int k=0; k<10; k++) { // throw some junk into the catch block, to ensure that j += 10; Console.WriteLine (j); if ((i % 1234) > 56) { // More junk - just to ensure that alternate paths through // this catch block end up at a throw and a rethrow throw; } } // This should trip the DontDestroyStackTrace rule, because we're // throwing the original exception. throw ex; } } [Test] public void TestRethrowOriginalExAndThrowWithJunk () { AssertRuleFailure ("RethrowOriginalExAndThrowWithJunk", 1); } public void ThrowNewExceptionUsingSameOldLocal () { try { Int32.Parse ("Broken!"); } catch (Exception ex) { // we deliberately choose to create a new exception ex = new InvalidOperationException ("uho"); throw ex; } } public void ThrowNewExceptionUsingSameOldLocal_WithParameter () { try { Int32.Parse ("Broken!"); } catch (Exception ex) { // we deliberately choose to create a new exception ex = new InvalidOperationException ("uho", ex); throw ex; } } [Test] public void TestThrowNewExceptionUsingSameOldLocal () { AssertRuleSuccess ("ThrowNewExceptionUsingSameOldLocal"); AssertRuleSuccess ("ThrowNewExceptionUsingSameOldLocal_WithParameter"); } // test case from bnc #668925 // https://github.com/Iristyle/mono-tools/commit/5516987609de6fdd40f24b91281e95a3b1457ea7 // CSC (at least for VS2008) put the ExceptionHandler.HandlerEnd past the last instruction (which cecil dislike) public void ThrowCatchThrowNew () { try { throw new NotImplementedException (); } catch (Exception) { throw new NotImplementedException (); } } [Test] public void TestThrowEatThrow () { AssertRuleSuccess ("ThrowCatchThrowNew"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/Tests.Rules.Exceptions.csproj0000664000175000017500000001472312413742070034041 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {AB493443-CE45-426F-8DE9-0F1D8EBC63AF} Library Properties Tests.Rules.Exceptions Tests.Rules.Exceptions 3.5 true v4.0 http://localhost/Tests.Rules.Exceptions/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {BDDBA1F9-061B-45BE-86B5-98571F7B0383} Gendarme.Rules.Exceptions False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/MissingExceptionConstructorsTest.cs0000664000175000017500000001257212413742070035414 0ustar00directhexdirecthex00000000000000// // Unit tests for MissingExceptionConstructorsRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.Serialization; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public class MissingExceptionConstructorsTest : TypeRuleTestFixture { [Test] public void NotAnException () { AssertRuleDoesNotApply (); } public class NoPublicCtorException : Exception { private NoPublicCtorException () { } } public class StaticCtorException : Exception { static StaticCtorException () { } private StaticCtorException (int error) { } } [Test] public void MissingAll () { AssertRuleFailure (4); AssertRuleFailure (4); } public class EmptyCtorException : Exception { public EmptyCtorException () { } } public class MessageCtorException : Exception { public MessageCtorException (string message) { } } public class MessageExtraCtorException : Exception { public MessageExtraCtorException (string message, string extra) { } } public class InnerCtorException : Exception { public InnerCtorException (string message, Exception inner) { } } public class InnerExtraCtorException : Exception { public InnerExtraCtorException (string message, string extra, Exception inner) { } } [Test] public void MissingSome () { AssertRuleFailure (3); AssertRuleFailure (3); AssertRuleFailure (3); AssertRuleFailure (3); AssertRuleFailure (3); } public class EmptyMessageCtorException : Exception { public EmptyMessageCtorException () { } public EmptyMessageCtorException (string message) { } } [Test] public void MissingHalf () { AssertRuleFailure (2); } public class MissinsEmptyCtorException : Exception { public MissinsEmptyCtorException (string message) { } public MissinsEmptyCtorException (string message, Exception inner) { } protected MissinsEmptyCtorException (SerializationInfo info, StreamingContext context) { } } public class MissinsStringCtorException : Exception { public MissinsStringCtorException () { } public MissinsStringCtorException (string message, Exception inner) { } private MissinsStringCtorException (SerializationInfo info, StreamingContext context) { } } public class MissinsInnerCtorException : Exception { public MissinsInnerCtorException () { } public MissinsInnerCtorException (string message) { } protected MissinsInnerCtorException (SerializationInfo info, StreamingContext context) { } } public class MissinsSerializationCtorException : Exception { public MissinsSerializationCtorException () { } public MissinsSerializationCtorException (string message) { } public MissinsSerializationCtorException (string message, Exception inner) { } } [Test] public void MissingOne () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } public class CompleteException : Exception { public CompleteException () { } public CompleteException (string message) { } public CompleteException (string message, Exception inner) { } protected CompleteException (SerializationInfo info, StreamingContext context) { } } public class CompleteExtraException : Exception { public CompleteExtraException () { } public CompleteExtraException (string message, string extra) { } public CompleteExtraException (string message, string extra, Exception inner) { } private CompleteExtraException (SerializationInfo info, StreamingContext context) { } } [Test] public void Complete () { AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/Makefile.in0000664000175000017500000003143612642235731030356 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Exceptions/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Exceptions.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Exceptions/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Exceptions/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/DoNotThrowInUnexpectedLocationTest.cs0000664000175000017500000003117312413742070035545 0ustar00directhexdirecthex00000000000000// // Unit test for DoNotThrowInUnexpectedLocationRule // // Authors: // Jesse Jones // Sebastien Pouliot // // Copyright (C) 2008 Jesse Jones // 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; using System.Collections.Generic; using System.Reflection; using Mono.Cecil; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Exceptions { [TestFixture] public sealed class DoNotThrowInUnexpectedLocationTest : MethodRuleTestFixture { public DoNotThrowInUnexpectedLocationTest () { // make sure OnAssembly / OnType / OnMethod are fired FireEvents = true; } private sealed class Inapplicable { public override string ToString () { return "Inapplicable"; // doesn't have an instruction which can throw } } private sealed class Good1 { public int State { get; set; } public override string ToString () { string result; try { if (State < 0) throw new Exception ("state is negative"); result = "Good1"; } catch (Exception e) { // has a catch block so the throw is OK result = e.Message; } return result; } } private sealed class Good2 : IEqualityComparer { public bool Equals (Good1 x, Good1 y) { return x.State == y.State; } public int GetHashCode (Good1 x) { if (x.State < 0) throw new ArgumentException ("state must be non-negative", "x"); // ok to throw ArgumentException here return x.State; } } private sealed class Good3 : IEqualityComparer { public bool Equals (Good1 x, Good1 y) { return x.State == y.State; } public int GetHashCode (Good1 x) { if (x.State < 0) throw new ArgumentOutOfRangeException ("x", "state must be non-negative"); // subclass of ArgumentException so OK return x.State; } } private sealed class Good4 { public int State { get; set; } public override bool Equals (object obj) { if (!(obj is Good4)) return false; Good4 rhs = (Good4) obj; // cast is OK when paired with isinst return State == rhs.State; } public override int GetHashCode () { if (State < 0) throw new ArgumentException ("oops"); // this is only allowed in IEqualityComparer return State; } } private sealed class Good5 { public int State { get; set; } public override string ToString () { int value = checked (State + 1000); // checked aithmetic is OK outside GetHashCode return value >= 0 ? "Good5" : "empty"; } } private sealed class Good6 { public override string ToString () { throw new NotImplementedException (); // NotImplementedException is OK everywhere } } private struct Good7 { public Good7 (int x, int y) { this.x = x; this.y = y; } public override bool Equals (object rhsObj) { if (rhsObj == null) return false; if (GetType () != rhsObj.GetType ()) return false; Good7 rhs = (Good7) rhsObj; // OK because of the GetType call return x == rhs.x && y == rhs.y; } public override int GetHashCode () { int hash; unchecked { hash = 3*x.GetHashCode () + 7*y.GetHashCode (); } return hash; } private int x, y; } private sealed class Good8 { public bool this [int index] { get { if (index < 0) throw new KeyNotFoundException (); // this is OK from indexers return index > 0; } } } private sealed class Bad1 { public int State { get; set; } public override string ToString () { if (State < 0) throw new Exception ("state is negative"); return "Bad1"; } } private sealed class Bad2 { public int State { get; set; } public override string ToString () { string result; try { if (State < 0) throw new Exception ("state is negative"); result = "Bad2"; } finally { // finally blocks allow the exception to escape so they are no good result = "oops"; } return result; } } private sealed class Bad3 { public string State { get; set; } public override string ToString () { if (State == null) throw new Exception ("oops"); // throws return State.Length >= 0 ? "Bad3" : "empty"; } } // no Bad4 private sealed class Bad5 { public int State { get; set; } public override bool Equals (object obj) { Bad5 rhs = obj as Bad5; if (rhs == null) return false; return State == rhs.State; } public override int GetHashCode () { return checked (State + 1000); // checked airthmetic is not OK within GetHashCode } } private sealed class Bad6 { public int State { get; set; } public override bool Equals (object obj) { if (obj == null) return false; Bad6 rhs = (Bad6) obj; // cast return State == rhs.State; } public override int GetHashCode () { return checked (State + 1000); } } private sealed class Bad7 : IEqualityComparer { public bool Equals (Good1 x, Good1 y) { return x.State == y.State; } public int GetHashCode (Good1 x) { if (x.State < 0) throw new NotSupportedException ("state must be non-negative"); // only ArgumentException is OK return x.State; } } private sealed class Bad8 : IEqualityComparer { public bool Equals (Good1 x, Good1 y) { if (x.State < 0) throw new Exception ("oops"); return x.State == y.State; } public int GetHashCode (Good1 x) { return x.State; } } private sealed class Bad9 { public int State { get; set; } public override bool Equals (object obj) { Bad9 rhs = obj as Bad9; if (rhs == null) return false; return State == rhs.State; } public override int GetHashCode () { if (State < 0) throw new ArgumentException ("oops"); // this is only allowed in IEqualityComparer return State; } } private sealed class Bad10 : IDisposable { public void Dispose () { if (disposed) throw new ObjectDisposedException (GetType ().Name); // throws Dispose (true); GC.SuppressFinalize (this); } private void Dispose (bool disposing) { if (!disposing) throw new Exception ("how did we get here?"); // throws disposed = true; } private bool disposed; } private sealed class Bad11 { public int State { get; set; } public static implicit operator int (Bad11 value) { if (value.State < 0) throw new ArgumentException ("oops"); // throws return value.State; } } private sealed class Bad12 { public bool this [int index] { get { if (index < 0) throw new ApplicationException (); // this is not OK return index > 0; } } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply ("ToString"); } [Test] public void Check () { AssertRuleSuccess ("ToString"); AssertRuleSuccess ("GetHashCode"); AssertRuleSuccess ("GetHashCode"); AssertRuleSuccess ("Equals"); AssertRuleSuccess ("ToString"); AssertRuleSuccess ("ToString"); AssertRuleSuccess ("Equals"); AssertRuleSuccess ("get_Item"); AssertRuleFailure ("ToString", 1); AssertRuleFailure ("ToString", 1); AssertRuleFailure ("ToString", 1); AssertRuleFailure ("GetHashCode", 1); AssertRuleFailure ("Equals", 1); AssertRuleFailure ("GetHashCode", 1); AssertRuleFailure ("GetHashCode", 1); AssertRuleFailure ("Equals", 1); AssertRuleFailure ("GetHashCode", 1); AssertRuleFailure ("Dispose", new Type [0], 1); AssertRuleFailure ("Dispose", new Type [] {typeof (bool)}, 1); AssertRuleFailure ("op_Implicit", 1); AssertRuleFailure ("get_Item", 1); } class Bad : IDisposable { static Bad () { throw new NullReferenceException (); } ~Bad () { throw new ObjectDisposedException ("a bit too soon"); } int Property { get { throw new NotFiniteNumberException (); } } event EventHandler Handler { add { throw new NotFiniteNumberException (); } remove { throw new NotFiniteNumberException (); } } static public bool operator == (Bad a, Bad b) { // not a very good test since it recurse if ((a == null) || (b == null)) throw new ArgumentNullException (); return Object.ReferenceEquals (a, b); } static public bool operator != (Bad a, Bad b) { if ((a == null) || (b == null)) throw new ArgumentNullException (); return !Object.ReferenceEquals (a, b); } void IDisposable.Dispose () { throw new ObjectDisposedException ("quickie"); } static bool TryParse (string s, out Bad value) { if (s == null) throw new ArgumentNullException (); value = new Bad (); return true; } } class Good : IDisposable { static Good () { Console.WriteLine (); } ~Good () { } int Property { get { return 0; } } event EventHandler Handler { add { throw new NotSupportedException (); } remove { } } static public bool operator == (Good a, Good b) { return Object.ReferenceEquals (a, b); } static public bool operator != (Good a, Good b) { return (!(a == b)); } void IDisposable.Dispose () { throw new NotImplementedException (); } static bool TryParse (string s, out Good value) { value = new Good (); return (s != null); } } [Test] public void StaticCtor () { AssertRuleFailure (".cctor", 1); AssertRuleDoesNotApply (".cctor"); // no throw } [Test] public void Finalizers () { AssertRuleFailure ("Finalize", 1); AssertRuleDoesNotApply ("Finalize"); // no throw } [Test] public void Getter () { AssertRuleFailure ("get_Property", 1); AssertRuleDoesNotApply ("get_Property"); // no throw } [Test] public void Events () { AssertRuleFailure ("add_Handler", 1); AssertRuleFailure ("remove_Handler", 1); AssertRuleSuccess ("add_Handler"); // NotSupportedException is allowed here AssertRuleDoesNotApply ("remove_Handler"); // no throw } [Test] public void EqualityOperator () { AssertRuleFailure ("op_Equality", 1); AssertRuleDoesNotApply ("op_Equality"); // no throw } [Test] public void InequalityOperator () { AssertRuleFailure ("op_Inequality", 1); AssertRuleDoesNotApply ("op_Inequality"); // no throw } [Test] public void ExplicitDispose () { AssertRuleFailure ("System.IDisposable.Dispose", 1); // NotImplementedException is allowed here AssertRuleSuccess ("System.IDisposable.Dispose"); } [Test] public void TryParse () { AssertRuleFailure ("TryParse", 1); AssertRuleDoesNotApply ("TryParse"); // no throw } struct Unbox { int i; public override bool Equals (object obj) { Unbox ub = (Unbox) obj; return ub.i == i; } } [Test] public void EqualsStructUnboxing () { AssertRuleFailure ("Equals", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/ExceptionShouldBeVisibleTest.cs0000664000175000017500000000613712413742070034375 0ustar00directhexdirecthex00000000000000// // Unit tests for ExceptionShouldBeVisibleRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public class ExceptionShouldBeVisibleTest : TypeRuleTestFixture { [Test] public void NotAnException () { AssertRuleDoesNotApply (); } internal class InternalException : Exception { } internal abstract class AbstractException : Exception { } public class MyException : Exception { } [Test] public void InheritsFromException () { AssertRuleFailure (); AssertRuleSuccess (); AssertRuleSuccess (); } private class PrivateSystemException : SystemException { } protected class ProtectedSystemException : SystemException { } [Test] public void InheritsFromSystemException () { AssertRuleFailure (); AssertRuleSuccess (); } class PrivateApplicationException : ApplicationException { } public class PublicApplicationException : ApplicationException { } [Test] public void InheritsFromApplicationException () { AssertRuleFailure (); AssertRuleSuccess (); } private class PrivateArgumentException : ArgumentException { } internal class InternalArgumentException : ArgumentException { } protected class ProtectedArgumentException : ArgumentException { } public class PublicArgumentException : ArgumentException { } [Test] public void InheritsFromArgumentException () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } } } InstantiateArgumentExceptionCorrectlyTest.cs0000664000175000017500000007427312413742070037156 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test// // Unit tests for InstantiateArgumentExceptionsCorrectlyRule // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2008 Néstor Salceda // Copyright (C) 2008,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; using System.Collections; using System.Collections.Generic; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Exceptions { [TestFixture] public class InstantiateArgumentExceptionCorrectlyTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no exception is instantiated AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void ArgumentExceptionWithTwoParametersInGoodOrder (int parameter) { throw new ArgumentException ("Invalid parameter", "parameter"); } [Test] public void SuccessOnArgumentExceptionWithTwoParametersInGoodOrderTest () { AssertRuleSuccess ("ArgumentExceptionWithTwoParametersInGoodOrder"); } public void ArgumentExceptionWithTwoParametersInBadOrder (int parameter) { throw new ArgumentException ("parameter", "Invalid parameter"); } [Test] public void SuccessOnArgumentExceptionWithTwoParametersInBadOrderTest () { AssertRuleFailure ("ArgumentExceptionWithTwoParametersInBadOrder", 1); } public void ArgumentNullExceptionWithTwoParametersInGoodOrder (int parameter) { throw new ArgumentNullException ("parameter", "This parameter is null"); } [Test] public void SuccessOnArgumentNullExceptionWithTwoParametersInGoodOrderTest () { AssertRuleSuccess ("ArgumentNullExceptionWithTwoParametersInGoodOrder"); } public void ArgumentNullExceptionWithTwoParametersInBadOrder (int parameter) { throw new ArgumentNullException ("This parameter is null", "parameter"); } [Test] public void FailOnArgumentNullExceptionWithTwoParametersInBadOrderTest () { AssertRuleFailure ("ArgumentNullExceptionWithTwoParametersInBadOrder", 1); } public void ArgumentOutOfRangeExceptionWithTwoParametersInGoodOrder (int parameter) { throw new ArgumentOutOfRangeException ("parameter", "This parameter is out of order"); } [Test] public void SuccessOnArgumentOutOfRangeExceptionWithTwoParametersInGoodOrderTest () { AssertRuleSuccess ("ArgumentOutOfRangeExceptionWithTwoParametersInGoodOrder"); } public void ArgumentOutOfRangeExceptionWithTwoParametersInBadOrder (int parameter) { throw new ArgumentOutOfRangeException ("This parameter is out of order", "parameter"); } [Test] public void FailOnArgumentOutOfRangeExceptionWithTwoParametersInBadOrderTest () { AssertRuleFailure ("ArgumentOutOfRangeExceptionWithTwoParametersInBadOrder", 1); } public void DuplicateWaitObjectExceptionWithTwoParametersInGoodOrder (int parameter) { throw new DuplicateWaitObjectException ("parameter", "A simple message"); } [Test] public void SuccessOnDuplicateWaitObjectExceptionWithTwoParametersInGoodOrderTest () { AssertRuleSuccess ("DuplicateWaitObjectExceptionWithTwoParametersInGoodOrder"); } public void DuplicateWaitObjectExceptionWithTwoParametersInBadOrder (int parameter) { throw new DuplicateWaitObjectException ("A simple message", "parameter"); } [Test] public void FailOnDuplicateWaitObjectExceptionWithTwoParametersInBadOrderTest () { AssertRuleFailure ("DuplicateWaitObjectExceptionWithTwoParametersInBadOrder", 1); } // public void ArgumentExceptionWithOneArgument (int parameter) { throw new ArgumentException ("parameter"); } [Test] public void SuccessOnArgumentExceptionWithOneArgumentTest () { AssertRuleSuccess ("ArgumentExceptionWithOneArgument"); } public void ArgumentExceptionWithOneMessage (int parameter) { throw new ArgumentException ("Invalid parameter"); } [Test] public void SuccessOnArgumentExceptionWithOneMessageTest () { AssertRuleSuccess ("ArgumentExceptionWithOneMessage"); } public void ArgumentNullExceptionWithOneParameter (int parameter) { throw new ArgumentNullException ("parameter"); } [Test] public void SuccessOnArgumentNullExceptionWithOneParameterTest () { AssertRuleSuccess ("ArgumentNullExceptionWithOneParameter"); } public void ArgumentNullExceptionWithOneMessage (int parameter) { throw new ArgumentNullException ("This argument is null " + parameter); } [Test] public void FailOnArgumentNullExceptionWithOneMessageTest () { AssertRuleFailure ("ArgumentNullExceptionWithOneMessage", 1); } public void ArgumentOutOfRangeExceptionWithOneParameter (int parameter) { throw new ArgumentOutOfRangeException ("parameter"); } [Test] public void SuccessOnArgumentOutOfRangeExceptionWithOneParameterTest () { AssertRuleSuccess ("ArgumentOutOfRangeExceptionWithOneParameter"); } public void ArgumentOutOfRangeExceptionWithOneMessage (int parameter) { throw new ArgumentOutOfRangeException ("The parameter is out of range"); } [Test] public void FailOnArgumentOutOfRangeExceptionWithOneMessageTest () { AssertRuleFailure ("ArgumentOutOfRangeExceptionWithOneMessage", 1); } public void DuplicateWaitObjectExceptionWithOneParameter (int parameter) { throw new DuplicateWaitObjectException ("parameter"); } [Test] public void SuccessOnDuplicateWaitObjectExceptionWithOneParameterTest () { AssertRuleSuccess ("DuplicateWaitObjectExceptionWithOneParameter"); } public void DuplicateWaitObjectExceptionWithOneMessage (int parameter) { throw new DuplicateWaitObjectException ("There are a duplicate wait object."); } [Test] public void FailOnDuplicateWaitObjectExceptionWithOneMessageTest () { AssertRuleFailure ("DuplicateWaitObjectExceptionWithOneMessage", 1); } public void ArgumentExceptionWithOtherConstructor (int x) { throw new ArgumentException ("A sample message" , new Exception ("Other message")); } [Test] public void SuccessOnArgumentExceptionWithOtherConstructorTest () { AssertRuleSuccess ("ArgumentExceptionWithOtherConstructor"); } public void ArgumentExceptionWithMessageAndConditionals (Array array, int index) { if (array == null) throw new ArgumentNullException ("array"); if (index < 0) throw new IndexOutOfRangeException ("Index was outside the bounds of the array."); if (array.Rank > 1) throw new ArgumentException ("array is multidimensional"); if ((array.Length > 0) && (index >= array.Length)) throw new IndexOutOfRangeException ("Index was outside the bounds of the array."); if (index > array.Length) throw new IndexOutOfRangeException ("Index was outside the bounds of the array."); IEnumerator it = null; int i = index; while (it.MoveNext ()) { array.SetValue (it.Current, i++); } } [Test] public void SuccessOnArgumentExceptionWithMessageAndConditionalsTest () { AssertRuleSuccess ("ArgumentExceptionWithMessageAndConditionals"); } public void MixedArgumentExceptionsAndConditionals (string name, int versionRequiredToExtract, int madeByInfo) { if (name == null) { //failed here throw new System.ArgumentNullException("ZipEntry name"); } if ( name.Length == 0 ) { throw new ArgumentException("ZipEntry name is empty"); } if (versionRequiredToExtract != 0 && versionRequiredToExtract < 10) { throw new ArgumentOutOfRangeException("versionRequiredToExtract"); } } [Test] public void FailOnMixedArgumentExceptionsAndConditionalsTest () { AssertRuleFailure ("MixedArgumentExceptionsAndConditionals", 1); } private string GetString (string message) { return message; } public void ArgumentExceptionsWithTranslatedMessage (int parameter) { throw new ArgumentException (GetString("Error"), "parameter"); } [Test] public void SuccessOnArgumentExceptionsWithTranslatedMessageTest () { AssertRuleSuccess ("ArgumentExceptionsWithTranslatedMessage"); } public void ArgumentExceptionWithTranslatedInverted (int parameter) { throw new ArgumentException ("parameter", GetString ("Error")); } [Test] public void FailOnArgumentExceptionWithTranslatedInvertedTest () { AssertRuleFailure ("ArgumentExceptionWithTranslatedInverted", 1); } public void ArgumentExceptionWithTranslatedDescription (int parameter) { throw new ArgumentException (GetString ("Error")); } [Test] public void SuccessOnArgumentExceptionWithTranslatedDescriptionTest () { AssertRuleSuccess ("ArgumentExceptionWithTranslatedDescription"); } public int WellNamedProperty { set { if (value == 0) throw new ArgumentException ("The parameter is zero.", "WellNamedProperty"); } } [Test] public void SuccessOnWellNamedPropertyTest () { AssertRuleSuccess ("set_WellNamedProperty"); } public int BadNamedProperty { set { if (value == 0) throw new ArgumentException ("The parameter is zero.", "value"); } } [Test] public void FailOnBadNamedPropertyTest () { AssertRuleFailure ("set_BadNamedProperty", 1); Assert.AreEqual (Severity.Low, Runner.Defects [0].Severity, "Low"); } public int WellNamedPropertyWithArgumentNullException { set { throw new ArgumentNullException ("WellNamedPropertyWithArgumentNullException"); } } [Test] public void SuccessOnWellNamedPropertyWithArgumentNullExceptionTest () { AssertRuleSuccess ("set_WellNamedPropertyWithArgumentNullException"); } public int WellNamedPropertyWithArgumentExceptionAndOneParameter { set { throw new ArgumentException ("This is a sample description."); } } [Test] public void SuccessOnWellNamedPropertyWithArgumentExceptionAndOneParameterTest () { AssertRuleSuccess ("set_WellNamedPropertyWithArgumentExceptionAndOneParameter"); } public int ArgumentExceptionProperty { get { // public ArgumentException () // i.e. we don't care about this ctor (no parameter) throw new ArgumentException ("uho"); } set { // public ArgumentException (string message, string paramName) // i.e. we CARE about this ctor second parameter (paramName) throw new ArgumentException ("ArgumentExceptionProperty", "uho"); } } public int ArgumentNullExceptionProperty { get { // public ArgumentNullException (string paramName) // i.e. we CARE about this ctor single parameter (paramName) throw new ArgumentNullException ("uho"); } set { // public ArgumentNullException (string paramName, string message) // i.e. we CARE about this ctor first parameter (paramName) throw new ArgumentNullException ("ArgumentNullExceptionProperty", "aha"); } } [Test] public void PropertiesTest () { AssertRuleSuccess ("get_ArgumentExceptionProperty"); AssertRuleFailure ("set_ArgumentExceptionProperty", 1); AssertRuleFailure ("get_ArgumentNullExceptionProperty", 1); AssertRuleSuccess ("set_ArgumentNullExceptionProperty"); } public ArgumentException MethodReturningArgumentException_Empty (int value) { // public ArgumentException () // i.e. we don't care about this ctor (no parameter) return new ArgumentException (); } public ArgumentException MethodReturningArgumentException_String (int value) { // public ArgumentException (string message) // i.e. we don't care about this ctor (no paramName) return new ArgumentException ("value"); } public ArgumentException MethodReturningArgumentException_StringException (int value) { // public ArgumentException (string message, Exception innerException) // i.e. we don't care about this ctor (no paramName) return new ArgumentException ("heho", new Exception ()); } public ArgumentException MethodReturningArgumentException_StringString_Good (int value) { // public ArgumentException (string message, string paramName) // i.e. we CARE about this ctor second parameter (paramName) return new ArgumentException ("heho", "value"); } public ArgumentException MethodReturningArgumentException_StringString_Bad (int value) { // public ArgumentException (string message, string paramName) // i.e. we CARE about this ctor second parameter (paramName) return new ArgumentException ("value", "heho"); } public ArgumentException MethodReturningArgumentException_StringStringException_Good (int value) { // public ArgumentException (string message, string paramName, Exception innerException) // i.e. we CARE about this ctor second parameter (paramName) return new ArgumentException ("heho", "value", new Exception ()); } public ArgumentException MethodReturningArgumentException_StringStringException_Bad (int value) { // public ArgumentException (string message, string paramName, Exception innerException) // i.e. we CARE about this ctor second parameter (paramName) return new ArgumentException ("value", "heho", new Exception ()); } [Test] public void MethodReturningArgumentException () { AssertRuleSuccess ("MethodReturningArgumentException_Empty"); AssertRuleSuccess ("MethodReturningArgumentException_String"); AssertRuleSuccess ("MethodReturningArgumentException_StringException"); AssertRuleSuccess ("MethodReturningArgumentException_StringString_Good"); AssertRuleFailure ("MethodReturningArgumentException_StringString_Bad"); AssertRuleSuccess ("MethodReturningArgumentException_StringStringException_Good"); AssertRuleFailure ("MethodReturningArgumentException_StringStringException_Bad"); } public ArgumentNullException MethodReturningArgumentNullException_Empty (int value) { // public ArgumentNullException () // i.e. we don't care about this ctor (no parameter) return new ArgumentNullException (); } public ArgumentNullException MethodReturningArgumentNullException_StringOk (int value) { // public ArgumentNullException (string paramName) // i.e. we CARE about this ctor single parameter (paramName) return new ArgumentNullException ("value"); } public ArgumentNullException MethodReturningArgumentNullException_StringBad (int value) { // public ArgumentNullException (string paramName) // i.e. we CARE about this ctor single parameter (paramName) return new ArgumentNullException ("heho"); } public ArgumentNullException MethodReturningArgumentNullException_StringException (int value) { // public ArgumentNullException (string message, Exception innerException) // i.e. we don't care about this ctor (no paramName) return new ArgumentNullException ("heho", new Exception ()); } public ArgumentNullException MethodReturningArgumentNullException_StringString_Good (int value) { // public ArgumentNullException (string paramName, string message) // i.e. we CARE about this ctor first parameter (paramName) return new ArgumentNullException ("value", "heho"); } public ArgumentNullException MethodReturningArgumentNullException_StringString_Bad (int value) { // public ArgumentNullException (string paramName, string message) // i.e. we CARE about this ctor first parameter (paramName) return new ArgumentNullException ("heho", "value"); } [Test] public void MethodReturningArgumentNullException () { AssertRuleSuccess ("MethodReturningArgumentNullException_Empty"); AssertRuleSuccess ("MethodReturningArgumentNullException_StringOk"); AssertRuleFailure ("MethodReturningArgumentNullException_StringBad", 1); AssertRuleSuccess ("MethodReturningArgumentNullException_StringException"); AssertRuleSuccess ("MethodReturningArgumentNullException_StringString_Good"); AssertRuleFailure ("MethodReturningArgumentNullException_StringString_Bad", 1); } public ArgumentOutOfRangeException MethodReturningArgumentOutOfRangeException_Empty (int value) { // public ArgumentOutOfRangeException () // i.e. we don't care about this ctor (no parameter) return new ArgumentOutOfRangeException (); } public ArgumentOutOfRangeException MethodReturningArgumentOutOfRangeException_StringOk (int value) { // public ArgumentOutOfRangeException (string paramName) // i.e. we CARE about this ctor single parameter (paramName) return new ArgumentOutOfRangeException ("value"); } public ArgumentOutOfRangeException MethodReturningArgumentOutOfRangeException_StringBad (int value) { // public ArgumentOutOfRangeException (string paramName) // i.e. we CARE about this ctor single parameter (paramName) return new ArgumentOutOfRangeException ("heho"); } public ArgumentOutOfRangeException MethodReturningArgumentOutOfRangeException_StringException (int value) { // public ArgumentOutOfRangeException (string message, Exception innerException) // i.e. we don't care about this ctor (no paramName) return new ArgumentOutOfRangeException ("heho", new Exception ()); } public ArgumentOutOfRangeException MethodReturningArgumentOutOfRangeException_StringString_Good (int value) { // public ArgumentOutOfRangeException (string paramName, string message) // i.e. we CARE about this ctor first parameter (paramName) return new ArgumentOutOfRangeException ("value", "heho"); } public ArgumentOutOfRangeException MethodReturningArgumentOutOfRangeException_StringString_Bad (int value) { // public ArgumentOutOfRangeException (string paramName, string message) // i.e. we CARE about this ctor first parameter (paramName) return new ArgumentOutOfRangeException ("heho", "value"); } [Test] public void MethodReturningArgumentOutOfRangeException () { AssertRuleSuccess ("MethodReturningArgumentOutOfRangeException_Empty"); AssertRuleSuccess ("MethodReturningArgumentOutOfRangeException_StringOk"); AssertRuleFailure ("MethodReturningArgumentOutOfRangeException_StringBad", 1); AssertRuleSuccess ("MethodReturningArgumentOutOfRangeException_StringException"); AssertRuleSuccess ("MethodReturningArgumentOutOfRangeException_StringString_Good"); AssertRuleFailure ("MethodReturningArgumentNullException_StringString_Bad", 1); } public DuplicateWaitObjectException MethodReturningDuplicateWaitObjectException_Empty (int value) { // public DuplicateWaitObjectException () // i.e. we don't care about this ctor (no parameter) return new DuplicateWaitObjectException (); } public DuplicateWaitObjectException MethodReturningDuplicateWaitObjectException_StringOk (int value) { // public DuplicateWaitObjectException (string paramName) // i.e. we CARE about this ctor single parameter (paramName) return new DuplicateWaitObjectException ("value"); } public DuplicateWaitObjectException MethodReturningDuplicateWaitObjectException_StringBad (int value) { // public DuplicateWaitObjectException (string paramName) // i.e. we CARE about this ctor single parameter (paramName) return new DuplicateWaitObjectException ("heho"); } public DuplicateWaitObjectException MethodReturningDuplicateWaitObjectException_StringException (int value) { // public DuplicateWaitObjectException (string message, Exception innerException) // i.e. we don't care about this ctor (no paramName) return new DuplicateWaitObjectException ("heho", new Exception ()); } public DuplicateWaitObjectException MethodReturningDuplicateWaitObjectException_StringString_Good (int value) { // public DuplicateWaitObjectException (string paramName, string message) // i.e. we CARE about this ctor first parameter (paramName) return new DuplicateWaitObjectException ("value", "heho"); } public DuplicateWaitObjectException MethodReturningDuplicateWaitObjectException_StringString_Bad (int value) { // public DuplicateWaitObjectException (string paramName, string message) // i.e. we CARE about this ctor first parameter (paramName) return new DuplicateWaitObjectException ("heho", "value"); } [Test] public void MethodReturningDuplicateWaitObjectException () { AssertRuleSuccess ("MethodReturningDuplicateWaitObjectException_Empty"); AssertRuleSuccess ("MethodReturningDuplicateWaitObjectException_StringOk"); AssertRuleFailure ("MethodReturningDuplicateWaitObjectException_StringBad", 1); AssertRuleSuccess ("MethodReturningDuplicateWaitObjectException_StringException"); AssertRuleSuccess ("MethodReturningDuplicateWaitObjectException_StringString_Good"); AssertRuleFailure ("MethodReturningDuplicateWaitObjectException_StringString_Bad", 1); } public void MessageLoadedFromLocal (int value) { string msg = "The parameter: {0} is out of range"; // public ArgumentOutOfRangeException (string paramName, string message) throw new ArgumentOutOfRangeException ("value", msg); } [Test] public void SuccessOnMessageLoadedFromLocalTest () { AssertRuleSuccess ("MessageLoadedFromLocal"); } public void StringFormatForMessage (int value) { // public ArgumentException (string message, string paramName) throw new ArgumentException (String.Format ("value {0} is bad", value), "value"); } [Test] public void ArgumentExceptionTest () { AssertRuleSuccess ("StringFormatForMessage"); } // adapted from NamespaceEngine.cs // gmcs creates an inner type with fields and the exception can be thrown from there (without parameter) class CompilerGeneratedInnerIterator { private static IList types; public static IEnumerable TypesInside (string nameSpace) { if (nameSpace == null) throw new ArgumentNullException ("nameSpace"); foreach (TypeDefinition type in types) { yield return type; } } } [Test] public void Yield () { AssertRuleSuccess ("TypesInside"); TypeDefinition inner = (DefinitionLoader.GetTypeDefinition ().NestedTypes [0] as TypeDefinition); foreach (MethodDefinition method in inner.Methods) { AssertRuleDoesNotApply (method); } } public void CallLocalizedThrow () { throw new ArgumentNullException ("obj", "a localized string"); } public int DoThis (object obj) { if (obj == null) CallLocalizedThrow (); return obj.GetHashCode (); } [Test] public void CheckThenDelegateThrow () { // no exception throw (or created) AssertRuleDoesNotApply ("DoThis"); // no parameter to check against AssertRuleDoesNotApply ("CallLocalizedThrow"); } static public int GoodStaticMethod (object obj) { if (obj == null) throw new ArgumentNullException ("obj"); return obj.GetHashCode (); } static public void GoodStaticMethod2 (object obj, string s) { if (obj == null) throw new ArgumentNullException ("obj"); if (String.IsNullOrEmpty (s)) throw new ArgumentNullException ("s"); Console.WriteLine ("{0}: {1}", s, obj.GetHashCode ()); } static public int BadStaticMethod (object obj) { if (obj == null) throw new ArgumentNullException ("object"); return obj.GetHashCode (); } static public void BadStaticMethod2 (object obj, string s) { if (obj == null) throw new ArgumentNullException ("object"); if (String.IsNullOrEmpty (s)) throw new ArgumentNullException ("string"); Console.WriteLine ("{0}: {1}", s, obj.GetHashCode ()); } static public void BadStaticMethod2half (object objectHash, string stringParameterName) { if (objectHash == null) throw new ArgumentNullException ("objectHash"); if (String.IsNullOrEmpty (stringParameterName)) throw new ArgumentNullException ("stringParameter"); Console.WriteLine ("{0}: {1}", stringParameterName, objectHash.GetHashCode ()); } [Test] public void StaticMethods () { AssertRuleSuccess ("GoodStaticMethod"); AssertRuleFailure ("BadStaticMethod", 1); AssertRuleSuccess ("GoodStaticMethod2"); AssertRuleFailure ("BadStaticMethod2", 2); AssertRuleFailure ("BadStaticMethod2half", 1); } public object this [int index] { get { throw new ArgumentOutOfRangeException ("index"); } set { throw new ArgumentOutOfRangeException ("index", "foo"); } } [Test] public void Indexer () { AssertRuleSuccess ("get_Item"); AssertRuleSuccess ("set_Item"); } public void ArgumentNullExceptionWithBranchInMessageSelectionAndIncorrectParameterName(int parameter) { throw new ArgumentNullException("asdf", parameter > 0 ? "little parameter " : "big parameter"); } public void ArgumentOutOfRangeExceptionWithBranchInMessageSelectionAndIncorrectParameterName(int parameter) { throw new ArgumentOutOfRangeException("asdf", parameter > 0 ? "little parameter " : "big parameter"); } public void DuplicateWaitObjectExceptionWithBranchInMessageSelectionAndIncorrectParameterName(int parameter) { throw new DuplicateWaitObjectException("asdf", parameter > 0 ? "little parameter " : "big parameter"); } public void ArgumentNullExceptionWithBranchInMessageSelectionAndCorrectParameterName(int parameter) { throw new ArgumentNullException("parameter", parameter > 0 ? "little parameter " : "big parameter"); } public void ArgumentOutOfRangeExceptionWithBranchInMessageSelectionAndCorrectParameterName(int parameter) { throw new ArgumentOutOfRangeException("parameter", parameter > 0 ? "little parameter " : "big parameter"); } public void DuplicateWaitObjectExceptionWithBranchInMessageSelectionAndCorrectParameterName(int parameter) { throw new DuplicateWaitObjectException("parameter", parameter > 0 ? "little parameter " : "big parameter"); } [Test] public void ArgumentExceptionsWithBranchInMessageSelectionDoesNotThrow() { AssertRuleSuccess("ArgumentNullExceptionWithBranchInMessageSelectionAndCorrectParameterName"); AssertRuleSuccess("ArgumentOutOfRangeExceptionWithBranchInMessageSelectionAndCorrectParameterName"); AssertRuleSuccess("DuplicateWaitObjectExceptionWithBranchInMessageSelectionAndCorrectParameterName"); //Ideally the rules below would be AssertRuleFailure - but better to incorrectly pass than to throw an unhandled exception // If the handling code is changed a better resolution here may be possible AssertRuleSuccess("ArgumentNullExceptionWithBranchInMessageSelectionAndIncorrectParameterName"); AssertRuleSuccess("ArgumentOutOfRangeExceptionWithBranchInMessageSelectionAndIncorrectParameterName"); AssertRuleSuccess("DuplicateWaitObjectExceptionWithBranchInMessageSelectionAndIncorrectParameterName"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/AvoidThrowingBasicExceptionsTest.cs0000664000175000017500000001004012413742070035247 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidThrowingBasicExceptionsRule // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public class AvoidThrowingBasicExceptionsTest : MethodRuleTestFixture { class ExceptionThrower { public void CreateException () { Exception ex = new Exception ("upyachka"); } public void CreateApplicationException () { ApplicationException ex = new ApplicationException ("krevedko"); } public void CreateSystemException () { SystemException ex = new SystemException ("^_^"); } public void ThrowException () { throw new Exception ("yarrr!"); } public void ThrowApplicationException () { throw new ApplicationException ("s.r.u."); } public void ThrowSystemException () { throw new SystemException ("zhazha"); } public void ThrowSpecificExceptions () { Random r = new Random (); // to avoid compiler optimizations that remove everything after throw if (r.NextDouble () > 0.5) throw new NotImplementedException (); if (r.NextDouble () > 0.5) throw new OverflowException ("too much upyachka!"); if (r.NextDouble () > 0.5) throw new ExecutionEngineException (); } public void ThrowTwoBasicExceptions () { Random r = new Random (); // to avoid compiler optimizations that remove everything after throw if (r.NextDouble () > 0.5) throw new NotImplementedException (); // bad #1: if (r.NextDouble () > 0.5) throw new Exception ("upyachka"); if (r.NextDouble () > 0.5) throw new OverflowException ("YARR!!11"); // bad #2: if (r.NextDouble () > 0.5) throw new ApplicationException ("this is parta!!11oneoneone"); if (r.NextDouble () > 0.5) throw new ExecutionEngineException (); } } [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no newobj (so no new *Exception possible) AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void CreateBasicExceptionsFails () { AssertRuleFailure ("CreateException"); AssertRuleFailure ("CreateApplicationException"); AssertRuleFailure ("CreateSystemException"); } [Test] public void ThrowBasicExceptionsFails () { AssertRuleFailure ("ThrowException"); AssertRuleFailure ("ThrowApplicationException"); AssertRuleFailure ("ThrowSystemException"); } [Test] public void ThrowSpecificExceptionsSucceeds () { AssertRuleSuccess ("ThrowSpecificExceptions"); } [Test] public void GotCountRight () { AssertRuleFailure ("ThrowTwoBasicExceptions", 2); } } } DontSwallowErrorsCatchingNonspecificExceptionsTest.cs0000664000175000017500000002161012413742070040743 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test// // Unit Test for DontSwallowErrorsCatchingNonspecificExceptions Rule // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Diagnostics; using System.IO; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public class DoNotSwallowErrorsCatchingNonSpecificExceptionsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no exception handler AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void SwallowErrorsCatchingExceptionEmptyCatchBlock () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception exception) { } } [Test] public void SwallowErrorsCatchingExceptionsEmptyCatchBlockTest () { AssertRuleFailure ("SwallowErrorsCatchingExceptionEmptyCatchBlock", 1); } public void SwallowErrorsCatchingExceptionNoEmptyCatchBlock () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } [Test] public void SwallowErrorsCatchingExceptionsNoEmptyCatchBlockTest () { AssertRuleFailure ("SwallowErrorsCatchingExceptionNoEmptyCatchBlock", 1); } public void SwallowErrorsCatchingSystemExceptionEmptyCatchBlock () { try { File.Open ("foo.txt", FileMode.Open); } catch (SystemException exception) { } } [Test] public void SwallowErrorsCatchingSystemExceptionEmptyCatchBlockTest () { AssertRuleFailure ("SwallowErrorsCatchingSystemExceptionEmptyCatchBlock", 1); } public void SwallowErrorsCatchingSystemExceptionNoEmptyCatchBlock () { try { File.Open ("foo.txt", FileMode.Open); } catch (SystemException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } [Test] public void SwallowErrorsCatchingSystemExceptionNoEmptyCatchBlockTest () { AssertRuleFailure ("SwallowErrorsCatchingSystemExceptionNoEmptyCatchBlock", 1); } public void SwallowErrorsCatchingTypeExceptionEmptyCatchBlock () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception) { } } [Test] public void SwallowErrorsCatchingTypeExceptionEmptyCatchBlockTest () { AssertRuleFailure ("SwallowErrorsCatchingTypeExceptionEmptyCatchBlock", 1); } public void SwallowErrorsCatchingTypeExceptionNoEmptyCatchBlock () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception) { Console.WriteLine ("Has happened an exception."); } } [Test] public void SwallowErrorsCatchingTypeExceptionNoEmptyCatchBlockTest () { AssertRuleFailure ("SwallowErrorsCatchingTypeExceptionNoEmptyCatchBlock", 1); } public void SwallowErrorsCatchingAllEmptyCatchBlock () { try { File.Open ("foo.txt", FileMode.Open); } catch { } } [Test] public void SwallowErrorsCatchingAllEmptyCatchBlockTest () { AssertRuleFailure ("SwallowErrorsCatchingAllEmptyCatchBlock", 1); } public void SwallowErrorsCatchingAllNoEmptyCatchBlock () { try { File.Open ("foo.txt", FileMode.Open); } catch { Console.WriteLine ("Has happened an exception."); } } [Test] public void SwallowErrorsCatchingAllNoEmptyCatchBlockTest () { AssertRuleFailure ("SwallowErrorsCatchingAllNoEmptyCatchBlock", 1); } public void NotSwallowRethrowingGeneralException () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); throw; Console.WriteLine (exception.Message); Console.WriteLine (exception); } } [Test] public void NotSwallowRethrowingGeneralExceptionTest () { AssertRuleSuccess ("NotSwallowRethrowingGeneralException"); } public void NotSwallowRethrowingException () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); throw exception; Console.WriteLine (exception.Message); Console.WriteLine (exception); } } [Test] public void NotSwallowRethrowingExceptionTest () { AssertRuleFailure ("NotSwallowRethrowingException", 1); } public void NotSwallowCatchingSpecificException () { try { File.Open ("foo.txt", FileMode.Open); } catch (FileNotFoundException exception) { } } [Test] public void NotSwallowCatchingSpecificExceptionTest () { AssertRuleSuccess ("NotSwallowCatchingSpecificException"); } public void NotSwallowThrowingANewException () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception exception) { throw new SystemException ("Message"); } } [Test] public void NotSwallowThrowingANewExceptionTest () { AssertRuleFailure ("NotSwallowThrowingANewException", 1); } public void NotSwallowCatchingAllThrowingANewException () { try { File.Open ("foo.txt", FileMode.Open); } catch { throw new Exception ("Message"); } } [Test] public void NotSwallowCatchingAllThrowingANewExceptionTest () { AssertRuleFailure ("NotSwallowCatchingAllThrowingANewException", 1); } public void NotSwallowCatchingTypeExceptionThrowingANewException () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception) { throw new Exception ("Message"); } } [Test] public void NotSwallowCatchingTypeExceptionThrowingANewExceptionTest () { AssertRuleFailure ("NotSwallowCatchingTypeExceptionThrowingANewException", 1); } public void NotSwallowCatchingSystemExceptionThrowingANewException () { try { File.Open ("foo.txt", FileMode.Open); } catch (System.Exception exception) { throw new Exception ("Message"); } } [Test] public void NotSwallowCatchingSystemExceptionThrowingANewExceptionTest () { AssertRuleFailure ("NotSwallowCatchingSystemExceptionThrowingANewException", 1); } public void SkipUsingGoto () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception exception) { retry: if (exception == null) throw new Exception (exception.ToString ()); Console.WriteLine ("Skipped"); exception = exception.InnerException; goto retry; } } [Test] public void Goto () { AssertRuleFailure ("SkipUsingGoto", 1); } [Conditional ("DONTDEFINE")] public void ConditionWrite (object obj) { Console.WriteLine (obj); } public void ExceptionWithConditional () { try { File.Open ("foo.txt", FileMode.Open); } catch (Exception exception) { ConditionWrite (exception); throw new Exception ("uho", exception); } } [Test] public void Conditional () { AssertRuleFailure ("ExceptionWithConditional", 1); } } } AvoidArgumentExceptionDefaultConstructorTest.cs0000664000175000017500000000767112413742070037617 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test// // Unit tests for AvoidArgumentExceptionDefaultConstructorRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public class AvoidArgumentExceptionDefaultConstructorTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no newobj (so no new *Exception possible) AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void Argument_Single (string s) { if (String.IsNullOrEmpty (s)) throw new ArgumentException (); } public void ArgumentNull_Single (string s) { if (s == null) throw new ArgumentNullException (); } public void ArgumentOutOfRange_Single () { throw new ArgumentOutOfRangeException (); } public void DuplicateWaitObject_Single () { throw new DuplicateWaitObjectException (); } public void Multiple (string s) { if (s == null) throw new ArgumentNullException (); if (s.Length == 0) throw new ArgumentException (); if (s.Length > 32) throw new ArgumentOutOfRangeException (); throw new DuplicateWaitObjectException (); } [Test] public void NoArgument () { AssertRuleFailure ("Argument_Single", 1); AssertRuleFailure ("ArgumentNull_Single", 1); AssertRuleFailure ("ArgumentOutOfRange_Single", 1); AssertRuleFailure ("DuplicateWaitObject_Single", 1); AssertRuleFailure ("Multiple", 4); } public void ThrowArgumentException (int n) { switch (n) { case 1: throw new ArgumentException ("message"); case 2: throw new ArgumentException ("message", new ArgumentNullException ("n")); case 3: throw new ArgumentException ("message", "n"); case 4: throw new ArgumentException ("message", "n", new ArgumentOutOfRangeException ("n")); } } [Test] public void Arguments () { AssertRuleSuccess ("ThrowArgumentException"); } public class MyOwnException : ArgumentException { public MyOwnException () { } public MyOwnException (string paramName) : base (paramName) { } static void Throw () { throw new MyOwnException (); } static void ThrowForParam (string s) { throw new MyOwnException (s); } } [Test] public void Derived () { AssertRuleFailure ("Throw", 1); AssertRuleSuccess ("ThrowForParam"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/Makefile.am0000664000175000017500000000015412413742070030331 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Exceptions.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/DoNotThrowInNonCatchClausesTest.cs0000664000175000017500000000671212413742070034766 0ustar00directhexdirecthex00000000000000// // Unit Tests for DoNotThrowInNonCatchClausesRule // // Authors: // Sebastien Pouliot // // 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 Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public class DoNotThrowInNonCatchClausesTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } void ThrowInTry () { try { throw new NotImplementedException ("no luck"); } finally { Console.WriteLine (); } } void ThrowInCatch () { try { Console.WriteLine (); } catch (Exception e) { throw new NotImplementedException ("no luck", e); } } // copied from DontDestroyStackTraceTest since CSC compiles the HandlerEnd as past the method offset void ThrowCatchThrowNew () { try { throw new NotImplementedException (); } catch (Exception) { throw new NotImplementedException (); } } [Test] public void Success () { AssertRuleSuccess ("ThrowInTry"); AssertRuleSuccess ("ThrowInCatch"); AssertRuleSuccess ("ThrowCatchThrowNew"); } void RethrowInCatch () { try { Console.WriteLine (); } catch (Exception) { throw; // rethrow in IL which is seen only in catch clauses } } [Test] public void Rethrow () { AssertRuleDoesNotApply ("RethrowInCatch"); } void ThrowInFinally () { try { Console.WriteLine (); } finally { throw new NotImplementedException ("no luck"); } } void ThrowInFinallyToo () { try { throw new NotImplementedException ("no luck"); } catch (Exception e) { throw new NotImplementedException ("no more luck", e); } finally { if (GetType ().IsSealed) throw new NotImplementedException ("never any luck"); else throw new NotSupportedException ("stop playing cards"); } } [Test] public void Failure () { AssertRuleFailure ("ThrowInFinally", 1); AssertRuleFailure ("ThrowInFinallyToo", 2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Test/DoNotThrowReservedExceptionTest.cs0000664000175000017500000000523112413742070035113 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotThrowReservedExceptionRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Framework; using Gendarme.Rules.Exceptions; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Exceptions { [TestFixture] public class DoNotThrowReservedExceptionTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public Exception CreateExceptionBad () { return new ExecutionEngineException ("uho"); } public void ThrowOutOfRangeExceptionBad () { throw new IndexOutOfRangeException (); } public void Throw (object o) { if (o == null) throw new NullReferenceException ("null", new OutOfMemoryException ()); } [Test] public void Bad () { AssertRuleFailure ("CreateExceptionBad", 1); AssertRuleFailure ("ThrowOutOfRangeExceptionBad", 1); AssertRuleFailure ("Throw", 2); } public Exception CreateExceptionGood () { // another rule deals with "basic" exceptions return new Exception (); } public void ThrowOutOfRangeExceptionGood () { throw new ArgumentOutOfRangeException (); } [Test] public void Good () { AssertRuleSuccess ("CreateExceptionGood"); AssertRuleSuccess ("ThrowOutOfRangeExceptionGood"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/MissingExceptionConstructorsRule.cs0000664000175000017500000001511712413742070034463 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.MissingExceptionConstructorsRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Exceptions { /// /// This rule will fire if an exception class is missing one or more of the following /// constructors: /// /// public E () is required for XML serialization. Public access is required /// in case the assembly uses CAS to prevent reflection on non-public members. /// public E (string message) is a .NET convention. /// public E (string message, ..., Exception inner) is a .NET convention. /// (non)public E (SerializationInfo info, StreamingContext context) is required for binary serialization. /// /// /// /// Bad example: /// /// public class GeneralException : Exception { /// // access should be public /// private GeneralException () /// { /// } /// } /// /// /// /// Good example: /// /// public class GeneralException : Exception { /// public GeneralException () /// { /// } /// /// public GeneralException (string message) : base (message) /// { /// } /// /// public GeneralException (string message, Exception inner) : base (message, inner) /// { /// } /// /// protected GeneralException (SerializationInfo info, StreamingContext context) : base (info, context) /// { /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("The exception does not provide all of the constructors required by the runtime or by .NET programming conventions.")] [Solution ("Add the missing constructor(s).")] [FxCopCompatibility ("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")] public class MissingExceptionConstructorsRule : Rule, ITypeRule { // localizable private const string MissingConstructor = "Exception is missing '{0} {1}{2}' constructor."; private static bool CheckForStringConstructor (MethodDefinition ctor) { if (!ctor.IsPublic) return false; return (ctor.Parameters [0].ParameterType.IsNamed ("System", "String")); } private static bool CheckForInnerExceptionConstructor (IMethodSignature ctor) { IList pdc = ctor.Parameters; if (!pdc [0].ParameterType.IsNamed ("System", "String")) return false; return pdc [pdc.Count - 1].ParameterType.IsNamed ("System", "Exception"); } private static bool CheckForSerializationConstructor (MethodDefinition ctor) { if (ctor.IsPrivate || ctor.IsFamily) return MethodSignatures.SerializationConstructor.Matches (ctor); return false; } public RuleResult CheckType (TypeDefinition type) { // rule apply only to type that inherits from System.Exception if (!type.Inherits ("System", "Exception")) return RuleResult.DoesNotApply; // rule applies, only Success or Failure from the point on // check if the type implements all the needed exception constructors bool empty_ctor = false; // MyException () bool string_ctor = false; // MyException (string message) bool inner_exception_ctor = false; // MyException (string message, Exception innerException) bool serialization_ctor = false; // MyException (SerializationInfo info, StreamingContext context) foreach (MethodDefinition ctor in type.Methods) { // skip non-constructors and cctor if (!ctor.IsConstructor || ctor.IsStatic) continue; if (!ctor.HasParameters) { // there can be only one so only it's visibility matters empty_ctor = ctor.IsPublic; continue; } switch (ctor.Parameters.Count) { case 1: string_ctor |= CheckForStringConstructor (ctor); break; case 2: if (ctor.IsPublic) { if (!inner_exception_ctor) { inner_exception_ctor = CheckForInnerExceptionConstructor (ctor); if (inner_exception_ctor) break; } string_ctor |= CheckForStringConstructor (ctor); } else { serialization_ctor |= CheckForSerializationConstructor (ctor); } break; default: inner_exception_ctor |= CheckForInnerExceptionConstructor (ctor); break; } } if (!empty_ctor) { string s = String.Format (CultureInfo.InvariantCulture, MissingConstructor, "public", type.Name, "()"); Runner.Report (type, Severity.High, Confidence.Total, s); } if (!string_ctor) { string s = String.Format (CultureInfo.InvariantCulture, MissingConstructor, "public", type.Name, "(string message)"); Runner.Report (type, Severity.High, Confidence.Total, s); } if (!inner_exception_ctor) { string s = String.Format (CultureInfo.InvariantCulture, MissingConstructor, "public", type.Name, "(string message, Exception innerException)"); Runner.Report (type, Severity.High, Confidence.Total, s); } if (!serialization_ctor) { string s = String.Format (CultureInfo.InvariantCulture, MissingConstructor, (type.IsSealed) ? "private" : "protected", type.Name, "(SerializationInfo info, StreamingContext context)"); Runner.Report (type, Severity.High, Confidence.Total, s); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/Makefile.am0000664000175000017500000000206312413742070027413 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AvoidArgumentExceptionDefaultConstructorRule.cs \ AvoidThrowingBasicExceptionsRule.cs \ DoNotDestroyStackTraceRule.cs \ DoNotThrowInNonCatchClausesRule.cs \ DoNotThrowInUnexpectedLocationRule.cs \ DoNotThrowReservedExceptionRule.cs \ DontSwallowErrorsCatchingNonspecificExceptionsRule.cs \ ExceptionShouldBeVisibleRule.cs \ Impl/ExecutionBlock.cs \ Impl/ExecutionPath.cs \ Impl/ExecutionPathFactory.cs \ InstantiateArgumentExceptionCorrectlyRule.cs \ MissingExceptionConstructorsRule.cs \ NewExceptionRule.cs \ UseObjectDisposedExceptionRule.cs tests_sources = \ AvoidArgumentExceptionDefaultConstructorTest.cs \ AvoidThrowingBasicExceptionsTest.cs \ DoNotThrowInNonCatchClausesTest.cs \ DoNotThrowInUnexpectedLocationTest.cs \ DontDestroyStackTraceTest.cs \ DontSwallowErrorsCatchingNonspecificExceptionsTest.cs \ DoNotThrowReservedExceptionTest.cs \ ExceptionShouldBeVisibleTest.cs \ MissingExceptionConstructorsTest.cs \ InstantiateArgumentExceptionCorrectlyTest.cs \ UseObjectDisposedExceptionTest.cs DontSwallowErrorsCatchingNonspecificExceptionsRule.cs0000664000175000017500000001226212413742070040017 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions// // DontSwallowErrorsCatchingNonspecificExceptions class // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; namespace Gendarme.Rules.Exceptions { /// /// This rule will fire if a catch block catches System.Exception or /// System.SystemException but does not rethrow the original /// exception. This is problematic because you don't know what went wrong /// so it's difficult to know that the error was handled correctly. It is better /// to catch a more specific set of exceptions so that you do know what went /// wrong and do know that it is handled correctly. /// /// /// Bad example: /// /// try { /// File.Open ("foo.txt", FileMode.Open); /// } /// catch (Exception) { /// //Ooops what's failed ??? UnauthorizedException, FileNotFoundException ??? /// } /// /// /// /// Good example (catch a specific exception): /// /// try { /// File.Open ("foo.txt", FileMode.Open); /// } /// catch (FileNotFoundException exception) { /// //I know that the system can't find the file. /// } /// /// /// /// Good example (catch all and rethrow): /// /// try { /// File.Open ("foo.txt", FileMode.Open); /// } /// catch { /// Console.WriteLine ("An error has happened."); /// throw; // You don't swallow the error, because you rethrow the original exception. /// } /// /// /// Prior to Gendarme 2.0 this rule was named DontSwallowErrorsCatchingNonspecificExceptionsRule. [Problem ("This method catches a very general exception without rethrowing it. This is not safe to do in general and may mask problems that the caller should be made aware of.")] [Solution ("Rethrow the original exception (which will preserve the stacktrace of the original error) or catch a more specific exception type.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] public class DoNotSwallowErrorsCatchingNonSpecificExceptionsRule : Rule, IMethodRule { //Added System.Object because is the code behind the following block: //try { // File.Open (foo, bar); //} //catch { //} private static bool IsForbiddenTypeInCatches (TypeReference type) { if (type.Namespace != "System") return false; string name = type.Name; return ((name == "Exception") || (name == "SystemException") || (name == "Object")); } // will always return exceptionHandler.HandlerStart if there's no 'rethrow' inside the method private static Instruction ThrowsGeneralException (ExceptionHandler exceptionHandler) { for (Instruction currentInstruction = exceptionHandler.HandlerStart; currentInstruction != exceptionHandler.HandlerEnd && currentInstruction != null; currentInstruction = currentInstruction.Next) { if (currentInstruction.OpCode.Code == Code.Rethrow) return null; } return exceptionHandler.HandlerStart; } public RuleResult CheckMethod (MethodDefinition method) { // rule only applies to methods with IL if (!method.HasBody) return RuleResult.DoesNotApply; // and if the method has, at least one, exception handler(s) MethodBody body = method.Body; if (!body.HasExceptionHandlers) return RuleResult.DoesNotApply; bool has_rethrow = OpCodeEngine.GetBitmask (method).Get (Code.Rethrow); foreach (ExceptionHandler exceptionHandler in body.ExceptionHandlers) { if (exceptionHandler.HandlerType == ExceptionHandlerType.Catch) { if (IsForbiddenTypeInCatches (exceptionHandler.CatchType)) { // quickly find 'throw_instruction' if there's no 'rethrow' used in this method Instruction throw_instruction = has_rethrow ? ThrowsGeneralException (exceptionHandler) : exceptionHandler.HandlerStart; if (throw_instruction != null) { Runner.Report (method, throw_instruction, Severity.Medium, Confidence.High); } } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Exceptions/DoNotThrowInNonCatchClausesRule.cs0000664000175000017500000000702712413742070034037 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Exceptions.DoNotThrowInNonCatchClausesRule // // Authors: // Sebastien Pouliot // // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Exceptions { /// /// This rule detects exceptions that are throw in fault, filter or /// finally clauses. Such exceptions will make it much harder to debug your /// applications since it will hide the original exception. /// /// /// Bad example: /// /// int err = 0; /// try { /// err = Initialize (); /// } /// finally { /// Cleanup (); /// if (err != 0) /// throw new NotSupportedException (); /// } /// /// /// /// Good example: /// /// try { /// if (Initialize () != 0) /// throw new NotSupportedException (); /// } /// finally { /// Cleanup (); /// } /// /// [Problem ("An exception is thrown in a fault, filter or finally clause.")] [Solution ("Remove the exception or move it inside the try or catch clause.")] [FxCopCompatibility ("Microsoft.Usage", "CA2219:DoNotRaiseExceptionsInExceptionClauses")] [EngineDependency (typeof (OpCodeEngine))] public class DoNotThrowInNonCatchClausesRule : Rule, IMethodRule { void CheckBlock (MethodDefinition method, Instruction start, Instruction end) { Instruction ins = start; while (ins != end) { if (ins.Is (Code.Throw)) Runner.Report (method, ins, Severity.High, Confidence.High); ins = ins.Next; } } public RuleResult CheckMethod (MethodDefinition method) { // rule only applies to methods with IL... if (!method.HasBody) return RuleResult.DoesNotApply; // ... and exceptions handlers MethodBody body = method.Body; if (!body.HasExceptionHandlers) return RuleResult.DoesNotApply; // and when the IL contains a Throw instruction (Rethrow is fine) if (!OpCodeEngine.GetBitmask (method).Get (Code.Throw)) return RuleResult.DoesNotApply; foreach (ExceptionHandler eh in body.ExceptionHandlers) { // throwing in catch handler is fine if (eh.HandlerType == ExceptionHandlerType.Catch) continue; CheckBlock (method, eh.HandlerStart, eh.HandlerEnd); if (eh.FilterStart != null) CheckBlock (method, eh.FilterStart, eh.HandlerStart); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Makefile.in0000664000175000017500000005045012642235732022502 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ RULEDIRS = Gendarme.Rules.BadPractice \ Gendarme.Rules.Concurrency \ Gendarme.Rules.Correctness \ Gendarme.Rules.Design \ Gendarme.Rules.Design.Generic \ Gendarme.Rules.Design.Linq \ Gendarme.Rules.Exceptions \ Gendarme.Rules.Globalization \ Gendarme.Rules.Gendarme \ Gendarme.Rules.Interoperability \ Gendarme.Rules.Interoperability.Com \ Gendarme.Rules.Maintainability \ Gendarme.Rules.Naming \ Gendarme.Rules.NUnit \ Gendarme.Rules.Performance \ Gendarme.Rules.Portability \ Gendarme.Rules.Security \ Gendarme.Rules.Security.Cas \ Gendarme.Rules.Serialization \ Gendarme.Rules.Smells \ Gendarme.Rules.Ui TESTDIRS = Test.Rules SUBDIRS = $(TESTDIRS) $(RULEDIRS) EXTRA_DIST = rules.xml common.make DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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) -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-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: @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook 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: @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: $(am__recursive_targets) install-am install-data-am \ install-strip uninstall-am .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ distclean distclean-generic distclean-tags distdir dvi dvi-am \ html html-am info info-am install install-am install-data \ install-data-am install-data-hook 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-am uninstall \ uninstall-am uninstall-hook .PRECIOUS: Makefile install-data-hook: $(INSTALL) -c -m 0644 $(addprefix $(srcdir)/, rules.xml) $(DESTDIR)$(prefix)/lib/gendarme; uninstall-hook: rm -f $(DESTDIR)$(prefix)/lib/gendarme/`basename rules.xml`; rules: for ASM in $(RULEDIRS); do \ cd $$ASM; \ make rule; \ cd ..; \ done; test: list='$(SUBDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) test) ; \ done; run-test: list='$(TESTDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) test) ; \ done; list='$(RULEDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) run-test) ; \ done; # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/0000775000175000017500000000000012642235741025535 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/ChangeLog0000664000175000017500000003416312413742070027310 0ustar00directhexdirecthex000000000000002010-06-14 Sebastien Pouliot * DecorateThreadsRule.cs: * ThreadRocks.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-09 Sebastien Pouliot * DecorateThreadsRule.cs: Rework to use ThreadModel to reduce memory allocations. Save 217kb on self-test * ThreadRocks.cs: Refactor to return ThreadModel (enum) instead of ThreadModelAttribute (class). Add helpers 2010-06-08 Sebastien Pouliot * ThreadRocks.cs: Refactor to share some code (property and events) and avoid allocations when looking for properties. Also avoid string allocation to get its suffix. Saves 317kb while running self-test. Check return value for CustomAttribute.Resolve 2010-06-08 Sebastien Pouliot * ThreadRocks.cs: Resolving can be expensive so we avoid it whenever possible 2010-06-08 Sebastien Pouliot * ThreadRocks.cs: Always check HasCustomAttributes before accessing a CustomAttributes property (which would allocate an empty collection if no custom attributes are present). Memory usage down by 463kb while running self-test 2010-06-08 Sebastien Pouliot * Makefile.am: Remove ThreadModel.cs from build * ThreadModel.cs: Remove. There's already a copy in Gendarme's framework * ThreadRocks.cs: Add using Gendarme.Framework so it can access ThreadModelAttribute 2010-06-04 Sebastien Pouliot * DecorateThreadsRule.cs: * DontUseLockedRegionOutsideMethodRule.cs: * ProtectCallToEventDelegatesRule.cs: * ThreadRocks.cs: Apply AvoidUnnecessarySpecializationRule 2010-05-23 Sebastien Pouliot * ReviewLockUsedOnlyForOperationsOnVariablesRule.cs: Fix last unit test failure when compiled with VS2008 where CSC added some NOP instructions. 2010-05-08 Sebastien Pouliot * DecorateThreadsRule.cs: Replace internal type MethodName (which did not compile with CSC) and it's data by a simpler method. 2010-04-29 Sebastien Pouliot * DoNotLockOnWeakIdentityObjectsRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule to TypeReference::get_FullName * DecorateThreadsRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule on MemberReference::get_DeclaringType (11) and TypeReference::get_Name (6) 2010-04-22 Sebastien Pouliot * ReviewLockUsedOnlyForOperationsOnVariablesRule.cs: Handle case when a try handler correspond to the first instruction of a method 2010-04-18 Sebastien Pouliot * ReviewLockUsedOnlyForOperationsOnVariablesRule.cs: Fix rule to handle 4.0 Monitor.Enter(object, ref bool) as generated by CSC10 while retaining compatibility with previous/existing compilers. 2010-04-17 Sebastien Pouliot * DoubleCheckLockingRule.cs: Ignore calls to Monitor.Enter(object, ref bool), introduced in FX4.0, since this rule is applied only to code compiled with a runtime earlier than 2.0 2010-04-17 Sebastien Pouliot * DoNotLockOnThisOrTypesRule.cs: Update Analyze signature * DoNotLockOnWeakIdentityObjectsRule.cs: Update logic since CSC on FX4 use Monitor.Enter(object, ref bool) * LockAnalyzerRule.cs: Add a new 'enter' parameter to Analyze so its possible to query which Monitor.Enter overload is being used. 2010-04-13 Sebastien Pouliot * DecorateThreadsRule.cs: Implement IEquatable<> on MethodName as suggested by Gendarme itself (self-test) * DontUseLockedRegionOutsideMethodRule.cs, * LockAnalyzerRule.cs, * ReviewLockUsedOnlyForOperationsOnVariablesRule.cs: Don't assume a MethodReference for FlowControl.Call. Calli, while uncommon, would provide a CallSite. 2010-01-19 Sebastien Pouliot * DecorateThreadsRule.cs: Apply MethodCanBeMadeStaticRule * DoNotLockOnThisOrTypesRule.cs: Apply PreferEmptyInstanceOverNullRule * ThreadModel.cs: Apply MarkEnumerationsAsSerializableRule 2010-01-17 Sebastien Pouliot * ThreadModel.cs: Avoid boxing when concatenating strings 2009-08-25 Jesse Jones * DontUseLockedRegionOutsideMethodRule.cs: Edited the description. 2009-07-08 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-06-10 Jesse Jones * DecorateThreadsRule.cs, ThreadModel.cs, ThreadRocks.cs, Makefile.am: added new rule. 2009-01-23 Jesse Jones * DoNotUseThreadStaticWithInstanceFieldsRule.cs, Makefile.am: added new rule. 2009-01-22 Stephane Delcroix * Makefile.am: removing references that slipped in by mistake. 2009-01-21 Jesse Jones * WriteStaticFieldFromInstanceMethodRule.cs: Ignore fields decorated with [ThreadStatic]. 2008-12-21 Sebastien Pouliot * ProtectCallToEventDelegatesRule.cs: Deal with (null != variable) just like we did with (variable != null). 2008-11-30 Sebastien Pouliot * NonConstantStaticFieldsShouldNotBeVisibleRule.cs: Use HasFields 2008-11-09 Sebastien Pouliot * ProtectCallToEventDelegatesRule.cs: Change documentation comments to make it clear that this does not solve all potential problems wrt executing events while they are (possibly) being removed. 2008-11-08 Sebastien Pouliot * ProtectCallToEventDelegatesRule.cs: New. Rule that checks if calls to event delegates are null-protected and without a race condition. * Makefile.am: Added the new rule and tests to the build. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Concurrency.mdp: * Gendarme.Rules.Concurrency.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-23 Sebastien Pouliot * DoNotUseMethodImplOptionsSynchronizedRule.cs: New. Rule to warn about method decorated with [MethodImpl(MethodImplOptions.Synchronized)] since the runtime lock is similar to a lock(this) or lock(typeof(X)) * Gendarme.Rules.Concurrency.mdp: Updated MD project file. * Makefile.am: Added the new rule to the build. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-21 Cedric Vivier * ReviewLockUsedOnlyForOperationsOnVariables.cs: New. Rule to check if a lock section is only used for operations that could be better handled by System.Threading.Interlocked class. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Concurrency.xml, doc/Gendarme.Rules.Concurrency: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-18 Sebastien Pouliot * DoNotLockOnWeakIdentityObjectsRule.cs: Add [FxCopCompatibility] attribute. Use new GetOperandRock to simplify the rule. * DontUseLockedRegionOutsideMethodRule.cs: Use OpCodeEngine to ignore methods that do not contain call[virt] instructions. * DoubleCheckLockingRule.cs: Only apply rule to assemblies targetting runtimes before 2.0 (i.e. 1.x) Use OpCodeEngine to ignore methods that do not contain call[virt] instructions. Update and expand the XML documentation. * LockAnalyzerRule.cs: Use OpCodeEngine to ignore methods that do not contain call[virt] instructions. * NonConstantStaticFieldsShouldNotBeVisibleRule.cs: Ignore delegates. * WriteStaticFieldFromInstanceMethodRule.cs: Use OpCodeEngine to check for methods that contains Stsfld (store of static fields). Use Resolve rock on fields. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-10-14 Néstor Salceda * DoNotLockOnThisOrTypesRule.cs: Added XML documentation. 2008-10-14 Néstor Salceda * DontUseLockedRegionOutsideMethodRule.cs: Append the Rule suffix to the file name, because it's a rule. * Gendarme.Rules.Concurrency.mdp: Updated MD project file. * Makefile.am: Added the new file name to the build. 2008-10-14 Néstor Salceda * DontUseLockedRegionOutsideMethod.cs: Added XML documentation. 2008-10-14 Néstor Salceda * DoNotLockOnWeakIdentityObjectsRule.cs: Added XML documentation. 2008-10-06 Néstor Salceda * DoubleCheckLockingRule.cs: Fix a space in the XML documentation. 2008-10-06 Néstor Salceda * DoubleCheckLockingRule.cs: Added XML documentation. * NonConstantStaticFieldsShouldNotBeVisibleRule.cs: Added XML documentation. * WriteStaticFieldFromInstanceMethodRule.cs: Added XML documentation. 2008-08-13 Sebastien Pouliot * DoNotLockOnThisOrTypesRule.cs: Use TraceBack rocks. Don't ignore the rule on static methods (since they could still lock on a Type). * DoNotLockOnWeakIdentityObjectsRule.cs: Use new rocks. * LockAnalyzerRule.cs: Simplify now that we have InstructionRocks. 2008-07-10 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-08 Sebastien Pouliot * NonConstantStaticFieldsShouldNotBeVisibleRule.cs: Remove "public const string". Anyway it was not required since it was a "constant" message (and [Solution] handle this a lot better). * Makefile.am: Rebuild if the framework has changed. 2008-05-25 Sebastien Pouliot * DoNotLockOnThisOrTypesRule.cs: New. Rule to report when lock(this) or lock(typeof(X)) is being used. * DoNotLockOnWeakIdentityObjectsRule.cs: New. Rule to report when a lock is done on an object with a weak identity. * LockAnalyzerRule.cs: Base class for both new rules. * Gendarme.Rules.Concurrency.mdp: Update MD project file * Makefile.am: Add new rules/tests to build. 2008-05-24 Sebastien Pouliot * DontUseLockedRegionOutsideMethod.cs: Override Initialize to avoid executing the rule unless the current module use the Monitor class. 2008-05-05 Andres G. Aragoneses * DoubleCheckLockingRule.cs: More concrete link. 2008-05-05 Andres G. Aragoneses * DoubleCheckLockingRule.cs: Add an informative comment. 2008-04-26 Sebastien Pouliot * DontUseLockedRegionOutsideMethod.cs: Add missing reporting (not very accurate now) and simplified logic a bit while making it work with my new test case. 2008-04-26 Andres G. Aragoneses * Gendarme.Rules.Concurrency.mdp, DontUseLockedRegionOutsideMethod.cs: My first rule with its tests! It's very simple but more will come (noted in the TODO's). I hope it works because I cannot check it right now, the Gendarme.Tests are failing compilation for me. 2008-04-11 Nestor Salceda * NonConstantStaticFieldsShouldNotBeVisibleRule.cs: Fix the spelling error in the error message. 2008-04-05 Sebastien Pouliot * DoubleCheckLockingRule.cs: Optimization by using Initialize (mainly) and by removing allocations/using generic collections. * Makefile.am: Add reference to Test.Rules.dll for unit tests 2008-02-15 Sebastien Pouliot * DoubleCheckLockingRule.cs * NonConstantStaticFieldsShouldNotBeVisibleRule.cs * WriteStaticFieldFromInstanceMethodRule.cs: Update rules wrt framework changes. 2008-02-12 Sebastien Pouliot * Gendarme.Rules.Concurrency.xml.in: Fix copy-paste mistake for NonConstantStaticFieldsShouldNotBeVisibleRule. [Backport of r95541] 2008-01-21 Sebastien Pouliot * NonConstantStaticFieldsShouldNotBeVisibleRule.cs: New. Rule that warns about non-constant static fields since their access needs to be synchronized in multithreaded applications [Andreas Noever] * Gendarme.Rules.Concurrency.xml.in: Add new rule description. * Makefile.am: Add rule/test to the build. 2008-01-12 Sebastien Pouliot * DoubleCheckingLockingRule.cs: Use new Location ctor. Delay Hashtable creation a bit. * WriteStaticFieldFromInstanceMethodRule.cs: Use new Location ctor. Don't create MessageCollection until needed. 2008-01-11 Sebastien Pouliot * DoubleCheckingLockingRule.cs: Turn some methods to static. 2007-11-30 Nestor Salceda * DoubleCheckingLockingRule.cs: Extracted a method for return the error messages. This fixes the AvoidLongMethod violation in self-test. The source now conforms the Mono style. 2007-10-07 Sebastien Pouliot * Gendarme.Rules.Concurrency.mdp: Update project file. 2006-11-11 Sebastien Pouliot * Gendarme.Rules.Concurrency.mdp: Add new rule to MonoDevelop project. * Gendarme.Rules.Concurrency.xml.in: Add description and information about the new WriteStaticFieldFromInstanceMethodRule rule. * Makefile.am: Add WriteStaticFieldFromInstanceMethodRule rule and tests to the build. * WriteStaticFieldFromInstanceMethodRule.cs: New rule. 2006-10-15 Sebastien Pouliot * Gendarme.Rules.Concurrency.xml.in: Update Uri for rules (to generate more useful reports). 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-28 Christian Birkl * Gendarme.Rules.Concurrency.csproj: Included ChangeLog * DoubleCheckLockingRule.cs: Migrated untyped IList messages collection to typed MessageCollection class. 2006-07-31 Sebastien Pouliot * Gendarme.Rules.Concurrency.mdp: New. Project file for MonoDevelop. 2006-06-13 Sebastien Pouliot * Makefile.am: Use -pkg:mono-nunit to reference nunit assemblies. Added self-test target to promote compliance ;-) mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/LockAnalyzerRule.cs0000664000175000017500000000536612413742070031316 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.LockAnalyzerRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008,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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { [EngineDependency (typeof (OpCodeEngine))] abstract public class LockAnalyzerRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // is this module using Monitor.Enter ? (lock in c#) // if not then this rule does not need to be executed for the module // note: mscorlib.dll is an exception since it defines, not refer, System.Threading.Monitor Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Threading", "Monitor"); })); }; } abstract public void Analyze (MethodDefinition method, MethodReference enter, Instruction ins); public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { MethodReference mr = ins.GetMethod (); if (mr.IsNamed ("System.Threading", "Monitor", "Enter")) Analyze (method, mr, ins); } return Runner.CurrentRuleResult; } } } DoNotUseMethodImplOptionsSynchronizedRule.cs0000664000175000017500000000661212413742070036273 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency// // Gendarme.Rules.Concurrency.DoNotUseMethodImplOptionsSynchronizedRule // // Authors: // Sebastien Pouliot // // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { /// /// This rule fires if a method is decorated with [MethodImpl(MethodImplOptions.Synchronized)]. /// The runtime synchronizes those methods automatically using a lock(this) for /// instance methods or a lock(typeof(X)) for static methods. This can cause /// problems because anyone can acquire a lock on the instance or type. And if another /// thread does acquire a lock then deadlocks become a very real possibility. The preferred way to /// handle this is to create a private System.Object instance field and lock that. This /// greatly reduces the scope of the code which may acquire the lock which makes it much easier /// to ensure that the locking is done correctly. /// /// /// Bad example: /// /// [MethodImpl (MethodImplOptions.Synchronized)] /// public void SychronizedMethod () /// { /// producer++; /// } /// /// /// /// Good example: /// /// public class ClassWithALocker { /// object locker = new object (); /// int producer = 0; /// /// public void MethodLockingLocker () /// { /// lock (locker) { /// producer++; /// } /// } /// } /// /// [Problem ("This method is decorated with [MethodImpl(MethodImplOptions.Synchronized)].")] [Solution ("Remove the attribute and provide your own private lock object.")] public class DoNotUseMethodImplOptionsSynchronizedRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!method.IsSynchronized) return RuleResult.Success; // special case since the compiler generate add/remove on events using Synchronized if (method.IsAddOn || method.IsRemoveOn) return RuleResult.DoesNotApply; // base severity on whether the method is visible or not // if not then the potential problem is limited to the assembly Severity severity = method.IsVisible () ? Severity.High : Severity.Medium; Runner.Report (method, severity, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/DoubleCheckLockingRule.cs0000664000175000017500000002024612413742070032371 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.DoubleCheckLockingRule.cs: // looks for instances of double-check locking. // // Authors: // Aaron Tomb // Sebastien Pouliot // // Copyright (c) 2005 Aaron Tomb // Copyright (C) 2008, 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { // note: the rule only reports a single double-lock per method /// /// This rule is used to check for the double-check pattern, often used when implementing /// the singleton pattern (1), and warns of potential incorrect usage. /// /// The original CLR (1.x) could not guarantee that a double-check would work correctly /// in multithreaded applications. However the technique does work on the x86 architecture, /// the most common architecture, so the problem is seldom seen (e.g. IA64). /// /// The CLR 2 and later introduce a strong memory model (2) where a double check for a /// lock is correct (as long as you assign to a volatile variable). This /// rule won't report a defect for assemblies targetting the 2.0 (and later) runtime. /// /// 1. Implementing Singleton in C# /// http://msdn.microsoft.com/en-us/library/ms998558.aspx /// 2. Understand the Impact of Low-Lock Techniques in Multithreaded Apps /// http://msdn.microsoft.com/en-ca/magazine/cc163715.aspx#S5 /// /// /// /// Bad example: /// /// public class Singleton { /// private static Singleton instance; /// private static object syncRoot = new object (); /// /// public static Singleton Instance { /// get { /// if (instance == null) { /// lock (syncRoot) { /// if (instance == null) { /// instance = new Singleton (); /// } /// } /// } /// return instance; /// } /// } /// } /// /// /// /// Good example (for 1.x code avoid using double check): /// /// public class Singleton { /// private static Singleton instance; /// private static object syncRoot = new object (); /// /// public static Singleton Instance { /// get { /// // do not check instance before the lock /// // this will work on all CLRs but will affect /// // performance since the lock is always acquired /// lock (syncRoot) { /// if (instance == null) { /// instance = new Singleton (); /// } /// } /// return instance; /// } /// } /// } /// /// /// /// Good example (for 2.x and later): /// /// public class Singleton { /// // by using 'volatile' the double check will work under CLR 2.x /// private static volatile Singleton instance; /// private static object syncRoot = new object (); /// /// public static Singleton Instance { /// get { /// if (instance == null) { /// lock (syncRoot) { /// if (instance == null) { /// instance = new Singleton (); /// } /// } /// } /// return instance; /// } /// } /// } /// /// [Problem ("This method uses the potentially unreliable double-check locking technique.")] [Solution ("Remove the check that occurs outside of the protected region.")] [EngineDependency (typeof (OpCodeEngine))] public class DoubleCheckLockingRule : Rule, IMethodRule { Stack monitorOffsetList = new Stack (); List comparisons = new List (); public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = // we only want to run this on assemblies that use either the // 1.0 or 1.1 runtime - since the memory model, at that time, // was not entirely safe for double check locks e.CurrentModule.Runtime < TargetRuntime.Net_2_0 && // is this module using Monitor.Enter ? (lock in c#) // if not then this rule does not need to be executed for the module // note: mscorlib.dll is an exception since it defines, not refer, System.Threading.Monitor (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Threading", "Monitor"); })); }; } public RuleResult CheckMethod (MethodDefinition method) { // rule doesn't apply if the method has no IL if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; comparisons.Clear (); monitorOffsetList.Clear (); foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.FlowControl) { case FlowControl.Cond_Branch: if ((ins.Previous == null) || (ins.Previous.Previous == null)) continue; if (monitorOffsetList.Count > 0) { /* If there's a comparison in the list matching this * one, we have double-check locking. */ foreach (Instruction insn in comparisons) { if (!EffectivelyEqual (insn, ins)) continue; if (!EffectivelyEqual (insn.Previous, ins.Previous)) continue; if (!EffectivelyEqual (insn.Previous.Previous, ins.Previous.Previous)) continue; if (insn.Offset >= monitorOffsetList.Peek ()) continue; Runner.Report (method, insn, Severity.Medium, Confidence.High); return RuleResult.Failure; } } comparisons.Add (ins); break; case FlowControl.Call: MethodReference m = (ins.Operand as MethodReference); if (IsMonitorMethod (m, "Enter")) monitorOffsetList.Push (ins.Offset); else if (IsMonitorMethod (m, "Exit")) { if (monitorOffsetList.Count > 0) monitorOffsetList.Pop (); } break; } } return RuleResult.Success; } private static bool IsMonitorMethod (MethodReference method, string methodName) { if (method.Name != methodName) return false; if (!method.DeclaringType.IsNamed ("System.Threading", "Monitor")) return false; // exclude Monitor.Enter(object, ref bool) since the comparison would be made // againt the 'lockTaken' parameter and would report failures for every cases. // not a big deal since this rule if active only on code compiled < FX 2.0 return (method.Parameters.Count == 1); } private static bool EffectivelyEqual (Instruction insn1, Instruction insn2) { // return false if opcode are different if (insn1.OpCode != insn2.OpCode) return false; // If both are branch instructions, we don't care about their targets, only their opcodes. if (insn1.OpCode.FlowControl == FlowControl.Cond_Branch) return true; // For other instructions, their operands must also be equal. if (insn1.Operand == null) return (insn2.Operand == null); return insn1.Operand.Equals (insn2.Operand); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Makefile.in0000664000175000017500000006655412642235731027621 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Concurrency ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ DecorateThreadsRule.cs \ DoNotLockOnThisOrTypesRule.cs \ DoNotLockOnWeakIdentityObjectsRule.cs \ DoNotUseMethodImplOptionsSynchronizedRule.cs \ DoNotUseThreadStaticWithInstanceFieldsRule.cs \ DontUseLockedRegionOutsideMethodRule.cs \ DoubleCheckLockingRule.cs \ LockAnalyzerRule.cs \ NonConstantStaticFieldsShouldNotBeVisibleRule.cs \ ProtectCallToEventDelegatesRule.cs \ ReviewLockUsedOnlyForOperationsOnVariablesRule.cs \ ThreadRocks.cs \ WriteStaticFieldFromInstanceMethodRule.cs tests_sources = \ DecorateThreadsTest.cs \ DoNotLockOnThisOrTypesTest.cs \ DoNotLockOnWeakIdentityObjectsTest.cs \ DoNotUseMethodImplOptionsSynchronizedTest.cs \ DoNotUseThreadStaticWithInstanceFieldsTest.cs \ DontUseLockedRegionOutsideMethodTest.cs \ DoubleCheckLockingTest.cs \ NonConstantStaticFieldsShouldNotBeVisibleTest.cs \ ProtectCallToEventDelegatesTest.cs \ ReviewLockUsedOnlyForOperationsOnVariablesTest.cs \ WriteStaticFieldFromInstanceMethodTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Concurrency/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Concurrency/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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: DoNotUseThreadStaticWithInstanceFieldsRule.cs0000664000175000017500000000667212413742070036312 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency// // Gendarme.Rules.Concurrency.DoNotUseThreadStaticWithInstanceFieldsRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { /// /// This rule will fire if an instance field is decorated with a [ThreadStatic] attribute. /// This is an error because the attribute will only work with static fields. /// /// /// Bad example: /// /// // the field isn't static so this will do nothing /// [ThreadStatic] /// private List<object> items; /// /// public void Add (object item) /// { /// // If the field was thread safe this would ensure that each thread had /// // its own copy of the list. /// if (items == null) { /// items = new List<object> (); /// } /// /// items.Add (item); /// } /// /// /// /// Good example: /// /// private List<object> items = new List<object> (); /// private object mutex = new object (); /// /// // Typically some form of locking such as the code below is used to /// // serialize access to instance fields. However you can also use /// // Threading.Thread.Thread::AllocateNamedDataSlot or AllocateDataSlot. /// public void Add (object item) /// { /// lock (mutex) { /// items.Add (item); /// } /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("An instance field is decorated with System.ThreadStaticAttribute.")] [Solution ("ThreadStaticAttribute will only make static fields thread safe. To make an instance field thread safe you need to use techniques like locking or System.Threading.Thread.Thread::AllocateNamedDataSlot.")] public sealed class DoNotUseThreadStaticWithInstanceFieldsRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (!type.HasFields || type.IsEnum) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { if (!field.IsStatic && field.HasAttribute ("System", "ThreadStaticAttribute")) { Runner.Report (field, Severity.Critical, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Gendarme.Rules.Concurrency.csproj0000664000175000017500000001462012413742070034060 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {B8EA91A3-27A0-4732-BA90-7B590280FF9F} Library Properties Gendarme.Rules.Concurrency Gendarme.Rules.Concurrency 3.5 true v4.0 http://localhost/Gendarme.Rules.Concurrency/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 1591 1570 ..\..\console\bin\Debug\Gendarme.Rules.Concurrency.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Concurrency.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false NonConstantStaticFieldsShouldNotBeVisibleRule.cs0000664000175000017500000000613012413742070037017 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency// // Gendarme.Rules.Concurrency.NonConstantStaticFieldsShouldNotBeVisibleRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { /// /// This rule warns if a non-constant public static field is found. /// In a multi-threaded environment access to those fields must be synchronized. /// /// /// Bad example: /// /// class HasPublicStaticField { /// public static ComplexObject Field; /// } /// /// /// /// Good example: /// /// class FieldIsReadonly { /// public readonly static ComplexObject Field = new ComplexObject(); /// } /// /// /// class UseThreadStatic { /// [ThreadStatic] /// public static ComplexObject Field; /// /// public static InitializeThread () /// { /// if (Field == null) /// Field = new ComplexObject (); /// } /// } /// /// [Problem ("This type has some static fields that are not constant. They may represent problems in multithreaded applications.")] [Solution ("Change the field to read-only, or mark it [ThreadStatic], or make it non visible outside the assembly.")] [FxCopCompatibility ("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible")] public class NonConstantStaticFieldsShouldNotBeVisibleRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule does not apply to interface and enumerations if (type.IsInterface || type.IsEnum || !type.HasFields || type.IsDelegate ()) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { if (field.IsStatic && field.IsVisible () && !field.IsInitOnly && !field.IsLiteral) { Runner.Report (field, Severity.Medium, Confidence.High); } } return Runner.CurrentRuleResult; } } } ReviewLockUsedOnlyForOperationsOnVariablesRule.cs0000664000175000017500000001553212413742070037233 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency// // Gendarme.Rules.Concurrency.ReviewLockUsedOnlyForOperationsOnVariablesRule // // Authors: // Cedric Vivier // Sebastien Pouliot // // Copyright (C) 2008 Cedric Vivier // 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; using System.Collections.Generic; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.Concurrency { /// /// This rule checks if a lock is used only to perform operations on locals /// or fields. /// If the only purpose of that critical section is to make sure the variables /// are modified atomatically then the methods provided by /// System.Threading.Interlocked class will be more efficient. /// /// /// Bad example: /// /// lock (_lockObject) { /// _counter++; /// } /// /// /// /// Good example: /// /// Interlocked.Increment(_counter); /// /// /// /// Bad example: /// /// lock (_lockObject) { /// _someSharedObject = anotherObject; /// } /// /// /// /// Good example: /// /// Interlocked.Exchange(_someSharedObject, anotherObject); /// /// [Problem ("Using a lock to do only atomic operations on locals or fields is often overkill.")] [Solution ("If possible, use System.Threading.Interlocked class to improve throughput.")] [EngineDependency (typeof (OpCodeEngine))] public class ReviewLockUsedOnlyForOperationsOnVariablesRule : Rule, IMethodRule { private static OpCodeBitmask interlockedFriendlyOpCodeBitmask = BuildInterlockedFriendlyOpCodeBitmask (); public override void Initialize (IRunner runner) { base.Initialize (runner); // is this module using Monitor.Enter ? (lock in c#) // if not then this rule does not need to be executed for the module // note: mscorlib.dll is an exception since it defines, not refer, System.Threading.Monitor Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Threading", "Monitor"); })); }; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; MethodBody body = method.Body; if (!body.HasExceptionHandlers) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (ExceptionHandler eh in body.ExceptionHandlers) { Instruction ins = eh.TryStart; // xMCS and earlier (pre-4.0) CSC used Monitor.Enter(object) just outside of the Try block bool monitor_enter = IsMonitorEnter (ins.Previous, 1); // check every try block int end = eh.TryEnd.Offset; for (; ins.Offset < end; ins = ins.Next) { // CSC10 use Monitor.Enter(object, ref bool) and put it inside the Try block if (!monitor_enter) { if (ins.OpCode.FlowControl == FlowControl.Call) monitor_enter = (IsMonitorEnter (ins, 2)); // we do not start checking instruction until we have found our Enter call continue; } // check for operations that requires a lock (and not a simpler interlock) bool lock_required = false; while (ins.Offset < end) { if (!interlockedFriendlyOpCodeBitmask.Get (ins.OpCode.Code)) { lock_required = true; break; } ins = ins.Next; } if (!lock_required && monitor_enter) Runner.Report (method, ins, Severity.Medium, Confidence.Normal); break; } } return Runner.CurrentRuleResult; } static bool IsMonitorEnter (Instruction ins, int parametersCount) { // VS2008 like to includes a few NOP while (ins != null && ins.OpCode.Code == Code.Nop) ins = ins.Previous; if (ins == null) return false; MethodReference method = (ins.Operand as MethodReference); if (!method.IsNamed ("System.Threading", "Monitor", "Enter")) return false; return (parametersCount == method.Parameters.Count); } private static OpCodeBitmask BuildInterlockedFriendlyOpCodeBitmask () { #if true return new OpCodeBitmask (0x80063FFFFFFFFF, 0x3f00000001800000, 0x1F30000000000000, 0x5F80); #else OpCodeBitmask mask = new OpCodeBitmask (); mask.UnionWith (OpCodeBitmask.FlowControlBranch); mask.UnionWith (OpCodeBitmask.FlowControlReturn); //locals mask.UnionWith (OpCodeBitmask.LoadLocal); mask.UnionWith (OpCodeBitmask.StoreLocal); //arguments mask.UnionWith (OpCodeBitmask.LoadArgument); mask.UnionWith (OpCodeBitmask.StoreArgument); //fields mask.Set (Code.Ldfld); mask.Set (Code.Ldflda); mask.Set (Code.Stfld); mask.Set (Code.Ldsfld); mask.Set (Code.Ldsflda); mask.Set (Code.Stsfld); //constants mask.Set (Code.Ldnull); mask.Set (Code.Ldc_I4_M1); mask.Set (Code.Ldc_I4_0); mask.Set (Code.Ldc_I4_1); mask.Set (Code.Ldc_I4_2); mask.Set (Code.Ldc_I4_3); mask.Set (Code.Ldc_I4_4); mask.Set (Code.Ldc_I4_5); mask.Set (Code.Ldc_I4_6); mask.Set (Code.Ldc_I4_7); mask.Set (Code.Ldc_I4_8); mask.Set (Code.Ldc_I4_S); mask.Set (Code.Ldc_I4); mask.Set (Code.Ldc_I8); mask.Set (Code.Ldc_R4); mask.Set (Code.Ldc_R8); //safe mask.Set (Code.Dup); mask.Set (Code.Pop); mask.Set (Code.Nop); mask.Set (Code.Break); //could be replace by interlocked call mask.Set (Code.Add); mask.Set (Code.Add_Ovf); mask.Set (Code.Add_Ovf_Un); mask.Set (Code.Sub); mask.Set (Code.Sub_Ovf); mask.Set (Code.Sub_Ovf_Un); return mask; #endif } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/ProtectCallToEventDelegatesRule.cs0000664000175000017500000001427312413742070034254 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.ProtectCallsToEventDelegatesRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { /// /// This rule checks that event invocations are safely implemented. In particular, /// the event must be copied into a local to avoid race conditions and it must be /// checked for null before it is used (events will normally be null until a delegate is added /// to them). /// /// /// Bad example (no check): /// /// public event EventHandler Loading; /// /// protected void OnLoading (EventArgs e) /// { /// // Loading field could be null, throwing a NullReferenceException /// Loading (this, e); /// } /// /// /// /// Bad example (race condition): /// /// public event EventHandler Loading; /// /// protected void OnLoading (EventArgs e) /// { /// // Loading could be non-null here /// if (Loading != null) { /// // but be null once we get here :( /// Loading (this, e); /// } /// } /// /// /// /// Good example: /// /// public event EventHandler Loading; /// protected void OnLoading (EventArgs e) /// { /// EventHandler handler = Loading; /// // handler is either null or non-null /// if (handler != null) { /// // and won't change (i.e. safe from a NullReferenceException) /// handler (this, e); /// // however it is still possible, like the original code, that /// // the Loading method will be removed before, or during its /// // execution. Your code should be safe against such occurance. /// } /// } /// /// [Problem ("The use of the event does not seems protected properly against NullReferenceException and/or race conditions.")] [Solution ("Fix the event use to make sure it won't be null or susceptible to a race condition.")] [EngineDependency (typeof (OpCodeEngine))] public class ProtectCallToEventDelegatesRule : Rule, IMethodRule { static private bool CheckNull (Instruction ins) { switch (ins.OpCode.Code) { // csc does a ldloc.x + ldnull + ceq for: if (variable == null) case Code.Ldnull: return (ins.Next.OpCode.Code == Code.Ceq); // [g]mcs will do a Br[true|false][.s] case Code.Brfalse: case Code.Brfalse_S: case Code.Brtrue: case Code.Brtrue_S: return true; case Code.Ceq: // csc does a ldnull + ldloc.x + ceq for: if (null == variable) return (ins.Previous.Previous.OpCode.Code == Code.Ldnull); default: return false; } } static private bool CheckVariable (MethodDefinition method, Instruction ins, VariableReference load) { // walkback to find the previous use of the variable Instruction previous = ins.Previous; while (previous != null) { VariableDefinition variable = previous.GetVariable (method); // are we talking about the same variable ? if ((variable != null) && (load.Index == variable.Index)) { if (previous.IsStoreLocal ()) { return false; } else { // load, check for null check if (CheckNull (previous.Next)) return true; } } previous = previous.Previous; } return true; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply to method without IL (e.g. p/invoke) or generated code (e.g. compiler or tools) if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if ((ins.OpCode.Code != Code.Callvirt) && (ins.OpCode.Code != Code.Call)) continue; // look for calls to .Invoke MethodReference mr = (ins.Operand as MethodReference); if (!MethodSignatures.Invoke.Matches (mr)) continue; // limit ourself to events if (!mr.IsEventCallback ()) continue; // first check if we're looking from a variable or directly from // the field (bad, it could be null) Instruction caller = ins.TraceBack (method); FieldDefinition field = caller.GetField (); if (field != null) { string msg = String.Format (CultureInfo.InvariantCulture, "Possible race condition since field '{0}' is accessed directly.", field.Name); Runner.Report (method, ins, Severity.High, Confidence.High, msg); } else { // look for the variable, if it's not then stop analysis VariableDefinition load = caller.GetVariable (method); if ((load != null) && !CheckVariable (method, caller, load)) { string msg = String.Format (CultureInfo.InvariantCulture, "Variable '{0}' does not seems to be checked against null.", load.Name); Runner.Report (method, ins, Severity.High, Confidence.Normal, msg); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/DoNotLockOnThisOrTypesRule.cs0000664000175000017500000001212412413742070033215 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.DoNotLockOnThisOrTypesRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { /// /// This rule checks if you're using lock on the current instance (this) or /// on a Type. This can cause /// problems because anyone can acquire a lock on the instance or type. And if another /// thread does acquire a lock then deadlocks become a very real possibility. The preferred way to /// handle this is to create a private System.Object instance field and lock that. This /// greatly reduces the scope of the code which may acquire the lock which makes it much easier /// to ensure that the locking is done correctly. /// /// /// Bad example (this): /// /// public void MethodLockingOnThis () /// { /// lock (this) { /// producer++; /// } /// } /// /// /// /// Bad example (type): /// /// public void MethodLockingOnType () /// { /// lock (this.GetType ()) { /// producer++; /// } /// } /// /// /// /// Good example: /// /// class ClassWithALocker { /// object locker = new object (); /// int producer = 0; /// /// public void MethodLockingLocker () /// { /// lock (locker) { /// producer++; /// } /// } /// } /// /// [Problem ("This method uses lock(this) or lock(typeof(X)) which makes it very difficult to ensure that the locking is done correctly.")] [Solution ("Instead lock a private object so that you have better control of when the locking is done.")] public class DoNotLockOnThisOrTypesRule : LockAnalyzerRule { private const string LockThis = "Monitor.Enter(this) or lock(this) in C#"; private const string LockType = "Monitor.Enter(typeof({0})) or lock(typeof({0})) in C#"; public override void Analyze (MethodDefinition method, MethodReference enter, Instruction ins) { Instruction locker = ins.TraceBack (method); if (locker.OpCode.Code == Code.Dup) locker = locker.TraceBack (method); string msg = CheckLocker (method, locker); if (msg.Length > 0) Runner.Report (method, ins, Severity.High, Confidence.High, msg); } private static string CheckLocker (MethodDefinition method, Instruction ins) { string msg = String.Empty; switch (ins.OpCode.Code) { case Code.Ldarg_0: if (!method.IsStatic) msg = LockThis; break; case Code.Ldarg: case Code.Ldarg_S: if (!method.IsStatic) { ParameterDefinition pd = (ins.Operand as ParameterDefinition); if ((pd == null) || (pd.Index == 0)) msg = LockThis; } break; case Code.Call: case Code.Callvirt: MethodReference mr = (ins.Operand as MethodReference); if (!mr.ReturnType.IsNamed ("System", "Type")) return String.Empty; if ((mr.Name == "GetTypeFromHandle") && (mr.DeclaringType.Name == "Type")) { // ldtoken msg = String.Format (CultureInfo.InvariantCulture, LockType, (ins.Previous.Operand as TypeReference).Name); } else { msg = mr.ToString (); } break; default: // [g]mcs commonly do a stloc.x ldloc.x just before // (a) an ldarg.0 (for instance methods); or // (b) an ldtoken (for static methods) // and this throws off TraceBack Instruction locker = StoreLoadLocal (method, ins); if (locker == null) return String.Empty; return CheckLocker (method, locker); } return msg; } private static Instruction StoreLoadLocal (MethodDefinition method, Instruction ins) { // check for a STLOC followed by a LDLOC if (!ins.IsLoadLocal () || !ins.Previous.IsStoreLocal ()) return null; // make sure it's about the same local variable if (ins.GetVariable (method) != ins.Previous.GetVariable (method)) return null; return ins.Previous.Previous; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/DecorateThreadsRule.cs0000664000175000017500000005675312413742070031767 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.DecorateThreadsRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.Linq; namespace Gendarme.Rules.Concurrency { /// /// This rule is designed to help you precisely specify the threading semantics supported /// by your code. This is valuable because it forces you to think clearly about the semantics /// required of the code, the semantics are explicitly visible in the code, and the rule verifies /// that the specification remains consistent. /// /// In order to do this the rule relies on an attribute which allows you to declare that your /// code can only run under the main thread, that it can run under an arbitrary thread, /// that it can run under multiple threads if the execution is serialized, or that the code /// is fully concurrent. /// /// The rule enforces the following constraints: /// /// Thread entry points cannot be main thread. /// MainThread code can call everything, AllowEveryCaller code can be called by /// everything, SingleThread can call SingleThread/Serializable/Concurrent, and Serializable/ /// Concurrent can call Serializable/Concurrent. /// Delegates must be able to call the methods they are bound to. /// An override of a base method or an implementation of an interface method must /// use the same threading model as the original method. /// A delegate used with a threaded event must use the same threading model as the /// event. /// Serializable cannot be applied to static methods and static methods of serializeable /// types do not inherit it from their types. (The rationale here is that there is normally nothing /// that can be used to serialize access to static methods other than the type which is a bad /// idea, see [http://bytes.com/groups/net-c/249277-dont-lock-type-objects]). /// /// /// When adding the attributes to a non-trivial amount of threaded code it seems best to focus /// on one thread at a time so that it is easier to understand how the methods interact and which /// threading model needs to be used by them. While doing this the defects for the other threads /// can be temporarily suppressed using gendarme's --ignore switch. /// /// /// Bad example: /// /// internal sealed class Wrapper : IDisposable /// { /// // Finalizers execute from a worker thread so the rule will complain /// // if they are main thread. /// ~Wrapper () /// { /// Dispose (false); /// } /// /// public void Dispose () /// { /// Dispose (true); /// GC.SuppressFinalize (this); /// } /// /// private void Dispose (bool disposing) /// { /// if (!Disposed) { /// Disposed = true; /// } /// } /// /// private bool Disposed { get; set; } /// } /// /// /// /// Good example: /// /// public enum ThreadModel { /// // The code may run safely only under the main thread (this is the /// // default for code in the assemblies being checked). /// MainThread = 0x0000, /// /// // The code may run under a single arbitrary thread. /// SingleThread = 0x0001, /// /// // The code may run under multiple threads, but only if the /// // execution is serialized (e.g. by user level locking). /// Serializable = 0x0002, /// /// // The code may run under multiple threads concurrently without user /// // locking (this is the default for code in the System/Mono namespaces). /// Concurrent = 0x0003, /// /// // Or this with the above for the rare cases where the code cannot be /// // shown to be correct using a static analysis. /// AllowEveryCaller = 0x0008, /// } /// /// // This is used to precisely specify the threading semantics of code. Note /// // that Gendarme's DecorateThreadsRule will catch problematic code which /// // uses these attributes (such as concurrent code calling main thread code). /// [Serializable] /// [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | /// AttributeTargets.Interface | AttributeTargets.Delegate | /// AttributeTargets.Method | AttributeTargets.Event | AttributeTargets.Property, /// AllowMultiple = false, Inherited = false)] /// public sealed class ThreadModelAttribute : Attribute { /// public ThreadModelAttribute (ThreadModel model) /// { /// Model = model; /// } /// /// public ThreadModel Model { get; set; } /// } /// /// internal sealed class Wrapper : IDisposable /// { /// [ThreadModel (ThreadModel.SingleThread)] /// ~Wrapper () /// { /// Dispose (false); /// } /// /// public void Dispose () /// { /// Dispose (true); /// GC.SuppressFinalize (this); /// } /// /// // This is called from both the finalizer thread and the main thread /// // so it must be decorated. But it only executes under one thread /// // at a time so we can use SingleThread instead of Concurrent. /// [ThreadModel (ThreadModel.SingleThread)] /// private void Dispose (bool disposing) /// { /// if (!Disposed) { /// Disposed = true; /// } /// } /// /// // This is called from a threaded method so it must also be /// // threaded. /// [ThreadModel (ThreadModel.SingleThread)] /// private bool Disposed { get; set; } /// } /// /// [Problem ("Threaded code is not decorated as threaded, a threading attribute is improperly used, or the assembly does not use ThreadModelAttribute.")] [Solution ("Use the correct threading attribute or disable the defect.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class DecorateThreadsRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); runner.AnalyzeAssembly += this.OnAssembly; DefectCount = 0; checked_entry_points.Clear (); anonymous_entry_points.Clear (); } static bool LookForThreadModelAttribute (IEnumerable list) { foreach (TypeReference type in list) { if (type.Name == "ThreadModelAttribute") { return true; } } return false; } public void OnAssembly (object sender, RunnerEventArgs e) { // If the assembly defines ThreadModelAttribute then we need to // check all of the methods within it. foreach (ModuleDefinition module in e.CurrentAssembly.Modules) { if (LookForThreadModelAttribute (module.GetAllTypes ())) { Log.WriteLine (this, "assembly defines ThreadModelAttribute"); Active = true; return; } else if (LookForThreadModelAttribute (module.GetTypeReferences ())) { Log.WriteLine (this, "assembly references ThreadModelAttribute"); Active = true; return; } } // If the assembly does not define ThreadModelAttribute then we don't // want to check methods but we do want to report (one) defect to inform // people about the rule. Active = false; if (!displayed_no_attribute_defect) { string mesg = "The assembly does not use ThreadModelAttribute (this defect will be reported only once)."; Log.WriteLine (this, mesg); ReportDefect (e.CurrentAssembly, Severity.Medium, Confidence.Low, mesg); displayed_no_attribute_defect = true; } } public int DefectCount { get; private set; } public RuleResult CheckMethod (MethodDefinition method) { if (ThreadRocks.ThreadedNamespace (method.DeclaringType.Namespace)) return RuleResult.DoesNotApply; Log.WriteLine (this); Log.WriteLine (this, "---------------------------------------"); Log.WriteLine (this, method); string name = method.Name; IList pdc = method.HasParameters ? method.Parameters : null; // Finalizers need to be single threaded. ThreadModel model = method.ThreadingModel (); if (method.IsFinalizer ()) { if ((model & ~ThreadModel.AllowEveryCaller) != ThreadModel.SingleThread) { string mesg = "Finalizers should be decorated with [ThreadModel (ThreadModel.SingleThreaded)]."; ReportDefect (method, Severity.High, Confidence.High, mesg); } } // Make sure all of the thread entry points are properly decorated and // that all calls are legit. if (method.HasBody && opcodes_mask.Intersect (OpCodeEngine.GetBitmask (method))) CheckMethodBody (method); // A delegate used with a threaded event must use the same threading model // as the event. if (method.IsAddOn) { ParameterDefinition p = pdc [0]; TypeDefinition delegateType = p.ParameterType.Resolve (); if (delegateType != null && !ThreadRocks.ThreadedNamespace (delegateType.Namespace)) { ThreadModel delegateModel = delegateType.ThreadingModel (); if (model != delegateModel && !delegateModel.AllowsEveryCaller ()) { string mesg = String.Format (CultureInfo.InvariantCulture, "{0} event must match {1} delegate.", model, delegateModel); ReportDefect (method, Severity.High, Confidence.High, mesg); } } } // An override of a base method or an implementation of an interface method // must use the same threading model as the original method. if (method.IsVirtual) { IEnumerable superTypes = method.DeclaringType.AllSuperTypes (); bool new_slot = method.IsNewSlot; superTypes = from s in superTypes where (s.IsInterface == new_slot) select s; string [] parameters = pdc != null ? (from p in pdc.Cast () select p.ParameterType.GetFullName ()).ToArray () : null; string return_type_name = method.ReturnType.GetFullName (); foreach (TypeDefinition type in superTypes) { MethodDefinition superMethod = type.GetMethod (name, return_type_name, parameters); if (superMethod != null && !ThreadRocks.ThreadedNamespace (superMethod.DeclaringType.Namespace)) { ThreadModel superModel = superMethod.ThreadingModel (); if (model != superModel) { string mesg = String.Format (CultureInfo.InvariantCulture, "{0} {1} must match {2} {3} method.", model, name, superModel, new_slot ? "interface" : "base"); ReportDefect (method, Severity.High, Confidence.High, mesg); } } } } // Serializable cannot be applied to static methods, but can be applied to // operators because they're just sugar for normal calls. if (method.IsStatic && model.Is (ThreadModel.Serializable) && !name.StartsWith ("op_", StringComparison.Ordinal)) { string mesg = "Static members cannot be decorated with Serializable."; ReportDefect (method, Severity.High, Confidence.High, mesg); } return Runner.CurrentRuleResult; } public override void TearDown () { // We don't always know that an anonymous method was used as a thread // entry point when we check the method so we check them just before we // tear down. foreach (MethodDefinition caller in anonymous_entry_points) { foreach (Instruction ins in caller.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodDefinition target = ((MethodReference) ins.Operand).Resolve (); if (target != null) { ThreadModel targetModel = target.ThreadingModel (); if (targetModel == ThreadModel.MainThread) { string mesg = String.Format (CultureInfo.InvariantCulture, "An anonymous thread entry point cannot call MainThread {0}.", target.Name); ++DefectCount; Log.WriteLine (this, "Defect: {0}", mesg); Defect defect = new Defect (this, caller, caller, ins, Severity.High, Confidence.High, mesg); Runner.Report (defect); } } break; } } } base.TearDown (); } #region Private Methods private void CheckMethodBody (MethodDefinition method) { var synchronizedEvents = new Dictionary> (); var thisSynchronized = new List (); foreach (Instruction ins in method.Body.Instructions) { MethodReference candidate = null; switch (ins.OpCode.Code) { case Code.Newobj: if (ins.Previous != null && ins.Previous.OpCode.Code == Code.Ldftn) { MethodReference ctor = (MethodReference) ins.Operand; TypeReference type = ctor.DeclaringType; if (type.IsDelegate ()) { string nspace = type.Namespace; // ldftn entry-point // newobj System.Void System.Threading.XXX::.ctor (System.Object,System.IntPtr) // i.e. creation of a System.Threading delegate if (nspace == "System.Threading") { string name = type.Name; if (name == "ThreadStart" || name == "ParameterizedThreadStart" || name == "WaitCallback" || name == "WaitOrTimerCallback" || name == "TimerCallback") { candidate = (MethodReference) ins.Previous.Operand; } // ldftn entry-point // newobj System.Void System.AsyncCallback::.ctor (System.Object,System.IntPtr) // i.e. creation of a async delegate } else if (nspace == "System") { if (type.Name == "AsyncCallback") { candidate = (MethodReference) ins.Previous.Operand; } // ldftn entry-point // newobj System.Void ThreadedDelegate::.ctor (System.Object,System.IntPtr) // i.e. creation of a delegate which is decorated with a threading attribute } else if (!ThreadRocks.ThreadedNamespace (nspace)) { // Delegates must be able to call the methods they are bound to. MethodDefinition target = ((MethodReference) ins.Previous.Operand).Resolve (); if (target != null) { ThreadModel callerModel = type.ThreadingModel (); if (!target.IsGeneratedCode () || target.IsProperty ()) { ThreadModel targetModel = target.ThreadingModel (); if (!IsValidCall (callerModel, targetModel)) { string mesg = String.Format (CultureInfo.InvariantCulture, "{0} delegate cannot be bound to {1} {2} method.", callerModel, targetModel, target.Name); ++DefectCount; Log.WriteLine (this, "Defect: {0}", mesg); Defect defect = new Defect (this, method, method, ins, Severity.High, Confidence.High, mesg); Runner.Report (defect); } } else if (!callerModel.Is (ThreadModel.MainThread)) { anonymous_entry_points.Add (target); } } } } } break; case Code.Call: case Code.Callvirt: if (!method.IsGeneratedCode () || method.IsProperty ()) CheckForLegalCall (method, ins); // ldftn entry-point // newobj XXX // callvirt System.Void SynchronizedType::add_Name (XXX) // i.e. adding a delegate to an event in a type which uses SynchronizingObject MethodReference call = (MethodReference) ins.Operand; TypeReference call_type = call.DeclaringType; if (ins.Previous.Is (Code.Newobj) && ins.Previous.Previous.Is (Code.Ldftn)) { // A few events are blacklisted because they do not use SynchronizingObject and // are therefore always threaded. if (IsNonSynchronizedSetter (call)) { candidate = (MethodReference) ins.Previous.Previous.Operand; // But most events do use SynchronizingObject and therefore their threading // depends on whether and how SynchronizingObject is initialized. } else if (HasSynchronizingObject (call_type)) { List methods; if (!synchronizedEvents.TryGetValue (call, out methods)) { methods = new List (); synchronizedEvents.Add (call, methods); } methods.AddIfNew ((MethodReference) ins.Previous.Previous.Operand); // Misc threaded events. } else if (call_type.IsNamed ("System.ComponentModel", "BackgroundWorker")) { if (call.Name == "add_DoWork") { candidate = (MethodReference) ins.Previous.Previous.Operand; } } // callvirt System.Void System.Diagnostics.Process::set_SynchronizingObject (System.ComponentModel.ISynchronizeInvoke) } else if (SetSynchronizingObject.Matches (call)) { if (ins.Previous.OpCode.Code == Code.Ldarg_0) { thisSynchronized.Add (call_type); } } break; } if (candidate != null) { Log.WriteLine (this, "{0} is a thread entry point", candidate); CheckEntryPoint (candidate); } } // For every method added to a threaded event, ThreadModel? method_model = null; foreach (KeyValuePair> entry in synchronizedEvents) { // if the event is synchronized on this then the target must have the same thread // as the current method's type or better and it should not be treated as a entry point. if (thisSynchronized.Contains (entry.Key.DeclaringType)) { if (method_model == null) method_model = method.DeclaringType.ThreadingModel (); foreach (MethodReference mr in entry.Value) { MethodDefinition target = mr.Resolve (); if (target != null) { ThreadModel targetModel = target.ThreadingModel (); if (!IsValidCall (method_model.Value, targetModel)) { string mesg = String.Format (CultureInfo.InvariantCulture, "{0} {1} cannot be bound to {2} {3} method.", method_model, entry.Key, targetModel, target.Name); ReportDefect (method, Severity.High, Confidence.High, mesg); } } } // otherwise the method has to be treated as a thread entry point. } else { foreach (MethodReference mr in entry.Value) { Log.WriteLine (this, "{0} is a thread entry point", mr); CheckEntryPoint (mr); } } } } static bool IsNonSynchronizedSetter (MemberReference method) { switch (method.Name) { case "add_Disposed": return true; // MSDN is ambiguous about whether these are supposed to work with SynchronizingObject // but mono doesn't. case "add_ErrorDataReceived": case "add_OutputDataReceived": if (method.DeclaringType.IsNamed ("System.Diagnostics", "Process")) return true; break; } return false; } static bool HasSynchronizingObject (TypeReference tr) { foreach (TypeDefinition type in tr.AllSuperTypes ()) { if (type.GetMethod (SetSynchronizingObject) != null) return true; } return false; } // Thread entry points cannot be main thread or an anonymous // method (but not an auto-property). private void CheckEntryPoint (MethodReference mr) { if (!checked_entry_points.Contains (mr)) { checked_entry_points.Add (mr); MethodDefinition method = mr.Resolve (); if (method != null) { ThreadModel model = method.ThreadingModel (); if (method.IsGeneratedCode () && !method.IsProperty ()) { anonymous_entry_points.Add (method); } else if (model == ThreadModel.MainThread) { string mesg = String.Format (CultureInfo.InvariantCulture, "{0} is a thread entry point and so cannot be MainThread.", method.Name); ReportDefect (method, Severity.High, Confidence.High, mesg); } } } } private void CheckForLegalCall (MethodDefinition caller, Instruction ins) { MethodDefinition target = ((MethodReference) ins.Operand).Resolve (); if (target != null) { ThreadModel callerModel = caller.ThreadingModel (); ThreadModel targetModel = target.ThreadingModel (); if (!IsValidCall (callerModel, targetModel)) { string mesg = String.Format (CultureInfo.InvariantCulture, "{0} {1} cannot call {2} {3}.", callerModel, caller.Name, targetModel, target.Name); ++DefectCount; Log.WriteLine (this, "Defect: {0}", mesg); Defect defect = new Defect (this, caller, caller, ins, Severity.High, Confidence.High, mesg); Runner.Report (defect); } } } // MainThread code can call everything, AllowEveryCaller code can be called by // everything, SingleThread can call SingleThread/Serializable/Concurrent, and Serializable/ // Concurrent can call Serializable/Concurrent. static bool IsValidCall (ThreadModel caller, ThreadModel target) { // MainThread code can call everything if (caller.Is (ThreadModel.MainThread)) return true; // AllowEveryCaller code can be called by everything else if (target.AllowsEveryCaller ()) return true; // SingleThread can call SingleThread/Serializable/Concurrent else if (caller.Is (ThreadModel.SingleThread) && (target.Is (ThreadModel.SingleThread) || target.Is (ThreadModel.Serializable) || target.Is (ThreadModel.Concurrent))) return true; // Serializable/Concurrent can call Serializable/Concurrent else if ((caller.Is (ThreadModel.Serializable) || caller.Is (ThreadModel.Concurrent)) && (target.Is (ThreadModel.Serializable) || target.Is (ThreadModel.Concurrent))) return true; return false; } // We use this little helper so that we can report a better defect count to the test. // (The test itself can't quite manage this because it can't tell what happened // inside TearDown if CheckType or CheckMethod failed). private void ReportDefect (IMetadataTokenProvider metadata, Severity severity, Confidence confidence, string mesg) { ++DefectCount; Log.WriteLine (this, "Defect: {0}", mesg); // We need to use the Defect Report overload because the runner's current // target won't be set if we land here via TearDown. Defect defect = new Defect (this, metadata, metadata, severity, confidence, mesg); Runner.Report (defect); } #endregion #if false private void Bitmask () { OpCodeBitmask opcodes_mask = new OpCodeBitmask (); opcodes_mask.Set (Code.Ldftn); opcodes_mask.Set (Code.Call); opcodes_mask.Set (Code.Callvirt); Console.WriteLine (opcodes_mask); } #endif #region Fields private HashSet checked_entry_points = new HashSet (); private HashSet anonymous_entry_points = new HashSet (); private bool displayed_no_attribute_defect; private static readonly OpCodeBitmask opcodes_mask = new OpCodeBitmask (0x8000000000, 0x400000000000, 0x0, 0x20); private static readonly MethodSignature SetSynchronizingObject = new MethodSignature ("set_SynchronizingObject", "System.Void", new string [] { "System.ComponentModel.ISynchronizeInvoke" }); #endregion } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/WriteStaticFieldFromInstanceMethodRule.cs0000664000175000017500000001034012413742070035564 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.WriteStaticFieldFromInstanceMethodRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006,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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { /// /// This rule is used to check for instance methods which write values to static fields. /// This may cause problems if multiple instances of the type exist and are used in /// multithreaded applications. /// /// /// Bad example: /// /// static int default_value; /// /// public int Value { /// get { /// if (default_value == 0) { /// default_value = -1; /// } /// return (value > default_value) ? value : 0; /// } /// } /// /// /// /// Good example: /// /// static int default_value = -1; /// /// public int Value { /// get { /// return (value > default_value) ? value : 0; /// } /// } /// /// [Problem ("This instance method writes to static fields. This may cause problem with multiple instances in multithreaded applications.")] [Solution ("Move initialization to the static constructor or ensure appropriate locking.")] [EngineDependency (typeof (OpCodeEngine))] public class WriteStaticFieldFromInstanceMethodRule : Rule, IMethodRule { static bool CheckField (FieldReference field) { // skip instance fields and generated static field (likely by the compiler) if ((field == null) || field.IsGeneratedCode ()) return false; // check if the field could be resolved FieldDefinition fd = field.Resolve (); if (fd == null) return false; // skip fields decorated with [ThreadStatic] (the runtime will use // thread local storage for these so they are thread safe) if (fd.HasCustomAttributes) { if (fd.HasAttribute ("System", "ThreadStaticAttribute")) return false; } return true; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if // - the method has no body (e.g. p/invokes, icalls don't) // - the method is static // - the method was generated by the compiler or a tool if (!method.HasBody || method.IsStatic || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeEngine.GetBitmask (method).Get (Code.Stsfld)) return RuleResult.DoesNotApply; // *** ok, the rule applies! *** foreach (Instruction ins in method.Body.Instructions) { // look for stsfld instructions if (ins.OpCode.Code == Code.Stsfld) { FieldReference fr = (ins.Operand as FieldReference); if (CheckField (fr)) { string text = String.Format (CultureInfo.InvariantCulture, "The static field '{0}', of type '{1}'. is being set in an instance method.", fr.Name, fr.FieldType); Runner.Report (method, ins, Severity.Medium, Confidence.High, text); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/DoNotLockOnWeakIdentityObjectsRule.cs0000664000175000017500000001340112413742070034672 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.DoNotLockOnWeakIdentityObjectsRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Concurrency { /// /// This rule ensures there are no locks on objects with weak identity. /// An object with weak identity is one that can be directly accessed across /// different application domains. Because these objects can be accessed /// by different application domains it is very difficult to ensure that the /// locking is done correctly so problems such as deadlocks are much more likely. /// The following types have a weak identities: /// /// /// System.MarshalByRefObject /// /// /// System.OutOfMemoryException /// /// /// System.Reflection.MemberInfo /// /// /// System.Reflection.ParameterInfo /// /// /// System.ExecutionEngineException /// /// /// System.StackOverflowException /// /// /// System.String /// /// /// System.Threading.Thread /// /// /// /// /// Bad example: /// /// public void WeakIdLocked () /// { /// lock ("CustomString") { /// // ... /// } /// } /// /// /// /// Good example: /// /// public void WeakIdNotLocked () /// { /// Phone phone = new Phone (); /// lock (phone) { /// // ... /// } /// } /// /// [Problem ("This method uses a lock on an object with weak identity, i.e. one that is directly accessible across application domains.")] [Solution ("To be safe it is important to lock on an object that is private to your code.")] [FxCopCompatibility ("Microsoft.Reliability", "CA2002:DoNotLockOnObjectsWithWeakIdentity")] public class DoNotLockOnWeakIdentityObjectsRule : LockAnalyzerRule { static bool IsWeakSealedType (TypeReference type) { switch (type.Namespace) { case "System": string name = type.Name; return ((name == "String") || (name == "ExecutionEngineException") || (name == "StackOverflowException")); case "System.Threading": return (type.Name == "Thread"); default: return false; } } static string InheritFromWeakType (TypeReference type, string nameSpace, string name) { if (!type.Inherits (nameSpace, name)) return String.Empty; return String.Format (CultureInfo.InvariantCulture, "'{0}' inherits from '{1}.{2}'.", type.GetFullName (), nameSpace, name); } public override void Analyze (MethodDefinition method, MethodReference enter, Instruction ins) { TypeReference type = null; // keep original instruction since this is where we will report the defect Instruction call = ins; // Monitor.Enter(object) // Monitor.Enter(object, ref bool) <-- new in FX4 and used by CSC10 Instruction first = call.TraceBack (method); if (first.OpCode.Code == Code.Dup) first = first.Previous; type = first.GetOperandType (method); if (type.IsNamed ("System", "Object")) { // newer GMCS use a temporary local that hides the real type Instruction prev = first.Previous; if (first.IsLoadLocal () && prev.IsStoreLocal ()) { if (first.GetVariable (method) == prev.GetVariable (method)) type = prev.Previous.GetOperandType (method); } } if (type == null) return; if (IsWeakSealedType (type)) { Runner.Report (method, call, Severity.High, Confidence.Normal, type.GetFullName ()); } else { string msg = InheritFromWeakType (type, "System", "MarshalByRefObject"); if (msg.Length > 0) { Runner.Report (method, call, Severity.High, Confidence.Normal, msg); return; } msg = InheritFromWeakType (type, "System", "OutOfMemoryException"); if (msg.Length > 0) { Runner.Report (method, call, Severity.High, Confidence.Normal, msg); return; } msg = InheritFromWeakType (type, "System.Reflection", "MemberInfo"); if (msg.Length > 0) { Runner.Report (method, call, Severity.High, Confidence.Normal, msg); return; } msg = InheritFromWeakType (type, "System.Reflection", "ParameterInfo"); if (msg.Length > 0) { Runner.Report (method, call, Severity.High, Confidence.Normal, msg); } } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/0000775000175000017500000000000012642235741026454 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/ChangeLog0000664000175000017500000001246112413742070030224 0ustar00directhexdirecthex000000000000002010-06-08 Sebastien Pouliot * DecorateThreadsTest.cs: Remove yet another copy of ThreadModelAttribute 2010-04-18 Sebastien Pouliot * DoubleCheckLockingTest.cs: Fix cop-paste error :( * ReviewLockUsedOnlyForOperationsOnVariablesTest.cs: Use SimpleMethods and remove one-line helpers. Change Success6 to a DoNotApply (like the comment says) 2010-04-17 Sebastien Pouliot * DoubleCheckLockingTest.cs: Ignore test case if the unit tests were compiled with FX 4.0. 2010-04-17 Sebastien Pouliot * DoNotUseMethodImplOptionsSynchronizedTest.cs: With newer CSC we cannot assume the event accessor to be auto-generated by the presence of IsSynchronized. Ignore some asserts if needed 2009-06-10 Jesse Jones * DecorateThreadsTest.cs: added new rule. 2009-01-23 Jesse Jones * DoNotUseThreadStaticWithInstanceFieldsTest.cs: added new rule. 2009-01-21 Jesse Jones * WriteStaticFieldFromInstanceMethodRule.cs: Ignore fields decorated with [ThreadStatic]. 2008-12-21 Sebastien Pouliot * ProtectCallToEventDelegatesTest.cs: Add test cases where the condition arguments are inverted. Since CSC compiles this differently than [g]mcs so we need to handle this separately. 2008-11-08 Sebastien Pouliot * ProtectCallToEventDelegatesTest.cs: New. Unit tests for ProtectCallToEventDelegatesRule 2008-11-07 Alan McGovern * Tests.Rules.Concurrency.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-23 Sebastien Pouliot * DoNotUseMethodImplOptionsSynchronizedTest.cs: New. Unit tests for DoNotUseMethodImplOptionsSynchronizedRule * Test.Rules.Concurrency.mdp: Add new tests to MD project file. 2008-10-18 Sebastien Pouliot * DoNotLockOnThisOrTypesTest.cs: Add more coverage. * DoNotLockOnWeakIdentityObjectsTest.cs: Add more coverage. * DontUseLockedRegionOutsideMethodTest.cs: Add more coverage. * DoubleCheckLockingTest.cs: Add more coverage. * NonConstantStaticFieldsShouldNotBeVisibleTest.cs: Use newer, shorter, syntax for tests. Remove unused namespaces. * WriteStaticFieldFromInstanceMethodTest.cs: Use newer, shorter, syntax for tests. Remove unused namespaces. 2008-08-13 Sebastien Pouliot * DoNotLockOnThisOrTypesTest.cs: Add test cases for static method locking on type (they can't lock on this). Added test cases when the lock object is inside a base type field and property. Fix namespace. * DoNotLockOnWeakIdentityObjectsTest.cs: Fix namespace. 2008-05-25 Sebastien Pouliot * DoNotLockOnThisOrTypesTest.cs: New. Unit tests for DoNotLockOnThisOrTypesRule * DoNotLockOnWeakIdentityObjectsTest.cs: New. Unit tests for DoNotLockOnWeakIdentityObjectsRule * Test.Rules.Concurrency.mdp: Update MD project file 2008-05-11 Andres G. Aragoneses * Test.Rules.Concurrency.mdp: Fix references. 2008-04-26 Sebastien Pouliot * DontUseLockedRegionOutsideMethodTest.cs: Update header and add another test case where the number of Enter and Exit don't match. 2008-04-26 Andres G. Aragoneses * Test.Rules.Concurrency.mdp, DontUseLockedRegionOutsideMethodTest.cs: My first rule with its tests! It's very simple but more will come (noted in the TODO's). I hope it works because I cannot check it right now, the Gendarme.Tests are failing compilation for me. 2008-04-05 Sebastien Pouliot * DoubleCheckLockingTest.cs: Add two more test cases and update existing tests to the new, simpler, test design. * WriteStaticFieldFromInstanceMethodTest.cs: Fix namespace. * Test.Rules.Concurrency.mdp: Add reference to Test.Rules.dll 2008-02-15 Sebastien Pouliot * DoubleCheckLockingTest.cs * NonConstantStaticFieldsShouldNotBeVisibleTest.cs * WriteStaticFieldFromInstanceMethodTest.cs: Update unit tests wrt framework changes. 2008-01-21 Sebastien Pouliot * NonConstantStaticFieldsShouldNotBeVisibleTest.cs: New. Unit tests by Andreas Noever. 2007-10-07 Sebastien Pouliot * Test.Rules.Concurrency.mdp: Update project file. 2007-06-14 Sebastien Pouliot * WriteStaticFieldFromInstanceMethodTest.cs: Update API to fix build. 2006-11-11 Sebastien Pouliot * Test.Rules.Concurrency.mdp: Add new tests to MonoDevelop project. * WriteStaticFieldFromInstanceMethodTest.cs: New. Unit tests for the new WriteStaticFieldFromInstanceMethodRule rule. 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-20 Jonathan Chambers * Test.Rules.Concurrency.csproj: Make reference to nunit.framework not a specific version for portability. 2006-07-31 Sebastien Pouliot * Test.Rules.Concurrency.mdp: New. Project file for MonoDevelop. 2006-07-31 Sebastien Pouliot * DoubleCheckLockingTest.cs: Convert (and add) tests to NUnit format. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/DoNotLockOnWeakIdentityObjectsTest.cs0000664000175000017500000001047012413742070035624 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotLockOnWeakIdentityObjectsRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Reflection; using System.Threading; using Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Concurrency { [TestFixture] public class DoNotLockOnWeakIdentityObjectsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL for p/invokes AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no calls[virt] AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } static Dictionary cache = new Dictionary (); static object locker = new object (); public bool LockObject (string s) { lock (locker) { return cache.ContainsKey (s); } } [Test] public void Object () { AssertRuleSuccess ("LockObject"); } public bool LockOnLocalString () { // sealed type string s = "lock"; lock (s) { return cache.ContainsKey (s); } } // sealed type private static ExecutionEngineException static_eee; // sealed type private StackOverflowException so; public bool LocksOnExceptions () { lock (static_eee) { if (cache.ContainsKey ("a")) return true; } lock (so) { return cache.ContainsKey ("b"); } } // sealed type private Thread thread; public bool LockOnThread (string s) { lock (Thread.CurrentThread) { return cache.ContainsKey (s); } } [Test] public void WeakIdentity_Sealed () { AssertRuleFailure ("LockOnLocalString", 1); AssertRuleFailure ("LocksOnExceptions", 2); AssertRuleFailure ("LockOnThread", 1); } // abstract type private MarshalByRefObject instance_field = null; public bool LockOnMarshalByRefObject (string s) { lock (instance_field) { return cache.ContainsKey (s); } } public bool LockOnAppDomain (string s) { // AppDomain inherits from MBRO lock (AppDomain.CurrentDomain) { return cache.ContainsKey (s); } } // non-sealed type private OutOfMemoryException oom; public class MyOutOfMemoryException : OutOfMemoryException { } private MyOutOfMemoryException myOom; public bool LocksOnOutOfMemory () { lock (oom) { if (cache.ContainsKey ("a")) return true; } lock (myOom) { return cache.ContainsKey ("b"); } } // abstract type private MemberInfo mi; // non-sealed type private ParameterInfo pi; public bool LockOnReflectionObjects (string s) { lock (mi) { lock (pi) { return cache.ContainsKey (s); } } } [Test] public void WeakIdentity () { AssertRuleFailure ("LockOnMarshalByRefObject", 1); AssertRuleFailure ("LockOnAppDomain", 1); AssertRuleFailure ("LocksOnOutOfMemory", 2); AssertRuleFailure ("LockOnReflectionObjects", 2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/Makefile.in0000664000175000017500000003144212642235731030524 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Concurrency/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Concurrency.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Concurrency/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Concurrency/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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: WriteStaticFieldFromInstanceMethodTest.cs0000664000175000017500000000714512413742070036445 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test// // Unit tests for WriteStaticFieldFromInstanceMethodRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006-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; using Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Concurrency { [TestFixture] public class WriteStaticFieldFromInstanceMethodTest : MethodRuleTestFixture { public class TestCase { public const string public_const_field = ""; private static string private_static_field = String.Empty; public static int private_public_field = 1; [ThreadStatic] private static string thread_local_field; static TestCase () { private_static_field = "static"; } public TestCase () { private_static_field = "instance"; } public string GetConstField () { return public_const_field; } public string GetStaticField () { return private_static_field; } public void SetStaticField (string user_value) { private_static_field = user_value; } public string Append (string user_value) { return private_static_field + user_value; } public string AppendChange (string user_value) { private_static_field += user_value; return private_static_field; } public int MultipleChanges () { private_public_field = 10 + private_public_field; private_public_field = private_public_field + 12; return private_public_field; } public string ThreadStatic (string user_value) { thread_local_field = (thread_local_field ?? String.Empty) + user_value; return thread_local_field; } } [Test] public void GetConstField () { AssertRuleDoesNotApply ("GetConstField"); } [Test] public void GetStaticField () { AssertRuleDoesNotApply ("GetStaticField"); } [Test] public void SetStaticField () { AssertRuleFailure ("SetStaticField", 1); } [Test] public void Append () { AssertRuleDoesNotApply ("Append"); } [Test] public void AppendChange () { AssertRuleFailure ("AppendChange", 1); } [Test] public void MultipleChanges () { AssertRuleFailure ("MultipleChanges", 2); } [Test] public void StaticConstructor () { AssertRuleDoesNotApply (".cctor"); } [Test] public void ThreadStatic () { AssertRuleSuccess ("ThreadStatic"); } [Test] public void Constructor () { AssertRuleFailure (".ctor", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/DoNotLockOnThisOrTypesTest.cs0000664000175000017500000001134212413742070034145 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotLockOnThisOrTypesRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Concurrency { [TestFixture] public class DoNotLockOnThisOrTypesTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL for p/invokes AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no calls[virt] AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } static Dictionary cache = new Dictionary (); public bool LockThis (string s) { lock (this) { return cache.ContainsKey (s); } } [Test] public void This () { AssertRuleFailure ("LockThis"); } public bool LockType (string s) { lock (typeof (DoNotLockOnThisOrTypesTest)) { return cache.ContainsKey (s); } } public bool LockTypes (string s) { lock (typeof (DoNotLockOnThisOrTypesTest)) { lock (s.GetType ()) { return cache.ContainsKey (s); } } } [Test] public void Type () { AssertRuleFailure ("LockType", 1); AssertRuleFailure ("LockTypes", 2); } static public bool StaticLockType (string s) { lock (typeof (DoNotLockOnThisOrTypesTest)) { return cache.ContainsKey (s); } } static public bool StaticLockTypes (string s) { lock (typeof (DoNotLockOnThisOrTypesTest)) { lock (s.GetType ()) { return cache.ContainsKey (s); } } } static bool TryEnter (object obj) { lock (obj) { Console.WriteLine (); } return true; } [Test] public void StaticType () { AssertRuleFailure ("StaticLockType", 1); AssertRuleFailure ("StaticLockTypes", 2); AssertRuleSuccess ("TryEnter"); } object instance_locker = new object (); static object static_locker = new object (); public bool LockInstanceObject (string s) { lock (instance_locker) { return cache.ContainsKey (s); } } public bool LockStaticObject (string s) { lock (static_locker) { return cache.ContainsKey (s); } } public bool NoLock (string s) { return cache.ContainsKey (s); } [Test] public void Instance () { AssertRuleSuccess ("LockInstanceObject"); AssertRuleSuccess ("LockStaticObject"); AssertRuleSuccess ("NoLock"); } static public bool StaticLockStaticObject (string s) { lock (static_locker) { return cache.ContainsKey (s); } } static public bool StaticNoLock (string s) { return cache.ContainsKey (s); } [Test] public void Static () { AssertRuleSuccess ("StaticLockStaticObject"); AssertRuleSuccess ("StaticNoLock"); } abstract class Base { protected object locker = new object (); public object Locker { get { return locker; } } } class Concrete : Base { void LockField (string s) { try { lock (base.locker) { Console.WriteLine (s); } } catch { } } void LockProperty (string s) { try { lock (base.Locker) { Console.WriteLine (s); } } catch { } } } [Test] public void CallingBase () { AssertRuleSuccess ("LockField"); AssertRuleSuccess ("LockProperty"); } } } DoNotUseThreadStaticWithInstanceFieldsTest.cs0000664000175000017500000000431312413742070037227 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test// // Unit tests for DoNotUseThreadStaticWithInstanceFieldsRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Concurrency { [TestFixture] public sealed class DoNotUseThreadStaticWithInstanceFieldsTest : TypeRuleTestFixture { private sealed class Good1 { [ThreadStatic] public static string name; } private sealed class Bad1 { [ThreadStatic] public string name1; } private sealed class Bad2 { [ThreadStatic] public string name1; [ThreadStatic] public static string name; // this one is OK [ThreadStatic] public string name2; } [Test] public void NotApplicable () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void Cases () { AssertRuleSuccess (); AssertRuleFailure (); AssertRuleFailure (2); } } } NonConstantStaticFieldsShouldNotBeVisibleTest.cs0000664000175000017500000000626312413742070037755 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test// // Unit tests for NonConstantStaticFieldsShouldNotBeVisibleRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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 Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Concurrency { public class HasPublicConst { public const int CONST = 0; } public class HasPublicNonConstantStaticField { public static int Field; } public class HasProtectedNonConstantStaticField { protected static int Field; } public class HasInternalNonConstantStaticField { internal static int Field; } public class HasPublicConstantStaticField { public static readonly int Field; } public class HasPrivateNonConstantStaticField { private static int Field; } public class HasPublicNonConstantField { public int Field; } [TestFixture] public class NonConstantStaticFieldsShouldNotBeVisibleTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void TestHasPublicConst () { AssertRuleSuccess (); } [Test] public void TestHasPublicNonConstantStaticField () { AssertRuleFailure (1); } [Test] public void TestHasProtectedNonConstantStaticField () { AssertRuleFailure (1); } [Test] public void TestHasInternalNonConstantStaticField () { AssertRuleSuccess (); } [Test] public void TestHasPublicConstantStaticField () { AssertRuleSuccess (); } [Test] public void TestHasPrivateNonConstantStaticField () { AssertRuleSuccess (); } [Test] public void TestHasPublicNonConstantField () { AssertRuleSuccess (); } } } DontUseLockedRegionOutsideMethodTest.cs0000664000175000017500000000515112413742070036125 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test// // Unit tests for DontUseLockedRegionOutsideMethodTest // // Authors: // Andres G. Aragoneses // // Copyright (C) 2008 Andres G. Aragoneses // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Concurrency { [TestFixture] public class DoNotUseLockedRegionOutsideMethodTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL for p/invokes AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no calls[virt] AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public class Monitors { private Monitors () { } public static void WithLockStatement () { lock ( new object () ) { // do something... WithLockStatement (); } } public static void WithoutConcurrency () { // do something... WithoutConcurrency (); } public static void WithoutThreadExit () { // do something... WithoutThreadExit (); System.Threading.Monitor.Enter ( new object () ); // do something... WithoutThreadExit (); } public static void TwoEnterOneExit () { lock (new object ()) { System.Threading.Monitor.Enter (new object ()); } } } [Test] public void Check () { AssertRuleSuccess ("WithLockStatement"); AssertRuleSuccess ("WithoutConcurrency"); AssertRuleFailure ("WithoutThreadExit"); AssertRuleFailure ("TwoEnterOneExit"); } } } ReviewLockUsedOnlyForOperationsOnVariablesTest.cs0000664000175000017500000001504012413742070040154 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test// // Unit tests for ReviewLockUsedOnlyForOperationsOnVariablesRule // // Authors: // Cedric Vivier // Sebastien Pouliot // // Copyright (C) 2008 Cedric Vivier // 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; using System.Collections.Generic; using System.Reflection; using System.Threading; using Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Concurrency { [TestFixture] public class ReviewLockUsedOnlyForOperationsOnVariablesTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply ("DoesNotApply1"); AssertRuleDoesNotApply ("DoesNotApply2"); } [Test] public void Success () { AssertRuleSuccess ("Success1"); AssertRuleSuccess ("Success2"); AssertRuleSuccess ("Success3"); AssertRuleSuccess ("Success4"); AssertRuleSuccess ("Success5"); AssertRuleSuccess ("Success6"); } [Test] public void Failure () { AssertRuleFailure ("Failure0", 1); AssertRuleFailure ("Failure1", 1); AssertRuleFailure ("Failure2", 1); AssertRuleFailure ("Failure3", 1); AssertRuleFailure ("Failure4", 1); AssertRuleFailure ("Failure5", 1); AssertRuleFailure ("Failure5b", 2); AssertRuleFailure ("Failure6", 1); AssertRuleFailure ("Failure7", 1); AssertRuleFailure ("Failure8", 3); } private object locker = new object (); private object locker2 = new object (); public bool DoesNotApply1 () { bool ret = true; x = 42; y = 33; return ret; } public void DoesNotApply2 () { Monitor.Enter (locker); x = 0; //does not apply since we do not exit } public bool Success1 (string s) { lock (locker) { return cache.ContainsKey (s); } } public bool Success2 () { object o = new object (); lock (o) { Type t = o.GetType (); lock (locker) { return cache.ContainsKey ("foo"); } } } public bool Success3 () { bool ret = false; object o = new object (); lock (o) { object o2 = new object (); lock (locker) { Console.WriteLine("foo"); x++; } lock (locker) { ret = true; Console.WriteLine("foo"); } } return ret; } public bool Success4 () { bool ret = false; object o = new object (); lock (o) { Console.WriteLine (ret); lock (locker2) { if (!ret) ret = true; } } return ret; } bool ret; public void Success5 () { lock (locker) { if (!ret) ret = true; } x = 0; } public void Success6 (string name) { lock (locker) { s = name.Substring(1); } } public void Failure0 () { lock (locker) { x = 1; y = 2; } } public void Failure1 () { lock (locker) { x++; } } public void Failure2 () { lock (locker) { x = y; } } public void Failure3 () { lock (locker) { lock (locker2) { Console.WriteLine (x); } lock (locker2) { x++; } lock (locker2) { Console.WriteLine (x); } } } public void Failure4 () { lock (locker) { lock (locker2) { Console.WriteLine (x); } lock (locker2) { x--; y--; } lock (locker2) { Console.WriteLine (y); } } } public void Failure5 () { object o = new object (); lock (locker) { lock (locker2) { Console.WriteLine ("foo"); lock (o) { y--; } } lock (locker2) { Console.WriteLine ("foo"); } y++; } } public void Failure5b () { object o = new object (); lock (locker) { lock (locker2) { Console.WriteLine ("foo"); lock (o) { y--; } } lock (locker2) { y++; } y++; } } public void Failure6 (int j) { lock (locker) { lock (locker2) { Console.WriteLine ("foo"); } lock (locker2) { Console.WriteLine ("foo"); } } lock (locker) { y += j; } } string s; public void Failure7 (string name) { lock (locker) { s = name; } } public void Failure8 (int i, int j) { bool ret = false; lock (locker) { lock (locker2) { ret = true; } lock (locker2) { object o = new object (); object o2 = new object (); lock (o) { Console.WriteLine ("foo"); lock (o2) { x = j; } } } y += j; lock (locker2) { y += j; } } } Dictionary cache; int x; int y; } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/DecorateThreadsTest.cs0000664000175000017500000005050512413742070032703 0ustar00directhexdirecthex00000000000000// // Unit tests for DecorateThreadsRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; using NUnit.Framework; using System; using System.Collections.ObjectModel; using System.Runtime.CompilerServices; using System.Threading; using Test.Rules.Helpers; namespace Test.Rules.Concurrency { [TestFixture] public class DecorateThreadsTest { #region Test Cases // No threaded code. internal sealed class Good1 { public Good1 () { } public void Greeting () { Console.WriteLine ("hello"); } } // Thread entry points cannot be main thread. internal sealed class Good2 { public void Spawn () { new Thread (this.Thread1).Start (); new Thread (this.Thread2).Start (); new Thread (this.Thread3).Start (); } [ThreadModel (ThreadModel.SingleThread)] private void Thread1 () { } [ThreadModel (ThreadModel.Serializable)] private void Thread2 () { } [ThreadModel (ThreadModel.Concurrent)] private void Thread3 () { } } // MainThread code can call everything, AllowEveryCaller code can be called by // everything, SingleThread can call SingleThread/Serializable/Concurrent, and Serializable/ // Concurrent can call Serializable/Concurrent. internal sealed class Good3 { public void Stuff () { MainStuff (); SingleStuff (); SerializableStuff (); ConcurrentStuff (); AllStuff (); } [ThreadModel (ThreadModel.MainThread)] private void MainStuff () { MainStuff (); SingleStuff (); SerializableStuff (); ConcurrentStuff (); AllStuff (); } [ThreadModel (ThreadModel.SingleThread)] private void SingleStuff () { SingleStuff (); SerializableStuff (); ConcurrentStuff (); AllStuff (); } [ThreadModel (ThreadModel.Serializable)] private void SerializableStuff () { SerializableStuff (); ConcurrentStuff (); AllStuff (); } [ThreadModel (ThreadModel.Concurrent)] private void ConcurrentStuff () { SerializableStuff (); ConcurrentStuff (); AllStuff (); } [ThreadModel (ThreadModel.MainThread | ThreadModel.AllowEveryCaller)] private void AllStuff () { } } // An override of a base method or an implementation of an interface method must // use the same threading model as the original method. internal class Base { public virtual void MainStuff () { } [ThreadModel (ThreadModel.SingleThread | ThreadModel.AllowEveryCaller)] public virtual void AllSingleStuff () { } [ThreadModel (ThreadModel.SingleThread)] public virtual void SingleStuff () { } [ThreadModel (ThreadModel.Concurrent)] public virtual void ConcurrentStuff () { } } internal interface Interface { void MainStuff (); [ThreadModel (ThreadModel.SingleThread)] void SingleStuff (); [ThreadModel (ThreadModel.Concurrent)] void ConcurrentStuff (); } internal sealed class Good4 : Base { [ThreadModel (ThreadModel.MainThread)] public override void MainStuff () { } [ThreadModel (ThreadModel.SingleThread)] public override void SingleStuff () { } [ThreadModel (ThreadModel.Concurrent)] public override void ConcurrentStuff () { } } internal class Good5 : Interface { [ThreadModel (ThreadModel.MainThread)] public void MainStuff () { } [ThreadModel (ThreadModel.SingleThread)] public void SingleStuff () { } [ThreadModel (ThreadModel.Concurrent)] public virtual void ConcurrentStuff () { } } // A delegate used with a threaded event must use the same threading model as the // event. internal class Good6 { public delegate void DataHandler1 (object sender, EventArgs e); [ThreadModel (ThreadModel.Concurrent)] public delegate void DataHandler2 (object sender, EventArgs e); [ThreadModel (ThreadModel.MainThread)] public event DataHandler1 RecvData1; [ThreadModel (ThreadModel.Concurrent)] public event DataHandler2 RecvData2; } // Delegates must be able to call the methods they are bound to. internal class Good7 { public void Setup () { single_callback = this.SingleStuff; single_callback (null); single_callback = this.ConcurrentStuff; single_callback (null); concurrent_callback = this.ConcurrentStuff; concurrent_callback (null); } [ThreadModel (ThreadModel.SingleThread)] public void SingleStuff (object data) { } [ThreadModel (ThreadModel.Concurrent)] public void ConcurrentStuff (object data) { } [ThreadModel (ThreadModel.SingleThread)] internal delegate void SingleCallback (object data); [ThreadModel (ThreadModel.Concurrent)] internal delegate void ConcurrentCallback (object data); internal SingleCallback single_callback; internal ConcurrentCallback concurrent_callback; } // Static ctors of concurrent and serializable types are SingleThread. [ThreadModel (ThreadModel.Concurrent)] internal sealed class Good8 { static Good8 () { Stuff (); } [ThreadModel (ThreadModel.SingleThread)] private static void Stuff () { } } // Static operators inherit serializable thread from the type. [ThreadModel (ThreadModel.Serializable)] internal sealed class Good9 : IEquatable { public override bool Equals (object obj) { if (obj == null) return false; Good9 rhs = obj as Good9; return this == rhs; } public bool Equals (Good9 rhs) { return this == rhs; } public static bool operator== (Good9 lhs, Good9 rhs) { if (object.ReferenceEquals (lhs, rhs)) return true; if ((object) lhs == null || (object) rhs == null) return false; if (lhs.data != rhs.data) return false; return true; } public static bool operator!= (Good9 lhs, Good9 rhs) { return !(lhs == rhs); } public override int GetHashCode () { int hash = 0; unchecked { hash += data.GetHashCode (); } return hash; } internal int data; } // Methods used within anonymous thread roots must be threaded. internal sealed class Good10 { public string path; private System.Threading.Thread thread; public void Spawn () { thread = new System.Threading.Thread (() => SingleStuff (path)); thread.Start (); } [ThreadModel (ThreadModel.SingleThread)] private void SingleStuff (string path) { } } // Process.Exited uses the type's thread if SynchronizingObject is set to this. public sealed class Good11 : System.ComponentModel.ISynchronizeInvoke { public void Spawn () { var p = new System.Diagnostics.Process (); p.SynchronizingObject = this; p.Exited += this.Thread1; p.ErrorDataReceived += this.Thread2; p.Start (); } public bool InvokeRequired { get { return true; } } public IAsyncResult BeginInvoke (Delegate method, object [] args) { return null; } public object EndInvoke (IAsyncResult result) { return null; } public object Invoke (Delegate method, object [] args) { return null; } [ThreadModel (ThreadModel.MainThread)] private void Thread1 (object sender, EventArgs e) { Stuff (); } private void Stuff () { } [ThreadModel (ThreadModel.SingleThread)] private void Thread2 (object sender, System.Diagnostics.DataReceivedEventArgs e) { } } // Process.Exited is threaded if SynchronizingObject is set to non-this. public sealed class Good12 { public void Spawn1 () { var p = new System.Diagnostics.Process (); p.SynchronizingObject = null; p.Exited += this.Thread1; p.Start (); } public void Spawn2 (System.ComponentModel.ISynchronizeInvoke obj) { var p = new System.Diagnostics.Process (); p.SynchronizingObject = obj; p.Exited += this.Thread2; } [ThreadModel (ThreadModel.SingleThread)] private void Thread1 (object sender, EventArgs e) { } [ThreadModel (ThreadModel.Concurrent)] private void Thread2 (object sender, EventArgs e) { } } // (Non-threaded) system delegates work with anything. internal sealed class Good13 { public string path; private System.Threading.Thread thread; public void Spawn () { Action a = () => SingleStuff (path); a (); Action b = () => MainStuff (path); b (); } [ThreadModel (ThreadModel.SingleThread)] private void SingleStuff (string path) { } private void MainStuff (string path) { } } // Another anonymous method case. internal sealed class Good14 { public void Spawn (object data) { Process (() => Stuff (data)); } [ThreadModel (ThreadModel.SingleThread)] public delegate void Callback (); [ThreadModel (ThreadModel.SingleThread)] private void Process (Callback callback) { callback (); } [ThreadModel (ThreadModel.SingleThread)] private void Stuff (object data) { } } // Thread entry points cannot be main thread. internal sealed class Bad1 { public void Spawn () { new Thread (this.Thread1).Start (); new Thread (this.Thread2).Start (); } [ThreadModel (ThreadModel.MainThread)] private void Thread1 () { } private void Thread2 () { } } // MainThread code can call everything, AllowEveryCaller code can be called by // everything, SingleThread can call SingleThread/Serializable/Concurrent, and Serializable/ // Concurrent can call Serializable/Concurrent. internal sealed class Bad2 { [ThreadModel (ThreadModel.MainThread)] private void MainStuff () { } [ThreadModel (ThreadModel.SingleThread)] private void SingleStuff () { MainStuff (); } [ThreadModel (ThreadModel.Serializable)] private void SerializableStuff () { MainStuff (); SingleStuff (); } [ThreadModel (ThreadModel.Concurrent)] private void ConcurrentStuff () { MainStuff (); SingleStuff (); } } // An override of a base method or an implementation of an interface method must // use the same threading model as the original method. internal sealed class Bad3 : Base { [ThreadModel (ThreadModel.SingleThread)] public override void AllSingleStuff () { } [ThreadModel (ThreadModel.Concurrent)] public override void MainStuff () { } public override void SingleStuff () { } [ThreadModel (ThreadModel.MainThread)] public override void ConcurrentStuff () { } } internal class Bad4 : Interface { [ThreadModel (ThreadModel.Concurrent)] public void MainStuff () { } public void SingleStuff () { } [ThreadModel (ThreadModel.MainThread)] public virtual void ConcurrentStuff () { } } // A delegate used with a threaded event must use the same threading model as the // event. internal class Bad5 { [ThreadModel (ThreadModel.Concurrent)] public delegate void DataHandler1 (object sender, EventArgs e); public delegate void DataHandler2 (object sender, EventArgs e); [ThreadModel (ThreadModel.MainThread)] public event DataHandler1 RecvData1; [ThreadModel (ThreadModel.Concurrent)] public event DataHandler2 RecvData2; } // Delegates must be able to call the methods they are bound to. internal class Bad6 { public void Setup () { concurrent_callback = this.SingleStuff; concurrent_callback (null); } [ThreadModel (ThreadModel.SingleThread)] public void SingleStuff (object data) { } [ThreadModel (ThreadModel.Concurrent)] internal delegate void ConcurrentCallback (object data); internal ConcurrentCallback concurrent_callback; } // Serializable cannot be applied to static methods and static methods of serializeable // types do not inherit it from their types. [ThreadModel (ThreadModel.Serializable)] internal class Bad7 { [ThreadModel (ThreadModel.Serializable)] public static void BadDecoration () { } public void SerialStuff1 () { NotSerial (); } [ThreadModel (ThreadModel.SingleThread)] public void SerialStuff2 () { NotSerial (); } public static void NotSerial () { } } // Methods used within anonymous thread roots must be threaded. internal sealed class Bad8 { public string path; private System.Threading.Thread thread; public void Spawn () { thread = new System.Threading.Thread (() => Work (path)); thread.Start (); } private void Work (string path) { } } // Delegates can be constructed in different ways. public sealed class Bad9 { public void Spawn () { new Thread (Bad9.Thread1).Start (); new Thread (o => Thread2 ()).Start (null); new Thread (new ThreadStart (Thread3)).Start (); } private static void Thread1 () { } private void Thread2 () { } private void Thread3 () { } } // Process event handlers are threaded. public sealed class Bad10 { public void Spawn () { var p = new System.Diagnostics.Process (); p.Exited += this.Thread1; p.ErrorDataReceived += this.Thread2; p.OutputDataReceived += this.Thread3; p.Start (); } private void Thread1 (object sender, EventArgs e) { } private void Thread2 (object sender, System.Diagnostics.DataReceivedEventArgs e) { } private void Thread3 (object sender, System.Diagnostics.DataReceivedEventArgs e) { } } // Process.Exited uses the type's thread if SynchronizingObject is set to this and // ErrorDataReceived is not affected. [ThreadModel (ThreadModel.Serializable)] public sealed class Bad11 : System.ComponentModel.ISynchronizeInvoke { public void Spawn () { var p = new System.Diagnostics.Process (); p.SynchronizingObject = this; p.Exited += this.Thread1; p.ErrorDataReceived += this.Thread2; p.Start (); } public bool InvokeRequired { get { return true; } } public IAsyncResult BeginInvoke (Delegate method, object [] args) { return null; } public object EndInvoke (IAsyncResult result) { return null; } public object Invoke (Delegate method, object [] args) { return null; } [ThreadModel (ThreadModel.SingleThread)] private void Thread1 (object sender, EventArgs e) { } [ThreadModel (ThreadModel.SingleThread)] private void Thread2 (object sender, EventArgs e) { } } // Methods passed to the thread pool are entry points. public sealed class Bad12 { public void Spawn () { ThreadPool.QueueUserWorkItem (this.Thread1); ThreadPool.RegisterWaitForSingleObject (null, this.Thread2, null, TimeSpan.Zero, true); } private void Thread1 (object data) { } private void Thread2 (object data, bool timedOut) { } } // Methods passed to the thread timer are entry points. public sealed class Bad13 { public void Spawn () { Timer timer = new Timer (this.Thread1); timer.Dispose (); } private void Thread1 (object data) { } } // Async methods are thread entry points. public sealed class Bad14 { public void Read (System.IO.Stream stream) { stream.BeginRead (buffer, 0, buffer.Length, this.DoRead, null); } private void DoRead (IAsyncResult result) { } private byte [] buffer = new byte [256]; } // EventLog.EntryWritten is threaded. public sealed class Bad15 { public void Spawn1 () { var x = new System.Diagnostics.EventLog (); x.EntryWritten += this.Thread1; } private void Thread1 (object sender, System.Diagnostics.EntryWrittenEventArgs e) { } } // Finalizers must be threaded. public sealed class Bad16 { ~Bad16 () { } } // Another anonymous method case. internal sealed class Bad17 { public void Spawn (object data) { Process (() => Stuff (data)); } [ThreadModel (ThreadModel.SingleThread)] public delegate void Callback (); [ThreadModel (ThreadModel.SingleThread)] private void Process (Callback callback) { callback (); } // This is called within a anonymous method bound to a threaded // delegate so it must be threaded. private void Stuff (object data) { } } // BackgroundWorker events are threaded. public sealed class Bad18 { public void Spawn () { var worker = new System.ComponentModel.BackgroundWorker (); worker.DoWork += this.Thread1; } private void Thread1 (object sender, System.ComponentModel.DoWorkEventArgs e) { } } #endregion public DecorateThreadsTest () { rule = new Gendarme.Rules.Concurrency.DecorateThreadsRule (); runner = new TestRunner (rule); } [Test] public void Cases () { AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (0); AssertFailureCount (2); AssertFailureCount (5); AssertFailureCount (4); AssertFailureCount (3); AssertFailureCount (2); AssertFailureCount (1); AssertFailureCount (3); AssertFailureCount (1); AssertFailureCount (3); AssertFailureCount (3); AssertFailureCount (1); AssertFailureCount (2); AssertFailureCount (1); AssertFailureCount (1); AssertFailureCount (1); AssertFailureCount (1); AssertFailureCount (1); AssertFailureCount (1); } #region Private Methods // Unfortunately the standard test fixtures don't run the tests in anything like their // normal environment (in particular the events aren't fired, the runner isn't torn // down, and rules aren't (re)initialized). This hoses our test so we have to hand roll // an alternative. private void PreCheck (IMetadataTokenProvider obj) { runner.Reset (); rule.Initialize (runner); AssemblyDefinition assembly = obj.GetAssembly (); if (!runner.Assemblies.Contains (assembly)) { runner.Assemblies.Clear (); runner.Assemblies.Add (assembly); runner.Engines.Build (runner.Assemblies); } } private void PostCheck (IRule rule) { runner.TearDown (rule); } private void AssertFailureCount (int expectedCount) { TypeDefinition type = DefinitionLoader.GetTypeDefinition (); PreCheck (type); // runner.OnType (type); foreach (MethodDefinition method in type.Methods) { runner.OnMethod (method); } PostCheck (rule); if (expectedCount != rule.DefectCount) Assert.Fail ("{0} failed: should have {1} defects but got {2}.", typeof (T).Name, expectedCount, rule.DefectCount); } #endregion #region Fields private Gendarme.Rules.Concurrency.DecorateThreadsRule rule; private TestRunner runner; #endregion } } DoNotUseMethodImplOptionsSynchronizedTest.cs0000664000175000017500000000502612413742070037220 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test// // Unit tests for DoNotUseMethodImplOptionsSynchronizedRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Runtime.CompilerServices; using Mono.Cecil; using Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Concurrency { [TestFixture] public class DoNotUseMethodImplOptionsSynchronizedTest : MethodRuleTestFixture { [MethodImpl (MethodImplOptions.Synchronized)] public void Synchronized () { } [Test] public void Bad () { AssertRuleFailure ("Synchronized"); } [MethodImpl (MethodImplOptions.InternalCall)] public extern void NotSynchronized (); [Test] public void Good () { AssertRuleSuccess ("NotSynchronized"); } public event EventHandler CompilerGeneratedSynchronized; [Test] public void DoesNotApply () { MethodDefinition md = DefinitionLoader.GetMethodDefinition ("add_CompilerGeneratedSynchronized"); if (!md.IsSynchronized) Assert.Ignore ("newer versions of CSC (e.g. 10.0) does not set the Synchronized"); AssertRuleDoesNotApply (md); AssertRuleDoesNotApply ("remove_CompilerGeneratedSynchronized"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/Makefile.am0000664000175000017500000000015512413742070030503 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Concurrency.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/Tests.Rules.Concurrency.csproj0000775000175000017500000001472712413742070034372 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {77ACB4C1-95E3-42DC-980C-9A6FD506F17D} Library Properties Tests.Rules.Concurrency Tests.Rules.Concurrency 3.5 true v4.0 http://localhost/Tests.Rules.Concurrency/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {B8EA91A3-27A0-4732-BA90-7B590280FF9F} Gendarme.Rules.Concurrency False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/ProtectCallToEventDelegatesTest.cs0000664000175000017500000002206712413742070035203 0ustar00directhexdirecthex00000000000000// // Unit tests for ProtectCallToEventDelegatesRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Concurrency { [TestFixture] public class ProtectCallToEventDelegatesTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no call[virt] AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); // generated code - we assume the context is known not to be racy (or null) AssertRuleDoesNotApply (SimpleMethods.GeneratedCodeMethod); } public event EventHandler Loading; public event EventHandler Loaded; public void NoCheckLoading (EventArgs e) { // bad, as this could be null, but its not what this rule looks for Loading (this, e); } public void NoCheckLoad (EventArgs e) { // bad, as this could be null, but its not what this rule looks for Loading (this, e); Console.WriteLine ("LOAD"); Loaded (this, e); } public void OnBadLoading (EventArgs e) { // Loading could be non-null here if (Loading != null) { // but be null once we get here :( Loading (this, e); } } public void OnBadLoadingToo (EventArgs e) { EventHandler handler = Loading; // handler is either null or non-null if (handler != null) { // but we're not using handler to call Loading (this, e); } } public void WrongCheckLoading (EventArgs e) { EventHandler handler = Loading; // handler is either null or non-null if (handler != null) { // and won't change Loaded (this, e); } } public void NoNullCheckLoading (EventArgs e) { EventHandler handler = Loading; // handler is either null or non-null, but we call it without checking handler (this, e); } public void NoNullCheckLoad (EventArgs e) { EventHandler handler = Loading; // handler is either null or non-null, but we call it without checking handler (this, e); Console.WriteLine ("LOAD"); handler = Loaded; // handler is either null or non-null, but we call it without checking handler (this, e); } [Test] public void Bad () { AssertRuleFailure ("NoCheckLoading", 1); AssertRuleFailure ("NoCheckLoad", 2); AssertRuleFailure ("OnBadLoading", 1); AssertRuleFailure ("OnBadLoadingToo", 1); AssertRuleFailure ("WrongCheckLoading", 1); AssertRuleFailure ("NoNullCheckLoading", 1); AssertRuleFailure ("NoNullCheckLoad", 2); } public void OnGoodLoading (EventArgs e) { EventHandler handler = Loading; // handler is either null or non-null if (handler != null) { // and won't change (safe) handler (this, e); } } public void OnGoodLoad (EventArgs e) { EventHandler handler = Loading; if (handler != null) { handler (this, e); } Console.WriteLine ("LOAD"); handler = Loaded; if (handler != null) { handler (this, e); } } [Test] public void Good () { AssertRuleSuccess ("OnGoodLoading"); AssertRuleSuccess ("OnGoodLoad"); } public void OnGoodLoadingInverted (EventArgs e) { EventHandler handler = Loading; // handler is either null or non-null if (null == handler) { // and won't change (safe) handler (this, e); } } public void OnGoodLoadInverted (EventArgs e) { EventHandler handler = Loading; if (null == handler) { handler (this, e); } Console.WriteLine ("LOAD"); handler = Loaded; if (null == handler) { handler (this, e); } } [Test] public void GoodInverted () { AssertRuleSuccess ("OnGoodLoadingInverted"); AssertRuleSuccess ("OnGoodLoadInverted"); } // same but using generic EventHandler public event EventHandler Testing; public event EventHandler Tested; public void NoCheckTesting (EventArgs e) { // bad, as this could be null, but its not what this rule looks for Testing (this, e); } public void NoCheckTest (EventArgs e) { // bad, as this could be null, but its not what this rule looks for Testing (this, e); Console.WriteLine ("TEST"); Tested (this, e); } public void OnBadTesting (EventArgs e) { // Testing could be non-null here if (Testing != null) { // but be null once we get here :( Testing (this, e); } } public void OnBadTestingToo (EventArgs e) { EventHandler handler = Testing; // handler is either null or non-null if (handler != null) { // but we're not using handler to call Testing (this, e); } } public void WrongCheckTesting (EventArgs e) { EventHandler handler = Testing; // handler is either null or non-null if (handler != null) { // and won't change Tested (this, e); } } public void NoNullCheckTesting (EventArgs e) { EventHandler handler = Testing; // handler is either null or non-null, but we call it without checking handler (this, e); } public void NoNullCheckTest (EventArgs e) { EventHandler handler = Testing; // handler is either null or non-null, but we call it without checking handler (this, e); Console.WriteLine ("TEST"); handler = Tested; // handler is either null or non-null, but we call it without checking handler (this, e); } [Test] public void GenericBad () { AssertRuleFailure ("NoCheckTesting", 1); AssertRuleFailure ("NoCheckTest", 2); AssertRuleFailure ("OnBadTesting", 1); AssertRuleFailure ("OnBadLoadingToo", 1); AssertRuleFailure ("WrongCheckTesting", 1); AssertRuleFailure ("NoNullCheckTesting", 1); AssertRuleFailure ("NoNullCheckTest", 2); } public void OnGoodTesting (EventArgs e) { EventHandler handler = Testing; // handler is either null or non-null if (handler != null) { // and won't change (safe) handler (this, e); } } public void OnGoodTest (EventArgs e) { EventHandler handler = Testing; if (handler != null) { handler (this, e); } Console.WriteLine ("TEST"); handler = Tested; if (handler != null) { handler (this, e); } } [Test] public void GenericGood () { AssertRuleSuccess ("OnGoodTesting"); AssertRuleSuccess ("OnGoodTest"); } public void OnGoodTestingInverted (EventArgs e) { EventHandler handler = Testing; // handler is either null or non-null if (null != handler) { // and won't change (safe) handler (this, e); } } public void OnGoodTestInverted (EventArgs e) { EventHandler handler = Testing; if (null != handler) { handler (this, e); } Console.WriteLine ("TEST"); handler = Tested; if (null != handler) { handler (this, e); } } [Test] public void GenericGoodInverted () { AssertRuleSuccess ("OnGoodTestingInverted"); AssertRuleSuccess ("OnGoodTestInverted"); } // from Options.cs - generic, non-event, delegate public Converter localizer; public void Throw () { throw new Exception (localizer ("not an event")); } [Test] public void NonEventDelegates () { AssertRuleSuccess ("Throw"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Test/DoubleCheckLockingTest.cs0000664000175000017500000000747412413742070033330 0ustar00directhexdirecthex00000000000000// // Unit tests for DoubleCheckLockingRule // // Authors: // Aaron Tomb // Sebastien Pouliot // // Copyright (C) 2005 Aaron Tomb // Copyright (C) 2006-2008, 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 Mono.Cecil; using Gendarme.Rules.Concurrency; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Concurrency { [TestFixture] public class DoubleCheckLockingTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL for p/invokes AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no calls[virt] AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public class Singleton { private static volatile Singleton instance; private static object syncRoot = new object (); private Singleton () { } public static Singleton SingleCheckBefore { get { if (instance == null) { lock (syncRoot) { instance = new Singleton (); } } return instance; } } public static Singleton MultipleChecksBefore { get { if (instance == null) { // useless but not dangerous if (instance == null) { lock (syncRoot) { instance = new Singleton (); } } } return instance; } } public static Singleton SingleCheckAfter { get { lock (syncRoot) { if (instance == null) { instance = new Singleton (); } } return instance; } } public static Singleton MultipleChecksAfter { get { lock (syncRoot) { if (instance == null) { // useless but not dangerous if (instance == null) { instance = new Singleton (); } } } return instance; } } public static Singleton DoubleCheck { get { if (instance == null) { lock (syncRoot) { if (instance == null) instance = new Singleton (); } } return instance; } } } [Test] public void CheckBefore () { AssertRuleSuccess ("get_SingleCheckBefore"); AssertRuleSuccess ("get_MultipleChecksBefore"); } [Test] public void CheckAfter () { AssertRuleSuccess ("get_SingleCheckAfter"); AssertRuleSuccess ("get_MultipleChecksAfter"); } [Test] public void DoubleCheck () { MethodDefinition md = DefinitionLoader.GetMethodDefinition ("get_DoubleCheck"); // even if the rule applies only to < 2.0 it still works (for unit testsing) until 4.0 if (md.DeclaringType.Module.Runtime < TargetRuntime.Net_4_0) AssertRuleFailure (md); else Assert.Ignore ("Rule applies for < 2.0 and works only for < 4.0"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/Makefile.am0000664000175000017500000000176512413742070027574 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ DecorateThreadsRule.cs \ DoNotLockOnThisOrTypesRule.cs \ DoNotLockOnWeakIdentityObjectsRule.cs \ DoNotUseMethodImplOptionsSynchronizedRule.cs \ DoNotUseThreadStaticWithInstanceFieldsRule.cs \ DontUseLockedRegionOutsideMethodRule.cs \ DoubleCheckLockingRule.cs \ LockAnalyzerRule.cs \ NonConstantStaticFieldsShouldNotBeVisibleRule.cs \ ProtectCallToEventDelegatesRule.cs \ ReviewLockUsedOnlyForOperationsOnVariablesRule.cs \ ThreadRocks.cs \ WriteStaticFieldFromInstanceMethodRule.cs tests_sources = \ DecorateThreadsTest.cs \ DoNotLockOnThisOrTypesTest.cs \ DoNotLockOnWeakIdentityObjectsTest.cs \ DoNotUseMethodImplOptionsSynchronizedTest.cs \ DoNotUseThreadStaticWithInstanceFieldsTest.cs \ DontUseLockedRegionOutsideMethodTest.cs \ DoubleCheckLockingTest.cs \ NonConstantStaticFieldsShouldNotBeVisibleTest.cs \ ProtectCallToEventDelegatesTest.cs \ ReviewLockUsedOnlyForOperationsOnVariablesTest.cs \ WriteStaticFieldFromInstanceMethodTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/ThreadRocks.cs0000664000175000017500000001270012413742070030267 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.ThreadRocks // // Authors: // Jesse Jones // Sebastien Pouliot // // Copyright (C) 2009 Jesse Jones // 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 Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using System; using System.Collections; using System.Collections.Generic; namespace Gendarme.Rules.Concurrency { internal static class ThreadRocks { public static bool AllowsEveryCaller (this ThreadModel self) { return ((self & ThreadModel.AllowEveryCaller) == ThreadModel.AllowEveryCaller); } public static bool Is (this ThreadModel self, ThreadModel model) { // since ThreadModel.MainThread == 0 we cannot do bitwise ops // but we need to keep this "as is" for backward compatibility return ((self & ~ThreadModel.AllowEveryCaller) == model); } public static ThreadModel ThreadingModel (this TypeReference type) { while (type != null) { if (type.IsDefinition) { ThreadModel? model = TryGetThreadingModel ((TypeDefinition) type); if (model != null) return model.Value; } // If the type is not decorated then we'll assume that the type is main // thread unless it's a System/Mono type. if (ThreadedNamespace (type.Namespace)) return ThreadModel.Concurrent; type = type.DeclaringType; } return ThreadModel.MainThread; } static ThreadModel? Lookup (MemberReference method, IEnumerable collection) where TDefinition : IMemberDefinition { string name = method.Name; // Need the offset for explicit interface implementations. int offset = Math.Max (name.LastIndexOf ('.'), 0); offset = name.IndexOf ('_', offset) + 1; foreach (IMemberDefinition member in collection) { string member_name = member.Name; if (String.CompareOrdinal (name, offset, member_name, 0, member_name.Length) == 0) return TryGetThreadingModel (member); } return null; } public static ThreadModel ThreadingModel (this MethodDefinition method) { // Check the method first so it overrides whatever was used on the type. ThreadModel? model = TryGetThreadingModel (method); if (model != null) return model.Value; // If it's a property we need to check the property as well. if (method.IsProperty ()) { // FIXME: we won't get the property if it is an explicit implementation model = Lookup (method, method.DeclaringType.Properties); if (model != null) return model.Value; } // If it's a event we need to check the event as well. if (method.IsAddOn || method.IsRemoveOn || method.IsFire) { model = Lookup (method, method.DeclaringType.Events); if (model != null) return model.Value; } // Check the type. model = ThreadingModel (method.DeclaringType); if (method.IsConstructor && method.IsStatic) { if (model == ThreadModel.Concurrent || model == ThreadModel.Serializable) { return ThreadModel.SingleThread; } } else if (method.IsStatic) { if (model == ThreadModel.Serializable && !method.Name.StartsWith ("op_", StringComparison.Ordinal)) { return ThreadModel.MainThread; } } return model.Value; } // Returns true if the namespace is one for which we consider all the types thread safe. public static bool ThreadedNamespace (string ns) { if (ns == "System" || ns.StartsWith ("System.", StringComparison.Ordinal)) return true; if (ns == "Mono" || ns.StartsWith ("Mono.", StringComparison.Ordinal)) return true; return false; } #region Private Methods private static ThreadModel? TryGetThreadingModel (ICustomAttributeProvider provider) { if (!provider.HasCustomAttributes) return null; foreach (CustomAttribute attr in provider.CustomAttributes) { // ThreadModelAttribute ctor has a single parameter, skip param-less attributes if (!attr.HasConstructorArguments) continue; if (attr.AttributeType.Name != "ThreadModelAttribute") continue; IList cp = attr.ConstructorArguments; if ((cp.Count == 1) && (cp [0].Value is int)) return (ThreadModel) (int) cp [0].Value; throw new ArgumentException ("There should be a single ThreadModelAttribute ctor taking an (Int32) ThreadModel enum argument."); } return null; } #endregion } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Concurrency/DontUseLockedRegionOutsideMethodRule.cs0000664000175000017500000001376212413742070035264 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Concurrency.DontUseLockedRegionOutsideMethod.cs: // looks for methods that enter an exclusive region but do not exit // (this can imply deadlocks, or just a bad practice). // // Authors: // Andres G. Aragoneses // // Copyright (C) 2008 Andres G. Aragoneses // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.Concurrency { /// /// This rule will fire if a method calls System.Threading.Monitor.Enter, /// but not System.Threading.Monitor.Exit. This is a bad idea for public /// methods because the callers must (indirectly) manage a lock which they do not /// own. This increases the potential for problems such as dead locks because /// locking/unlocking may not be done together, the callers must do the unlocking /// even in the presence of exceptions, and it may not be completely clear that /// the public method is acquiring a lock without releasing it. /// /// This is less of a problem for private methods because the lock is managed by /// code that owns the lock. So, it's relatively easy to analyze the class to ensure /// that the lock is locked and unlocked correctly and that any invariants are /// preserved when the lock is acquired and after it is released. However it is /// usually simpler and more maintainable if methods unlock whatever they lock. /// /// /// Bad example: /// /// class BadExample { /// int producer = 0; /// object lock = new object(); /// /// // This class is meant to be thread safe, but in the interests of /// // performance it requires clients to manage its lock. This allows /// // clients to grab the lock, batch up edits, and release the lock /// // when they are done. But this means that the clients must /// // now (implicitly) manage the lock which is problematic, especially /// // if this object is shared across threads. /// public void BeginEdits () /// { /// Monitor.Enter (lock); /// } /// /// public void AddProducer () /// { /// // Real code would either assert or throw if the lock is not held. /// producer++; /// } /// /// public void EndEdits () /// { /// Monitor.Exit (lock); /// } /// } /// /// /// /// Good example: /// /// class GoodExample { /// int producer = 0; /// object mutex = new object(); /// /// public void AddProducer () /// { /// // We need a try block in case the assembly is compiled with /// // checked arithmetic. /// Monitor.Enter (mutex); /// try { /// producer++; /// } /// finally { /// Monitor.Exit (mutex); /// } /// } /// /// public void AddProducer2 () /// { /// // Same as the above, but with C# sugar. /// lock (mutex) { /// producer++; /// } /// } /// } /// /// // TODO: do a rule that checks if Monitor.Enter is used *before* Exit (dumb code, I know) // TODO: do a more complex rule that checks that you have used Thread.Monitor.Exit in a finally block [Problem ("This method uses Thread.Monitor.Enter() but doesn't use Thread.Monitor.Exit().")] [Solution ("Prefer the lock{} statement when using C# or redesign the code so that Monitor.Enter and Exit are called together.")] [EngineDependency (typeof (OpCodeEngine))] public class DoNotUseLockedRegionOutsideMethodRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // is this module using Monitor.Enter/Exit ? (lock in c#) // if not then this rule does not need to be executed for the module // note: mscorlib.dll is an exception since it defines, not refer, System.Threading.Monitor Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Threading", "Monitor"); })); }; } public RuleResult CheckMethod (MethodDefinition method) { // rule doesn't apply if the method has no IL if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; int enter = 0; int exit = 0; foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.FlowControl != FlowControl.Call) continue; MethodReference m = (ins.Operand as MethodReference); if (m == null) continue; if (m.IsNamed ("System.Threading", "Monitor", "Enter")) { enter++; } else if (m.IsNamed ("System.Threading", "Monitor", "Exit")) { exit++; } } if (enter == exit) return RuleResult.Success; Runner.Report (method, Severity.High, Confidence.Normal); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/0000775000175000017500000000000012642235742026042 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/SatelliteResourceMismatchRule.cs0000664000175000017500000002376412413742070034352 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Globalization.SatelliteResourceMismatchRule // // Authors: // Antoine Vandecreme // // Copyright (C) 2010 Antoine Vandecreme // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.IO; using System.Text; using System.Resources; using System.Collections; using System.Collections.Generic; using Mono.Cecil; using Mono.Collections.Generic; using Gendarme.Framework; namespace Gendarme.Rules.Globalization { /// /// A satellite assembly have a resource which does not match with a main assembly resource. /// Either : /// * The resource doesn't exist in the main assembly and should be removed from the satellite assembly. /// * The resource is not of the same type in the main and satellite assembly. The satellite one should be fixed. /// * The satellite string resource does not have the same string.Format parameters than the main assembly. The satellite one should be fixed. /// /// /// The satellites assemblies are searched in the subdirectories of the main assembly location. /// [Problem ("A satellite assembly have a resource which does not match correctly with a main assembly resource.")] [Solution ("Remove or fix the resource in the satellite assemby.")] public sealed class SatelliteResourceMismatchRule : Rule, IAssemblyRule { private const string resXResourcesExtension = ".resources"; private AssemblyResourceCache mainAssemblyResourceCache; public RuleResult CheckAssembly (AssemblyDefinition assembly) { // If the analyzed assembly is a satellite assembly, does not apply if (!string.IsNullOrEmpty (assembly.Name.Culture)) return RuleResult.DoesNotApply; // Reset caches mainAssemblyResourceCache = new AssemblyResourceCache (assembly); foreach (AssemblyDefinition satellite in GetSatellitesAssemblies (assembly)) CheckSatelliteAssembly (satellite); return RuleResult.Success; } private void CheckSatelliteAssembly (AssemblyDefinition satellite) { string culture = satellite.Name.Culture; Collection satellitesResources = satellite.MainModule.Resources; foreach (EmbeddedResource resource in satellitesResources) { EmbeddedResource mainResource; string resourceName = GetNameInSatellite (resource, culture); if (!mainAssemblyResourceCache.TryGetMainResourceFile (resourceName, out mainResource)) { string msg = String.Format (CultureInfo.InvariantCulture, "The resource file {0} exist in the satellite assembly but not in the main assembly", resource.Name); Runner.Report (satellite, Severity.Low, Confidence.High, msg); continue; } if (!IsResXResources (resource)) continue; CheckSatelliteResource (mainResource, resource, satellite); } } private void CheckSatelliteResource (EmbeddedResource mainResource, EmbeddedResource satelliteResource, IMetadataTokenProvider satelliteAssembly) { using (Stream resourceStream = satelliteResource.GetResourceStream ()) using (ResourceSet resourceSet = new ResourceSet (resourceStream)) { foreach (DictionaryEntry entry in resourceSet) { string resourceName = (string) entry.Key; object satelliteValue = entry.Value; object mainValue; if (!mainAssemblyResourceCache.TryGetMainResource (mainResource, resourceName, out mainValue)) { string msg = String.Format (CultureInfo.InvariantCulture, "The resource {0} in the file {1} exist in the satellite assembly but not in the main assembly", resourceName, satelliteResource.Name); Runner.Report (satelliteAssembly, Severity.Low, Confidence.High, msg); continue; } Type satelliteType = satelliteValue.GetType (); Type mainType = mainValue.GetType (); if (!satelliteType.Equals (mainType)) { string msg = String.Format (CultureInfo.InvariantCulture, "The resource {0} in the file {1} is of type {2} in the satellite assembly but of type {3} in the main assembly", resourceName, satelliteResource.Name, satelliteType, mainType); Runner.Report (satelliteAssembly, Severity.High, Confidence.High, msg); continue; } if (satelliteType.Equals (typeof (string))) { Bitmask mainParameters = GetStringFormatExpectedParameters ((string) mainValue); Bitmask satelliteParameters = GetStringFormatExpectedParameters ((string) satelliteValue); if (!mainParameters.Equals (satelliteParameters)) { string msg = String.Format (CultureInfo.InvariantCulture, "The string resource {0} in the file {1} does not use the same string format parameters in the satellite and main assemblies", resourceName, satelliteResource.Name); Runner.Report (satelliteAssembly, Severity.High, Confidence.Normal, msg); } } } } } private static Bitmask GetStringFormatExpectedParameters (string format) { Bitmask result = new Bitmask (false); if (format == null) return result; // if last character is { then there's no digit after it for (int index = 0; index < format.Length - 1; index++) { if (format [index] != '{') continue; char nextChar = format [index + 1]; if (nextChar == '{') { index++; // skip special {{ continue; } if (!char.IsDigit (nextChar)) continue; int value = nextChar - '0'; index++; // next char is already added to value int tenPower = 1; while (index++ < format.Length) { char current = format [index]; if (!char.IsDigit (current)) break; tenPower *= 10; value = value * tenPower + current - '0'; } if (index == format.Length) break; // Incorrect format result.Set (value); } return result; } private static IEnumerable GetSatellitesAssemblies (AssemblyDefinition mainAssembly) { string satellitesName = mainAssembly.Name.Name + ".resources.dll"; DirectoryInfo directory = new DirectoryInfo (Path.GetDirectoryName ( mainAssembly.MainModule.FullyQualifiedName)); DirectoryInfo [] subDirectories = directory.GetDirectories (); foreach (DirectoryInfo dir in subDirectories) { FileInfo [] files; try { files = dir.GetFiles (satellitesName, SearchOption.TopDirectoryOnly); } catch (UnauthorizedAccessException) { continue; // If we don't have access to directory ignore it } if (files.Length == 0) continue; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (files [0].FullName); yield return assembly; } } // In satellites assemblies, the resource file name sometimes contains the culture // some times do not // This method always returns the name without the culture to be able to match with the main // assembly resource private static string GetNameInSatellite (Resource resource, string culture) { string name = resource.Name; string nameWithoutExtension = Path.GetFileNameWithoutExtension (name); string cultureExtension = "." + culture; if (!nameWithoutExtension.EndsWith (cultureExtension, StringComparison.Ordinal)) return name; string nameWithoutCulture = Path.GetFileNameWithoutExtension (nameWithoutExtension); return nameWithoutCulture + Path.GetExtension (name); } private static bool IsResXResources (Resource resource) { return resource.Name.EndsWith (resXResourcesExtension, StringComparison.Ordinal); } private sealed class AssemblyResourceCache { private AssemblyDefinition assembly; private Dictionary files; private Dictionary> values; public AssemblyResourceCache (AssemblyDefinition assemblyDefinition) { assembly = assemblyDefinition; } public bool TryGetMainResourceFile (string resourceFileName, out EmbeddedResource embeddedResource) { if (files == null) { // Build cache of resources files files = new Dictionary (); Collection mainResources = assembly.MainModule.Resources; foreach (EmbeddedResource resource in mainResources) files.Add (resource.Name, resource); } return files.TryGetValue (resourceFileName, out embeddedResource); } public bool TryGetMainResource (EmbeddedResource embeddedResource, string resourceName, out object value) { value = null; if (values == null) { // Build cache of resources values values = new Dictionary> (); } Dictionary fileResources; if (!values.TryGetValue (embeddedResource, out fileResources)) { fileResources = new Dictionary (); using (Stream resourceStream = embeddedResource.GetResourceStream ()) using (ResourceSet resourceSet = new ResourceSet (resourceStream)) { foreach (DictionaryEntry entry in resourceSet) fileResources.Add ((string) entry.Key, entry.Value); } values.Add (embeddedResource, fileResources); } return fileResources.TryGetValue (resourceName, out value); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/AvoidUnusedInternalResourceRule.cs0000664000175000017500000001371712413742070034656 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Globalization.AvoidUnusedInternalResourceRule // // Authors: // Antoine Vandecreme // // Copyright (C) 2011 Antoine Vandecreme // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Globalization { /// /// This rule will check for internally visible resources (resx) which are never called. /// You should remove unused internal resources to avoid useless translations. /// [Problem ("This internal (assembly-level) resource (resx) does not have callers in the assembly.")] [Solution ("Remove the unused resource or add code to call it.")] public class AvoidUnusedInternalResourceRule : Rule, IMethodRule { static private bool Applicable (MethodDefinition method) { // only internal resources if (!method.IsAssembly) return false; // resources are static getters if (!method.IsStatic || !method.IsGetter) return false; // Ignore well known static getters of resources classes string name = method.Name; if ("get_Culture".Equals (name, StringComparison.InvariantCulture) || "get_ResourceManager".Equals (name, StringComparison.InvariantCulture)) return false; // rule apply only to static getters in a generated resx class TypeDefinition typeDefinition = method.DeclaringType; if (!typeDefinition.HasCustomAttributes) return false; if (typeDefinition.HasAttribute ("System.CodeDom.Compiler", "GeneratedCodeAttribute")) return true; if (typeDefinition.HasAttribute ("System.Diagnostics", "DebuggerNonUserCodeAttribute")) return true; if (typeDefinition.HasAttribute ("System.Runtime.CompilerServices", "CompilerGeneratedAttribute")) return true; return false; } public RuleResult CheckMethod (MethodDefinition method) { // check if the the rule applies to this method if (!Applicable (method)) return RuleResult.DoesNotApply; if (CheckAssemblyForMethodUsage (method)) return RuleResult.Success; // resource is unused and unneeded Runner.Report (method, Severity.Medium, Confidence.Normal, "The resource is not visible outside its declaring assembly, nor used within."); return RuleResult.Failure; } #region FIXME (following code is a copy of AvoidUncalledPrivateCodeRule) public override void TearDown () { // reusing the cache (e.g. the wizard) is not a good thing if an exception // occured while building it (future analysis results would be bad) cache.Clear (); base.TearDown (); } private static bool CheckAssemblyForMethodUsage (MethodReference method) { // scan each module in the assembly that defines the method AssemblyDefinition assembly = method.DeclaringType.Module.Assembly; foreach (ModuleDefinition module in assembly.Modules) { // scan each type foreach (TypeDefinition type in module.GetAllTypes ()) { if (CheckTypeForMethodUsage (type, method)) return true; } } return false; } static Dictionary> cache = new Dictionary> (); private static ulong GetToken (MethodReference method) { return (ulong) method.DeclaringType.Module.Assembly.GetHashCode () << 32 | method.GetElementMethod ().MetadataToken.ToUInt32 (); } private static bool CheckTypeForMethodUsage (TypeDefinition type, MethodReference method) { if (type.HasGenericParameters) type = type.GetElementType ().Resolve (); HashSet methods = GetCache (type); if (methods.Contains (GetToken (method))) return true; MethodDefinition md = method.Resolve (); if ((md != null) && md.HasOverrides) { foreach (MethodReference mr in md.Overrides) { if (methods.Contains (GetToken (mr))) return true; } } return false; } private static HashSet GetCache (TypeDefinition type) { HashSet methods; if (!cache.TryGetValue (type, out methods)) { methods = new HashSet (); cache.Add (type, methods); if (type.HasMethods) { foreach (MethodDefinition md in type.Methods) { if (!md.HasBody) continue; BuildMethodUsage (methods, md); } } } return methods; } private static void BuildMethodUsage (HashSet methods, MethodDefinition method) { foreach (Instruction ins in method.Body.Instructions) { MethodReference mr = (ins.Operand as MethodReference); if (mr == null) continue; TypeReference type = mr.DeclaringType; if (!type.IsArray) { // if (type.GetElementType ().HasGenericParameters) // the simpler ^^^ does not work under Mono but works on MS type = type.Resolve (); if (type != null && type.HasGenericParameters) { methods.Add (GetToken (type.GetMethod (mr.Name))); } } methods.Add (GetToken (mr)); } } #endregion } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/PreferStringComparisonOverrideRule.cs0000664000175000017500000000623512413742070035365 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Globalization.PreferStringComparisonOverrideRule // // Authors: // Sebastien Pouliot // // 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.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Globalization { /// /// This rule detects calls to method that could be changed to call an override accepting an /// extra System.StringComparison parameter. Using the override makes the code easier /// to maintain since it makes the intent clear on how the string needs to be compared. /// It is even more important since the default string comparison rules have changed between /// .NET 2.0 and .NET 4.0. /// /// /// Bad example: /// /// public bool Check (string name) /// { /// // it's not clear if the string comparison should be culture sensitive or not /// return (String.Compare (name, "Software") == 0); /// } /// /// /// /// Good example: /// /// public bool Check (string name) /// { /// return (String.Compare (name, "Software", StringComparison.CurrentCulture) == 0); /// } /// /// [Problem ("A call is made to a method for which an override, accepting an extra StringComparison, is available")] [Solution ("Specify how the string should be compared by adding the right StringComparison value to the call")] [FxCopCompatibility ("Microsoft.Globalization", "CA1307:SpecifyStringComparison")] public class PreferStringComparisonOverrideRule : PreferOverrideBaseRule { protected override bool IsPrefered (TypeReference type) { return type.IsNamed ("System", "StringComparison"); } protected override void Report (MethodDefinition method, Instruction instruction, MethodReference prefered) { string msg = String.Format (CultureInfo.InvariantCulture, "Consider using the perfered '{0}' override.", prefered.GetFullName ()); Runner.Report (method, instruction, Severity.Medium, Confidence.High, msg); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Gendarme.Rules.Globalization.csproj0000664000175000017500000001117612413742070034673 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {5D883285-903D-4FDB-9ED9-AB37AE9648F7} Library Properties Gendarme.Rules.Globalization Gendarme.Rules.Globalization v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Globalization.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 ..\..\console\bin\Release\Gendarme.Rules.Globalization.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Makefile.in0000664000175000017500000007254412642235731030121 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Globalization ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -r:System.Drawing -d:DEBUG \ -resource:Test/Resource.resources \ -resource:Test/InternalResource.resources \ -resource:Test/PublicResource.resources \ -resource:Test/Resources/XMLFileNotInResX.xml console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) \ $(prefixed_rules_category).csproj Test/Resource.resx \ Test/Resource.fr.resx Test/MainResourceMissing.fr.resx \ Test/InternalResource.resx Test/PublicResource.resx CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AvoidUnusedInternalResourceRule.cs \ PreferIFormatProviderOverrideRule.cs \ PreferOverrideBaseRule.cs \ PreferStringComparisonOverrideRule.cs \ SatelliteResourceMismatchRule.cs tests_resource_resx = Test/Resource.resx tests_resource_prefix_resx = $(addprefix $(srcdir)/, $(tests_resource_resx)) tests_resource_resx_fr = Test/Resource.fr.resx tests_resource_prefix_resx_fr = $(addprefix $(srcdir)/, $(tests_resource_resx_fr)) tests_resource_missing_resx_fr = Test/MainResourceMissing.fr.resx tests_resource_missing_prefix_resx_fr = $(addprefix $(srcdir)/, $(tests_resource_missing_resx_fr)) tests_internalresource_resx = Test/InternalResource.resx tests_internalresource_prefix_resx = $(addprefix $(srcdir)/, $(tests_internalresource_resx)) tests_publicresource_resx = Test/PublicResource.resx tests_publicresource_prefix_resx = $(addprefix $(srcdir)/, $(tests_publicresource_resx)) tests_resource_xmlnotresx_fr = Test/Resources/XMLFileNotInResX.fr.xml tests_resource_missing_xmlnotresx_fr = Test/Resources/XMLFileNotInResXOnlyInFrench.fr.xml EXTRA_TESTS_DEPS = Test/Resource.resources Test/InternalResource.resources Test/PublicResource.resources Test/Resources/XMLFileNotInResX.xml fr/Test.Rules.Globalization.resources.dll tests_sources = \ AvoidUnusedInternalResourceTest.cs \ PreferIFormatProviderOverrideTest.cs \ PreferStringComparisonOverrideTest.cs \ SatelliteResourceMismatchTest.cs \ Resource.Designer.cs \ InternalResource.Designer.cs \ PublicResource.Designer.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Globalization/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Globalization/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc Test/Resource.resources: $(tests_resource_resx) resgen2 -usesourcepath -compile $(tests_resource_resx),Test/Resource.resources; Test/Resource.fr.resources: $(tests_resource_resx_fr) resgen2 -usesourcepath -compile $(tests_resource_resx_fr),Test/Resource.fr.resources; Test/MainResourceMissing.fr.resources: $(tests_resource_missing_resx_fr) resgen2 -usesourcepath -compile $(tests_resource_missing_resx_fr),Test/MainResourceMissing.fr.resources; Test/InternalResource.resources: $(tests_internalresource_resx) resgen2 -usesourcepath -compile $(tests_internalresource_resx),Test/InternalResource.resources; Test/PublicResource.resources: $(tests_publicresource_resx) resgen2 -usesourcepath -compile $(tests_publicresource_resx),Test/PublicResource.resources; fr/Test.Rules.Globalization.resources.dll: Test/Resource.fr.resources Test/MainResourceMissing.fr.resources $(tests_resource_xmlnotresx_fr) $(tests_resource_missing_xmlnotresx_fr) mkdir -p fr al -culture:fr -embed:Test/MainResourceMissing.fr.resources -embed:Test/Resource.fr.resources -embed:$(tests_resource_xmlnotresx_fr) -embed:$(tests_resource_missing_xmlnotresx_fr) -out:fr/Test.Rules.Globalization.resources.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-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/PreferOverrideBaseRule.cs0000664000175000017500000001270212413742070032732 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Globalization.PreferOverrideBaseRule // // Authors: // Sebastien Pouliot // // 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.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Globalization { [EngineDependency (typeof (OpCodeEngine))] public abstract class PreferOverrideBaseRule : Rule, IMethodRule { protected virtual bool CheckFirstParameter { get { return false; } } protected abstract bool IsPrefered (TypeReference type); protected virtual bool IsSpecialCase (MethodReference method) { return (method == null); } protected abstract void Report (MethodDefinition method, Instruction instruction, MethodReference prefered); static bool MatchParameters (Collection pmethod, Collection candidate, int offset) { int ccount = candidate.Count - offset; int count = Math.Min (pmethod.Count, ccount - offset); for (int i = 0; i < count; i++) { ParameterDefinition pd = candidate [i + offset]; if (pd.IsParams ()) return true; TypeReference ptype = pd.ParameterType; if (!pmethod [i].ParameterType.IsNamed (ptype.Namespace, ptype.Name)) return false; } return (ccount - count <= 1); } // look for a signature identical to ours but that accept an extra parameter MethodReference LookForPreferredOverride (MethodReference method) { TypeDefinition type = method.DeclaringType.Resolve (); if (type == null) return null; var methods = type.Methods; // we already know that, if resolved, there's at least one method (the caller) // so there's no need to call HasMethods if (methods.Count == 1) return null; string name = method.Name; int pcount = 0; Collection mparams = null; if (method.HasParameters) { mparams = method.Parameters; pcount = mparams.Count; } foreach (MethodDefinition md in methods) { // has one more parameter, so non-zero if (!md.HasParameters) continue; Collection pdc = md.Parameters; if (name != md.Name) continue; // compare parameters and return value TypeReference rtype = md.ReturnType; if (!method.ReturnType.IsNamed (rtype.Namespace, rtype.Name)) continue; // last parameter could be our "prefered" type if (IsPrefered (pdc [pdc.Count - 1].ParameterType)) { // special case where the method has no parameter, override has only one (the prefered) if ((pcount == 0) && (mparams == null)) return md; if (MatchParameters (mparams, pdc, 0)) return md; } else if (CheckFirstParameter && IsPrefered (pdc [0].ParameterType)) { if (MatchParameters (mparams, pdc, 1)) return md; } } return null; } Dictionary prefered_overloads = new Dictionary (); MethodReference GetPreferedOverride (MethodReference method) { MethodReference prefered = null; if (!prefered_overloads.TryGetValue (method, out prefered)) { prefered = LookForPreferredOverride (method); prefered_overloads.Add (method, prefered); } return prefered; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // exclude methods that don't have calls if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { MethodReference mr = ins.GetMethod (); // some inheritors have special cases to deal with if (IsSpecialCase (mr)) continue; // check if the call starts or ends with our 'prefered' override if (mr.HasParameters) { Collection pdc = mr.Parameters; if (CheckFirstParameter && IsPrefered (pdc [0].ParameterType)) continue; if (IsPrefered (pdc [pdc.Count - 1].ParameterType)) continue; } // if not check if such a 'prefered' override exists to replace the called method MethodReference prefered = GetPreferedOverride (mr); if (prefered != null) Report (method, ins, prefered); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/PreferIFormatProviderOverrideRule.cs0000664000175000017500000001043312413742070035133 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Globalization.PreferIFormatProviderOverrideRule // // Authors: // Sebastien Pouliot // // 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.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Globalization { /// /// This rule detects calls to method that could be changed to call an override accepting an /// extra System.IFormatProvider or System.Globalization.CultureInfo parameter (the /// later implements System.IFormatProvider). /// Generally data displayed to the end user should be using /// System.Globalization.CultureInfo.CurrentCulture while other data (e.g. used internally, /// stored in files/databases) should use System.Globalization.CultureInfo.InvariantCulture. /// The rule will ignore the following special methods: /// /// System.Activator.CreateInstance /// System.Resources.ResourceManager.GetObject /// System.Resources.ResourceManager.GetString /// /// /// /// Bad example: /// /// public bool Confirm (double amount) /// { /// string msg = String.Format ("Accept payment of {0} ?", amount); /// Transaction.Log ("{0} {1}", DateTime.Now, amount); /// return Prompt (msg); /// } /// /// /// /// Good example: /// /// public bool Confirm (double amount) /// { /// string msg = String.Format (CultureInfo.CurrentCulture, "Accept payment of {0} ?", amount); /// Transaction.Log (CultureInfo.InvariantCulture, "{0} {1}", DateTime.Now, amount); /// return Prompt (msg); /// } /// /// [Problem ("A call is made to a method for which an override, accepting an extra IFormatProvider or CultureInfo, is available")] [Solution ("Specify how the string should be compared by adding the right IFormatProvider/CultureInfo value to the call")] [FxCopCompatibility ("Microsoft.Globalization", "CA1304:SpecifyCultureInfo")] [FxCopCompatibility ("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider")] public class PreferIFormatProviderOverrideRule : PreferOverrideBaseRule { protected override bool CheckFirstParameter { get { return true; } } protected override bool IsPrefered (TypeReference type) { return (type.IsNamed ("System", "IFormatProvider") || type.IsNamed ("System.Globalization", "CultureInfo")); } protected override bool IsSpecialCase (MethodReference method) { if ((method == null) || method.IsNamed ("System", "Activator", "CreateInstance")) return true; TypeReference type = method.DeclaringType; if (!type.IsNamed ("System.Resources", "ResourceManager")) return false; string name = method.Name; return (name == "GetObject" || name == "GetString"); } protected override void Report (MethodDefinition method, Instruction instruction, MethodReference prefered) { string msg = String.Format (CultureInfo.InvariantCulture, "Consider using the perfered '{0}' override.", prefered.GetFullName ()); Runner.Report (method, instruction, Severity.Medium, Confidence.High, msg); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/0000775000175000017500000000000012642235742026761 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/InternalResource.Designer.cs0000664000175000017500000000747012413742070034334 0ustar00directhexdirecthex00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Tests.Rules.Globalization { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class InternalResource { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal InternalResource() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tests.Rules.Globalization.InternalResource", typeof(InternalResource).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// /// Looks up a localized string similar to Called. /// internal static string CalledString { get { return ResourceManager.GetString("CalledString", resourceCulture); } } internal static System.Drawing.Bitmap ImageUnused { get { object obj = ResourceManager.GetObject("ImageUnused", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } internal static System.Drawing.Bitmap ImageUsed { get { object obj = ResourceManager.GetObject("ImageUsed", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized string similar to Uncalled. /// internal static string UncalledString { get { return ResourceManager.GetString("UncalledString", resourceCulture); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/SatelliteResourceMismatchTest.cs0000664000175000017500000000431112413742070035264 0ustar00directhexdirecthex00000000000000// // Unit tests for SatelliteResourceMismatchRule // // Authors: // Antoine Vandecreme // // Copyright (C) 2010 Antoine Vandecreme // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Globalization; using NUnit.Framework; using Test.Rules.Fixtures; using Mono.Cecil; namespace Tests.Rules.Globalization { [TestFixture] public sealed class SatelliteResourceMismatchTest : AssemblyRuleTestFixture { AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { // We use CodeBase insteed of Location to find the satellites assemblies string asmUri = Assembly.GetExecutingAssembly ().CodeBase; Uri uri = new Uri (asmUri); assembly = AssemblyDefinition.ReadAssembly (uri.AbsolutePath); } [Test] public void SatelliteResourceTest () { // 1. StringOnlyInFrench // 2. ImageOnlyInFrench // 3. StringInEnglishImageInFrench // 4. StringWith3ParametersEnBut12Fr // 5. StringWithThreeParametersButSomeUnused // 6. MainResourceMissing.fr.resx file // 7. XMLFileNotInResXOnlyInFrench.fr.xml file AssertRuleFailure (assembly, 7); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/Makefile.in0000664000175000017500000003144012642235731031026 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Globalization/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Globalization.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Globalization/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Globalization/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/PublicResource.resx0000664000175000017500000001336212413742070032610 0ustar00directhexdirecthex00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Called Uncalled mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/PreferIFormatProviderOverrideTest.cs0000664000175000017500000001127112413742070036063 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferIFormatProviderOverrideRule // // Authors: // Sebastien Pouliot // // 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.Globalization; using System.Reflection; using System.Resources; using Gendarme.Rules.Globalization; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Tests.Rules.Globalization { class IFormatProviderTestCases { public void Empty () { } public void Empty (IFormatProvider format) { } public void BadEmpty () { Empty (); } public void CorrectEmpty () { Empty (null); } public void First (object obj) { } public void First (IFormatProvider format, object obj) { } public void BadFirst () { First (null); } public void CorrectFirst () { First (null, null); } public void Last (object obj) { } public void Last (object obj, IFormatProvider format) { } public void BadLast () { Last (null); } public void CorrectLast () { Last (null, null); } } class CultureInfoTestCases { public void Empty () { } public void Empty (CultureInfo info) { } public void BadEmpty () { Empty (); } public void CorrectEmpty () { Empty (null); } public void First (object obj) { } public void First (CultureInfo info, object obj) { } public void BadFirst () { First (null); } public void CorrectFirst () { First (null, null); } public void Last (object obj) { } public void Last (object obj, CultureInfo info) { } public void BadLast () { Last (null); } public void CorrectLast () { Last (null, null); } } [TestFixture] public class PreferIFormatProviderOverrideTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } [Test] public void Success () { AssertRuleSuccess ("CorrectEmpty"); AssertRuleSuccess ("CorrectFirst"); AssertRuleSuccess ("CorrectLast"); AssertRuleSuccess ("CorrectEmpty"); AssertRuleSuccess ("CorrectFirst"); AssertRuleSuccess ("CorrectLast"); } [Test] public void Failure () { AssertRuleFailure ("BadEmpty", 1); AssertRuleFailure ("BadFirst", 1); AssertRuleFailure ("BadLast", 1); AssertRuleFailure ("BadEmpty", 1); AssertRuleFailure ("BadFirst", 1); AssertRuleFailure ("BadLast", 1); } void Ignored (ResourceManager rm) { rm.GetObject ("a"); rm.GetObject ("a", CultureInfo.CurrentCulture); rm.GetString ("b"); rm.GetString ("b", CultureInfo.InvariantCulture); } string Params () { // the overload to use is: Format(IFormatProvider, string, params object []); return String.Format ("{0} {1} {2}", 1, 2, 3); } void NoSimpleOverload (FieldInfo fi) { // the overload with a CultureInfo is SetValue (object, object, BindingFlags, Binder, CultureInfo); // and is not simply an "extra" parameter fi.SetValue (new object (), 1); } [Test] public void SpecialCases () { AssertRuleSuccess ("Ignored"); AssertRuleFailure ("Params", 1); AssertRuleSuccess ("NoSimpleOverload"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/Resource.Designer.cs0000664000175000017500000001300012413742070032621 0ustar00directhexdirecthex00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Tests.Rules.Globalization { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resource { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resource() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tests.Rules.Globalization.Resource", typeof(Resource).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static System.Drawing.Bitmap ImageInBothCultures { get { object obj = ResourceManager.GetObject("ImageInBothCultures", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } internal static System.Drawing.Bitmap ImageOnlyInEnglish { get { object obj = ResourceManager.GetObject("ImageOnlyInEnglish", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } /// /// Looks up a localized string similar to Hello!. /// internal static string StringInBothLanguages { get { return ResourceManager.GetString("StringInBothLanguages", resourceCulture); } } /// /// Looks up a localized string similar to A string. /// internal static string StringInEnglishImageInFrench { get { return ResourceManager.GetString("StringInEnglishImageInFrench", resourceCulture); } } /// /// Looks up a localized string similar to That's all !. /// internal static string StringOnlyInEnglish { get { return ResourceManager.GetString("StringOnlyInEnglish", resourceCulture); } } /// /// Looks up a localized string similar to First: {0} Second: {1} Third: {2}. /// internal static string StringWith3ParametersEnBut12Fr { get { return ResourceManager.GetString("StringWith3ParametersEnBut12Fr", resourceCulture); } } /// /// Looks up a localized string similar to Last parameter: {64}. /// internal static string StringWithMoreThan64Parameters { get { return ResourceManager.GetString("StringWithMoreThan64Parameters", resourceCulture); } } /// /// Looks up a localized string similar to First: {0} Second: {1} Third: {2}. /// internal static string StringWithThreeParameters { get { return ResourceManager.GetString("StringWithThreeParameters", resourceCulture); } } /// /// Looks up a localized string similar to First: {0} Third: {2}. /// internal static string StringWithThreeParametersButSomeUnused { get { return ResourceManager.GetString("StringWithThreeParametersButSomeUnused", resourceCulture); } } } } PreferStringComparisonOverrideTest.cs0000664000175000017500000001677212413742070036244 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test// // Unit tests for PreferStringComparisonOverrideRule // // Authors: // Sebastien Pouliot // // 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 Gendarme.Rules.Globalization; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Tests.Rules.Globalization { [TestFixture] public class PreferStringComparisonOverrideTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public class InstanceWithoutOverride { public bool Compare (string s1, string s2) { return false; } public void Test () { if (Compare ("a", "b")) Console.WriteLine (); } } public class Base { public bool Compare (string s1, string s2) { return false; } public void TestBase () { if (Compare ("a", "b")) Console.WriteLine (); } } public class Inherited : Base { public bool Compare (string s1, string s2, StringComparison comparison) { return true; } public void TestInherited () { // from IL this is a call to Base.Compare so the override is not seen // note: fxcop also miss this one if (Compare ("a", "b")) Console.WriteLine (); } } public class StaticHelperWithoutOverride { // no alternative public static bool StaticCompare (string s1, string s2) { return false; } public void Test () { if (StaticCompare ("a", "b")) Console.WriteLine (); } } public class StaticHelperWithExtraParameterInOverride { public static bool StaticCompare (string s1, string s2) { return false; } // the extra parameter disqualify the override public static bool StaticCompare (string s1, string s2, bool value, StringComparison comparison) { return value; } // the extra parameter disqualify the override public static bool StaticCompare (string s1, string s2, StringComparison comparison, bool value) { return value; } public void Test () { if (StaticCompare ("a", "b")) Console.WriteLine (); } } public class Weird { public bool Compare (StringComparison a, StringComparison b) { return (a == b); } public void Test () { if (Compare (StringComparison.CurrentCulture, StringComparison.CurrentCultureIgnoreCase)) Console.WriteLine (); } } [Test] public void Success () { AssertRuleSuccess ("Test"); AssertRuleSuccess ("TestBase"); AssertRuleSuccess ("TestInherited"); AssertRuleSuccess ("Test"); AssertRuleSuccess ("Test"); AssertRuleSuccess ("Test"); } public class InstanceWithOverride { public bool Compare (string s1, string s2) { return false; } public bool Compare (string s1, string s2, StringComparison comparison) { return true; } // bad public void Test () { if (Compare ("a", "b")) Console.WriteLine (); } } public class StaticHelper { public static bool StaticCompare (string s1, string s2) { return false; } // we have an alternative public static bool StaticCompare (string s1, string s2, StringComparison comparison) { return true; } // bad public void Test () { if (StaticHelper.StaticCompare ("a", "b")) Console.WriteLine (); } } public class NonString { public bool Kompare (char [] s1, char [] s2) { return false; } public bool Kompare (char [] s1, char [] s2, StringComparison comparison) { return true; } // bad public void TestCharArray () { if (Kompare (new char [] { }, new char [] { })) Console.WriteLine (); } public bool KomparInt (int a, int b) { return false; } public bool KomparInt (int a, int b, StringComparison comparison) { return true; } // bad public void TestInt () { if (KomparInt (0, 0)) Console.WriteLine (); } } public class ExtraParameters { public bool Kompare (int level, string s1, string s2) { return false; } public bool Kompare (int level, string s1, string s2, StringComparison comparison) { return true; } // bad public void TestExtraFirst () { if (Kompare (0, "a", "B")) Console.WriteLine (); } public bool Kompar (string s1, int start, string s2) { return false; } public bool Kompar (string s1, int start, string s2, StringComparison comparison) { return true; } // bad public void TestExtraMid () { if (Kompar ("a", 0, "B")) Console.WriteLine (); } public bool Komparz (string s1, string s2, int end) { return false; } // note: parameter name mismatch public bool Komparz (string s1, string s2, int start, StringComparison comparison) { return true; } // bad public void TestExtraEnd () { if (Komparz ("a", "B", 0)) Console.WriteLine (); } } public class FewParameters { public bool Compare () { return false; } public bool Compare (StringComparison comparison) { return true; } // bad public void TestNone () { if (Compare ()) Console.WriteLine (); } public bool Compare (object o) { return (o == null); } public bool Compare (object o, StringComparison comparison) { return true; } // bad public void TestSingle () { if (Compare (null)) Console.WriteLine (); } public bool Compare (short a, long b) { return (a == b); } public bool Compare (short a, long b, StringComparison comparison) { return true; } // bad public void TestDifferent () { if (Compare (1, 1)) Console.WriteLine (); } } [Test] public void Failure () { AssertRuleFailure ("Test"); AssertRuleFailure ("Test"); AssertRuleFailure ("TestCharArray"); AssertRuleFailure ("TestInt"); AssertRuleFailure ("TestExtraFirst"); AssertRuleFailure ("TestExtraMid"); AssertRuleFailure ("TestExtraEnd"); AssertRuleFailure ("TestNone"); AssertRuleFailure ("TestSingle"); AssertRuleFailure ("TestDifferent"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/InternalResource.resx0000664000175000017500000001454512413742070033152 0ustar00directhexdirecthex00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Called Resources/ImageUnused.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Resources/ImageUsed.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Uncalled mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/Resource.fr.resx0000664000175000017500000001630312413742070032055 0ustar00directhexdirecthex00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Resources/ImageInBothCultures.fr.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Resources/ImageOnlyInFrench.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Bonjour ! Resources/StringInEnglishImageInFrench.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Et voila ! Premier: {0} Deuxieme: {11} Troisieme: {2} Dernier paramètre : {64} Deuxieme: {1} Premier: {0} Troisieme: {2} Premier: {0} Deuxieme: {1} mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/AvoidUnusedInternalResourceTest.cs0000664000175000017500000000450212413742070035575 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidUnusedInternalResourceRule // // Authors: // Antoine Vandecreme // // Copyright (C) 2011 Antoine Vandecreme // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Globalization; using NUnit.Framework; using Test.Rules.Fixtures; using Mono.Cecil; namespace Tests.Rules.Globalization { [TestFixture] public sealed class AvoidUnusedInternalResourceTest : MethodRuleTestFixture { public class CallingClass { private void Call () { Console.WriteLine (InternalResource.CalledString); Console.WriteLine (PublicResource.CalledString); Console.WriteLine (InternalResource.ImageUsed.Size); } } [Test] public void InternalResources () { AssertRuleSuccess ("get_CalledString"); AssertRuleFailure ("get_UncalledString"); AssertRuleSuccess ("get_ImageUsed"); AssertRuleFailure ("get_ImageUnused"); } [Test] public void PublicResources () { AssertRuleDoesNotApply ("get_CalledString"); AssertRuleDoesNotApply ("get_UncalledString"); } [Test] public void NotResources () { AssertRuleDoesNotApply ("Call"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/MainResourceMissing.fr.resx0000664000175000017500000001034012413742070034207 0ustar00directhexdirecthex00000000000000 text/microsoft-resx 1.3 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/Makefile.am0000664000175000017500000000015712413742070031011 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Globalization.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/Tests.Rules.Globalization.csproj0000664000175000017500000001634112413742070035171 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {0D974FFB-C19F-40D0-AD87-708D35E9BD3E} Library Properties Tests.Rules.Globalization Tests.Rules.Globalization v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {5D883285-903D-4FDB-9ED9-AB37AE9648F7} Gendarme.Rules.Globalization ResXFileCodeGenerator Resource.Designer.cs Designer True True InternalResource.resx True True PublicResource.resx Resource.resx True True ResXFileCodeGenerator InternalResource.Designer.cs PublicResXFileCodeGenerator PublicResource.Designer.cs False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/Resource.resx0000664000175000017500000001576712413742070031464 0ustar00directhexdirecthex00000000000000 text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Resources/ImageInBothCultures.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Resources/ImageOnlyInEnglish.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Hello! A string That's all ! First: {0} Second: {1} Third: {2} Last parameter: {64} First: {0} Second: {1} Third: {2} First: {0} Third: {2} mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Test/PublicResource.Designer.cs0000664000175000017500000000645612413742070034001 0ustar00directhexdirecthex00000000000000//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Tests.Rules.Globalization { using System; /// /// A strongly-typed resource class, for looking up localized strings, etc. /// // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class PublicResource { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal PublicResource() { } /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tests.Rules.Globalization.PublicResource", typeof(PublicResource).Assembly); resourceMan = temp; } return resourceMan; } } /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// /// Looks up a localized string similar to Called. /// public static string CalledString { get { return ResourceManager.GetString("CalledString", resourceCulture); } } /// /// Looks up a localized string similar to Uncalled. /// public static string UncalledString { get { return ResourceManager.GetString("UncalledString", resourceCulture); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Globalization/Makefile.am0000664000175000017500000000601512413742070030071 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AvoidUnusedInternalResourceRule.cs \ PreferIFormatProviderOverrideRule.cs \ PreferOverrideBaseRule.cs \ PreferStringComparisonOverrideRule.cs \ SatelliteResourceMismatchRule.cs EXTRA_TESTS_OPTIONS += -r:System.Drawing -d:DEBUG -resource:Test/Resource.resources -resource:Test/InternalResource.resources \ -resource:Test/PublicResource.resources -resource:Test/Resources/XMLFileNotInResX.xml EXTRA_DIST += Test/Resource.resx Test/Resource.fr.resx Test/MainResourceMissing.fr.resx Test/InternalResource.resx Test/PublicResource.resx tests_resource_resx = Test/Resource.resx tests_resource_prefix_resx = $(addprefix $(srcdir)/, $(tests_resource_resx)) Test/Resource.resources: $(tests_resource_resx) resgen2 -usesourcepath -compile $(tests_resource_resx),Test/Resource.resources; tests_resource_resx_fr = Test/Resource.fr.resx tests_resource_prefix_resx_fr = $(addprefix $(srcdir)/, $(tests_resource_resx_fr)) Test/Resource.fr.resources: $(tests_resource_resx_fr) resgen2 -usesourcepath -compile $(tests_resource_resx_fr),Test/Resource.fr.resources; tests_resource_missing_resx_fr = Test/MainResourceMissing.fr.resx tests_resource_missing_prefix_resx_fr = $(addprefix $(srcdir)/, $(tests_resource_missing_resx_fr)) Test/MainResourceMissing.fr.resources: $(tests_resource_missing_resx_fr) resgen2 -usesourcepath -compile $(tests_resource_missing_resx_fr),Test/MainResourceMissing.fr.resources; tests_internalresource_resx = Test/InternalResource.resx tests_internalresource_prefix_resx = $(addprefix $(srcdir)/, $(tests_internalresource_resx)) Test/InternalResource.resources: $(tests_internalresource_resx) resgen2 -usesourcepath -compile $(tests_internalresource_resx),Test/InternalResource.resources; tests_publicresource_resx = Test/PublicResource.resx tests_publicresource_prefix_resx = $(addprefix $(srcdir)/, $(tests_publicresource_resx)) Test/PublicResource.resources: $(tests_publicresource_resx) resgen2 -usesourcepath -compile $(tests_publicresource_resx),Test/PublicResource.resources; tests_resource_xmlnotresx_fr = Test/Resources/XMLFileNotInResX.fr.xml tests_resource_missing_xmlnotresx_fr = Test/Resources/XMLFileNotInResXOnlyInFrench.fr.xml fr/Test.Rules.Globalization.resources.dll: Test/Resource.fr.resources Test/MainResourceMissing.fr.resources $(tests_resource_xmlnotresx_fr) $(tests_resource_missing_xmlnotresx_fr) mkdir -p fr al -culture:fr -embed:Test/MainResourceMissing.fr.resources -embed:Test/Resource.fr.resources -embed:$(tests_resource_xmlnotresx_fr) -embed:$(tests_resource_missing_xmlnotresx_fr) -out:fr/Test.Rules.Globalization.resources.dll EXTRA_TESTS_DEPS = Test/Resource.resources Test/InternalResource.resources Test/PublicResource.resources Test/Resources/XMLFileNotInResX.xml fr/Test.Rules.Globalization.resources.dll tests_sources = \ AvoidUnusedInternalResourceTest.cs \ PreferIFormatProviderOverrideTest.cs \ PreferStringComparisonOverrideTest.cs \ SatelliteResourceMismatchTest.cs \ Resource.Designer.cs \ InternalResource.Designer.cs \ PublicResource.Designer.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/0000775000175000017500000000000012642235742024301 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Makefile.in0000664000175000017500000006526712642235732026365 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.NUnit ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ NUnitRocks.cs \ NUnitRule.cs \ ProvideMessageOnAssertCallsRule.cs \ TestMethodsMustBePublicRule.cs \ UnitTestsMissingTestFixtureRule.cs tests_sources = \ Helpers.cs \ NUnitRocksTest.cs \ ProvideMessageOnAssertCallsTest.cs \ TestMethodsMustBePublicTest.cs \ UnitTestsMissingTestFixtureTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.NUnit/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.NUnit/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/NUnitRocks.cs0000664000175000017500000000425212413742070026663 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.NUnit.NUnitRocks // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; namespace Gendarme.Rules.NUnit { /// /// NUnitRocks contains extensions methods for NUnit-related methods and types. /// public static class NUnitRocks { /// /// Checks if the method is a valid unit test (has corresponding attribute). /// /// The ICustomAttributeProvider on which the extension method can be called. /// True if method is a unit test, false otherwise. public static bool IsTest (this ICustomAttributeProvider self) { if ((self == null) || !self.HasCustomAttributes) return false; foreach (CustomAttribute attribute in self.CustomAttributes) { TypeReference type = attribute.AttributeType; if (type.Namespace != "NUnit.Framework") continue; string name = attribute.AttributeType.Name; if (name == "TestAttribute" || name == "TestCaseAttribute" || name == "TestCaseSourceAttribute") return true; } return false; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/NUnitRule.cs0000664000175000017500000000375512413742070026520 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.NUnit.NUnitRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.NUnit { abstract public class NUnitRule : Rule { public Version NUnitVersion { get; set; } public override void Initialize (IRunner runner) { base.Initialize (runner); // If the assembly doesn't references nunit.framework then it // obviously doesn't use any of its types Runner.AnalyzeModule += (object o, RunnerEventArgs e) => { Active = false; foreach (AssemblyNameReference assembly in e.CurrentModule.AssemblyReferences) { if (assembly.Name == "nunit.framework") { Active = true; NUnitVersion = assembly.Version; return; } } }; } } }mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/UnitTestsMissingTestFixtureRule.cs0000664000175000017500000000635712413742070033167 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.NUnit.UnitTestsMissingTestFixtureRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.NUnit { /// /// This rule checks that all types which have methods with TestAttribute, TestCaseAttribute /// or TestCaseSourceAttribute are marked with the TestFixtureAttribute. NUnit < 2.5 will not run /// tests located in types without TestFixtureAttribute. /// /// /// Bad example: /// /// class Test { /// [Test] /// public void TestMethod () /// { /// Assert.AreEqual (0, 0); /// } /// } /// /// /// /// Good example: /// /// [TestFixture] /// class Test { /// [Test] /// public void TestMethod () /// { /// Assert.AreEqual (0, 0); /// } /// } /// /// [Problem ("Type contains methods with Test, TestCase or TestCaseSource attributes, but the type itself is not marked with the TestFixture attribute")] [Solution ("Add a TestFixture attribute to the type")] public class UnitTestsMissingTestFixtureRule : NUnitRule, ITypeRule { private Version Version25 = new Version (2, 5); public RuleResult CheckType (TypeDefinition type) { if (!type.IsClass || type.IsAbstract || !type.HasMethods) return RuleResult.DoesNotApply; // check if TestFixture is applied to any type in the hierarchy TypeDefinition testingType = type; while (testingType != null) { if (testingType.HasAttribute ("NUnit.Framework", "TestFixtureAttribute")) return RuleResult.Success; if (testingType.BaseType != null) testingType = testingType.BaseType.Resolve (); else break; } foreach (MethodDefinition method in type.Methods) { if (method.IsTest ()) { Severity severity = (NUnitVersion == null || NUnitVersion < Version25) ? Severity.High : Severity.Low; Runner.Report (method, severity, Confidence.High); return RuleResult.Failure; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/0000775000175000017500000000000012642235742025220 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/Tests.Rules.NUnit.csproj0000775000175000017500000001210112413742070031660 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {FE98135B-0CD0-4C0A-942D-2E5FF9E3A20F} Library Properties Tests.Rules.NUnit Tests.Rules.NUnit v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {54625746-D966-4BC2-A465-8F0928A767E6} Gendarme.Rules.NUnit False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/Helpers.cs0000664000175000017500000000354312413742070027147 0ustar00directhexdirecthex00000000000000// // Test.Rules.NUnit.Helpers // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Test.Rules.Helpers; using Mono.Cecil; using NUnit.Framework; namespace Test.Rules.NUnit { /// /// This class contains various helpers fot NUnit unit tests. /// public static class Helpers { /// /// Adds NUnit.Framework.TestAttribute to the specified ICustomAttributeProvicer /// /// ICustomAttributeProvider to which the attribute should be added public static void AddTestAttribute (this ICustomAttributeProvider self) { MethodDefinition ctor = DefinitionLoader.GetMethodDefinition (".ctor"); self.CustomAttributes.Add (new CustomAttribute (ctor)); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/Makefile.in0000664000175000017500000003140112642235732027263 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.NUnit/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.NUnit.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.NUnit/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.NUnit/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/TestMethodsMustBePublicTest.cs0000664000175000017500000000514412413742070033126 0ustar00directhexdirecthex00000000000000// // Test.Rules.NUnit.TestMethodsMustBePublicTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Rules.NUnit; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.NUnit { [TestFixture] public class TestMethodsMustBePublicTest : MethodRuleTestFixture { // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test private void PrivateTestMethod () { } // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test internal void InternalTestMethod () { } // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test protected void ProtectedTestMethod () { } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void Good () { AssertRuleSuccess ("Good"); } [Test] public void Bad () { MethodDefinition m = DefinitionLoader.GetMethodDefinition ("PrivateTestMethod"); m.AddTestAttribute (); AssertRuleFailure (m); m = DefinitionLoader.GetMethodDefinition ("InternalTestMethod"); m.AddTestAttribute (); AssertRuleFailure (m); m = DefinitionLoader.GetMethodDefinition ("ProtectedTestMethod"); m.AddTestAttribute (); AssertRuleFailure (m); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/NUnitRocksTest.cs0000664000175000017500000000326012413742070030440 0ustar00directhexdirecthex00000000000000// // Test.Rules.NUnit.NUnitRocksTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Rules.NUnit; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.NUnit { [TestFixture] public class NUnitRocksTest { [Test] public void True () { Assert.IsTrue (DefinitionLoader.GetMethodDefinition ("True").IsTest ()); } [Test] public void False () { Assert.IsFalse (SimpleMethods.EmptyMethod.IsTest()); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/ProvideMessageOnAssertCallsTest.cs0000664000175000017500000001127712413742070033763 0ustar00directhexdirecthex00000000000000// // Test.Rules.NUnit.ProvideMessageOnAssertCallsTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Rules.NUnit; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; using System.Runtime.InteropServices; namespace Test.Rules.NUnit { [TestFixture] public class ProvideMessageOnAssertCallsTest : MethodRuleTestFixture { private void DoesNotApplyNoAttributes () { Assert.AreEqual (10, 20); Assert.AreNotEqual (20, 30); } // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test private void BadTestAttribute () { Assert.AreEqual (10, 20); Assert.AreNotEqual (20, 30); } // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test private void FourBadAsserts () { Assert.AreEqual (10, 15); Assert.AreEqual (10, 15, "message string"); // unrelated code System.Collections.Generic.List ls = new System.Collections.Generic.List { "a", "b" }; ls.Clear (); Assert.IsInstanceOfType (typeof (System.Reflection.Assembly), new object ()); Assert.IsNull (null); Assert.IsNotNull (null, "message string"); Assert.ReferenceEquals (new object (), new object ()); // should be ignored Assert.Fail (); } // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test private void GoodOneBadAssert () { Assert.LessOrEqual (10, 20); } // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test private void GoodExceptions () { Assert.ReferenceEquals (1, 2); Assert.Equals (3, 4); } // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test private void GoodWithMessages () { Assert.IsNull (new object (), "Test to check whether new object is null"); Assert.IsFalse (true, "Test to check whether true is false"); Assert.Fail ("Failing the test"); } // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test [DllImport ("libc.so")] private static extern void DoesNotApplyExternal (); // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test private void DoesNotApplyEmpty () { } [Test] public void DoesNotApply () { MethodDefinition m = DefinitionLoader.GetMethodDefinition ("DoesNotApplyExternal"); m.AddTestAttribute (); AssertRuleDoesNotApply (m); m = DefinitionLoader.GetMethodDefinition ("DoesNotApplyEmpty"); m.AddTestAttribute (); AssertRuleDoesNotApply (m); AssertRuleDoesNotApply ("DoesNotApplyNoAttributes"); } [Test] public void Good () { MethodDefinition m = DefinitionLoader.GetMethodDefinition ("GoodOneBadAssert"); m.AddTestAttribute (); AssertRuleSuccess (m); m = DefinitionLoader.GetMethodDefinition ("GoodExceptions"); m.AddTestAttribute (); AssertRuleSuccess (m); m = DefinitionLoader.GetMethodDefinition ("GoodWithMessages"); m.AddTestAttribute (); AssertRuleSuccess (m); } [Test] public void Bad () { MethodDefinition m = DefinitionLoader.GetMethodDefinition ("BadTestAttribute"); m.AddTestAttribute (); AssertRuleFailure (m, 2); m = DefinitionLoader.GetMethodDefinition ("FourBadAsserts"); m.AddTestAttribute (); AssertRuleFailure (m, 4); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/Makefile.am0000664000175000017500000000015012413742070027241 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.NUnit.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Test/UnitTestsMissingTestFixtureTest.cs0000664000175000017500000000623412413742070034110 0ustar00directhexdirecthex00000000000000// // Test.Rules.NUnit.UnitTestsMissingTestFixtureTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Rules.NUnit; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.NUnit { [TestFixture] public class UnitTestsMissingTestFixtureTest : TypeRuleTestFixture { abstract class AbstractClass { } [TestFixture] class TestFixtureClass { // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test public void TestMethod () { } } class InheritsFromTestFixtureClass : TestFixtureClass { // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test public void AnotherTestMethod () { } } class NoTestFixtureClass { // [Test] -- added later using Cecil to avoid NUnit treating this as a unit test public void TestMethod () { } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Structure); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (); } [Test] public void Good () { // self-testing, TestFixture present AssertRuleSuccess (); AssertRuleSuccess (); DefinitionLoader.GetMethodDefinition ("TestMethod").AddTestAttribute (); DefinitionLoader.GetMethodDefinition ("AnotherTestMethod").AddTestAttribute (); AssertRuleSuccess (); AssertRuleSuccess (); // no TestFixture and no Test attributes AssertRuleSuccess (SimpleTypes.Class); // deep (more than one) hierarchy / loop AssertRuleSuccess (); } [Test] public void Bad () { DefinitionLoader.GetMethodDefinition ("TestMethod").AddTestAttribute (); AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/ProvideMessageOnAssertCallsRule.cs0000664000175000017500000001026012413742070033023 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.NUnit.ProvideMessageOnAssertCallsRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.NUnit { /// /// This rule checks that all Assert.* methods are calling with 'message' /// parameter, which helps to easily identify failing test. /// /// /// Bad example: /// /// [Test] /// public void TestThings () /// { /// Assert.AreEqual(10, 20); /// Assert.AreEqual(30, 40); /// } /// /// /// /// Good example: /// /// [Test] /// public void TestThings () /// { /// Assert.AreEqual(10, 20, "10 equal to 20 test"); /// Assert.AreEqual(30, 40, "30 equal to 40 test"); /// /// /// /// This rule will not report any problems if only one Assert.* call was made /// inside a method, because it's easy to identify failing test in this case. [Problem ("Assert.* methods being called without 'message' parameter, which helps to easily identify failing test.")] [Solution ("Add string 'message' parameter to the calls.")] [EngineDependency (typeof (OpCodeEngine))] public class ProvideMessageOnAssertCallsRule : NUnitRule, IMethodRule { // Assert.* methods that do not have an override with the 'string message' HashSet exceptions = new HashSet { "Equals", "ReferenceEquals", }; private int reportCounter = 0; private Defect defectDelayed; public RuleResult CheckMethod (MethodDefinition method) { reportCounter = 0; if (!method.HasBody || !method.IsTest ()) return RuleResult.DoesNotApply; if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.FlowControl != FlowControl.Call) continue; MethodReference m = (instruction.Operand as MethodReference); if (m == null || !m.DeclaringType.IsNamed ("NUnit.Framework", "Assert") || exceptions.Contains (m.Name)) continue; bool foundMessage = false; if (m.HasParameters) { MethodDefinition resolvedMethod = m.Resolve (); if (resolvedMethod == null) continue; foreach (ParameterDefinition parameter in resolvedMethod.Parameters) { if (parameter.ParameterType.IsNamed ("System", "String") && parameter.Name == "message") { foundMessage = true; break; } } } if (!foundMessage) DelayedReport (new Defect (this, method, method, instruction, Severity.Medium, Confidence.High)); } return Runner.CurrentRuleResult; } // reports only if it was called more than one time private void DelayedReport (Defect defect) { reportCounter++; if (reportCounter > 1) { if (reportCounter == 2) Runner.Report (defectDelayed); Runner.Report (defect); } else defectDelayed = defect; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Makefile.am0000664000175000017500000000053512413742070026331 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ NUnitRocks.cs \ NUnitRule.cs \ ProvideMessageOnAssertCallsRule.cs \ TestMethodsMustBePublicRule.cs \ UnitTestsMissingTestFixtureRule.cs tests_sources = \ Helpers.cs \ NUnitRocksTest.cs \ ProvideMessageOnAssertCallsTest.cs \ TestMethodsMustBePublicTest.cs \ UnitTestsMissingTestFixtureTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/Gendarme.Rules.NUnit.csproj0000775000175000017500000001134512413742070031372 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {54625746-D966-4BC2-A465-8F0928A767E6} Library Properties Gendarme.Rules.NUnit Gendarme.Rules.NUnit v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.NUnit.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 ..\..\console\bin\Release\Gendarme.Rules.NUnit.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.NUnit/TestMethodsMustBePublicRule.cs0000664000175000017500000000465512413742070032205 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.NUnit.TestMethodsMustBePublicRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.NUnit { /// /// Test method (a method, marked with either TestAttribute, TestCaseAttribute /// or TestCaseSourceAttribute) is not public. Most NUnit test runners won't /// execute non-public unit tests. /// /// /// Bad example: /// /// [Test] /// private void TestMethod () /// { /// Assert.AreEqual (10, 20); /// } /// /// /// /// Good example: /// /// public void TestMethod () /// { /// Assert.AreEqual (10, 20); /// } /// /// [Problem ("Test method is not marked as public, which means it will not be executed by most test runners.")] [Solution ("Change method visibility to public.")] public class TestMethodsMustBePublicRule : NUnitRule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!method.IsTest ()) return RuleResult.DoesNotApply; if (!method.IsPublic) Runner.Report (method, Severity.Critical, Confidence.High); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/0000775000175000017500000000000012642235741025404 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/PreferEmptyInstanceOverNullRule.cs0000664000175000017500000001221712413742070034176 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.PreferEmptyInstanceOverNullRule // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.BadPractice { /// /// This rule checks that all methods and properties which return a string, an array, /// a collection, or an enumerable do not return null. /// It is usually better to return an empty instance, as this allows /// the caller to use the result without having to perform a null-check first. /// /// /// Bad example (string): /// /// public string DisplayName { /// get { /// if (IsAnonymous) { /// return null; /// } /// return name; /// } /// } /// /// /// /// Good example (string): /// /// public string DisplayName { /// get { /// if (IsAnonymous) { /// return string.Empty; /// } /// return name; /// } /// } /// /// /// /// Bad example (array): /// /// public int [] GetOffsets () /// { /// if (!store.HasOffsets) { /// return null; /// } /// store.LoadOffsets (); /// return store.Offsets; /// } /// /// /// /// Good example (array): /// /// static const int [] Empty = new int [0]; /// public int [] GetOffsets () /// { /// if (!store.HasOffsets) { /// return Empty; /// } /// store.LoadOffsets (); /// return store.Offsets.ToArray (); /// } /// /// /// /// Bad example (enumerable): /// /// public IEnumerable<int> GetOffsets () /// { /// if (!store.HasOffsets) { /// return null; /// } /// store.LoadOffsets (); /// return store.Offsets; /// } /// /// /// /// Good example (enumerable): /// /// public IEnumerable<int> GetOffsets () /// { /// if (!store.HasOffsets) { /// yield break; /// } /// store.LoadOffsets (); /// foreach (int offset in store.Offsets) { /// yield return offset; /// } /// } /// /// /// This rule is available since Gendarme 2.4 [Problem ("This method returns null but returning an empty instance would make it easier to use.")] [Solution ("Return an empty instance instead of null.")] public class PreferEmptyInstanceOverNullRule : ReturnNullRule, IMethodRule { TypeReference return_type; bool string_return_type; bool array_return_type; bool ienumerable_return_type; public override RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; //the rule does not apply to the particular case of ToString() //that have its own ToStringShouldNotReturnNullRule if (!method.HasParameters && method.Name == "ToString") return RuleResult.DoesNotApply; //only apply to methods returning string, array, or IEnumerable-impl return_type = method.ReturnType; string_return_type = return_type.IsNamed ("System", "String"); array_return_type = return_type.IsArray; ienumerable_return_type = return_type.Implements ("System.Collections", "IEnumerable"); if (!string_return_type && !array_return_type && !ienumerable_return_type) return RuleResult.DoesNotApply; return base.CheckMethod (method); } protected override void Report (MethodDefinition method, Instruction ins) { string msg = String.Format (CultureInfo.InvariantCulture, "Replace null with {0}.", SuggestReturnType ()); Runner.Report (method, ins, method.IsVisible () ? Severity.Medium : Severity.Low, Confidence.Normal, msg); } string SuggestReturnType () { if (string_return_type) return "string.Empty"; else if (array_return_type) return String.Format (CultureInfo.InvariantCulture, "an empty {0} array", return_type.Name); else if (ienumerable_return_type) return "yield break (or equivalent)"; return "an empty collection"; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/ChangeLog0000664000175000017500000004353612413742070027163 0ustar00directhexdirecthex000000000000002010-06-22 Sebastien Pouliot * PreferEmptyInstanceOverNullRule.cs: Apply AvoidLargeClassesRule 2010-06-13 Sebastien Pouliot * DisableDebuggingCodeRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-10 Sebastien Pouliot * ConstructorShouldNotCallVirtualMethodsRule.cs: Avoid calling MethodReference.ToString since we already have the value 2010-06-05 Sebastien Pouliot * ReturnNullRule.cs: Fix case where an immediate if (?:) would not be reported 2010-06-04 Sebastien Pouliot * PreferEmptyInstanceOverNullRule.cs: Keep state around since it can be needed if we report a defect. Rename GetReturnTypeSuggestion to SuggestReturnType (apply ConsiderConvertingMethodToPropertyRule) 2010-01-28 Sebastien Pouliot * PreferTryParseRule.cs: Simplify and reduce code duplication by using the new MethodSignatures.[Try]Parse 2010-01-23 Sebastien Pouliot * PreferSafeHandleRule.cs: Apply MethodCanBeMadeStaticRule * PreferTryParseRule.cs: New. Rule to encourage the use of TryParse methods (when available) over Parse methods. 2010-01-09 Sebastien Pouliot * PreferParamsArrayForVariableArgumentsRule.cs: New rule to warn about methods using the vararg calling convention and not used for interoperability purpose. 2009-07-17 Jesse Jones * GetEntryAssemblyMayReturnNullRule.cs, DisableDebuggingCodeRule.cs: Rewrote descriptions. 2009-07-01 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-02-17 Jesse Jones * OnlyUseDisposeForIDisposableTypesRule.cs, Makefile.am: Added new rule. 2009-01-30 Jb Evain * Makefile.am: add new DoNotUseEnumIsAssignableFrom rule and tests. 2009-01-30 Jb Evain * DoNotUseEnumIsAssignableFromRule.cs: add new rule. 2009-01-20 Jesse Jones * PreferSafeHandleRule.cs: Added. 2008-12-23 Cedric Vivier * CloneMethodShouldNotReturnNull.cs: * ToStringReturnsNullRule.cs: * PreferEmptyInstanceOverNullRule.cs: * ReturnNullRule.cs: Improve text and consistency between ReturnNullRule inheritors. * ToStringReturnsNullRule.cs: Rename to ToStringShouldNotReturnNullRule. 2008-12-23 Cedric Vivier * PreferEmptyInstanceOverNullRule.cs: New. This rule checks that methods/properties returning a string, an array, a collection, or an enumerable, do not return null. 2008-12-13 Jesse Jones * ObsoleteMessagesShouldNotBeEmptyRule.cs, CloneMethodShouldNotReturnNullRule.cs, GetEntryAssemblyMayReturnNullRule.cs, DisableDebuggingCodeRule.cs: Fix AnalyzeModule so that it activates the rule properly when multiple assemblies or modules are being checked. 2008-12-09 Jesse Jones * AvoidAssemblyVersionMismatchRule.cs: Tweaked the language in the description. 2008-12-02 Sebastien Pouliot * ObsoleteMessagesShouldNotBeEmptyRule.cs: Avoid using two conditions leading to the exact same code. 2008-11-30 Sebastien Pouliot * AvoidAssemblyVersionMismatchRule.cs: Use HasCustomAttributes * AvoidVisibleConstantFieldRule.cs: Use HasFields * CheckNewExceptionWithoutThrowingRule.cs: Use HasParameters * CheckNewThreadWithoutStartRule.cs: Use HasParameters * DisableDebuggingCodeRule.cs: Use HasCustomAttributes * ObsoleteMessagesShouldNotBeEmptyRule.cs: Use HasCustomAttributes, HasEvents, HasFields, HasProperties, HasConstructors and HasMethods 2008-11-20 Sebastien Pouliot * AvoidCallingProblematicMethodsRule.cs: Rework SortedDictionary not to require the full name, which avoid calling MethodReference so many times (each time creating a string). * CloneMethodShouldNotReturnNullRule.cs: Only apply rules if the module refers to System.ICloneable (only 23 out of 86 assemblies of Mono 2.0 profile do). Change rule to IMethodRule since calling Implements is rather expensive (recursive). * DisableDebuggingCodeRule.cs: Specify StringComparison.Ordinal when calling String.StartsWith. * ReturnNullRule.cs: Change CheckMethod to virtual. 2008-11-13 Sebastien Pouliot * AvoidAssemblyVersionMismatchRule.cs, ObsoleteMessagesShouldNotBeEmptyRule.cs: Small changes to XML docs. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.BadPractice.mdp: * Gendarme.Rules.BadPractice.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-30 Jesse Jones * Makefile.am: Append onto the inherited EXTRA_RULES_OPTIONS. 2008-10-26 Sebastien Pouliot * AvoidAssemblyVersionMismatchRule.cs: Use the new IsEmpty rock. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.BadPractice.xml, doc/Gendarme.Rules.BadPractice: With the new code in the Makefiles we don't need to store the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-21 Sebastien Pouliot * DoNotUseGetInterfaceToCheckAssignabilityRule.cs: New. Rule to check if Type.GetInterface is being used to defect the presence, or absence, of an interface (wrt getting back a Type instance). There is a better way to check for this when the interface name is known at compile time. * Makefile.am: Add rule/test to the build. 2008-09-20 Sebastien Pouliot * AvoidAssemblyVersionMismatchRule.cs: New. Rule to check if the version numbers in both [AssemblyVersion] and [AssemblyFileVersion] match. * Makefile.am: Add rule/test to the build. 2008-09-19 Sebastien Pouliot * ReplaceIncompleteOddnessCheckRule.cs: Reduce the OpCodeBitmask properties visibility [self-test] 2008-09-19 Sebastien Pouliot * AvoidCallingProblematicMethodsRule.cs: Use OpCodeEngine to analyze only if both a Call or Callvirt are present in the method's IL. Added XML documentation. * AvoidVisibleConstantFieldRule.cs: Added XML documentation. * CheckNewExceptionWithoutThrowingRule.cs: Use OpCodeEngine to analyze only if a Newobj instruction is present in the method's IL. Added XML documentation. Use shorter override for Runner.Report. * CheckNewThreadWithoutStartRule.cs: Use OpCodeEngine to analyze only if a Newobj instruction is present in the method's IL. Added XML documentation. * CloneMethodShouldNotReturnNullRule.cs: Big simplification by using the new ReturnNullRule. Added XML documentation. * ConstructorShouldNotCallVirtualMethodsRule.cs: Use OpCodeEngine to analyze only if both a Call or Callvirt are present in the method's IL. Added XML documentation. * DisableDebuggingCodeRule.cs: Use OpCodeEngine to analyze only if both a Call or Callvirt are present in the method's IL. Added XML documentation. * DoNotForgetNotImplementedMethodsRule.cs: Use OpCodeEngine to analyze only if both a Newobj and Throw are present in the method's IL. Change logic to handle more cases (small methods with branches versus large methods without conditional branches). Added XML documentation. * EqualShouldHandleNullArgRule.cs: Added XML documentation. Use shorter override for Runner.Report. * GetEntryAssemblyMayReturnNullRule.cs: Use OpCodeEngine to analyze only if both a Call or Callvirt are present in the method's IL. Added XML documentation. * ObsoleteMessagesShouldNotBeEmptyRule.cs: Added XML documentation. Use shorter override for Runner.Report. * ReplaceIncompleteOddnessCheckRule.cs: Use OpCodeEngine to analyze only if a Rem or Rem_Un instruction are present in the method's IL. Use OpCodeBitmask to simplify the rule (and cover more conversion cases). Added XML documentation. * ReturnNullRule.cs: New. Abstract base class for both CloneMethodShouldNotReturnNullRule and ToStringReturnsNullRule. Use OpCodeEngine and InstructionRocks.TraceBack to to its job. The later allows CSC non-optimized code to work correctly (no more false positive) with both rules. * ToStringReturnsNullRule.cs: Big simplification by using the new ReturnNullRule. Added XML documentation. * Makefile.am: Add abstract ReturnNullRule to the build. Compile tests with DEBUG and TRACE defined since the rule return value, Success versus DoesNotApply, now makes a difference. 2008-07-17 Sebastien Pouliot * ObsoleteMessagesShouldNotBeEmptyRule.cs: Speed up rule. Only 18 out of 72 assemblies (Mono 2.0 profile) refers to the ObsoleteAttribute type (+1 for mscorlib that defines it). 2008-07-13 Sebastien Pouliot * DoNotForgetNotImplementedMethodsRule.cs: New. Rule to check if some method are incomplete (e.g. throwing NotImplementedException) [committed for Cedric Vivier with a few changes from myself] * Gendarme.Rules.BadPractice.mdp: Update MD project file. * Makefile.am: Add rule/test to the build. 2008-07-12 Sebastien Pouliot * ObsoleteMessagesShouldNotBeEmptyRule.cs: Remove unused field (self-test) 2008-07-10 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-04 Jb Evain * AvoidCallingProblematicMethodsRule.cs: refactor to avoid creating a new delegate type by using Func<,>, and use the lambda syntax to shorten anonymous methods declarations. 2008-07-03 Sebastien Pouliot * AvoidCallingProblematicMethodsRule.cs: Use IComparer instead of IEqualityComparer and avoid the "constant" GetHashCode hack. Use a custom delagate in order to remove the struct allocations and make the source code smaller (and easier to test). 2008-07-03 Nestor Salceda * AvoidCallingProblematicMethodsRule.cs: New. Rule that check for potentially damaging / dangerous methods calls. * Gendarme.Rules.BadPractice.mdp: Update MD project file. * Makefile.am: Add rule/test to the build. 2008-06-30 Sebastien Pouliot * AvoidVisibleConstantFieldRule.cs: New. Rule that check for a constant fields visible to other assemblies. Using them makes the value, not a reference to the field, part of the assemblies that reference the field. This requires all those assemblies to be recompiled if the value change. * Gendarme.Rules.BadPractice.mdp: Update MD project file. * Makefile.am: Add rule/test to the build. 2008-06-28 Sebastien Pouliot * ReplaceIncompleteOddnessCheckRule.cs: New. Rule that check for a common, yet incomplete, oddness check (that fails when using negative numbers). * Gendarme.Rules.BadPractice.mdp: Update MD project file. * Makefile.am: Add rule/test to the build. 2008-06-08 Sebastien Pouliot * CheckNewExceptionWithoutThrowingRule.cs: Rename StackEntryAnalysis.UsageResult to StackEntryUsageResult * CheckNewThreadWithoutStartRule.cs: Rename StackEntryAnalysis.UsageResult to StackEntryUsageResult 2008-05-18 Sebastien Pouliot * ObsoleteMessagesShouldNotBeEmptyRule.cs: New. Check that when [Obsolete] is used a description is provided. * Makefile.am: Add rule/test to the build. 2008-05-04 Sebastien Pouliot * EqualShouldHandleNullArgRule.cs: Simplify method (self-test cc). Fix all known positives (3) that were still found in Mono BCL. 2008-04-25 Sebastien Pouliot * CheckNewThreadWithoutStartRule.cs: Use Initialize to avoid executing the rule on some assemblies (52 out of 72 for Mono 2.0) * GetEntryAssemblyMayReturnNullRule.cs: Use Initialize to avoid executing the rule on some assemblies (36 out of 72 for Mono 2.0) and when the assembly is an EXE. 2008-04-23 Sebastien Pouliot * DisableDebuggingCodeRule.cs: Change Initialize so the rule applies to corlib too (which defines, not refer to Console type). * CheckNewExceptionWithoutThrowingRule.cs: Use Inherits (instead of checking name suffix) to find Exception-devired types. 2008-03-07 Sebastien Pouliot * DisableDebuggingCodeRule.cs: New. Rule to check for debugging CWL left inside assemblies (ref: bug #366450) * Gendarme.Rules.BadPractice.mdp: Update MD project file. * Makefile.am: Add rule/test to the build. 2008-02-16 Sebastien Pouliot * CloneMethodShouldNotReturnNullRule: Remove unused method. 2008-02-15 Sebastien Pouliot * CheckNewExceptionWithoutThrowingRule.cs * CheckNewThreadWithoutStartRule.cs * CloneMethodShouldNotReturnNullRule.cs * ConstructorShouldNotCallVirtualMethodsRule.cs * EqualShouldHandleNullArgRule.cs * GetEntryAssemblyMayReturnNullRule.cs * ToStringReturnsNullRule.cs Update rules wrt framework changes. 2008-01-30 Sebastien Pouliot * CheckNewExceptionWithoutThrowingRule.cs: New. Rule to check that all exception we create are thrown (or returned) from all methods. [Andreas Noever] * CheckNewThreadWithoutStartRule.cs: New. Rule to check that all threads we create are started (or returned) from all methods. [Andreas Noever] * Gendarme.Rules.BadPractice.xml.in: Add rules descriptions. * Makefile.am: Add rules/tests to the build. 2008-01-24 Sebastien Pouliot * ImplementingEqualsButNotGetHashCodeAndViceVersaRule.cs: Rule moves (with tests) into Design since it affects the API. * ToStringReturnsNullRule.cs: Simplification to avoid uncommon cases that added *LOTS* of false positives while still missing some real defects. Now a rock-ified ITypeRule with much lower memory requirements. * Gendarme.Rules.BadPractice.xml.in: Remove (moved) definition. * Makefile.am: Remove (moved) rule and tests 2008-01-23 Sebastien Pouliot * ConstructorShouldNotCallVirtualMethodsRule.cs: Add recursive checks for non-virtual calls (as they can lead to virtual calls). Add check for final methods. Add check for calling 'this' sub-classes (versus calling them on other instances, other types) * EqualShouldHandleNullArgRule.cs: Change to ITypeRule (and locate Equals) and to use rocks. Reimplemented HandlesNullArg based on more extensive unit tests. False positives are mostly history :) 2008-01-14 Sebastien Pouliot * ConstructorShouldNotCallVirtualMethodsRule.cs: New. Rule to find every virtual calls made inside constructor of unsealed types. * GetEntryAssemblyMayReturnNullRule.cs: New. Rule to detect usage of Assembly.GetEntryAssembly which returns null when called outside the root application domain [Daniel Abramov] * Gendarme.Rules.BadPractice.mdp: Update MD project file. * Gendarme.Rules.BadPractice.xml.in: Add rules descriptions. * Makefile.am: Add rules/tests to the build. 2008-01-12 Sebastien Pouliot * CloneMethodShouldNotReturnNullRule.cs: Use new Location ctor. * EqualShouldHandleNullArgRule.cs: Use new Location ctor. * ImplementingEqualsButNotGetHashCodeAndViceVersaRule.cs: Use new Location ctor. * ToStringReturnsNullRule.cs: Use new Location ctor. 2008-01-11 Sebastien Pouliot * CloneMethodShouldNotReturnNullRule.cs: Use rocks and turn a method to static. * EqualShouldHandleNullArgRule.cs: Turn some methods to static. * ToStringReturnsNullRule.cs: Turn some methods to static. 2008-01-06 Sebastien Pouliot * ToStringReturnsNullRule.cs: Avoid creating MessageCollection until/unless it's needed. 2007-11-23 Sebastien Pouliot * EqualShouldHandleNullArgRule.cs: Don't create a MessageCollection unless we return a message. Avoid NRE if Equals simply return a boolean. Add FIXME to rework logic for MS compilers in debug mode. 2007-11-22 Sebastien Pouliot * CloneMethodShouldNotReturnNullRule.cs: Don't create a MessageCollection unless we return a message. IL check logic is too simplistic, added a little more logic (but it's still needs to be fixed) so the test run correctly under Windows (VS in Debug mode really generates crap). * ImplementingEqualsButNotGetHashCodeAndViceVersaRule.cs: Avoid creating MessageCollection unless needed. 2007-11-18 Nestor Salceda * ToStringReturnsNullRule.cs: Fixed NullReferenceException when doesn't exist the key in the hash table. Some internal refactoring (fix the selection for the ToString () method). 2007-10-24 Nestor Salceda * Gendarme.Rules.BadPractice.xml.in: Put the version attribute with autotools helpers. Added documentation for these rules. 2007-10-19 Nestor Salceda * CloneMethodShouldNotReturnNullRule.cs: Fixed NullReferenceException when try to inspect a method without body. 2007-10-16 Nestor Salceda * ToStringReturnsNullRule.cs: Fixed NullReferenceException when try to inspect a method without instructions. 2007-10-07 Sebastien Pouliot * CloneMethodShouldNotReturnNullRule.cs: New rule (Nidhi Rawal, GSoC 2007) * EqualShouldHandleNullArgRule.cs: New rule (Nidhi Rawal, GSoC 2007) * ImplementingEqualsButNotGetHashCodeAndViceVersaRule.cs: New rule (Nidhi Rawal, GSoC 2007) * ToStringReturnsNullRule.cs: New rule (Nidhi Rawal, GSoC 2007) * Gendarme.Rules.BadPractice.mdp: Project file for MonoDevelop. * Makefile.am: Build file. mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Gendarme.Rules.BadPractice.csproj0000775000175000017500000001505212413742070033601 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {7FF6D373-551E-4C6B-98FA-D1D883FD2502} Library Properties Gendarme.Rules.BadPractice Gendarme.Rules.BadPractice v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.BadPractice.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.BadPractice.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/AvoidNullCheckWithAsOperatorRule.cs0000664000175000017500000001007712413742070034251 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.AvoidNullCheckWithAsOperatorRule // // Authors: // Sebastien Pouliot // // 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.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// The rule will detect if a null check is done before using the as operator. /// This null check is not needed, a null instance will return null, /// and the code will need to deal with as returning a null value anyway. /// /// /// Bad example: /// /// public string AsString (object obj) /// { /// return (o == null) ? null : o as string; /// } /// /// /// /// Good example: /// /// public string AsString (object obj) /// { /// return (o as string); /// } /// /// // as suggested in https://bugzilla.novell.com/show_bug.cgi?id=651305 [Problem ("An unneeded null check is done before using the 'as' operator.")] [Solution ("Remove the extraneous null check")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidNullCheckWithAsOperatorRule : Rule, IMethodRule { OpCodeBitmask mask = new OpCodeBitmask (0x100000, 0x10000000000000, 0x0, 0x0); static bool CheckFalseBranch (Instruction ins) { Instruction next = ins.Next; if (!next.Is (ins.Previous.OpCode.Code)) return false; if (!(ins.Operand as Instruction).Is (Code.Ldnull)) return false; return CheckIsinst (next.Next); } static bool CheckTrueBranch (Instruction ins) { if (!ins.Next.Is (Code.Ldnull)) return false; Instruction br = (ins.Operand as Instruction); if (ins.Previous.OpCode.Code != br.OpCode.Code) return false; return CheckIsinst (br.Next); } static bool CheckIsinst (Instruction ins) { if (!ins.Is (Code.Isinst)) return false; return (ins.Next.OpCode.FlowControl != FlowControl.Cond_Branch); } public RuleResult CheckMethod (MethodDefinition method) { // rule only applies to methods with IL... if (!method.HasBody) return RuleResult.DoesNotApply; // and when the IL contains both a isinst and ldnull if (!mask.IsSubsetOf (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { bool detected = false; switch (ins.OpCode.Code) { case Code.Brfalse_S: case Code.Brfalse: detected = CheckFalseBranch (ins); break; case Code.Brtrue_S: case Code.Brtrue: detected = CheckTrueBranch (ins); break; } if (detected) Runner.Report (method, ins, Severity.Medium, Confidence.Normal); } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Isinst); mask.Set (Code.Ldnull); Console.WriteLine (mask); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/CloneMethodShouldNotReturnNullRule.cs0000664000175000017500000000662212413742070034657 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.CloneMethodShouldNotReturnNullRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule checks for Clone() methods which return null. /// /// /// Bad example: /// /// public class MyClass : ICloneable { /// public object Clone () /// { /// MyClass myClass = new MyClass (); /// // set some internals /// return null; /// } /// } /// /// /// /// Good example: /// /// public class MyClass : ICloneable { /// public object Clone () /// { /// MyClass myClass = new MyClass (); /// // set some internals /// return myClass; /// } /// } /// /// [Problem ("This implementation of ICloneable.Clone() could return null in some circumstances.")] [Solution ("Return an appropriate object instead of returning null.")] public class CloneMethodShouldNotReturnNullRule : ReturnNullRule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference System.ICloneable then // no type inside will be implementing it Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System", "ICloneable"); })); }; } public override RuleResult CheckMethod (MethodDefinition method) { // rule applies only to Clone methods with a body (IL) if (!method.HasBody || !MethodSignatures.Clone.Matches (method)) return RuleResult.DoesNotApply; // where the type implements ICloneable if (!method.DeclaringType.Implements ("System", "ICloneable")) return RuleResult.DoesNotApply; // call base class to detect if the method can return null return base.CheckMethod (method); } protected override void Report (MethodDefinition method, Instruction ins) { Runner.Report (method, ins, Severity.Medium, Confidence.Normal); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/PreferSafeHandleRule.cs0000664000175000017500000002003112413742070031707 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.PreferSafeHandleRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// In general it is best to interop with native code using /// System.Runtime.InteropServices.SafeHandle instead of /// System.IntPtr or System.UIntPtr because: /// /// /// SafeHandles are type safe. /// /// /// SafeHandles are guaranteed to be disposed of during /// exceptional conditions like a thread aborting unexpectedly or a stack /// overflow. /// /// /// SafeHandles are not vulnerable to reycle attacks. /// /// /// You don't need to write a finalizer which can be tricky /// to do because they execute within their own thread, may execute on /// partially constructed objects, and normally tear down the application /// if you allow an exception to escape from them. /// /// /// /// /// Bad example: /// /// using System.Runtime.InteropServices; /// using System.Security; /// using System.Security.Permissions; /// /// // If cleaning up the native resource in a timely manner is important you can /// // implement IDisposable. /// public sealed class Database { /// ~Database () /// { /// // This will execute even if the ctor throws so it is important to check /// // to see if the fields are initialized. /// if (m_database != IntPtr.Zero) { /// NativeMethods.sqlite3_close (m_database); /// } /// } /// /// public Database (string path) /// { /// NativeMethods.OpenFlags flags = NativeMethods.OpenFlags.READWRITE | NativeMethods.OpenFlags.CREATE; /// int err = NativeMethods.sqlite3_open_v2 (path, out m_database, flags, IntPtr.Zero); /// // handle errors /// } /// /// // exec and query methods would go here /// /// [SuppressUnmanagedCodeSecurity] /// private static class NativeMethods { /// [Flags] /// public enum OpenFlags : int { /// READONLY = 0x00000001, /// READWRITE = 0x00000002, /// CREATE = 0x00000004, /// // ... /// } /// /// [DllImport ("sqlite3")] /// public static extern int sqlite3_close (IntPtr db); /// /// [DllImport ("sqlite3")] /// public static extern int sqlite3_open_v2 (string fileName, out IntPtr db, OpenFlags flags, IntPtr module); /// } /// /// private IntPtr m_database; /// } /// /// /// /// Good example: /// /// using System.Runtime.ConstrainedExecution; /// using System.Runtime.InteropServices; /// using System.Security; /// using System.Security.Permissions; /// /// // If cleaning up the native resource in a timely manner is important you can /// // implement IDisposable, but you do not need to implement a finalizer because /// // SafeHandle will take care of the cleanup. /// internal sealed class Database { /// public Database (string path) /// { /// NativeMethods.OpenFlags flags = NativeMethods.OpenFlags.READWRITE | NativeMethods.OpenFlags.CREATE; /// m_database = new SqlitePtr (path, flags); /// } /// /// // exec and query methods would go here /// /// // This corresponds to a native sqlite3*. /// [SecurityPermission (SecurityAction.InheritanceDemand, UnmanagedCode = true)] /// [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)] /// private sealed class SqlitePtr : SafeHandle { /// public SqlitePtr (string path, NativeMethods.OpenFlags flags) : base (IntPtr.Zero, true) /// { /// int err = NativeMethods.sqlite3_open_v2 (path, out handle, flags, IntPtr.Zero); /// // handle errors /// } /// /// public override bool IsInvalid { /// get { /// return (handle == IntPtr.Zero); /// } /// } /// /// // This will not be called if the handle is invalid. Note that this method should not throw. /// [ReliabilityContract (Consistency.WillNotCorruptState, Cer.MayFail)] /// protected override bool ReleaseHandle () /// { /// NativeMethods.sqlite3_close (this); /// return true; /// } /// } /// /// [SuppressUnmanagedCodeSecurity] /// private static class NativeMethods { /// [Flags] /// public enum OpenFlags : int { /// READONLY = 0x00000001, /// READWRITE = 0x00000002, /// CREATE = 0x00000004, /// // ... /// } /// /// [DllImport ("sqlite3")] /// public static extern int sqlite3_close (SqlitePtr db); /// /// // Open must take an IntPtr but all other methods take a type safe SqlitePtr. /// [DllImport ("sqlite3")] /// public static extern int sqlite3_open_v2 (string fileName, out IntPtr db, OpenFlags flags, IntPtr module); /// } /// /// private SqlitePtr m_database; /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("The type uses System.IntPtr or System.UIntPtr instead of System.Runtime.InteropServices.SafeHandle.")] [Solution ("Consider changing the code to use SafeHandle.")] [FxCopCompatibility ("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] public sealed class PreferSafeHandleRule : Rule, ITypeRule { static FieldDefinition FindIntPtr (TypeDefinition type) { foreach (FieldDefinition field in type.Fields) { TypeReference ftype = field.FieldType; if (ftype.Namespace == "System") { string name = ftype.Name; if ((name == "IntPtr") || (name == "UIntPtr")) return field; } } return null; } public override void Initialize (IRunner runner) { base.Initialize (runner); // SafeHandle was introduced in .NET 2.0 so disable the rule if the // assembly is targeting something earlier. Runner.AnalyzeModule += (object o, RunnerEventArgs e) => { Active = e.CurrentModule.Runtime >= TargetRuntime.Net_2_0; }; } public RuleResult CheckType (TypeDefinition type) { if (!type.HasFields || type.IsEnum) return RuleResult.DoesNotApply; Log.WriteLine (this); Log.WriteLine (this, "----------------------------------"); Log.WriteLine (this, type); FieldDefinition field = FindIntPtr (type); if (field != null) { Confidence confidence = Confidence.Low; MethodDefinition finalizer = type.GetMethod (MethodSignatures.Finalize); if (finalizer != null) confidence = (Confidence) ((int) confidence - 1); // lower numbers have higher confidence if (type.Implements ("System", "IDisposable")) confidence = (Confidence) ((int) confidence - 1); Log.WriteLine (this, "'{0}' is an IntPtr.", field.Name); Runner.Report (field, Severity.Medium, confidence); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/AvoidCallingProblematicMethodsRule.cs0000664000175000017500000001517512413742070034630 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.AvoidCallingProblematicMethodsRule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Collections.Generic; using System.Reflection; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule warns about methods that calls into potentially dangerous API of the .NET /// framework. If possible try to avoid the API (there are generally safer ways to do the /// same) or at least make sure your code can be safely called from others. /// /// /// System.GC::Collect() /// /// /// System.Threading.Thread::Suspend() and Resume() /// /// /// System.Runtime.InteropServices.SafeHandle::DangerousGetHandle() /// /// /// System.Reflection.Assembly::LoadFrom(), LoadFile() and /// LoadWithPartialName() /// /// /// System.Type::InvokeMember() when used with /// BindingFlags.NonPublic /// /// /// /// /// Bad example: /// /// public void Load (string filename) /// { /// Assembly a = Assembly.LoadFile (filename); /// // ... /// } /// /// /// /// Good example: /// /// public void Load (string filename) /// { /// AssemblyName aname = AssemblyName.GetAssemblyName (filename); /// // ensure it's the assembly you expect (e.g. public key, version...) /// Assembly a = Assembly.Load (aname); /// // ... /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("There are potentially dangerous calls into your code.")] [Solution ("You should remove or replace the call to the dangerous method.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods")] public class AvoidCallingProblematicMethodsRule : Rule, IMethodRule { SortedDictionary> problematicMethods = new SortedDictionary> (); public AvoidCallingProblematicMethodsRule () { problematicMethods.Add ("Collect", (m, i) => m.DeclaringType.IsNamed ("System", "GC") ? Severity.Critical : (Severity?) null); problematicMethods.Add ("Suspend", (m, i) => m.DeclaringType.IsNamed ("System.Threading", "Thread") ? Severity.Medium : (Severity?) null); problematicMethods.Add ("Resume", (m, i) => m.DeclaringType.IsNamed ("System.Threading", "Thread") ? Severity.Medium : (Severity?) null); problematicMethods.Add ("DangerousGetHandle", (m, i) => m.DeclaringType.IsNamed ("System.Runtime.InteropServices", "SafeHandle") ? Severity.Critical : (Severity?) null); problematicMethods.Add ("LoadFrom", (m, i) => m.DeclaringType.IsNamed ("System.Reflection", "Assembly") ? Severity.High : (Severity?) null); problematicMethods.Add ("LoadFile", (m, i) => m.DeclaringType.IsNamed ("System.Reflection", "Assembly") ? Severity.High : (Severity?) null); problematicMethods.Add ("LoadWithPartialName", (m, i) => m.DeclaringType.IsNamed ("System.Reflection", "Assembly") ? Severity.High : (Severity?) null); problematicMethods.Add ("InvokeMember", (m, i) => !m.DeclaringType.IsNamed ("System", "Type") ? (Severity?) null : IsAccessingWithNonPublicModifiers (i) ? Severity.Critical : (Severity?) null); } private static bool OperandIsNonPublic (BindingFlags operand) { return (operand & BindingFlags.NonPublic) == BindingFlags.NonPublic; } private static bool IsAccessingWithNonPublicModifiers (Instruction call) { Instruction current = call; while (current != null) { if (current.OpCode == OpCodes.Ldc_I4_S) return OperandIsNonPublic ((BindingFlags) (sbyte) current.Operand); //Some compilers can use the ldc.i4 //instruction instead if (current.OpCode == OpCodes.Ldc_I4) return OperandIsNonPublic ((BindingFlags) current.Operand); current = current.Previous; } return false; } private Severity? IsProblematicCall (Instruction call) { MethodReference method = call.GetMethod (); if (method != null) { Func sev; if (problematicMethods.TryGetValue (method.Name, out sev)) return sev (method, call); } return null; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if there's no IL code if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.FlowControl != FlowControl.Call) continue; Severity? severity = IsProblematicCall (instruction); if (severity.HasValue) { string msg = String.Format (CultureInfo.InvariantCulture, "You are calling to {0}, which is a potentially problematic method", instruction.Operand); Runner.Report (method, instruction, severity.Value, Confidence.High, msg); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/UseFileOpenOnlyWithFileAccessRule.cs0000664000175000017500000001162112413742070034354 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.UseFileOpenOnlyWithFileAccessRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; namespace Gendarme.Rules.BadPractice { /// /// This rule checks that when file open method is called with FileMode parameter /// it is also called with FileAccess (or FileSystemRights) parameter. It is needed /// because default behaviour of file open methods when they are called only with /// FileMode is to require read-write access while it is commonly expected that they /// will require only read access. /// /// /// Bad example: /// /// public void OpenFile () /// { /// FileStream f = File.Open ("Filename.ext", FileMode.Open); /// } /// /// /// /// Good example: /// /// public void OpenFile () /// { /// FileStream f = File.Open ("Filename.ext", FileMode.Open, FileAccess.Read); /// } /// /// [Problem ("File open methods should be called with FileAccess parameter if they are called with FileMode parameter")] [Solution ("Add FileAccess parameter to your call")] [EngineDependency (typeof (OpCodeEngine))] public class UseFileOpenOnlyWithFileAccessRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference System.IO.FileMode // then no code inside the module will be using it Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.IO", "FileMode"); })); }; } // System.IO.File::Open // System.IO.FileInfo::Open // System.IO.FileStream::.ctor // System.IO.IsolatedStorage.IsolatedStorageFileStream::.ctor static bool IsCandidate (MemberReference method) { TypeReference type = method.DeclaringType; string tname = type.Name; string mname = method.Name; switch (type.Namespace) { case "System.IO": switch (tname) { case "File": case "FileInfo": return (mname == "Open"); case "FileStream": return (mname == ".ctor"); default: return false; } case "System.IO.IsolatedStorage": return ((tname == "IsolatedStorageFileStream") && (mname == ".ctor")); default: return false; } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { MethodReference m = instruction.GetMethod (); if (m == null || !m.HasParameters || !IsCandidate (m)) continue; bool foundFileMode = false; bool foundFileAccess = false; foreach (ParameterDefinition parameter in m.Parameters) { TypeReference ptype = parameter.ParameterType; if (!foundFileMode && ptype.IsNamed ("System.IO", "FileMode")) foundFileMode = true; if (!foundFileAccess && (ptype.IsNamed ("System.IO", "FileAccess") || ptype.IsNamed ("System.Security.AccessControl", "FileSystemRights"))) foundFileAccess = true; } if (foundFileMode && !foundFileAccess) { string msg = String.Format (CultureInfo.InvariantCulture, "{0}::{1} being called with FileMode parameter but without FileAccess.", m.DeclaringType.GetFullName (), m.Name); Runner.Report (method, instruction, Severity.Medium, Confidence.Normal, msg); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/ToStringReturnsNullRule.cs0000664000175000017500000000570612413742070032554 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.ToStringShouldNotReturnNullRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule checks for overridden ToString() methods which return null. /// An appropriately descriptive string, or string.Empty, should be returned /// instead in order to make the value more useful (especially in debugging). /// /// /// Bad example: /// /// public override string ToString () /// { /// return (count == 0) ? null : count.ToString (); /// } /// /// /// /// Good example: /// /// public override string ToString () /// { /// return count.ToString (); /// } /// /// /// Before Gendarme 2.4 this rule was named ToStringReturnsNull. [Problem ("This type contains a ToString() method that could return null.")] [Solution ("Return an appropriately descriptive string or an empty string instead of returning null.")] public class ToStringShouldNotReturnNullRule: ReturnNullRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rules applies to types that overrides System.Object.Equals(object) MethodDefinition method = type.GetMethod (MethodSignatures.ToString); if ((method == null) || !method.HasBody) return RuleResult.DoesNotApply; // call base class to detect if the method can return null return CheckMethod (method); } protected override void Report (MethodDefinition method, Instruction ins) { Runner.Report (method, ins, Severity.High, Confidence.Normal); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/ObsoleteMessagesShouldNotBeEmptyRule.cs0000664000175000017500000001164112413742070035152 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.ObsoleteMessagesShouldNotBeEmptyRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections; using System.Collections.Generic; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule warns if any type (including classes, structs, enums, interfaces and /// delegates), field, property, events, method and constructor are decorated with /// an empty [Obsolete] attribute because the attribute is much more helpful /// if it includes advice on how to deal with the situation (e.g. the new recommended /// API to use). /// /// /// Bad example: /// /// [Obsolete] /// public byte[] Key { /// get { /// return (byte[]) key.Clone (); /// } /// } /// /// /// /// Good example: /// /// [Obsolete ("Use the new GetKey() method since properties should not return arrays.")] /// public byte[] Key { /// get { /// return (byte[]) key.Clone (); /// } /// } /// /// [Problem ("The [Obsolete] attribute was used but no help, alternative or description was provided.")] [Solution ("Provide advice to help developers abandon old features and migrate to newer ones.")] [FxCopCompatibility ("Microsoft.Design", "CA1041:ProvideObsoleteAttributeMessage")] public class ObsoleteMessagesShouldNotBeEmptyRule : Rule, ITypeRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not have a reference to System.ObsoleteAttribute // then nothing will be marked as obsolete inside it Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System", "ObsoleteAttribute"); })); }; } private void CheckAttributes (ICustomAttributeProvider cap) { if (!cap.HasCustomAttributes) return; foreach (CustomAttribute ca in cap.CustomAttributes) { // ObsoleteAttribute has a three (3) ctors, including a default (parameter-less) ctor // http://msdn.microsoft.com/en-us/library/68k270ch.aspx if (!ca.AttributeType.IsNamed ("System", "ObsoleteAttribute")) continue; // note: we don't have to check fields since they cannot be used // (as the Message property isn't read/write it cannot be a named argument) // no parameter == empty description // note: Message is the first parameter in both ctors (with params) if (!ca.HasConstructorArguments || String.IsNullOrEmpty ((string) ca.ConstructorArguments [0].Value)) Runner.Report ((IMetadataTokenProvider) cap, Severity.Medium, Confidence.High); } // no System.ObsoleteAttribute found inside the collection } public RuleResult CheckType (TypeDefinition type) { // handles AttributeTargets.[Class | Struct | Enum | Interface | Delegate] CheckAttributes (type); // handles AttributeTargets.Property // properties can be obsoleted - but this is different // than the getter/setter that CheckMethod will report if (type.HasProperties) { foreach (PropertyDefinition property in type.Properties) { CheckAttributes (property); } } // handle AttributeTargets.Event if (type.HasEvents) { foreach (EventDefinition evnt in type.Events) { CheckAttributes (evnt); } } // handle AttributeTargets.Field if (type.HasFields) { foreach (FieldDefinition field in type.Fields) { CheckAttributes (field); } } // handles AttributeTargets.Method if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) { CheckAttributes (method); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Makefile.in0000664000175000017500000007042012642235731027453 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.BadPractice ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AvoidAssemblyVersionMismatchRule.cs \ AvoidCallingProblematicMethodsRule.cs \ AvoidNullCheckWithAsOperatorRule.cs \ AvoidVisibleConstantFieldRule.cs \ CheckNewExceptionWithoutThrowingRule.cs \ CheckNewThreadWithoutStartRule.cs \ CloneMethodShouldNotReturnNullRule.cs \ ConstructorShouldNotCallVirtualMethodsRule.cs \ DisableDebuggingCodeRule.cs \ DoNotDecreaseVisibilityRule.cs \ DoNotForgetNotImplementedMethodsRule.cs \ DoNotUseEnumIsAssignableFromRule.cs \ DoNotUseGetInterfaceToCheckAssignabilityRule.cs \ EqualShouldHandleNullArgRule.cs \ GetEntryAssemblyMayReturnNullRule.cs \ ObsoleteMessagesShouldNotBeEmptyRule.cs \ OnlyUseDisposeForIDisposableTypesRule.cs \ PreferEmptyInstanceOverNullRule.cs \ PreferParamsArrayForVariableArgumentsRule.cs \ PreferTryParseRule.cs \ PreferSafeHandleRule.cs \ ReplaceIncompleteOddnessCheckRule.cs \ ReturnNullRule.cs \ ToStringReturnsNullRule.cs \ UseFileOpenOnlyWithFileAccessRule.cs tests_sources = \ AvoidAssemblyVersionMismatchTest.cs \ AvoidCallingProblematicMethodsTest.cs \ AvoidNullCheckWithAsOperatorTest.cs \ AvoidVisibleConstantFieldTest.cs \ CheckNewExceptionWithoutThrowingTest.cs \ CheckNewThreadWithoutStartTest.cs \ CloneMethodShouldNotReturnNullTest.cs \ ConstructorShouldNotCallVirtualMethodsTest.cs \ DoNotDecreaseVisibilityTest.cs \ DoNotForgetNotImplementedMethodsTest.cs \ DoNotUseEnumIsAssignableFromTest.cs \ DoNotUseGetInterfaceToCheckAssignabilityTest.cs \ DisableDebuggingCodeTest.cs \ EqualShouldHandleNullArgTest.cs \ GetEntryAssemblyMayReturnNullTest.cs \ ObsoleteMessagesShouldNotBeEmptyTest.cs \ OnlyUseDisposeForIDisposableTypesTest.cs \ PreferEmptyInstanceOverNullTest.cs \ PreferParamsArrayForVariableArgumentsTest.cs \ PreferTryParseTest.cs \ PreferSafeHandleTest.cs \ ReplaceIncompleteOddnessCheckTest.cs \ ToStringReturnsNullTest.cs \ UseFileOpenOnlyWithFileAccessTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.BadPractice/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.BadPractice/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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: ConstructorShouldNotCallVirtualMethodsRule.cs0000664000175000017500000001532512413742070036360 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice// // Gendarme.Rules.BadPractice.ConstructorShouldNotCallVirtualMethodsRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.Collections.Generic; using System.Globalization; using System.Linq; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule warns the developer if any virtual methods are called in the constructor /// of a non-sealed type. The problem is that if a derived class overrides the method /// then that method will be called before the derived constructor has had a chance /// to run. This makes the code quite fragile. /// /// /// Bad example: /// /// class A { /// public A () /// { /// this.DoSomething (); /// } /// /// protected virtual void DoSomething () /// { /// } /// } /// /// class B : A { /// private int x; /// /// public B () /// { /// x = 10; /// } /// /// protected override void DoSomething () /// { /// Console.WriteLine (x); /// } /// } /// /// B b = new B (); // outputs 0 because B's constructor hasn't been called yet /// /// /// /// Good example: /// /// class A { /// public void Run () /// { /// this.DoSomething (); /// } /// /// protected virtual void DoSomething () /// { /// } /// } /// /// class B : A { /// private int x; /// /// public B () /// { /// x = 10; /// } /// /// protected override void DoSomething () /// { /// Console.WriteLine (x); /// } /// } /// /// B b = new B (); /// b.Run (); // outputs 10 as intended /// /// /// This rule is available since Gendarme 2.0 [Problem ("A constructor calls an unsealed virtual method.")] [Solution ("Avoid calling virtual methods from constructors or seal the the type/method.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public class ConstructorShouldNotCallVirtualMethodsRule : Rule, ITypeRule { private Stack stack = new Stack (); public RuleResult CheckType (TypeDefinition type) { // sealed classes are ok if (type.IsSealed) return RuleResult.DoesNotApply; // check each constructor foreach (MethodDefinition constructor in type.Methods) { // early checks to avoid stack creation if (!constructor.IsConstructor || constructor.IsStatic || !constructor.HasBody) continue; CheckConstructor (constructor); } return Runner.CurrentRuleResult; } private void CheckConstructor (MethodDefinition constructor) { stack.Clear (); CheckMethod (constructor); } private static bool IsSubsclass (TypeReference sub, TypeReference type) { while (type != null) { if (sub == type) return true; TypeDefinition td = (type as TypeDefinition); type = (td == null) ? null : td.BaseType; } return false; } private static bool IsCallFromInstance (Instruction ins, int parameters) { while ((ins != null) && (parameters >= 0)) { if ((ins.OpCode.Code == Code.Ldarg_0) && (parameters == 0)) return true; // this switch (ins.OpCode.StackBehaviourPush) { case StackBehaviour.Push0: case StackBehaviour.Push1: case StackBehaviour.Push1_push1: case StackBehaviour.Pushi: case StackBehaviour.Pushi8: case StackBehaviour.Pushr4: case StackBehaviour.Pushr8: case StackBehaviour.Pushref: parameters--; break; case StackBehaviour.Varpush: // call[i|virt] MethodReference mr = (ins.Operand as MethodReference); if (mr != null) { if (mr.HasThis) parameters++; parameters += mr.Parameters.Count; if (!mr.ReturnType.IsNamed ("System", "Void")) parameters--; } break; } ins = ins.Previous; } return false; } private void CheckMethod (MethodDefinition method) { if (!method.HasBody) return; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return; string method_name = method.GetFullName (); // check to avoid constructors calling recursive methods if (stack.Contains (method_name)) return; // check constructor for virtual method calls foreach (Instruction current in method.Body.Instructions) { switch (current.OpCode.Code) { case Code.Call: case Code.Callvirt: // we recurse into normal calls since they might be calling virtual methods MethodDefinition md = (current.Operand as MethodDefinition); if (md == null || md.IsConstructor || !md.HasThis) continue; // check that the method is it this class or a subclass if (!IsSubsclass (md.DeclaringType, method.DeclaringType)) continue; // check that we're not calling the method on another object int n = md.HasParameters ? md.Parameters.Count : 0; if (!IsCallFromInstance (current.Previous, n)) continue; if (md.IsVirtual && !md.IsFinal) { string s = stack.Count == 0 ? method_name : stack.Aggregate ((a1, a2) => a1 + ", " + Environment.NewLine + a2); s = String.Format (CultureInfo.InvariantCulture, "Calling a virtual method, '{0}' from {1}.", md, s); Runner.Report (method, current, Severity.High, Confidence.High, s); } else { stack.Push (method_name); CheckMethod (md); stack.Pop (); } break; } } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/PreferTryParseRule.cs0000664000175000017500000001341712413742070031500 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.PreferTryParseRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.BadPractice { /// /// This rule will warn you if a method use a Parse method when an /// alternative TryParse method is available. A Parser method, /// when using correctly, requires you to deal with multiple exceptions (a /// complete list likely not easily available) or catching all exceptions (bad). /// Also the throwing/catching of exceptions can kill performance. /// The TryParse method allow simpler code without the performance penality. /// /// /// Bad example (no validation): /// /// bool ParseLine (string line) /// { /// string values = line.Split (','); /// if (values.Length == 3) { /// id = Int32.Parse (values [0]); /// timestamp = DateTime.Parse (values [1]); /// msg = values [2]; /// return true; /// } else { /// return false; /// } /// } /// /// /// /// Bad example (validation): /// /// bool ParseLine (string line) /// { /// string values = line.Split (','); /// if (values.Length == 3) { /// try { /// id = Int32.Parse (values [0]); /// timestamp = DateTime.Parse (values [1]); /// msg = values [2]; /// return true; /// } /// catch { /// // catching all exception is bad /// return false; /// } /// } else { /// return false; /// } /// } /// /// /// /// Good example: /// /// bool ParseLine (string line) /// { /// string values = line.Split (','); /// if (values.Length == 3) { /// if (!Int32.TryParse (values [0], out id)) /// return false; /// if (!DateTime.TryParse (values [1], out timestamp)) /// return false; /// msg = values [2]; /// return true; /// } else { /// return false; /// } /// } /// /// /// This rule is available since Gendarme 2.8 [Problem ("Using a Parse method force you to catch multiple exceptions.")] [Solution ("Use the existing TryParse alternative method.")] [EngineDependency (typeof (OpCodeEngine))] public class PreferTryParseRule : Rule, IMethodRule { // keep a cache of types with a ::Parse(string s ...) // so we know if an alternative TryParse is available static Dictionary has_try_parse = new Dictionary (); static bool HasTryParseMethod (TypeDefinition type) { bool present = false; if (!has_try_parse.TryGetValue (type, out present)) { foreach (MethodReference method in type.Methods) { if (MethodSignatures.TryParse.Matches (method)) { has_try_parse.Add (type, true); return true; } } } return present; } static bool InsideTryBlock (MethodDefinition method, Instruction ins) { MethodBody body = method.Body; if (!body.HasExceptionHandlers) return false; // no handlers int offset = ins.Offset; foreach (ExceptionHandler eh in body.ExceptionHandlers) { // is the call between a "try/catch" or "try/finally" if ((offset >= eh.TryStart.Offset) && (offset < eh.TryEnd.Offset)) return true; } return false; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // avoid processing methods that do not call any methods if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { Code code = ins.OpCode.Code; if ((code != Code.Call) && (code != Code.Callvirt)) continue; MethodReference mr = (ins.Operand as MethodReference); if (!MethodSignatures.Parse.Matches (mr)) continue; TypeDefinition declaringType = mr.DeclaringType.Resolve(); if (declaringType != null && !HasTryParseMethod(declaringType)) continue; // if inside a try (catch/finally) block then... bool inside_try_block = InsideTryBlock (method, ins); // we lower severity (i.e. other cases are more urgent to fix) Severity severity = inside_try_block ? Severity.Medium : Severity.High; // but since we're do not check all exceptions (and they could differ // between Parse implementations) we also reduce our confidence level Confidence confidence = inside_try_block ? Confidence.Normal : Confidence.High; Runner.Report (method, ins, severity, confidence); } return Runner.CurrentRuleResult; } } } PreferParamsArrayForVariableArgumentsRule.cs0000664000175000017500000001005712413742070036072 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice// // Gendarme.Rules.BadPractice.PreferParamsArrayForVariableArgumentsRule // // Authors: // Sebastien Pouliot // // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// The rule warns for any method that use the (semi-documented) vararg /// calling convention (e.g. __arglist in C#) and that is not used for /// interoperability (i.e. pinvoke to unmanaged code). /// Using params (C#) can to achieve the same objective while vararg /// is not CLS compliant. The later will limit the usability of the method to CLS /// compliant language (e.g. Visual Basic does not support vararg. /// /// /// Bad example: /// /// public void ShowItems_Bad (string header, __arglist) /// { /// Console.WriteLine (header); /// ArgIterator args = new ArgIterator (__arglist); /// for (int i = 0; i < args.GetRemainingCount (); i++) { /// Console.WriteLine (__refvalue (args.GetNextArg (), string)); /// } /// } /// /// /// /// Good example: /// /// public void ShowItems (string header, params string [] items) /// { /// Console.WriteLine (header); /// for (int i = 0; i < items.Length; i++) { /// Console.WriteLine (items [i]); /// } /// } /// /// /// /// Good example (interoperability): /// /// [DllImport ("libc.dll")] /// static extern int printf (string format, __arglist); /// /// /// This rule is available since Gendarme 2.8 [Problem ("The varags (__arglist in C#) calling convention should only be used for unmanaged interoperability purpose.")] [Solution ("Use params (C#) to support a variable number of parameters for managed code.")] [FxCopCompatibility ("Microsoft.Usage", "CA2230:UseParamsForVariableArguments")] public class PreferParamsArrayForVariableArgumentsRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += (object o, RunnerEventArgs e) => { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System", "ArgIterator"); })); }; } public RuleResult CheckMethod (MethodDefinition method) { // methods using vararg are easily identifiable if ((method.CallingConvention & MethodCallingConvention.VarArg) == 0) return RuleResult.Success; // __arglist is accepted for interoperability purpose if (method.IsPInvokeImpl) return RuleResult.Success; // all other case should be changed to use "params" // this is more severe for visible methods since vararg is not CLS compliant Severity severity = method.IsVisible () ? Severity.Critical : Severity.High; Runner.Report (method, severity, Confidence.High); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/AvoidVisibleConstantFieldRule.cs0000664000175000017500000000741212413742070033617 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.AvoidVisibleConstantFieldRule // // Authors: // Sebastien Pouliot // // 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.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule looks for constant fields which are visible outside the current assembly. /// Such fields, if used outside the assemblies, will have their value (not the field /// reference) copied into the other assembly. Changing the field's value requires that all /// assemblies which use the field to be recompiled. Declaring the field /// as static readonly, on the other hand, allows the value to be changed /// without requiring that client assemblies be recompiled. /// /// /// Bad example: /// /// // if this fields is used inside another assembly then /// // the integer 42, not the field, will be baked into it /// public const int MagicNumber = 42; /// /// /// /// Good example: /// /// // if this field is used inside another assembly then /// // that assembly will reference the field instead of /// // embedding the value /// static public readonly int MagicNumber = 42; /// /// /// This rule is available since Gendarme 2.0 [Problem ("This type contains visible constant fields so the value instead of the field will be embedded into assemblies which use it.")] [Solution ("Use a 'static readonly' field (C# syntax) so that the field's value can be changed without forcing client assemblies to be recompiled.")] public class AvoidVisibleConstantFieldRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // if the type is not visible or has no fields then the rule does not apply if (!type.HasFields || type.IsEnum || !type.IsVisible ()) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { // look for 'const' fields if (!field.IsLiteral) continue; // that are visible outside the current assembly if (!field.IsVisible ()) continue; // we let null constant for all reference types (since they can't be changed to anything else) // except for strings (which can be modified later) TypeReference ftype = field.FieldType; if (!ftype.IsValueType && !ftype.IsNamed ("System", "String")) continue; string msg = string.Format (CultureInfo.InvariantCulture, "'{0}' of type {1}.", field.Name, ftype.GetFullName ()); Runner.Report (field, Severity.High, Confidence.High, msg); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/DoNotUseEnumIsAssignableFromRule.cs0000664000175000017500000001002012413742070034204 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.DoNotUseEnumIsAssignableFromRule // // Authors: // Jb Evain // // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule checks for calls to typeof (Enum).IsAssignableFrom (type) that /// can be simplified to type.IsEnum. /// /// /// Bad example: /// /// if (typeof (Enum).IsAssignableFrom (type)) { /// // then the type is an enum /// } /// /// /// /// Good example: /// /// if (type.IsEnum) { /// // then the type is an enum. /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("This method uses typeof (Enum).IsAssignableFrom to check if a type is an enum.")] [Solution ("Use the Type.IsEnum property instead.")] [EngineDependency (typeof (OpCodeEngine))] public class DoNotUseEnumIsAssignableFromRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if there's no IL code if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { if (!IsCallToTypeIsAssignableFrom (instruction)) continue; // get the previous expression's last instruction var previous = instruction.TraceBack (method); if (!IsCallToTypeGetTypeFromHandle (previous)) continue; if (!IsLoadEnumToken (previous.Previous)) continue; Runner.Report (method, instruction, Severity.Medium, Confidence.Normal); } return Runner.CurrentRuleResult; } static bool IsLoadEnumToken (Instruction instruction) { if (instruction.OpCode.Code != Code.Ldtoken) return false; var type = instruction.Operand as TypeReference; if (type == null) return false; return type.IsNamed ("System", "Enum"); } static bool IsCallToTypeIsAssignableFrom (Instruction instruction) { return IsCallToTypeMethod (instruction, "IsAssignableFrom"); } static bool IsCallToTypeGetTypeFromHandle (Instruction instruction) { return IsCallToTypeMethod (instruction, "GetTypeFromHandle"); } static bool IsCallToTypeMethod (Instruction instruction, string name) { if (!IsCall (instruction.OpCode)) return false; var operand = instruction.Operand as MethodReference; if (operand == null) return false; if (operand.Name != name) return false; return operand.DeclaringType.IsNamed ("System", "Type"); } static bool IsCall (OpCode opcode) { return opcode.Code == Code.Call || opcode.Code == Code.Callvirt; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/CheckNewExceptionWithoutThrowingRule.cs0000664000175000017500000001073312413742070035235 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.CheckNewExceptionWithoutThrowingRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.BadPractice { /// /// This rule checks for exception objects which are created but not thrown, not returned, /// and not passed to another method as an argument. /// /// /// Bad example: /// /// void MissingThrow (object arg) /// { /// if (arg == null) { /// new ArgumentNullException ("arg"); /// } /// DoWork (arg); /// } /// /// /// /// Good examples: /// /// void Throw (object arg) /// { /// if (arg == null) { /// throw new ArgumentNullException ("arg"); /// } /// DoWork (arg); /// } /// /// Exception CreateException () /// { /// return new Exception (); /// } /// /// [Problem ("This method creates an exception that is never throwed nor returned to the caller.")] [Solution ("Make sure the exception is required, throw it (if it is) or remove it (if not).")] [EngineDependency (typeof (OpCodeEngine))] public class CheckNewExceptionWithoutThrowingRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Newobj instructions in this method if (!OpCodeEngine.GetBitmask (method).Get (Code.Newobj)) return RuleResult.DoesNotApply; StackEntryAnalysis sea = null; foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.Code != Code.Newobj) continue; MethodReference constructor = (MethodReference) ins.Operand; if (!constructor.DeclaringType.Inherits ("System", "Exception")) continue; // quick check to save resources if (ins.Next != null && ins.Next.OpCode.Code == Code.Throw) continue; if (sea == null) sea = new StackEntryAnalysis (method); StackEntryUsageResult [] usageResults = sea.GetStackEntryUsage (ins); bool exceptionUsed = false; foreach (var usage in usageResults) { switch (usage.Instruction.OpCode.Code) { case Code.Throw: //throw case Code.Ret: //return case Code.Stind_I: //out / ref case Code.Stind_I1: case Code.Stind_I2: case Code.Stind_I4: case Code.Stind_I8: case Code.Stind_R4: case Code.Stind_R8: case Code.Stind_Ref: //case Code.Stfld: exceptionUsed = true; break; case Code.Call: //call (to the exception or as an argument) case Code.Calli: case Code.Callvirt: case Code.Newobj: case Code.Initobj: IMethodSignature calledMethod = (IMethodSignature) usage.Instruction.Operand; int pcount = calledMethod.HasParameters ? calledMethod.Parameters.Count : 0; if (pcount <= usage.StackOffset) break; //not used as a parameter exceptionUsed = true; break; } if (exceptionUsed) break; } if (!exceptionUsed) { // Critical because code cannot work as intented Runner.Report (method, ins, Severity.Critical, Confidence.High); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/GetEntryAssemblyMayReturnNullRule.cs0000664000175000017500000001037112413742070034522 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.GetEntryAssemblyMayReturnNullRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule warns when an assembly without an entry point (i.e. a dll or library) calls /// Assembly.GetEntryAssembly (). This call is problematic since it will always /// return null when called from outside the root (main) application domain. This may /// become a problem inside libraries that can be used, for example, inside ASP.NET /// applications. /// /// /// Bad example: /// /// // this will throw a NullReferenceException from an ASP.NET page /// Response.WriteLine (Assembly.GetEntryAssembly ().CodeBase); /// /// /// /// Good example: /// /// public class MainClass { /// static void Main () /// { /// Console.WriteLine (Assembly.GetEntryAssembly ().CodeBase); /// } /// } /// /// [Problem ("This method calls Assembly.GetEntryAssembly which may return null if not called from the root application domain.")] [Solution ("Avoid depending on Assembly.GetEntryAssembly inside reusable code.")] [EngineDependency (typeof (OpCodeEngine))] public class GetEntryAssemblyMayReturnNullRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active &= // GetEntryAssembly will work inside executables e.CurrentAssembly.EntryPoint == null && // if the module does not reference System.Reflection.Assembly.GetEntryAssembly // then there's no point in enabling the rule (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyMemberReference ((MemberReference mr) => { return IsGetEntryAssembly (mr); })); }; } static bool IsGetEntryAssembly (MemberReference method) { return method.IsNamed ("System.Reflection", "Assembly", "GetEntryAssembly"); } public RuleResult CheckMethod (MethodDefinition method) { // rule doesn't not apply to methods without code (e.g. p/invokes) if (!method.HasBody) return RuleResult.DoesNotApply; // not for executables if (method.DeclaringType.Module.Assembly.EntryPoint != null) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // go! foreach (Instruction current in method.Body.Instructions) { switch (current.OpCode.Code) { case Code.Call: case Code.Callvirt: if (IsGetEntryAssembly (current.Operand as MethodReference)) Runner.Report (method, current, Severity.Medium, Confidence.Total); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/EqualShouldHandleNullArgRule.cs0000664000175000017500000001056112413742070033407 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.EqualsShouldHandleNullArgRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule ensures that Equals(object) methods return false when the /// object parameter is null. /// /// /// Bad example: /// /// public bool Equals (object obj) /// { /// // this would throw a NullReferenceException instead of returning false /// return ToString ().Equals (obj.ToString ()); /// } /// /// /// /// Good example: /// /// public override bool Equals (object obj) /// { /// if (obj == null) { /// return false; /// } /// return ToString ().Equals (obj.ToString ()); /// } /// /// [Problem ("This Equals method does not handle null arguments as it should.")] [Solution ("Modify the method implementation to return false if a null argument is found.")] public class EqualsShouldHandleNullArgRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rules applies to types that overrides System.Object.Equals(object) MethodDefinition method = type.GetMethod (MethodSignatures.Equals); if ((method == null) || !method.HasBody || method.IsStatic) return RuleResult.DoesNotApply; // rule applies // scan IL to see if null is checked and false returned if (CheckSequence (method.Body.Instructions [0], type)) return RuleResult.Success; Runner.Report (method, Severity.Medium, Confidence.High); return RuleResult.Failure; } private static bool CheckSequence (Instruction ins, TypeDefinition type) { bool previous_ldarg1 = false; while (ins != null) { switch (ins.OpCode.Code) { case Code.Ldarg_1: previous_ldarg1 = true; ins = ins.Next; continue; case Code.Brfalse: case Code.Brfalse_S: if (previous_ldarg1) return CheckSequence (ins.Operand as Instruction, type); break; case Code.Ceq: if ((previous_ldarg1) && (ins.Next.OpCode.Code == Code.Ret)) return true; break; case Code.Bne_Un: case Code.Bne_Un_S: if (CheckSequence (ins.Operand as Instruction, type)) return true; break; case Code.Isinst: if (!previous_ldarg1) break; if ((ins.Operand as TypeReference) != type) break; switch (ins.Next.OpCode.Code) { case Code.Brfalse: case Code.Brfalse_S: return CheckSequence (ins.Next.Operand as Instruction, type); } ins = ins.Next; continue; case Code.Ret: // we're not sure of what the other call will return // but since it's probably a base class then the same rule apples there if (ins.Previous.OpCode.FlowControl == FlowControl.Call) return true; return (ins.Previous.OpCode.Code != Code.Ldc_I4_1); case Code.Throw: // don't report when an exception is thrown return true; default: ins = ins.Next; continue; } previous_ldarg1 = false; ins = ins.Next; } return false; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/OnlyUseDisposeForIDisposableTypesRule.cs0000664000175000017500000000741712413742070035326 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.OnlyUseDisposeForIDisposableTypesRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// To avoid confusing developers methods named Dispose should be /// reserved for types that implement IDisposable. /// /// /// Bad example: /// /// internal sealed class Worker /// { /// // This class uses one or more temporary files to do its work. /// private List<string> files = new List<string> (); /// /// // This is confusing: developers will think they can do things /// // like use the instance with a using statement. /// public void Dispose () /// { /// foreach (string path in files) { /// File.Delete (path); /// } /// /// files.Clear (); /// } /// } /// /// /// /// Good example: /// /// internal sealed class Worker /// { /// // This class uses one or more temporary files to do its work. /// private List<string> files = new List<string> (); /// /// public void Reset () /// { /// foreach (string path in files) { /// File.Delete (path); /// } /// /// files.Clear (); /// } /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("A type has a method named Dispose, but does not implement IDisposable.")] [Solution ("Rename the method or implement IDisposable.")] public sealed class OnlyUseDisposeForIDisposableTypesRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (!type.HasMethods || type.IsEnum || type.IsDelegate ()) return RuleResult.DoesNotApply; Log.WriteLine (this); Log.WriteLine (this, "----------------------------------"); Log.WriteLine (this, type); if (!type.Implements ("System", "IDisposable")) { Log.WriteLine (this, "type does not implement IDisposable"); foreach (MethodDefinition method in type.Methods.Where (m => m.Name == "Dispose")) { Log.WriteLine (this, "found {0}", method); Severity severity; if (method.IsVisible ()) severity = Severity.High; else if (!method.IsPrivate) severity = Severity.Medium; else severity = Severity.Low; // Confidence is not total because we may not be able to resolve // every base class. Runner.Report (method, severity, Confidence.High); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/DoNotDecreaseVisibilityRule.cs0000664000175000017500000000745012413742070033312 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.DoNotDecreaseVisibilityRule // // Authors: // Sebastien Pouliot // // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// The rule detect when a method visibility is decreased in an inherited type. /// Decreasing visibility does not prevent calling the base class method unless /// the type is sealed. Note that some language (but not C#) will allow /// you to seal, e.g. final, the method without an override. /// /// /// Bad example: /// /// public class Base { /// public void Public () /// { /// } /// } /// /// public class BadInheritor : Base { /// private new void Public () /// { /// } /// } /// /// /// /// Good example (do not hide): /// /// public class Inheritor : Base { /// } /// /// /// /// Good example (sealed type): /// /// public sealed class Inheritor : Base { /// private new void Public () /// { /// } /// } /// /// [Problem ("A private method is hiding a visible method from a base type")] [Solution ("Either seal the inherited type or rename/remove the private method.")] [FxCopCompatibility ("Microsoft.Usage", "CA2222:DoNotDecreaseInheritedMemberVisibility")] public class DoNotDecreaseVisibilityRule : Rule, IMethodRule { static bool IsHiding (MethodDefinition method, TypeReference type) { if (type == null) return false; TypeDefinition td = type.Resolve (); if ((td != null) && td.HasMethods) { string name = method.Name; foreach (MethodDefinition md in td.Methods) { if (!md.IsPublic && !md.IsFamily) continue; if (name != md.Name) continue; if (method.CompareSignature (md)) return true; } } return IsHiding (method, type.DeclaringType); } public RuleResult CheckMethod (MethodDefinition method) { if (!method.IsPrivate || method.IsFinal) return RuleResult.DoesNotApply; TypeDefinition type = method.DeclaringType; if (type.IsSealed) return RuleResult.DoesNotApply; // we got a private, non-final, method in an unsealed type // note: unlike CSC, MCS does not mark .cctor with hidebysig // this also covers a private default ctor inheriting from System.Object if (method.IsConstructor && !method.HasParameters) return RuleResult.Success; // are we're hiding something ? if (method.IsHideBySig && !IsHiding (method, type.BaseType)) return RuleResult.Success; Runner.Report (method, Severity.High, Confidence.Normal); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/DoNotForgetNotImplementedMethodsRule.cs0000664000175000017500000001044412413742070035143 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.DoNotForgetNotImplementedMethodsRule // // Authors: // Cedric Vivier // Sebastien Pouliot // // (C) 2008 Cedric Vivier // 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; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.BadPractice { /// /// This rule checks for short methods that throw a System.NotImplementedException /// exception. It's likely a method that has not yet been implemented and should not be /// forgotten by the developer before a release. /// /// /// Bad example: /// /// private void Save () /// { /// throw new NotImplementedException ("pending final format"); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method looks like it is not implemented or is incomplete.")] [Solution ("Implement the method and/or make sure it's limitations are well documented.")] [EngineDependency (typeof (OpCodeEngine))] // part of CA1065 is implemented here instead of DoNotThrowInUnexpectedLocationRule so we need to be // able to suppress it too, with the same [SuppressMessage], even if this rule has a larger scope [FxCopCompatibility ("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")] public class DoNotForgetNotImplementedMethodsRule : Rule, IMethodRule { // contains NEWOBJ and THROW instructions private static OpCodeBitmask bitmask = new OpCodeBitmask (0x0, 0x84000000000000, 0x0, 0x0); public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if there's no IL code // or if it was generated by the compiler or tools if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // is there a Newobj *and* a Throw instruction in this method if (!bitmask.IsSubsetOf (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; int n = 0; bool cond_branch = false; foreach (Instruction inst in method.Body.Instructions) { // check if the code is linear or with branches if (FlowControl.Cond_Branch == inst.OpCode.FlowControl) cond_branch = true; // if there are branch and it's long enough then assume it is implemented if (cond_branch && (++n > 10)) break; // check for "throw new NotImplementedException (...)" if (inst.OpCode.Code != Code.Newobj) continue; MethodReference ctor = (MethodReference) inst.Operand; if (!ctor.DeclaringType.IsNamed ("System", "NotImplementedException")) continue; if (inst.Next.OpCode.Code != Code.Throw) continue; // the defect is more severe if the method is visible outside it's assembly Severity severity = method.IsPublic ? Severity.High : Severity.Medium; Runner.Report (method, severity, Confidence.Normal); return RuleResult.Failure; } return RuleResult.Success; } #if false public void GenerateBitmask () { OpCodeBitmask bitmask = new OpCodeBitmask (); bitmask.Set (Code.Newobj); bitmask.Set (Code.Throw); Console.WriteLine (bitmask); } #endif } } DoNotUseGetInterfaceToCheckAssignabilityRule.cs0000664000175000017500000001015612413742070036446 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice// // Gendarme.Rules.BadPractice.DoNotUseGetInterfaceToCheckAssignabilityRule // // Authors: // Sebastien Pouliot // // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { // based on an IRC discussion from jb and robertj leading to // http://lists.ximian.com/archives/public/mono-patches/2008-September/128122.html /// /// This rule checks for calls to Type.GetInterface that look like they query if /// a type is supported, i.e. the result is only used to compare against null. /// The problem is that only assembly qualified names uniquely identify a type so if /// you just use the interface name or even just the name and namespace you may /// get unexpected results. /// /// /// Bad example: /// /// if (type.GetInterface ("IConvertible") != null) { /// // then the type can be assigned to IConvertible /// // but what if there is another IConvertible in there ?!? /// } /// /// /// /// Good example: /// /// if (typeof (IConvertible).IsAssignableFrom (type)) { /// // then the type can be assigned to IConvertible /// // without a doubt! /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("This method calls Type.GetInterface(string) to query if an interface is supported by the type, but the result may be incorrect if the type is not qualified with a namespace (and not even that is guaranteed to work).")] [Solution ("Instead use Type.IsAssignableFrom(Type) method to query for types known at compile time.")] [EngineDependency (typeof (OpCodeEngine))] public class DoNotUseGetInterfaceToCheckAssignabilityRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if there's no IL code if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if ((ins.OpCode.Code != Code.Call) && (ins.OpCode.Code != Code.Callvirt)) continue; MethodReference call = (ins.Operand as MethodReference); if (call.Name != "GetInterface") continue; if (!call.DeclaringType.Inherits ("System", "Type")) // not a sealed type continue; // check for a null compare if (ins.Next.OpCode.Code != Code.Ldnull) continue; // there's a problem, but our confidence depends on whether a // *constant* string was used for the first parameter or not Instruction p = ins.TraceBack (method, -1); Confidence c = (p.OpCode.Code == Code.Ldstr) ? Confidence.Normal : Confidence.Low; Runner.Report (method, ins, Severity.Medium, c); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/ReturnNullRule.cs0000664000175000017500000000630412413742070030672 0ustar00directhexdirecthex00000000000000// // Abstract Gendarme.Rules.BadPractice.ReturnsNullRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { // Notes: // * We don't implement IMethodRule on purpose since a rule that inherit // from us can be an ITypeRule (checking for a specific method in the type) [EngineDependency (typeof (OpCodeEngine))] abstract public class ReturnNullRule : Rule { void CheckReturn (Instruction ins, MethodDefinition method) { // trace back what is being returned Instruction previous = ins.TraceBack (method); while (previous != null) { // most of the time we'll find the null value on the first trace back call if (previous.OpCode.Code == Code.Ldnull) { Report (method, ins); break; } // but CSC non-optimized code generation results in strange IL that needs a few // more calls. e.g. "return null" == "nop | ldnull | stloc.0 | br.s | ldloc.0 | ret" if ((previous.OpCode.FlowControl == FlowControl.Branch) || (previous.IsLoadLocal () || previous.IsStoreLocal ())) { previous = previous.TraceBack (method); } else break; } } void CheckLdnull (Instruction ins, MethodDefinition method) { Instruction branch = (ins.Next.Operand as Instruction); if (branch.Is (Code.Ret)) Report (method, ins); } public virtual RuleResult CheckMethod (MethodDefinition method) { // is there any Ldnull instructions in this method if (!OpCodeEngine.GetBitmask (method).Get (Code.Ldnull)) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Ret: // look if a null is returned CheckReturn (ins, method); break; case Code.Ldnull: // look for branching, e.g. immediate if CheckLdnull (ins, method); break; } } return Runner.CurrentRuleResult; } protected abstract void Report (MethodDefinition method, Instruction ins); } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/DisableDebuggingCodeRule.cs0000664000175000017500000001403212413742070032527 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.DisableDebuggingCodeRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule checks for non-console applications which contain calls to Console.WriteLine. /// These are often used as debugging aids but such code should be removed or disabled in /// the released version. If you don't want to remove it altogether you can place it inside a method /// decorated with [Conditional ("DEBUG")], use Debug.WriteLine, use /// Trace.WriteLine, or use the preprocessor. But note that TRACE is often enabled /// in release builds so if you do use that you'll probably want to use a config file to remove /// the default trace listener. /// /// /// Bad example: /// /// private byte[] GenerateKey () /// { /// byte[] key = new byte[16]; /// rng.GetBytes (key); /// Console.WriteLine ("debug key = {0}", BitConverter.ToString (key)); /// return key; /// } /// /// /// /// Good example (removed): /// /// private byte[] GenerateKey () /// { /// byte[] key = new byte[16]; /// rng.GetBytes (key); /// return key; /// } /// /// /// /// Good example (changed): /// /// private byte[] GenerateKey () /// { /// byte[] key = new byte[16]; /// rng.GetBytes (key); /// Debug.WriteLine ("debug key = {0}", BitConverter.ToString (key)); /// return key; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method includes calls to Console.WriteLine inside an assembly not compiled for console application (e.g. /target:exe).")] [Solution ("If this code is used for debugging then either use the Debug or Trace types or disable the code manually (e.g. using the preprocessor).")] [EngineDependency (typeof (OpCodeEngine))] public class DisableDebuggingCodeRule : Rule, IMethodRule { // note: there can be multiple [Conditional] attribute on a method private static bool HasConditionalAttributeForDebugging (IList cac) { foreach (CustomAttribute ca in cac) { // ConditionalAttribute has a single ctor taking a string value // http://msdn.microsoft.com/en-us/library/system.diagnostics.conditionalattribute.conditionalattribute.aspx // any attribute without arguments can be skipped if (!ca.HasConstructorArguments) continue; if (ca.AttributeType.IsNamed ("System.Diagnostics", "ConditionalAttribute")) { switch (ca.ConstructorArguments [0].Value as string) { case "DEBUG": case "TRACE": return true; } } } return false; } public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += (object o, RunnerEventArgs e) => { Active = // using Console.Write* methods is ok if the application is compiled // with /target:exe - but not if it's compiled with /target:winexe or // /target:library e.CurrentModule.Kind != ModuleKind.Console && // if the module does not reference System.Console then no // method inside it will be calling any Console.write* methods (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System", "Console"); })); }; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if there's no IL code if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // it's ok if the code is conditionally compiled for DEBUG or TRACE purposes if (method.HasCustomAttributes) { if (HasConditionalAttributeForDebugging (method.CustomAttributes)) return RuleResult.Success; } foreach (Instruction ins in method.Body.Instructions) { // look for a call... if (ins.OpCode.FlowControl != FlowControl.Call) continue; // ... to System.Console ... MethodReference mr = ins.Operand as MethodReference; if (mr == null) continue; if (!mr.DeclaringType.IsNamed ("System", "Console")) continue; // ... Write* methods if (mr.Name.StartsWith ("Write", StringComparison.Ordinal)) Runner.Report (method, ins, Severity.Low, Confidence.Normal, mr.ToString ()); // Confidence==Normal because we can't be sure if there's some logic to avoid displaying // on the console under normal (non debugging) circumstances } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/ReplaceIncompleteOddnessCheckRule.cs0000664000175000017500000001453312413742070034434 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.ReplaceIncompleteOddnessCheckRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // IM: Check for oddness that won't work for negative numbers (IM_BAD_CHECK_FOR_ODD) /// /// This rule checks for problematic oddness checks. Often this is done by comparing /// a value modulo two (% 2) with one (1). However this will not work if the value is /// negative because negative one will be returned. A better (and faster) approach is /// to check the least significant bit of the integer. /// /// /// Bad example: /// /// public bool IsOdd (int x) /// { /// // (x % 2) won't work for negative numbers (it returns -1) /// return ((x % 2) == 1); /// } /// /// /// /// Good example: /// /// public bool IsOdd (int x) /// { /// return ((x % 2) != 0); /// } /// /// /// /// Good example (faster): /// /// public bool IsOdd (int x) /// { /// return ((x & 1) == 1); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("The method contains code which looks as if it is doing an oddness check, but the code will not work for negative integers.")] [Solution ("Verify the code logic and, if required, replace the defective code with code that works for negative values as well.")] [EngineDependency (typeof (OpCodeEngine))] public class ReplaceIncompleteOddnessCheckRule : Rule, IMethodRule { // Conv_[Ovf_][I|U][1|2|4|8][_Un] - about all except Conv_R[4|8] private static OpCodeBitmask Conversion = new OpCodeBitmask (0x0, 0x800003C000000000, 0xE07F8000001FF, 0x0); // Rem[_Un] private static OpCodeBitmask Remainder = new OpCodeBitmask (0x0, 0x30000000, 0x0, 0x0); // if/when needed this could be refactored (e.g. missing Ldc_I4__#) // and turned into an InstructionRock static bool IsLoadConstant (Instruction ins, int constant) { if (ins == null) return false; switch (ins.OpCode.Code) { case Code.Ldc_I4_1: return (constant == 1); case Code.Ldc_I4_2: return (constant == 2); case Code.Ldc_I4: return ((int) ins.Operand == constant); case Code.Ldc_I4_S: return ((int)(sbyte) ins.Operand == constant); case Code.Ldc_I8: return ((long) ins.Operand == constant); default: // recurse on integer convertion if (Conversion.Get (ins.OpCode.Code)) return IsLoadConstant (ins.Previous, constant); return false; } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!Remainder.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { Severity severity; // look for a remainder operation switch (ins.OpCode.Code) { case Code.Rem: // this won't work when negative numbers are used severity = Severity.High; break; case Code.Rem_Un: // this will work since it can't be a negative number // but it's a coding bad (practice) example severity = Severity.Low; break; default: continue; } // x % 2 if (!IsLoadConstant (ins.Previous, 2)) continue; // compared to 1 if (!IsLoadConstant (ins.Next, 1)) continue; // using equality Instruction cmp = ins.Next.Next; if (Conversion.Get (cmp.OpCode.Code)) cmp = cmp.Next; if (cmp.OpCode.Code != Code.Ceq) continue; Runner.Report (method, ins, severity, Confidence.Normal); } return Runner.CurrentRuleResult; } #if false public void BuildRemainder () { OpCodeBitmask remainder = new OpCodeBitmask (); remainder.Set (Code.Rem); remainder.Set (Code.Rem_Un); Console.WriteLine (remainder); } public void BuildConversion () { OpCodeBitmask convert = new OpCodeBitmask (); convert.Set (Code.Conv_I); convert.Set (Code.Conv_I1); convert.Set (Code.Conv_I2); convert.Set (Code.Conv_I4); convert.Set (Code.Conv_I8); convert.Set (Code.Conv_Ovf_I); convert.Set (Code.Conv_Ovf_I_Un); convert.Set (Code.Conv_Ovf_I1); convert.Set (Code.Conv_Ovf_I1_Un); convert.Set (Code.Conv_Ovf_I2); convert.Set (Code.Conv_Ovf_I2_Un); convert.Set (Code.Conv_Ovf_I4); convert.Set (Code.Conv_Ovf_I4_Un); convert.Set (Code.Conv_Ovf_I8); convert.Set (Code.Conv_Ovf_I8_Un); convert.Set (Code.Conv_Ovf_U); convert.Set (Code.Conv_Ovf_U_Un); convert.Set (Code.Conv_Ovf_U1); convert.Set (Code.Conv_Ovf_U1_Un); convert.Set (Code.Conv_Ovf_U2); convert.Set (Code.Conv_Ovf_U2_Un); convert.Set (Code.Conv_Ovf_U4); convert.Set (Code.Conv_Ovf_U4_Un); convert.Set (Code.Conv_Ovf_U8); convert.Set (Code.Conv_Ovf_U8_Un); convert.Set (Code.Conv_Ovf_U); convert.Set (Code.Conv_Ovf_U1); convert.Set (Code.Conv_Ovf_U2); convert.Set (Code.Conv_Ovf_U4); convert.Set (Code.Conv_Ovf_U8); Console.WriteLine (convert); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/CheckNewThreadWithoutStartRule.cs0000664000175000017500000001222412413742070033777 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.CheckNewThreadWithoutStartRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.BadPractice { /// /// This rule checks for threads which are created but not started, or returned or passed /// to another method as an argument. /// /// /// Bad example: /// /// void UnusedThread () /// { /// Thread thread = new Thread (threadStart); /// thread.Name = "Thread 1"; /// } /// /// /// /// Good examples: /// /// void Start () /// { /// Thread thread = new Thread (threadStart); /// thread.Name = "Thread 1"; /// thread.Start (); /// } /// /// Thread InitializeThread () /// { /// Thread thread = new Thread (threadStart); /// thread.Name = "Thread 1"; /// return thread; /// } /// /// [Problem ("This method creates an thread that is never started nor returned to the caller.")] [Solution ("Make sure the thread is required, start it (if it is) or remove it (if not).")] [EngineDependency (typeof (OpCodeEngine))] public class CheckNewThreadWithoutStartRule : Rule, IMethodRule { private static bool CheckUsage (StackEntryUsageResult [] usageResults) { foreach (var usage in usageResults) { switch (usage.Instruction.OpCode.Code) { case Code.Ret: //return case Code.Stind_I: //out / ref case Code.Stind_I1: case Code.Stind_I2: case Code.Stind_I4: case Code.Stind_I8: case Code.Stind_R4: case Code.Stind_R8: case Code.Stind_Ref: case Code.Newobj: //passed as an argument case Code.Initobj: case Code.Stfld: return true; case Code.Call: //call (to the thread or as an argument) case Code.Callvirt: MethodReference calledMethod = (MethodReference) usage.Instruction.Operand; int pcount = calledMethod.HasParameters ? calledMethod.Parameters.Count : 0; if (pcount <= usage.StackOffset) { //thread.Method (not used as a parameter) if (calledMethod.Name != "Start") break; } return true; } } return false; } public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference (sealed) System.Threading.Thread // then no code inside the module will instanciate it Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Threading", "Thread"); })); }; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Newobj instructions in this method if (!OpCodeEngine.GetBitmask (method).Get (Code.Newobj)) return RuleResult.DoesNotApply; StackEntryAnalysis sea = null; foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.Code != Code.Newobj) continue; MethodReference constructor = (MethodReference) ins.Operand; if (!constructor.DeclaringType.IsNamed ("System.Threading", "Thread")) continue; if (ins.Next != null && (ins.Next.OpCode.Code == Code.Call || ins.Next.OpCode.Code == Code.Callvirt)) { //quick check to safe resources MethodReference calledMethod = (MethodReference) ins.Next.Operand; if (calledMethod.IsNamed ("System.Threading", "Thread", "Start")) continue; } if (sea == null) sea = new StackEntryAnalysis (method); StackEntryUsageResult [] usageResults = sea.GetStackEntryUsage (ins); if (!CheckUsage (usageResults)) { // Critical because code cannot work as intented Runner.Report (method, ins, Severity.Critical, Confidence.High, String.Empty); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/0000775000175000017500000000000012642235741026323 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/ChangeLog0000664000175000017500000001635312413742070030077 0ustar00directhexdirecthex000000000000002010-06-05 Sebastien Pouliot * CloneMethodShouldNotReturnNullTest.cs: * PreferEmptyInstanceOverNullTest.cs: * ToStringReturnsNullTest.cs: Add test cases where an immediate if is used. xMCS use a ldnull+branch while CSC branch then load null 2010-01-23 Sebastien Pouliot * PreferTryParseTest.cs: New. Unit tests for PreferTryParseRule 2010-01-09 Sebastien Pouliot * PreferParamsArrayForVariableArgumentsTest.cs: New. Unit tests for PreferParamsArrayForVariableArgumentsRule 2009-02-17 Jesse Jones * OnlyUseDisposeForIDisposableTypesTest.cs: Added new rule. 2009-01-30 Jb Evain * DoNotUseEnumIsAssignableFromTest.cs: add tests for DoNotUseEnumIsAssignableFromRule. 2009-01-20 Jesse Jones * PreferSafeHandleTest.cs: Added. 2008-11-20 Sebastien Pouliot * CloneMethodShouldNotReturnNullTest.cs: Adjust fixture since the rule now check methods. 2008-11-14 Jesse Jones * DisableDebuggingCodeTest.cs: Tweaked to allow it to work when compiled in release. 2008-11-07 Alan McGovern * Tests.Rules.BadPractice.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-09-21 Sebastien Pouliot * DoNotUseGetInterfaceToCheckAssignabilityTest.cs: New. Unit tests for DoNotUseGetInterfaceToCheckAssignabilityRule. 2008-09-20 Sebastien Pouliot * AvoidAssemblyVersionMismatchTest.cs: New. Unit tests for AvoidAssemblyVersionMismatchRule. 2008-09-19 Sebastien Pouliot * AvoidCallingProblematicMethodsTest.cs: Add more coverage. * CheckNewExceptionWithoutThrowingTest.cs: Add more coverage. * CheckNewThreadWithoutStartTest.cs: Add more coverage. * CloneMethodShouldNotReturnNullTest.cs: Update to the new, shorter, test syntax. Change some Success to DoesNotApply since the rule is now able to skip more cases. Add more coverage. * ConstructorShouldNotCallVirtualMethodsTest.cs: Add more coverage. * DisableDebuggingCodeTest.cs: Update to the new, shorter, test syntax. Add more coverage. * DoNotForgetNotImplementedMethodsTest.cs: Change some Success to DoesNotApply since the rule is now able to skip more cases. Add more coverage. * GetEntryAssemblyMayReturnNullTest.cs: Update to the new, shorter, test syntax. Add more coverage. * ReplaceIncompleteOddnessCheckTest.cs: Change some Success to DoesNotApply since the rule is now able to skip more cases. Add more coverage. * ToStringReturnsNullTest.cs: Update to the new, shorter, test syntax. Change some Success to DoesNotApply since the rule is now able to skip more cases. Add more coverage. 2008-07-13 Sebastien Pouliot * DoNotForgetNotImplementedMethodsTest.cs: Test cases for DoNotForgetNotImplementedMethodsRule [committed for Cedric Vivier] * Test.Rules.BadPractice.mdp: Update MD project file. 2008-07-03 Sebastien Pouliot * AvoidCallingProblematicMethodsTest.cs: Add two more test cases to achieve 100% coverage of the rule. 2008-07-03 Nestor Salceda * AvoidCallingProblematicMethodsTest.cs: New. Unit tests for AvoidCallingProblematicMethodsRule. * Test.Rules.BadPractice.mdp: Update MD project file. 2008-06-30 Sebastien Pouliot * AvoidVisibleConstantFieldRule.cs: New. Unit tests for AvoidVisibleConstantFieldRule * Test.Rules.BadPractice.mdp: Update MD project file. 2008-06-28 Sebastien Pouliot * ReplaceIncompleteOddnessCheckTest.cs: New. Unit tests for ReplaceIncompleteOddnessCheckRule * Test.Rules.BadPractice.mdp: Update MD project file. 2008-05-18 Sebastien Pouliot * ObsoleteMessagesShouldNotBeEmptyTest.cs: New. Unit tests for ObsoleteMessagesShouldNotBeEmptyRule 2008-05-10 Andres G. Aragoneses * CheckNewExceptionWithoutThrowingTest.cs, CloneMethodShouldNotReturnNullTest.cs, ConstructorShouldNotCallVirtualMethodsTest.cs, CheckNewThreadWithoutStartTest.cs, GetEntryAssemblyMayReturnNullTest.cs, Test.Rules.BadPractice.mdp, ToStringReturnsNullTest.cs, DisableDebuggingCodeTest.cs: Update (to fix build): somebody forgot to include the new namespace when moving TestRunner. 2008-05-04 Sebastien Pouliot * EqualShouldHandleNullArgTest.cs: Convert test cases to new format. Add new test cases based on Mono BCL (old) false positives. 2008-04-23 Sebastien Pouliot * DisableDebuggingCodeTest.cs: Adapt to change for Initialize behavior. If a runner desactivate a rule then it should not re-activate itself. 2008-03-07 Sebastien Pouliot * DisableDebuggingCodeTest.cs: New. Unit tests for DisableDebuggingCodeRule. * Test.Rules.BadPractice.mdp: Update MD project file. 2008-02-15 Sebastien Pouliot * CheckNewExceptionWithoutThrowingTest.cs * CheckNewThreadWithoutStartTest.cs * CloneMethodShouldNotReturnNullTest.cs * ConstructorShouldNotCallVirtualMethodsTest.cs * EqualShouldHandleNullArgTest.cs * GetEntryAssemblyMayReturnNullTest.cs * ToStringReturnsNullTest.cs Update unit tests wrt framework changes. 2008-01-30 Sebastien Pouliot * CheckNewExceptionWithoutThrowingTest.cs: New. Unit tests by Andreas Noever. * CheckNewThreadWithoutStartTest.cs: New. Unit tests by Andreas Noever. 2008-01-24 Sebastien Pouliot * EqualShouldHandleNullArgTest.cs: Changed my mind about "new" ;-) * ImplementingEqualsButNotGetHashCodeAndViceVersaTest.cs: Tests move (with rules) into Design since it affects the API. * ToStringReturnsNullTest.cs: Add a bunch of new test cases. 2008-01-23 Sebastien Pouliot * ConstructorShouldNotCallVirtualMethodsTest.cs: Add a bunch of test cases to exclude final, include non-virtual calls leading to virtual calls, instance versus member/field calls... * EqualShouldHandleNullArgTest.cs: Add a bunch of test cases to duplicate common patterns (from class lib) leading to false positives. 2008-01-14 Sebastien Pouliot * ConstructorShouldNotCallVirtualMethodsTest.cs: New. Unit tests by Daniel Abramov. * GetEntryAssemblyMayReturnNullTest.cs: New. Unit tests by Daniel Abramov. * Test.Rules.BadPractice.mdp: Update MonoDevelop project file. 2007-11-23 Sebastien Pouliot * EqualShouldHandleNullArgTest.cs: Add a test case where Equals simply return false. 2007-11-22 Sebastien Pouliot * EqualShouldHandleNullArgTest.cs: Add little variations in the null checks. 2007-10-07 Sebastien Pouliot * CloneMethodShouldNotReturnNullTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * EqualShouldHandleNullArgTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * ImplementingEqualsButNotGetHashCodeAndViceVersaTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * ToStringReturnsNullTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * Test.Rules.BadPractice.mdp: Project file for MonoDevelop * Makefile.am: Build file. mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/AvoidNullCheckWithAsOperatorTest.cs0000664000175000017500000000755512413742070035207 0ustar00directhexdirecthex00000000000000// // Unit Tests for AvoidNullCheckWithAsOperatorRule // // Authors: // Sebastien Pouliot // // 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 Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public class AvoidNullCheckWithAsOperatorTest : MethodRuleTestFixture { string AsString_Bad1a (object obj) { return obj == null ? null : obj as string; } string AsString_Bad1b (object obj) { if (obj != null) return obj as string; return null; } string AsString_Bad2a (object obj) { return obj != null ? obj as string : null; } string AsString_Bad2b (object obj) { if (obj == null) return null; return obj as string; } string AsString_Good (object obj) { return obj as string; } string AsString_Good2 (string message, object obj) { if (message == null) throw new ArgumentNullException ("message"); Console.WriteLine (message); return obj as string; } string AsString_Good3 (string message, object obj) { if (message == null) return null; Console.WriteLine (message); return obj as string; } void LocalsBad1a () { object o = null; string a = o == null ? null : o as string; Console.WriteLine (a); } void LocalsBad2a () { object o = null; string a = o != null ? o as string : null; Console.WriteLine (a); } // extracted from: moon/class/System.Windows/Mono.Xaml/XamlPropertySetter.cs // no 'as' has been harmed by this test object ConvertValue (object value) { if (value == null) return null; if (value is Type || value is SimpleMethods) return value; return value.ToString (); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); // no ldnull instruction AssertRuleDoesNotApply ("AsString_Good"); AssertRuleDoesNotApply ("AsString_Good2"); } [Test] public void Success () { AssertRuleSuccess ("AsString_Good3"); AssertRuleSuccess ("ConvertValue"); } [Test] public void Failure () { AssertRuleFailure ("AsString_Bad1a"); AssertRuleFailure ("AsString_Bad1b"); AssertRuleFailure ("AsString_Bad2a"); AssertRuleFailure ("AsString_Bad2b"); AssertRuleFailure ("LocalsBad1a"); AssertRuleFailure ("LocalsBad2a"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/GetEntryAssemblyMayReturnNullTest.cs0000664000175000017500000000741512413742070035456 0ustar00directhexdirecthex00000000000000// // Unit tests for GetEntryAssemblyMayReturnNullRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) Daniel Abramov // 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; using System.Linq; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.BadPractice { internal class ClassCallingGetEntryAssembly { public static void Main () // fake main { } public void OneCall () { object o = System.Reflection.Assembly.GetEntryAssembly (); } public void ThreeCalls () { string s = System.Reflection.Assembly.GetEntryAssembly ().ToString (); int x = 2 + 2; x = x.CompareTo (1); object o = System.Reflection.Assembly.GetEntryAssembly (); System.Reflection.Assembly.GetEntryAssembly (); } public void NoCalls () { int x = 42; int y = x * 42; x = x * y.CompareTo (42); } } [TestFixture] public class GetEntryAssemblyMayReturnNullTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no NEWOBJ AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void TestMethodNotCallingGetEntryAssembly () { AssertRuleSuccess ("NoCalls"); } private TypeDefinition GetTest (AssemblyDefinition assembly) { return assembly.MainModule.GetType (typeof (T).FullName); } [Test] public void TestGetEntryAssemblyCallFromExecutable () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (unit); try { assembly.EntryPoint = GetTest (assembly).Methods.FirstOrDefault (m => m.Name == "Main"); assembly.MainModule.Kind = ModuleKind.Console; MethodDefinition method = GetTest (assembly).Methods.FirstOrDefault (m => m.Name == "ThreeCalls"); Assert.AreEqual (RuleResult.DoesNotApply, (Runner as TestRunner).CheckMethod (method), "RuleResult"); Assert.AreEqual (0, Runner.Defects.Count, "Count"); } finally { assembly.EntryPoint = null; assembly.MainModule.Kind = ModuleKind.Dll; } } [Test] public void TestMethodCallingGetEntryAssemblyOnce () { AssertRuleFailure ("OneCall", 1); } [Test] public void TestMethodCallingGetEntryAssemblyThreeTimes () { AssertRuleFailure ("ThreeCalls", 3); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/EqualShouldHandleNullArgTest.cs0000664000175000017500000001323312413742070034335 0ustar00directhexdirecthex00000000000000// // Unit tests for EqualsShouldHandleNullArgRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using System.Reflection; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { #pragma warning disable 114, 649, 659 [TestFixture] public class EqualsShouldHandleNullArgTest : TypeRuleTestFixture { public class EqualsChecksForNullArg { public override bool Equals (object obj) { if (obj == null) return false; else return this == obj; } } public class EqualsDoesNotReturnFalseForNullArg { public override bool Equals (object obj) { if (obj == null) return true; return this == obj; } } public class EqualsNotOverriddenNotCheckingNull { public bool Equals (object obj) { return this == obj; } } public class EqualsNotOverriddenNotReturningFalseForNull { public new bool Equals (object obj) { if (obj != null) return this == obj; return true; } } [Test] public void Basic () { AssertRuleSuccess (); AssertRuleFailure (1); AssertRuleSuccess (); AssertRuleFailure (); } public class EqualsReturnsFalse { public override bool Equals (object obj) { return false; } } public class EqualsReturnsTrue { public override bool Equals (object obj) { return true; } } [Test] public void Constants () { AssertRuleSuccess (); AssertRuleFailure (1); } public struct EqualsUsingIsReturnFalse { public override bool Equals (object obj) { if (obj is EqualsUsingIsReturnFalse) return Object.ReferenceEquals (this, obj); return false; } } public struct EqualsUsingIsReturnTrue { public override bool Equals (object obj) { if (obj is EqualsUsingIsReturnTrue) return Object.ReferenceEquals (this, obj); return true; } } // from /mcs/class/corlib/System.Reflection.Emit/SignatureToken.cs public struct EqualsUsingIsReturnVariable { internal int tokValue; public override bool Equals (object obj) { bool res = obj is EqualsUsingIsReturnVariable; if (res) { EqualsUsingIsReturnVariable that = (EqualsUsingIsReturnVariable) obj; res = (this.tokValue == that.tokValue); } return res; } } [Test] public void EqualsUsingIs () { AssertRuleSuccess (); AssertRuleFailure (1); AssertRuleSuccess (); } public class EqualsCallBase : EqualsReturnsTrue { public override bool Equals (object obj) { return base.Equals (obj); } } public class EqualsCheckThis { // System.Object does this public override bool Equals (object obj) { return (this == obj); } } public class EqualsCheckType { // common pattern in corlib public override bool Equals (object obj) { if (obj == null || GetType () != obj.GetType ()) return false; return true; } } // from /mcs/class/System/System.ComponentModel/DisplayNameAttribute.cs public class CheckThisFirst { string DisplayName; public override bool Equals (object obj) { if (obj == this) return true; CheckThisFirst dna = obj as CheckThisFirst; if (dna == null) return false; return dna.DisplayName == DisplayName; } } [Test] public void CommonPatterns () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } public class StaticEquals { static public bool Equals (object obj) { return false; } } public class EqualsTwoParameters { public new bool Equals (object left, object right) { return (left == right); } } public class EqualsReference { public bool Equals (EqualsReference obj) { return this == obj; } } [Test] public void NotApplicable () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } public class Throw { public bool Equals (object obj) { throw new NotSupportedException (); } } [Test] public void Special () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/AvoidVisibleConstantFieldTest.cs0000664000175000017500000000625312413742070034550 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidVisibleConstantFieldRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public class AvoidVisibleConstantFieldTest : TypeRuleTestFixture { public class PublicBad { public const double ZeroDouble = 0.0; // 1 protected const int ZeroInteger = 0; // 2 protected const ulong MaxUInt64 = UInt64.MaxValue; // 3 // ok, since it can only be null public const object Null = null; // not a const public static readonly object ReadOnlyNullObject = null; private const string Message = "Ok since it's not visible"; } public class PublicGood { public static readonly double ZeroDouble = 0.0; public const object Null = null; } public class PublicEmpty { // no fields } [Test] public void PublicType () { AssertRuleFailure (3); AssertRuleSuccess (); AssertRuleDoesNotApply (); } public class ProtectedBad { public const string Message = "Oops"; // 1 // ok, since it can only be null public const ProtectedBad Reference = null; // not a const public static readonly float Pi = 3.14f; } public class ProtectedGood { public static readonly string Empty = String.Empty; public const object Null = null; protected int count = 1; } public class ProtectedEmpty { // no fields } [Test] public void ProtectedType () { AssertRuleFailure (1); AssertRuleSuccess (); AssertRuleDoesNotApply (); } private class Private { public const double ZeroDouble = 0.0; } private class Internal { protected const int ZeroInteger = 0; } [Test] public void NonVisibleType () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } [Test] public void Others () { AssertRuleDoesNotApply (SimpleTypes.Enum); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/Makefile.in0000664000175000017500000003144212642235731030373 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.BadPractice/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.BadPractice.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.BadPractice/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.BadPractice/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/DoNotUseEnumIsAssignableFromTest.cs0000664000175000017500000000542212413742070035145 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotUseEnumIsAssignableFromRule // // Authors: // Jb Evain // // 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 Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public class DoNotUseEnumIsAssignableFromTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] instruction AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public bool EnumIsAssignableFromType (Type type) { return typeof (Enum).IsAssignableFrom (type); } public bool EnumIsAssignableFromBaseType (Type type) { return typeof (Enum).IsAssignableFrom (type.BaseType); } public bool EnumIsEnum (Type type) { return type.IsEnum; } enum Foo { Bar, Baz, Gaz, } [Test] public void Bad () { Assert.IsTrue (EnumIsAssignableFromType (typeof (Foo)), "EnumIsAssignableFromType"); AssertRuleFailure ("EnumIsAssignableFromType", 1); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "1"); Assert.IsTrue (EnumIsAssignableFromBaseType (typeof (Foo)), "EnumIsAssignableFromBaseType"); AssertRuleFailure ("EnumIsAssignableFromBaseType", 1); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "1"); } [Test] public void Good () { Assert.IsTrue (EnumIsEnum (typeof (Foo)), "EnumIsEnum"); AssertRuleSuccess ("EnumIsEnum"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/ReplaceIncompleteOddnessCheckTest.cs0000664000175000017500000001274412413742070035365 0ustar00directhexdirecthex00000000000000// // Unit test for ReplaceIncompleteOddnessCheckRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public class ReplaceIncompleteOddnessCheckTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } // common, but incomplete, oddness check public bool IsIntOddBad (int x) { // this won't work for negative numbers (returns -1) return ((x % 2) == 1); } public bool IsLongOddBad (long x) { // this won't work for negative numbers (returns -1) return ((x % 2) == 1); } [Test] public void Bad () { Assert.IsTrue (IsIntOddBad (1), "1"); Assert.IsFalse (IsIntOddBad (-1), "-1"); // uho Assert.IsFalse (IsIntOddBad (2), "2"); Assert.IsFalse (IsIntOddBad (-2), "-2"); AssertRuleFailure ("IsIntOddBad", 1); Assert.IsFalse (IsLongOddBad (Int64.MinValue), "Int64.MinValue"); Assert.IsTrue (IsLongOddBad (Int64.MaxValue), "Int64.MaxValue"); AssertRuleFailure ("IsLongOddBad", 1); } public bool IsUnsignedByteOddBad (byte x) { // this can't be a negative number since it's unsigned return ((x % 2) == 1); } public bool IsUnsignedLongOddBad (ulong x) { // this can't be a negative number since it's unsigned return ((x % 2) == 1); } [Test] public void Unsigned () { Assert.IsFalse (IsUnsignedByteOddBad (Byte.MinValue), "Byte.MinValue"); Assert.IsTrue (IsUnsignedByteOddBad (Byte.MaxValue), "Byte.MaxValue"); AssertRuleFailure ("IsUnsignedByteOddBad", 1); Assert.IsFalse (IsUnsignedLongOddBad (UInt64.MinValue), "UInt64.MinValue"); Assert.IsTrue (IsUnsignedLongOddBad (UInt64.MaxValue), "UInt64.MaxValue"); AssertRuleFailure ("IsUnsignedLongOddBad", 1); } // fixed version, i.e. what the developer expected public bool IsOddGood (int x) { return ((x % 2) != 0); } [Test] public void Good () { Assert.IsTrue (IsOddGood (1), "1"); Assert.IsTrue (IsOddGood (-1), "-1"); Assert.IsFalse (IsOddGood (2), "2"); Assert.IsFalse (IsOddGood (-2), "-2"); AssertRuleSuccess ("IsOddGood"); } // better version, without modulo, that works on all integer public bool IsOddBest (int x) { return ((x & 1) == 1); } [Test] public void Best () { Assert.IsTrue (IsOddBest (1), "1"); Assert.IsTrue (IsOddBest (-1), "-1"); Assert.IsFalse (IsOddBest (2), "2"); Assert.IsFalse (IsOddBest (-2), "-2"); // no REM[_UN] instruction is used so the rule does not apply AssertRuleDoesNotApply ("IsOddBest"); } public bool IsEvenGood (int x) { return ((x % 2) == 0); } [Test] public void EvenGood () { Assert.IsFalse (IsEvenGood (1), "1"); Assert.IsFalse (IsEvenGood (-1), "-1"); Assert.IsTrue (IsEvenGood (2), "2"); Assert.IsTrue (IsEvenGood (-2), "-2"); AssertRuleSuccess ("IsEvenGood"); } public bool IsEvenBad (int x) { return ((x % 2) != 1); } [Test] public void EvenBad () { Assert.IsFalse (IsEvenBad (1), "1"); Assert.IsTrue (IsEvenBad (-1), "-1"); // uho Assert.IsTrue (IsEvenBad (2), "2"); Assert.IsTrue (IsEvenBad (-2), "-2"); AssertRuleFailure ("IsEvenBad"); } public bool ModuloThree (int x) { return ((x % 3) == 0); } public bool Compare (int x) { return ((x % 2) >= 1); } public bool SByteMax (long x) { return ((x % SByte.MaxValue) == 1); } public bool Int64Max (long x) { return ((x % Int64.MaxValue) == 1); } public bool Int32Max (int x) { return ((x % Int32.MaxValue) == 1); } [Test] public void NonOddnessVariations () { AssertRuleSuccess ("ModuloThree"); AssertRuleSuccess ("Compare"); AssertRuleSuccess ("SByteMax"); AssertRuleSuccess ("Int64Max"); AssertRuleSuccess ("Int32Max"); } } } PreferParamsArrayForVariableArgumentsTest.cs0000664000175000017500000000636312413742070037026 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test// // Unit tests for PreferParamsArrayForVariableArgumentsRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.BadPractice { [TestFixture] public class PreferParamsArrayForVariableArgumentsTest : MethodRuleTestFixture { // special case, this return false for HasParameters private void ShowItems_NoParameter (__arglist) { ArgIterator args = new ArgIterator (__arglist); for (int i = 0; i < args.GetRemainingCount (); i++) { // gmcs cannot compile __refvalue correctly - bnc 569539 #if !__MonoCS__ Console.WriteLine (__refvalue (args.GetNextArg (), string)); #endif } } public void ShowItems_Bad (string header, __arglist) { Console.WriteLine (header); ArgIterator args = new ArgIterator (__arglist); for (int i = 0; i < args.GetRemainingCount (); i++) { // gmcs cannot compile __refvalue correctly - bnc 569539 #if !__MonoCS__ Console.WriteLine (__refvalue (args.GetNextArg (), string)); #endif } } [Test] public void ArgIterator () { AssertRuleFailure ("ShowItems_NoParameter", 1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "private"); AssertRuleFailure ("ShowItems_Bad", 1); Assert.AreEqual (Severity.Critical, Runner.Defects [0].Severity, "public"); } [DllImport ("libc.dll")] static extern int printf (string format, __arglist); [Test] public void Interop () { AssertRuleSuccess ("printf"); } public void ShowItems_Params (string header, params string [] items) { Console.WriteLine (header); for (int i = 0; i < items.Length; i++) { Console.WriteLine (items [i]); } } [Test] public void Params () { AssertRuleSuccess ("ShowItems_Params"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/UseFileOpenOnlyWithFileAccessTest.cs0000664000175000017500000000644112413742070035307 0ustar00directhexdirecthex00000000000000// // Test.Rules.BadPractice.UseFileOpenOnlyWithFileAccessTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.IO.IsolatedStorage; using System.Collections.Generic; using System.Security.AccessControl; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.BadPractice { [TestFixture] public class UseFileOpenOnlyWithFileAccessTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] instruction AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void BadMethod1 () { var f = File.Open ("HelloWorld.cs", FileMode.Open); } public void BadMethod2 () { var f = File.Open ("HelloWorld.cs", FileMode.Append); // unrelated call string a = f.ToString (); var g = new FileStream ("HelloWorld.cs", FileMode.Truncate); // unrelated code if (a.Length == 42) return; else return; } public void BadMethod3() { var f = File.Open ("HelloWorld.cs", FileMode.CreateNew); var g = new FileStream ("HelloWorld.cs", FileMode.OpenOrCreate); var h = new IsolatedStorageFileStream ("HelloWorld.cs", FileMode.Create); } public void GoodMethod () { var f = File.Open ("HelloWorld.cs", FileMode.Open, FileAccess.Read); var g = new FileStream ("HelloWorld.cs", FileMode.OpenOrCreate, FileAccess.ReadWrite); var h = new IsolatedStorageFileStream ("HelloWorld.cs", FileMode.Create, FileAccess.Write); // unrelated code List ls = new List { "a", "b" }; ls.Clear (); var i = new FileStream ("HelloWorld.cs", FileMode.Open, FileSystemRights.Read, FileShare.Read, 8, FileOptions.None); } [Test] public void Bad () { AssertRuleFailure ("BadMethod1", 1); AssertRuleFailure ("BadMethod2", 2); AssertRuleFailure ("BadMethod3", 3); } [Test] public void Good () { AssertRuleSuccess ("GoodMethod"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/CheckNewThreadWithoutStartTest.cs0000664000175000017500000001651312413742070034733 0ustar00directhexdirecthex00000000000000// // Unit tests for CheckNewThreadWithoutStartRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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; using System.Reflection; using System.Threading; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using Mono.Cecil; using Mono.Cecil.Cil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.BadPractice { [TestFixture] public class CheckNewThreadWithoutStartTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no NEWOBJ AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } private AssemblyDefinition assembly; private TypeDefinition type; private CheckNewThreadWithoutStartRule rule; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.BadPractice.CheckNewThreadWithoutStartTest"); rule = new CheckNewThreadWithoutStartRule (); runner = new TestRunner (rule); } public MethodDefinition GetTest (string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } return null; } private void ThreadStart () { } public void DirectStart () { new Thread (ThreadStart).Start (); } [Test] public void TestDirectThrow () { MethodDefinition method = GetTest ("DirectStart"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void SimpleError () { new Thread (ThreadStart); } [Test] public void TestSimpleError () { MethodDefinition method = GetTest ("SimpleError"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } public void LocalVariable () { Thread a = new Thread (ThreadStart); int c = 0; for (int i = 0; i < 10; i++) c += i * 2; a.Start (); } [Test] public void TestLocalVariable () { MethodDefinition method = GetTest ("LocalVariable"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public object Return () { Thread a = new Thread (ThreadStart); object b = a; return b; } [Test] public void TestReturn () { MethodDefinition method = GetTest ("Return"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public object ReturnOther () { Thread a = new Thread (ThreadStart); object b = a; b = new object (); return b; } [Test] public void TestReturnOther () { MethodDefinition method = GetTest ("ReturnOther"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } public object Branch () { Thread a = new Thread (ThreadStart); if (new Random ().Next () == 0) { a = null; } return a; } [Test] public void TestBranch () { MethodDefinition method = GetTest ("Branch"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public Thread TryCatch () { Thread a = new Thread (ThreadStart); Thread b = null; Thread c = null; try { b = a; } catch (Exception) { c = b; } return c; } [Test] public void TestTryCatch () { MethodDefinition method = GetTest ("TryCatch"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public Thread TryCatch2 () { Thread a = new Thread (ThreadStart); Thread b = null; try { throw new Exception (); } catch (InvalidOperationException) { b = a; } catch (InvalidCastException) { return b; } return null; } [Test] public void TestTryCatch2 () { MethodDefinition method = GetTest ("TryCatch2"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } public void TryCatchFinally () { Thread a = new Thread (ThreadStart); Thread b = null; try { throw new Exception (); } catch (Exception) { b = a; } finally { b.Start (); } } [Test] public void TestTryCatchFinally () { MethodDefinition method = GetTest ("TryCatchFinally"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void Out (out Thread thread) { thread = new Thread (ThreadStart); } [Test] public void TestOut () { MethodDefinition method = GetTest ("Out"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void Ref (ref Thread thread) { thread = new Thread (ThreadStart); } [Test] public void TestRef () { MethodDefinition method = GetTest ("Ref"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void Call () { Thread a = new Thread (ThreadStart); a.ToString (); a.Name = "Thread"; } [Test] public void TestCall () { MethodDefinition method = GetTest ("Call"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } public void Call2 () { Thread a = new Thread (ThreadStart); Console.WriteLine (a); } [Test] public void TestCall2 () { MethodDefinition method = GetTest ("Call2"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } } } ObsoleteMessagesShouldNotBeEmptyTest.cs0000664000175000017500000001036512413742070036024 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test// // Unit tests for ObsoleteMessagesShouldNotBeEmptyRule // // Authors: // Sebastien Pouliot // // 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; using System.Reflection; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { #pragma warning disable 67, 169, 612, 618 [TestFixture] public class ObsoleteMessagesShouldNotBeEmptyTest : TypeRuleTestFixture { [Obsolete] public class ObsoleteEmptyClass { } [Obsolete ("use something else")] internal class ObsoleteClass { } public class ClassWithObsoleteEmptyStuff { [Obsolete] // 1 public const int ObsoletedEmptyConstField = 411; [Obsolete (null)] // 2 static int ObsoleteEmptyStaticField; [Obsolete ("")] // 3 public int ObsoleteEmptyField; [Obsolete] // 4 public ClassWithObsoleteEmptyStuff (int x) { } [Obsolete (null)] // 5 public void ObsoleteEmptyMethod () { } [Obsolete ("")] // 6 protected int ObsoleteEmptyProperty { get { return 42; } } [Obsolete] // 7 event EventHandler ObsoleteEvent; } internal class ClassWithObsoleteStuff { [Obsolete ("just because")] private ClassWithObsoleteStuff () { } [Obsolete ("!")] public void ObsoleteMethod () { } [Obsolete (" ")] protected int ObsoleteProperty { get { return 42; } } } [Test] public void Class () { AssertRuleFailure (1); AssertRuleFailure (7); AssertRuleSuccess (); AssertRuleSuccess (); } [Obsolete] delegate void ObsoleteEmptyDelegate (); [Obsolete ("not needed anymore")] delegate void ObsoleteDelegate (); [Test] public void Delegate () { AssertRuleFailure (1); AssertRuleSuccess (); } [Obsolete ("")] protected enum ObsoleteEmptyEnum { } [Obsolete ("not needed anymore")] protected enum ObsoleteEnum { } [Test] public void Enum () { AssertRuleFailure (1); AssertRuleSuccess (); } [Obsolete (null)] interface ObsoleteEmptyInterface { [Obsolete (null)] void ObsoleteEmptyMethod (); [Obsolete ("")] int ObsoleteEmptyProperty { get; set; } } [Obsolete ("not needed anymore")] interface ObsoleteInterface { int Property { get; set; } } [Test] public void Interface () { AssertRuleFailure (3); AssertRuleSuccess (); } [Obsolete (null)] private struct ObsoleteEmptyStruct { } public struct StructWithObsoleteEmptyMembers { [Obsolete ("")] string Why; } [Obsolete ("not needed anymore")] public struct ObsoleteStruct { } public struct StructWithObsoleteMembers { [Obsolete ("not needed anymore")] string Why; } [Test] public void Struct () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/PreferEmptyInstanceOverNullTest.cs0000664000175000017500000001262212413742070035125 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferEmptyInstanceOverNullRule // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.BadPractice { [TestFixture] public class PreferEmptyInstanceOverNullTest : MethodRuleTestFixture { public class DoesNotApplyCases { bool foo; string x; public void Void () { Console.WriteLine ("Foo"); } public int Int () { return 0; } public Type Type () { return null; } public string StringProperty { set { x = value; } } public IEnumerable GetOffsets () { if (!foo) yield break; //store.LoadOffsets (); foreach (int offset in GetOffsets ()) yield return offset; } public override string ToString () { return null; } } public class SuccessCases { bool foo; string x; public int [] IntArray () { x = null; return new int [0]; } public string StringProperty { get { x = null; return "foo"; } } public string String (string s) { x = null; return "foo"; } public string String2 () { x = null; return string.Empty; } public string String3 () { x = String (null); return this.ToString (); } public ArrayList Collection () { if (!foo) return new ArrayList (); var list = new ArrayList (); list.Add (4); list.Add (8); String (null); return list; } public List GenericCollection () { if (!foo) return new List (); String (null); var list = new List (); list.Add (4); list.Add (8); return list; } } public class FailureCases { bool foo = false; string s; public int [] IntArray () { if (!foo) return null; return new int [1]; } public string StringProperty { get { return null; } } public string String () { return null; } public string String2 () { if (!foo) return null; return "foo"; } public string String3 () { if (!foo) return null; if (s == "N/A") return null; return s; } public IEnumerable GetOffsets () { if (!foo) return null; //store.LoadOffsets (); return GetOffsets (); } public ArrayList Collection () { if (!foo) return null; var list = new ArrayList (); list.Add (4); list.Add (8); return list; } public List GenericCollection () { if (!foo) return null; var list = new List (); list.Add (4); list.Add (8); return list; } public string InlineIf { get { return s.Length == 0 ? null : s; } } public string InlineIf2 { get { return s.Length == 0 ? s : null; } } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply ("Void"); AssertRuleDoesNotApply ("Int"); AssertRuleDoesNotApply ("Type"); AssertRuleDoesNotApply ("set_StringProperty"); AssertRuleDoesNotApply ("GetOffsets"); AssertRuleDoesNotApply ("ToString"); } [Test] public void Success () { AssertRuleSuccess ("IntArray"); AssertRuleSuccess ("get_StringProperty"); AssertRuleSuccess ("String"); AssertRuleSuccess ("String2"); AssertRuleSuccess ("String3"); AssertRuleSuccess ("Collection"); AssertRuleSuccess ("GenericCollection"); } [Test] public void Failure () { AssertRuleFailure ("IntArray", 1); AssertRuleFailure ("get_StringProperty", 1); AssertRuleFailure ("String", 1); AssertRuleFailure ("String2", 1); AssertRuleFailure ("String3", 2); AssertRuleFailure ("GetOffsets", 1); AssertRuleFailure ("Collection", 1); AssertRuleFailure ("GenericCollection", 1); AssertRuleFailure ("get_InlineIf", 1); AssertRuleFailure ("get_InlineIf2", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/DoNotDecreaseVisibilityTest.cs0000664000175000017500000001135312413742070034236 0ustar00directhexdirecthex00000000000000// // Tests.Rules.BadPractice.DoNotDecreaseVisibilityTest // // Authors: // Sebastien Pouliot // // 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.Cecil; using Gendarme.Rules.BadPractice ; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.BadPractice { [TestFixture] public class DoNotDecreaseVisibilityTest : MethodRuleTestFixture { public class TestCase { public class Base { public void Public () { } protected bool Protected (int x) { return x == 0; } internal int Internal () { return -1; } private float Private (float f) { return f; } } public class BadInheritor : Base { private new void Public () { } private new bool Protected (int x) { return x == 1; } private new int Internal () { return -1; } private new float Private (float f) { return -f; } } public class NoInheritance { private new void Public () { } private new bool Protected (int x) { return x == 1; } private new int Internal () { return -1; } private new float Private (float f) { return -f; } } // c# cannot seal the method without making it an override // and an override cannot change visibility #if false public class FinalInheritor : Base { private new sealed void Public () { } private new sealed bool Protected (int x) { return x == 1; } private new sealed int Internal () { return -1; } private new float Private (float f) { return -f; } } #endif public sealed class Sealed : Base { private new void Public () { } private new bool Protected (int x) { return x == 1; } private new int Internal () { return -1; } private new float Private (float f) { return -f; } } public class StaticCtor { static StaticCtor () { } } public class StaticCtorInheritor : StaticCtor { static StaticCtorInheritor () { } } } [Test] public void DoesNotApply () { // not private AssertRuleDoesNotApply ("Public"); AssertRuleDoesNotApply ("Protected"); AssertRuleDoesNotApply ("Internal"); #if false // method is sealed (final) AssertRuleDoesNotApply ("Public"); AssertRuleDoesNotApply ("Protected"); AssertRuleDoesNotApply ("Internal"); AssertRuleDoesNotApply ("Private"); #endif // type is sealed AssertRuleDoesNotApply ("Public"); AssertRuleDoesNotApply ("Protected"); AssertRuleDoesNotApply ("Internal"); AssertRuleDoesNotApply ("Private"); } [Test] public void Good () { AssertRuleSuccess ("Private"); AssertRuleSuccess ("Public"); AssertRuleSuccess ("Protected"); AssertRuleSuccess ("Internal"); AssertRuleSuccess ("Private"); AssertRuleSuccess ("Internal"); AssertRuleSuccess ("Private"); AssertRuleSuccess (".cctor"); AssertRuleSuccess (".cctor"); } [Test] public void Bad () { AssertRuleFailure ("Public"); AssertRuleFailure ("Protected"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/AvoidAssemblyVersionMismatchTest.cs0000664000175000017500000001076412413742070035312 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidAssemblyVersionMismatchRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Reflection; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; [assembly: AssemblyVersion ("2.2.0.0")] [assembly: AssemblyFileVersion ("2.2.0.0")] namespace Test.Rules.BadPractice { [TestFixture] public class AvoidAssemblyVersionMismatchTest : AssemblyRuleTestFixture { private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } [Test] public void EmptyAssemblyVersion () { Version v = assembly.Name.Version; try { assembly.Name.Version = null; // should not happen AssertRuleDoesNotApply (assembly); assembly.Name.Version = new Version (0, 0, 0, 0); AssertRuleDoesNotApply (assembly); } finally { assembly.Name.Version = v; } } [Test] public void EmptyCustomAttributes () { IList cac = new List (); foreach (CustomAttribute ca in assembly.CustomAttributes) cac.Add (ca); try { assembly.CustomAttributes.Clear (); AssertRuleDoesNotApply (assembly); } finally { foreach (CustomAttribute ca in cac) assembly.CustomAttributes.Add (ca); } } [Test] public void AbsentAssemblyFileVersion () { CustomAttribute afv = null; foreach (CustomAttribute ca in assembly.CustomAttributes) { if (ca.AttributeType.FullName != "System.Reflection.AssemblyFileVersionAttribute") continue; afv = ca; break; } assembly.CustomAttributes.Remove (afv); try { AssertRuleDoesNotApply (assembly); } finally { assembly.CustomAttributes.Add (afv); } } [Test] public void EmptyAssemblyFileVersion () { CustomAttribute afv = null; foreach (CustomAttribute ca in assembly.CustomAttributes) { if (ca.Constructor.DeclaringType.FullName != "System.Reflection.AssemblyFileVersionAttribute") continue; afv = ca; break; } CustomAttributeArgument value = afv.ConstructorArguments [0]; afv.ConstructorArguments [0] = new CustomAttributeArgument (); try { AssertRuleDoesNotApply (assembly); } finally { afv.ConstructorArguments [0] = value; } } [Test] public void VersionMatch () { AssertRuleSuccess (assembly); } [Test] public void VersionMismatch () { Version v = assembly.Name.Version; try { assembly.Name.Version = new Version (2, 2, 0, 9); AssertRuleFailure (assembly, 1); Assert.AreEqual (Severity.Low, Runner.Defects [0].Severity, "Low"); assembly.Name.Version = new Version (2, 2, 9, 0); AssertRuleFailure (assembly, 1); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "Medium"); assembly.Name.Version = new Version (2, 9, 0, 0); AssertRuleFailure (assembly, 1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "High"); assembly.Name.Version = new Version (9, 2, 0, 0); AssertRuleFailure (assembly, 1); Assert.AreEqual (Severity.Critical, Runner.Defects [0].Severity, "Critical"); } finally { assembly.Name.Version = v; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/PreferTryParseTest.cs0000664000175000017500000001117012413742070032421 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferTryParseRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public class PreferTryParseTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] instruction AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } class ParseWithTryCatch { private int Int32Parse () { try { return Int32.Parse ("12") + Int32.Parse ("-12", NumberStyles.AllowCurrencySymbol); } catch { return 0; } } } [Test] public void Bad () { AssertRuleFailure ("Int32Parse", 2); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "Severity"); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "Confidence"); } class ParseWithoutTryCatch { private int Int32Parse () { return Int32.Parse ("12") + Int32.Parse ("-12", NumberStyles.AllowCurrencySymbol); } } class ParseOutsideTryCatch { private int Int32Parse (string s) { try { if (String.IsNullOrEmpty (s)) return 0; return (int) (s [0] - '0'); } catch (Exception) { return Int32.Parse (s); } } } [Test] public void Worse () { AssertRuleFailure ("Int32Parse", 2); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "Severity-1"); Assert.AreEqual (Confidence.High, Runner.Defects [0].Confidence, "Confidence-1"); AssertRuleFailure ("Int32Parse", 1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "Severity-2"); Assert.AreEqual (Confidence.High, Runner.Defects [0].Confidence, "Confidence-2"); } class TryParse { private int Int32Parse () { int i; if (!Int32.TryParse ("12", out i)) i = 0; return i; } } class AtypicalParse { private bool Parse () { return true; } public void CallParse () { if (!Parse ()) Console.WriteLine (); } } class NoTryParse { static NoTryParse Parse (string s) { return new NoTryParse (); } public void CallParse () { NoTryParse.Parse (null); } } class BadTryParse { // bad candidate - does not return 'bool' static void TryParse (string s, out BadTryParse btp) { btp = new BadTryParse (); } // bad candidate - first parameter is not 'string' static bool TryParse (char c, out BadTryParse btp) { btp = new BadTryParse (); return true; } // bad candidate - last parameter is not 'out ' static bool TryParse (string s, BadTryParse btp) { btp = new BadTryParse (); return true; } static BadTryParse Parse (string s) { return new BadTryParse (); } public void CallParse () { BadTryParse btp = null; BadTryParse.TryParse (String.Empty, out btp); BadTryParse.TryParse ('a', out btp); BadTryParse.TryParse (String.Empty, btp); // below is valid since there was no valid TryParse cnadidate BadTryParse.Parse (null); } } [Test] public void Good () { AssertRuleSuccess ("Int32Parse"); AssertRuleSuccess ("CallParse"); AssertRuleSuccess ("CallParse"); AssertRuleSuccess ("CallParse"); } } } DoNotForgetNotImplementedMethodsTest.cs0000664000175000017500000001127712413742070036020 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test// // Unit Test for DoNotForgetNotImplementedMethodsRule. // // Authors: // Cedric Vivier // // (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.BadPractice { public class ImplementedOrNotMethods { public void Empty () { // but empty methods are not considered } public void NotImplemented1 () { throw new NotImplementedException (); } private string BuildLazyMessage (string s) { return string.Format ("I'm too lazy to implement {0}", s); } public void NotImplemented2 () { throw new NotImplementedException (BuildLazyMessage ("this")); } public int Implemented1 () { return 1; } public void Implemented2 () { Console.WriteLine ("foo"); } public void Implemented3 () { throw new InvalidOperationException (); } public Exception Implemented4 () { return new NotImplementedException (); } public Exception Implemented5 (object o) { if (o == null) throw new ArgumentNullException ("o"); return new NotImplementedException (); } public void NotFullyImplemented_Split (int x) { if (x < 0) { throw new NotImplementedException ("x < 0 has a different behavior which isn't implemented yet."); } else { Implemented2 (); } } public void NotFullyImplemented_Check (object o) { if (o == null) throw new ArgumentNullException ("o"); throw new NotImplementedException ("only basic checks are done"); } public void NotFullyImplemented_Long (int x) { switch (x) { case 0: break; case 1: Implemented1 (); break; case 2: Implemented2 (); break; case 3: Implemented3 (); break; case 4: Implemented4 (); break; default: throw new NotImplementedException ("only basic checks are done"); } } } interface InterfaceMethods { void Method (); } abstract class AbstractMethods { abstract protected int Method (); } [TestFixture] public class DoNotForgetNotImplementedMethodsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no NEWOBJ AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void NotImplementedMethodsTest () { AssertRuleFailure ("NotImplemented1"); AssertRuleFailure ("NotImplemented2"); } [Test] public void NotFullyImplementedMethodsTest () { // there's a branch but the code is too small for a NotImplementedException not to mean something AssertRuleFailure ("NotFullyImplemented_Split"); AssertRuleFailure ("NotFullyImplemented_Check"); // in this last case the code is big enough to be judged, partially, useful AssertRuleSuccess ("NotFullyImplemented_Long"); } [Test] public void ImplementedMethods () { // no NEWOBJ AssertRuleDoesNotApply ("Implemented1"); // no NEWOBJ AssertRuleDoesNotApply ("Implemented2"); AssertRuleSuccess ("Implemented3"); // no THROW AssertRuleDoesNotApply ("Implemented4"); AssertRuleSuccess ("Implemented5"); } [Test] public void OutOfScopeMethods () { AssertRuleDoesNotApply ("Method"); AssertRuleDoesNotApply ("Method"); } } } CheckNewExceptionWithoutThrowingTest.cs0000664000175000017500000001634612413742070036113 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test// // Unit tests for CheckNewExceptionWithoutThrowingRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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; using System.Reflection; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using Mono.Cecil; using Mono.Cecil.Cil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.BadPractice { [TestFixture] public class CheckNewExceptionWithoutThrowingTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no NEWOBJ AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } private AssemblyDefinition assembly; private TypeDefinition type; private CheckNewExceptionWithoutThrowingRule rule; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.BadPractice.CheckNewExceptionWithoutThrowingTest"); rule = new CheckNewExceptionWithoutThrowingRule (); runner = new TestRunner (rule); } public MethodDefinition GetTest (string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } Assert.Fail ("Method {0} not found!", name); return null; } public void DirectThrow () { throw new Exception (); } [Test] public void TestDirectThrow () { MethodDefinition method = GetTest ("DirectThrow"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void SimpleError () { new Exception (); } [Test] public void TestSimpleError () { MethodDefinition method = GetTest ("SimpleError"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } public void LocalVariable () { Exception a = new Exception (); int c = 0; for (int i = 0; i < 10; i++) c += i * 2; throw a; } [Test] public void TestLocalVariable () { MethodDefinition method = GetTest ("LocalVariable"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public object Return () { Exception a = new Exception (); object b = a; return b; } [Test] public void TestReturn () { MethodDefinition method = GetTest ("Return"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public object ReturnOther () { Exception a = new Exception (); object b = a; b = new object (); return b; } [Test] public void TestReturnOther () { MethodDefinition method = GetTest ("ReturnOther"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } public object Branch () { Exception a = new Exception (); if (new Random ().Next () == 0) { a = null; } return a; } [Test] public void TestBranch () { MethodDefinition method = GetTest ("Branch"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void TryCatch () { Exception a = new Exception (); Exception b = null; Exception c = null; try { b = a; } catch (Exception) { c = b; } throw c; } [Test] public void TestTryCatch () { MethodDefinition method = GetTest ("TryCatch"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void TryCatch2 () { Exception a = new Exception (); Exception b = null; try { throw new Exception (); } catch (InvalidOperationException) { b = a; } catch (InvalidCastException) { throw b; } } [Test] public void TestTryCatch2 () { MethodDefinition method = GetTest ("TryCatch2"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } public void TryCatchFinally () { Exception a = new Exception (); Exception b = null; try { throw new Exception (); } catch (Exception) { b = a; } finally { throw b; } } [Test] public void TestTryCatchFinally () { MethodDefinition method = GetTest ("TryCatchFinally"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void Out (out Exception ex) { ex = new Exception (); } [Test] public void TestOut () { MethodDefinition method = GetTest ("Out"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void Ref (ref Exception ex) { ex = new Exception (); } [Test] public void TestRef () { MethodDefinition method = GetTest ("Ref"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } public void Call () { Exception e = new Exception (); e.ToString (); } [Test] public void TestCall () { MethodDefinition method = GetTest ("Call"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } public void Call2 () { Exception e = new Exception (); Console.WriteLine (e); } [Test] public void TestCall2 () { MethodDefinition method = GetTest ("Call2"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/DisableDebuggingCodeTest.cs0000664000175000017500000000746712413742070033474 0ustar00directhexdirecthex00000000000000// // Unit tests for DisableDebuggingCodeRule // // Authors: // Sebastien Pouliot // // 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; using System.Diagnostics; using Mono.Cecil; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.BadPractice { [TestFixture] public class DisableDebuggingCodeTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no NEWOBJ AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } // note: [Conditional] is usable on type from 2.0 onward but only if it inherit from Attribute [Conditional ("DEBUG")] public void ConditionalDebug () { Console.WriteLine ("debug"); } [Conditional ("TRACE")] public void ConditionalTrace () { Console.WriteLine ("debug"); } [Conditional ("OTHER")] [Conditional ("DEBUG")] public void ConditionalMultiple () { Console.WriteLine ("debug"); } [Conditional ("OTHER")] public void ConditionalOther () { Console.WriteLine ("debug"); } [Test] public void CommonCheck () { AssertRuleSuccess ("ConditionalTrace"); AssertRuleFailure ("ConditionalOther", 1); } [Test] [Conditional ("DEBUG")] public void DebugCheck () { AssertRuleSuccess ("ConditionalDebug"); AssertRuleSuccess ("ConditionalMultiple"); } public void UsingTrace () { Trace.WriteLine ("debug"); } public void UsingDebug () { Debug.WriteLine ("debug"); } [Category ("DEBUG")] // wrong attribute public void UsingConsole () { Console.WriteLine ("debug"); } [Test] public void NonDebug () { #if DEBUG AssertRuleSuccess ("UsingDebug"); #else AssertRuleDoesNotApply ("UsingDebug"); // method has no body in release #endif AssertRuleSuccess ("UsingTrace"); AssertRuleFailure ("UsingConsole", 1); } [Test] public void Initialize () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (unit); Rule.Active = false; (Runner as TestRunner).OnAssembly (assembly); Assert.IsFalse (Rule.Active, "Default-Active-False"); Rule.Active = true; (Runner as TestRunner).OnAssembly (assembly); Assert.IsTrue (Rule.Active, "Assembly-Active-True"); (Runner as TestRunner).OnModule (assembly.MainModule); Assert.IsTrue (Rule.Active, "Module-Active-True"); } } } DoNotUseGetInterfaceToCheckAssignabilityTest.cs0000664000175000017500000001154712413742070037402 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test// // Unit tests for DoNotUseGetInterfaceToCheckAssignabilityRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public class DoNotUseGetInterfaceToCheckAssignabilityTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] instruction AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public interface IConvertible { } class Convertible : IConvertible { } // in thie case it's clear that the code can be re-written to avoid using a // string for the interface public bool IsAssignableUsingGetInterface (Type type) { return (type.GetInterface ("IConvertible") != null); } public bool IsAssignableUsingGetInterfaceCase (Type type, bool ignoreCase) { return (type.GetInterface ("IConvertible", ignoreCase) != null); } [Test] public void Bad () { Assert.IsTrue (IsAssignableUsingGetInterface (typeof (Convertible)), "my.IConvertible"); AssertRuleFailure ("IsAssignableUsingGetInterface", 1); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "1"); Assert.IsTrue (IsAssignableUsingGetInterfaceCase (typeof (Convertible), true), "my.IConvertible-false"); AssertRuleFailure ("IsAssignableUsingGetInterfaceCase", 1); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "1"); } // in this case it's difficult to know if the code can be re-written to use a type // fo the interface public bool IsAssignableUsingGetInterfaceNotConstant (Type type, string interfaceName) { return (type.GetInterface (interfaceName) != null); } public bool IsAssignableUsingGetInterfaceNotConstantCase (Type type, string interfaceName, bool ignoreCase) { return (type.GetInterface (interfaceName, ignoreCase) != null); } [Test] public void Bad_LowConfidence () { Assert.IsTrue (IsAssignableUsingGetInterfaceNotConstant (typeof (Convertible), "IConvertible"), "my.IConvertible"); AssertRuleFailure ("IsAssignableUsingGetInterfaceNotConstant", 1); Assert.AreEqual (Confidence.Low, Runner.Defects [0].Confidence, "1"); Assert.IsTrue (IsAssignableUsingGetInterfaceNotConstantCase (typeof (Convertible), "IConvertible", false), "my.IConvertible-false"); AssertRuleFailure ("IsAssignableUsingGetInterfaceNotConstantCase", 1); Assert.AreEqual (Confidence.Low, Runner.Defects [0].Confidence, "2"); } public Type GetTypeInterface (Type type, string name) { // correct usage of Type.GetInterface return type.GetInterface (name); } [Test] public void Ok () { Assert.AreEqual (typeof (IConvertible), GetTypeInterface (typeof (Convertible), "IConvertible"), "Usage"); AssertRuleSuccess ("GetTypeInterface"); } public bool IsAssignable (Type type, Type assign) { return assign.IsAssignableFrom (type); } [Test] public void Good () { Assert.IsFalse (IsAssignable (typeof (Convertible), typeof (System.IConvertible)), "System.IConvertible"); AssertRuleSuccess ("IsAssignable"); } public void CallToAnotherGetInterfaceMethod () { GetInterface (); } [Test] public void GetInterface () { AssertRuleSuccess ("CallToAnotherGetInterfaceMethod"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/ToStringReturnsNullTest.cs0000664000175000017500000001204212413742070033472 0ustar00directhexdirecthex00000000000000// // Unit tests for ToStringShouldNotReturnNullRule // // Authors: // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public class ToStringShouldNotReturnNullTest : TypeRuleTestFixture { abstract class ToStringAbstract { public abstract override string ToString (); } [Test] public void NoIL () { AssertRuleDoesNotApply (); } public class ToStringReturningNull { public override string ToString () { // this is bad return null; } } public class ToStringReturningEmptyString { public override string ToString () { // this is Ok return String.Empty; } } public class ToStringReturningField { string s = "ab"; public override string ToString () { // this is Ok (even if we're not sure) ??? return s; } } public class ToStringReturningConstField { const string s = "ab"; public override string ToString () { // this is Ok return s; } } public class ToStringReturningReadOnlyField { readonly string s = "ab"; public override string ToString () { // this is Ok return s; } } public class ToStringReturningNewString { public override string ToString () { // this is Ok return new string ('!', 2); } } public class ToStringReturningStringFormat { public override string ToString () { return String.Format ("{0}-{1}", 1, 2); } } public class ToStringReturningConvertToStringObject { public override string ToString () { return Convert.ToString ((object)null); } } public class ToStringReturningConvertToStringString { public override string ToString () { return Convert.ToString ((string)null); } } public class ToStringReturningTypeName { public override string ToString () { return GetType ().FullName; } } public class ToStringInlineIf { public override string ToString () { return GetType () != typeof (ToStringInlineIf) ? null : "ToStringInlineIf"; } } [Test] public void ReturningNullTest () { AssertRuleFailure (1); } [Test] public void ReturningEmptyStringTest () { AssertRuleDoesNotApply (); } [Test] public void ReturningField () { // there's doubt but it's not easy (i.e. false positives) to be sure AssertRuleDoesNotApply (); } [Test] public void ReturningConstField () { AssertRuleDoesNotApply (); } [Test] public void ReturningReadOnlyField () { AssertRuleDoesNotApply (); } [Test] public void ReturningNewString () { AssertRuleDoesNotApply (); } [Test] public void ReturningStringFormat () { AssertRuleDoesNotApply (); } [Test] public void ReturningConvertToStringObject () { Assert.AreEqual (String.Empty, Convert.ToString ((object) null), "Convert.ToString(object)"); AssertRuleSuccess (); } [Test] [Ignore ("requires to analyze what called methods returns")] public void ReturningConvertToStringString () { // converting a null string to a string return null // however this is a special case since, most times, we won't know // if the value passed to Convert.ToString is null or not Assert.IsNull (Convert.ToString ((string) null), "Convert.ToString((string)null)"); AssertRuleFailure (1); } [Test] public void ReturningTypeName () { AssertRuleDoesNotApply (); } [Test] public void InlineIf () { AssertRuleFailure (1); } } } ConstructorShouldNotCallVirtualMethodsTest.cs0000664000175000017500000002254412413742070037310 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test// // Unit tests for ConstructorShouldNotCallVirtualMethodsRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.BadPractice { internal class ClassWithStaticCtor { static ClassWithStaticCtor () { ClassWithStaticCtor test = new ClassWithStaticCtor (); // this is ok, since we calling the instance virtual method test.Method (); } public virtual void Method () { } } internal class ClassWithInstanceOfItself { private ClassWithInstanceOfItself itself; public ClassWithInstanceOfItself () { itself = null; } public ClassWithInstanceOfItself (ClassWithInstanceOfItself self) { itself = self; itself.Method (0); } public virtual void Method (int x) { } } internal class ClassNotCallingVirtualMethods { public ClassNotCallingVirtualMethods () { this.NormalMethod (); } private void NormalMethod () { } protected virtual void VirtualMethod () { } public virtual bool VirtualProperty { get { return true; } set { ; } } } internal sealed class SealedClassWithVirtualCall : ClassNotCallingVirtualMethods { public SealedClassWithVirtualCall () { VirtualMethod (); } } internal class ClassWithRecursiveVirtualCall { public ClassWithRecursiveVirtualCall () { VirtualMethod (5); } protected virtual void VirtualMethod (int n) { while (n > 0) VirtualMethod (n--); } } internal class ClassCallingVirtualMethodOnce { public ClassCallingVirtualMethodOnce () { this.NormalMethod (); // call virtual method - bad thing this.VirtualMethod (); this.NormalMethod (); } protected virtual void VirtualMethod () { } public void NormalMethod () { } public void CallingVirtualMethod () { VirtualMethod (); } } internal class ClassCallingVirtualMethodThreeTimes { public ClassCallingVirtualMethodThreeTimes () { this.NormalMethod (); // call virtual method - bad thing this.VirtualMethod (); this.VirtualMethod2 (); this.VirtualMethod (); this.NormalMethod (); } protected virtual void VirtualMethod () { } protected virtual void VirtualMethod2 () { } private void NormalMethod () { } } internal class ClassCallingVirtualMethodFromBaseClass : ClassCallingVirtualMethodOnce { public ClassCallingVirtualMethodFromBaseClass () { base.VirtualMethod (); } } internal class ClassCallingVirtualPropertyFromBaseClass : ClassNotCallingVirtualMethods { public ClassCallingVirtualPropertyFromBaseClass () { this.VirtualProperty = false; } } internal class ClassIndirectlyCallingVirtualMethod { public ClassIndirectlyCallingVirtualMethod () { NormalMethod (); } [DllImport ("liberty.so")] extern static void Erty (); public virtual void VirtualMethod () { Erty (); } private void NormalMethod () { VirtualMethod (); } } internal class ClassIndirectlyCallingVirtualMethodFromBaseClass : ClassNotCallingVirtualMethods { public ClassIndirectlyCallingVirtualMethodFromBaseClass () { Method (); } private void Method () { base.VirtualMethod (); } } internal class ClassIndirectlyCallingVirtualPropertyFromBaseClass : ClassNotCallingVirtualMethods { public ClassIndirectlyCallingVirtualPropertyFromBaseClass () { Method (); } public bool NonVirtualProperty { get { return false; } } private void Method () { base.VirtualProperty = NonVirtualProperty; Method (); // check recursion } } internal class ClassCallingVirtualMethodFromOtherClasses { ClassIndirectlyCallingVirtualMethod test; public ClassCallingVirtualMethodFromOtherClasses () { test = new ClassIndirectlyCallingVirtualMethod (); test.VirtualMethod (); } } [TestFixture] public class ConstructorShouldNotCallVirtualMethodsTest : TypeRuleTestFixture { private ITypeRule rule; private AssemblyDefinition assembly; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new ConstructorShouldNotCallVirtualMethodsRule (); runner = new TestRunner (rule); } private TypeDefinition GetTest () { return assembly.MainModule.GetType (typeof (T).FullName); } [Test] public void TestClassWithStaticCtor () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestSealedClassWithVirtualCall () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestClassWithInstanceOfItself () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestClassCallingVirtualMethodOnce () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestClassCallingVirtualMethodThreeTimes () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (3, runner.Defects.Count, "Count"); } [Test] public void TestClassNotCallingVirtualMethods () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestClassCallingVirtualMethodFromBaseClass () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestClassCallingVirtualPropertyFromBaseClass () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestClassIndirectlyCallingVirtualMethod () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestClassIndirectlyCallingVirtualMethodFromBaseClass () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestClassIndirectlyCallingVirtualPropertyFromBaseClass () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestClassCallingVirtualMethodFromOtherClasses () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestClassWithRecursiveVirtualCall () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } } } OnlyUseDisposeForIDisposableTypesTest.cs0000664000175000017500000000645412413742070036176 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test// // Unit tests for OnlyUseDisposeForIDisposableTypesRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public sealed class OnlyUseDisposeForIDisposableTypesTest : TypeRuleTestFixture { public class Good1 { public void Reset () { } } public class Good2 : IDisposable { public virtual void Dispose () { } } public class Good3 : Good2 { public override void Dispose () { } } public class Bad1 { public void Dispose () { } } public class Bad2 { public void Dispose (int x) { } } public interface Bad3 { void Dispose (); } internal class Bad4 { public void Dispose () { } } internal class Bad5 { public void Close () { Dispose (0); } private void Dispose (int x) { } } internal class Bad6 { public void Dispose () { Dispose (0); } private void Dispose (int x) { } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); } [Test] public void Cases () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "Bad1-Severity-High"); AssertRuleFailure (); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "Bad2-Severity-High"); AssertRuleFailure (); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "Bad3-Severity-High"); // Bad4 has internal visibility so we consider it less severe. AssertRuleFailure (); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "Bad4-Severity-Medium"); // Private Dispose. AssertRuleFailure (); Assert.AreEqual (Severity.Low, Runner.Defects [0].Severity, "Bad5-Severity-Low"); AssertRuleFailure (2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/PreferSafeHandleTest.cs0000664000175000017500000000564512413742070032654 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferSafeHandleRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public sealed class PreferSafeHandleTest : TypeRuleTestFixture { internal class Good1 { internal SafeHandle ptr; } internal class Bad1 { internal IntPtr ptr; } internal class Bad2 { internal UIntPtr ptr; } internal class Bad3 { ~Bad3 () { } internal UIntPtr ptr; } internal class Bad4 : IDisposable { public void Dispose () { } internal UIntPtr ptr; } internal class Bad5 : IDisposable { ~Bad5 () { } public void Dispose () { } internal UIntPtr ptr; } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void Cases () { AssertRuleSuccess (); AssertRuleFailure (); Assert.AreEqual (Confidence.Low, Runner.Defects [0].Confidence, "Bad1-Confidence-Low"); AssertRuleFailure (); Assert.AreEqual (Confidence.Low, Runner.Defects [0].Confidence, "Bad2-Confidence-Low"); AssertRuleFailure (); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "Bad3-Confidence-Normal"); AssertRuleFailure (); Assert.AreEqual (Confidence.Normal, Runner.Defects [0].Confidence, "Bad4-Confidence-Normal"); AssertRuleFailure (); Assert.AreEqual (Confidence.High, Runner.Defects [0].Confidence, "Bad5-Confidence-High"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/Makefile.am0000664000175000017500000000015512413742070030352 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.BadPractice.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/CloneMethodShouldNotReturnNullTest.cs0000664000175000017500000000702712413742070035606 0ustar00directhexdirecthex00000000000000// // Unit tests for CloneMethodShouldNotReturnNullRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.BadPractice { [TestFixture] public class CloneMethodShouldNotReturnNullTest : MethodRuleTestFixture { abstract class CloneAbstract : ICloneable { public abstract object Clone (); } [Test] public void NoIL () { AssertRuleDoesNotApply (); } public class CloneMethodReturningNull: ICloneable { public object Clone () { return null; } } [Test] public void CloneMethodReturningNullTest () { AssertRuleFailure ("Clone", 1); } public class CloneMethodNotReturningNull: ICloneable { public object Clone () { return this.MemberwiseClone (); } } [Test] public void CloneMethodNotReturningNullTest () { // no LDNULL AssertRuleDoesNotApply (); } public class NotUsingICloneableClone { public object Clone () { return null; } } [Test] public void NotUsingICloneableCloneTest () { AssertRuleDoesNotApply ("Clone"); } public class CloneWithDifferentArgsReturningNull: ICloneable { public virtual object Clone () { return this.MemberwiseClone (); } public object Clone (int j) { return null; } } [Test] public void cloneWithDifferentArgsReturningNullTest () { // no LDNULL in Clone() and wrong signature for Clone(int) AssertRuleDoesNotApply (); } public class CloneReturningNullInSomeConditions: ICloneable { public bool test (int j) { if (j > 10) return true; else return false; } public object Clone() { if (test (11)) return MemberwiseClone(); else return null; } } [Test] public void CloneReturningNullInSomeConditionsTest () { AssertRuleFailure ("Clone", 1); } public class CloneWithInlineIf: ICloneable { public object Clone () { return (this is ICloneable) ? null : MemberwiseClone (); } } [Test] public void InlineIf () { AssertRuleFailure ("Clone", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/AvoidCallingProblematicMethodsTest.cs0000664000175000017500000001531212413742070035550 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidCallingProblematicMethodsRule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Configuration.Assemblies; using System.Security.Policy; using System.Reflection; using System.Collections.Generic; using System.Threading; using Microsoft.Win32.SafeHandles; using Gendarme.Rules.BadPractice; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.BadPractice { [TestFixture] public class AvoidCallingProblematicMethodsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] instruction AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void MethodWithGCCall () { List list = new List (); list.Add ("foo"); list.Add ("bar"); list = null; GC.Collect (); GC.Collect (1); } [Test] public void MethodWithGCCallTest () { AssertRuleFailure ("MethodWithGCCall", 2); } public void MethodWithThreadSuspendCall () { Thread thread = new Thread (delegate () { Console.WriteLine ("Stupid code"); }); thread.Suspend (); } [Test] public void MethodWithThreadSuspendCallTest () { AssertRuleFailure ("MethodWithThreadSuspendCall"); } public void MethodWithThreadResumeCall () { Thread thread = new Thread (delegate () { Console.WriteLine ("Useless code"); }); thread.Resume (); } [Test] public void MethodWithThreadResumeCallTest () { AssertRuleFailure ("MethodWithThreadResumeCall"); } public void MethodWithInvokeMemberWithPrivateFlagsCall () { this.GetType ().InvokeMember ("Foo", BindingFlags.NonPublic | BindingFlags.DeclaredOnly, null, null, Type.EmptyTypes); this.GetType ().InvokeMember ("Foo", BindingFlags.NonPublic | BindingFlags.Static, null, null, Type.EmptyTypes, CultureInfo.CurrentCulture); this.GetType ().InvokeMember ("Foo", BindingFlags.NonPublic | BindingFlags.Instance, null, null, Type.EmptyTypes, null, CultureInfo.CurrentCulture, null); } [Test] public void MethodWithInvokeMemberWithPrivateFlagsCallTest () { AssertRuleFailure ("MethodWithInvokeMemberWithPrivateFlagsCall", 3); } public void MethodWithInvokeMemberWithoutPrivateFlagsCall () { this.GetType ().InvokeMember ("Foo", BindingFlags.Public | BindingFlags.IgnoreCase, null, null, Type.EmptyTypes); this.GetType ().InvokeMember ("Foo", BindingFlags.Public | BindingFlags.Instance, null, null, Type.EmptyTypes, CultureInfo.CurrentCulture); this.GetType ().InvokeMember ("Foo", BindingFlags.Public | BindingFlags.DeclaredOnly, null, null, Type.EmptyTypes, null, CultureInfo.CurrentCulture, null); } public void MethodWithInvokeMemberWithUnkownFlagsCall (BindingFlags flags) { this.GetType ().InvokeMember ("Foo", flags, null, null, Type.EmptyTypes); } public void MethodWithInvokeMemberWithLargeValueCall () { BindingFlags flags = (BindingFlags) Int32.MinValue; this.GetType ().InvokeMember ("Foo", flags, null, null, Type.EmptyTypes, null, CultureInfo.CurrentCulture, null); } [Test] public void MethodWithInvokeMemberWithoutPrivateFlagsCallTest () { AssertRuleSuccess ("MethodWithInvokeMemberWithoutPrivateFlagsCall"); AssertRuleSuccess ("MethodWithInvokeMemberWithUnkownFlagsCall"); AssertRuleSuccess ("MethodWithInvokeMemberWithLargeValueCall"); } private class MySafeHandle : SafeHandleZeroOrMinusOneIsInvalid { public MySafeHandle () : base (true) { } protected override bool ReleaseHandle () { return true; } } public void MethodWithSafeHandleDangerousGetHandleCall () { MySafeHandle myHandle = new MySafeHandle (); IntPtr handlePtr = myHandle.DangerousGetHandle (); } [Test] public void MethodWithSafeHandleDangerousGetHandleCallTest () { AssertRuleFailure ("MethodWithSafeHandleDangerousGetHandleCall"); } public void MethodWithAssemblyLoadFromCall () { Assembly.LoadFrom ("myAssembly.dll"); Assembly.LoadFrom ("myAssembly.dll", new Evidence ()); Assembly.LoadFrom ("myAssembly.dll", new Evidence (), null, AssemblyHashAlgorithm.None); } [Test] public void MethodWithAssemblyLoadFromCallTest () { AssertRuleFailure ("MethodWithAssemblyLoadFromCall", 3); } public void MethodWithAssemblyLoadFileCall () { Assembly.LoadFile ("myAssembly.dll"); Assembly.LoadFile ("myAssembly.dll", new Evidence ()); } [Test] public void MethodWithAssemblyLoadFileCallTest () { AssertRuleFailure ("MethodWithAssemblyLoadFileCall", 2); } public void MethodWithAssemblyLoadWithPartialNameCall () { Assembly.LoadWithPartialName ("MyAssembly"); Assembly.LoadWithPartialName ("MyAssembly", new Evidence ()); } [Test] public void MethodWithAssemblyLoadWithPartialNameCallTest () { AssertRuleFailure ("MethodWithAssemblyLoadWithPartialNameCall", 2); } public void MethodWithouAnyDangerousCall () { List list = new List (); list.Add ("Foo"); list.Add ("Bar"); } [Test] public void MethodWithouAnyDangerousCallTest () { AssertRuleSuccess ("MethodWithouAnyDangerousCallTest"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Test/Tests.Rules.BadPractice.csproj0000775000175000017500000001544112413742070034102 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {C95DBCDA-ED1D-4B77-93CD-E27B37B84577} Library Properties Tests.Rules.BadPractice Tests.Rules.BadPractice v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full true bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {7FF6D373-551E-4C6B-98FA-D1D883FD2502} Gendarme.Rules.BadPractice False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/Makefile.am0000664000175000017500000000363112413742070027435 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AvoidAssemblyVersionMismatchRule.cs \ AvoidCallingProblematicMethodsRule.cs \ AvoidNullCheckWithAsOperatorRule.cs \ AvoidVisibleConstantFieldRule.cs \ CheckNewExceptionWithoutThrowingRule.cs \ CheckNewThreadWithoutStartRule.cs \ CloneMethodShouldNotReturnNullRule.cs \ ConstructorShouldNotCallVirtualMethodsRule.cs \ DisableDebuggingCodeRule.cs \ DoNotDecreaseVisibilityRule.cs \ DoNotForgetNotImplementedMethodsRule.cs \ DoNotUseEnumIsAssignableFromRule.cs \ DoNotUseGetInterfaceToCheckAssignabilityRule.cs \ EqualShouldHandleNullArgRule.cs \ GetEntryAssemblyMayReturnNullRule.cs \ ObsoleteMessagesShouldNotBeEmptyRule.cs \ OnlyUseDisposeForIDisposableTypesRule.cs \ PreferEmptyInstanceOverNullRule.cs \ PreferParamsArrayForVariableArgumentsRule.cs \ PreferTryParseRule.cs \ PreferSafeHandleRule.cs \ ReplaceIncompleteOddnessCheckRule.cs \ ReturnNullRule.cs \ ToStringReturnsNullRule.cs \ UseFileOpenOnlyWithFileAccessRule.cs tests_sources = \ AvoidAssemblyVersionMismatchTest.cs \ AvoidCallingProblematicMethodsTest.cs \ AvoidNullCheckWithAsOperatorTest.cs \ AvoidVisibleConstantFieldTest.cs \ CheckNewExceptionWithoutThrowingTest.cs \ CheckNewThreadWithoutStartTest.cs \ CloneMethodShouldNotReturnNullTest.cs \ ConstructorShouldNotCallVirtualMethodsTest.cs \ DoNotDecreaseVisibilityTest.cs \ DoNotForgetNotImplementedMethodsTest.cs \ DoNotUseEnumIsAssignableFromTest.cs \ DoNotUseGetInterfaceToCheckAssignabilityTest.cs \ DisableDebuggingCodeTest.cs \ EqualShouldHandleNullArgTest.cs \ GetEntryAssemblyMayReturnNullTest.cs \ ObsoleteMessagesShouldNotBeEmptyTest.cs \ OnlyUseDisposeForIDisposableTypesTest.cs \ PreferEmptyInstanceOverNullTest.cs \ PreferParamsArrayForVariableArgumentsTest.cs \ PreferTryParseTest.cs \ PreferSafeHandleTest.cs \ ReplaceIncompleteOddnessCheckTest.cs \ ToStringReturnsNullTest.cs \ UseFileOpenOnlyWithFileAccessTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.BadPractice/AvoidAssemblyVersionMismatchRule.cs0000664000175000017500000001064312413742070034357 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.BadPractice.AvoidAssemblyVersionMismatchRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.BadPractice { /// /// This rule checks that the [AssemblyVersion] matches the [AssemblyFileVersion] /// when both are present inside an assembly. Having different version numbers in both /// attributes can be confusing once the application is deployed. /// /// /// Bad example: /// /// [assembly: AssemblyVersion ("2.2.0.0")] /// [assembly: AssemblyFileVersion ("1.0.0.0")] /// /// /// /// Good example: /// /// [assembly: AssemblyVersion ("2.2.0.0")] /// [assembly: AssemblyFileVersion ("2.2.0.0")] /// /// /// This rule is available since Gendarme 2.2 [Problem ("The assembly version, from [AssemblyVersion], does not match the file version, from [AssemblyFileVersion].")] [Solution ("This situation can be confusing once deployed. Make sure both version are identical.")] public class AvoidAssemblyVersionMismatchRule : Rule, IAssemblyRule { public RuleResult CheckAssembly (AssemblyDefinition assembly) { if (!assembly.HasCustomAttributes) return RuleResult.DoesNotApply; // once compiled [AssemblyVersion] is not part of the custom attributes Version assembly_version = assembly.Name.Version; // if only one version is specified then there's no mismatch if (assembly_version.IsEmpty ()) return RuleResult.DoesNotApply; Version file_version = null; foreach (CustomAttribute ca in assembly.CustomAttributes) { // AssemblyFileVersionAttribute has a single ctor taking a string value // http://msdn.microsoft.com/en-us/library/system.reflection.assemblyfileversionattribute.assemblyfileversionattribute.aspx // any attribute without arguments can be skipped if (!ca.HasConstructorArguments) continue; if (!ca.AttributeType.IsNamed ("System.Reflection", "AssemblyFileVersionAttribute")) continue; Version.TryParse (ca.ConstructorArguments [0].Value as string, out file_version); break; } // if only one version is specified then there's no mismatch if (file_version.IsEmpty ()) return RuleResult.DoesNotApply; // rule applies since both versions are present // adjust severity based on the difference between the versions // a revision/build difference is less likely to be confusing than // a difference between the major or minor numbers Severity s = Severity.Low; if (assembly_version.Major != file_version.Major) s = Severity.Critical; else if (assembly_version.Minor != file_version.Minor) s = Severity.High; else if (assembly_version.Build != file_version.Build) s = Severity.Medium; else if (assembly_version.Revision == file_version.Revision) return RuleResult.Success; string msg = String.Format (CultureInfo.InvariantCulture, "Assembly version is '{0}' while file version is '{1}'.", assembly_version, file_version); Runner.Report (assembly, s, Confidence.High, msg); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/rules.xml0000664000175000017500000001344212413742070022303 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/0000775000175000017500000000000012642235742024455 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ChangeLog0000664000175000017500000007625612413742070026240 0ustar00directhexdirecthex000000000000002010-06-13 Sebastien Pouliot * ConsiderAddingInterfaceRule.cs: * PreferXmlAbstractionsRule.cs: * TypesWithDisposableFieldsShouldBeDisposableRule.cs: * TypesWithNativeFieldsShouldBeDisposableRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-05 Sebastien Pouliot * AvoidSmallNamespaceRule.cs: Use a unique NamespaceDefinition (not a new one each time) when reporting a defect 2010-05-24 Sebastien Pouliot * Makefile.am: Add define for CODE_ANALYSIS on unit tests (required for [SuppressMessage] to be present) and add GlobalSuppressions.cs to the build 2010-05-08 Sebastien Pouliot * ConsiderConvertingMethodToPropertyRule.cs: Apply AvoidRepetitive CallsToPropertiesRule to MethodDefinition.get_Name 2010-01-29 Sebastien Pouliot * AvoidPublicInstanceFieldsRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule on FieldDefinition.get_Name 2010-01-28 Sebastien Pouliot * ProvideTryParseAlternativeRule.cs: Simplify and reduce code duplication by using the new MethodSignatures.[Try]Parse 2010-01-24 Sebastien Pouliot * ProvideTryParseAlternativeRule.cs: New. Rule to suggest adding TryParse method(s) to types that already provide Parse method(s) * Makefile.am: Add new rule and tests to the build 2010-01-23 Sebastien Pouliot * DeclareEventHandlersCorrectlyRule.cs: Apply AvoidUnnecessary SpecializationRule and AvoidRepetitiveCallsToPropertiesRule * UseCorrectDisposeSignaturesRule.cs: Apply MethodCanBeMadeStatic Rule, ProvideCorrectArgumentsToFormattingMethodsRule and Avoid UnusedParametersRule * UseFlagsAttributeRule.cs: Apply MethodCanBeMadeStaticRule 2010-01-19 Jb Evain * DisposableTypesShouldHaveFinalizerRule.cs: the rule does not apply on generated types such as generators. 2010-01-17 Sebastien Pouliot * AttributeArgumentsShouldHaveAccessorsRule.cs: Avoid boxing when concatenating strings * AvoidPublicInstanceFieldsRule.cs: Avoid boxing when concatenating strings 2010-01-01 Sebastien Pouliot * AvoidRefAndOutParametersRule.cs: Use new IsRef rock 2009-12-13 Sebastien Pouliot * DisposableTypesShouldHaveFinalizerRule.cs: Report an additional defect for struct, which cannot define a finalizer. 2009-08-11 Jesse Jones * AvoidSmallNamespaceRule.cs, DeclareEventHandlersCorrectlyRule.cs, DontDeclareProtectedFieldsInSealedClassRule.cs, AttributeArgumentsShouldHaveAccessorsRule.cs, AvoidMultidimensionalIndexerRule.cs: Rewrote the descriptions. 2009-07-02 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-03-27 Cedric Vivier * PreferXmlAbstractionsRule.cs: New. Rule that checks if visible methods signatures uses XmlDocument, XPathDocument or XmlNode instead of a more flexible/efficient abstraction. 2009-03-13 Sebastien Pouliot * Makefile.am: Fix 'make-clean' (found by dna) and compile all rules (even the last one) 2009-02-21 Jesse Jones * Makefile.am, UseCorrectDisposeSignaturesRule.cs: added new rule. 2009-01-23 Jesse Jones * Makefile.am: fixed line continuations. 2009-01-20 Jesse Jones * UseFlagsAttributeRule.cs: fixed misspelled "Serializeable", improved solution text. 2009-01-12 Jesse Jones * UseFlagsAttributeRule.cs, Makefile.am: added new rule. 2009-01-09 Jesse Jones * FlagsShouldNotDefineAZeroValueRule.cs: fixed the description so that it points to bitwise operators instead of boolean operators as being the problem, fixed some misspellings/bad english in the description, added [Serializable] to example code. 2008-12-06 Sebastien Pouliot * AvoidRefAndOutParametersRule.cs: Use HasParameters * ConsiderConvertingFieldToNullableRule.cs: Use HasFields 2008-11-30 Sebastien Pouliot * AvoidEmptyInterfaceRule.cs: Use HasMethods and HasInterfaces * AvoidMultidimensionalIndexerRule.cs: Use HasParameters * AvoidPropertiesWithoutGetAccessorRule.cs: Use HasProperties * ConsiderAddingInterfaceRule.cs: Use HasMethods, HasParameters and HasGenericParameters. * ConsiderUsingStaticTypeRule.cs: Use HasFields, HasMethods and HasConstructors * DeclareEventHandlersCorrectlyRule.cs: Use HasEvents and HasParameters * MarkAssemblyWithAttributeRule.cs: Use HasCustomAttributes * UsingCloneWithoutImplementingICloneableRule.cs: Use HasParameters 2008-11-20 Sebastien Pouliot * AvoidRefAndOutParametersRule.cs: Specify StringComparison.Ordinal when calling String.[Starts|Ends]With. * ConsiderConvertingFieldToNullableRule.cs: Specify StringComparison. Ordinal when calling String.EndsWith. * ConsiderConvertingMethodToPropertyRule.cs: Specify StringComparison.Ordinal when calling String.EndsWith. * ImplementIComparableCorreclyRule.cs: Apply the rule to types that directly implement IComparable. * InternalNamespacesShouldNotExposeTypesRule.cs: Specify StringComparison.Ordinal when calling String.EndsWith. * PreferEventsOverMethodsRule.cs: Get method name out of the loop. Specify StringComparison.Ordinal when calling String.StartsWith. * TypesWithDisposableFieldsShouldBeDisposableRule.cs: Skip fields type that are primitives or enums (as they wont be disposable). 2008-11-15 Sebastien Pouliot * ConsiderAddingInterfaceRule.cs: Only check the current assembly or assemblies (from the set) that refers to the current assembly. Huge performance boost when a large number of assemblies are used. 2008-11-13 Sebastien Pouliot * AvoidMultidimensionalIndexerRule.cs, AvoidSmallNamespaceRule.cs, ConsiderAddingInterfaceRule.cs, DeclareEventHandlersCorrectlyRule.cs, MarkAssemblyWithCLSCompliantRule.cs, MarkAssemblyWithComVisibleRule.cs, OverrideEqualsMethodRule.cs, PreferEventsOverMethodsRule.cs, ProvideAlternativeNamesForOperatorOverloadsRule.cs, TypesWithNativeFieldsShouldBeDisposableRule.cs: Small update to XML documentation. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Design.mdp: * Gendarme.Rules.Design.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-30 Sebastien Pouliot * ConsiderAddingInterfaceRule.cs: Fix reporting the issue. This rule analyze interfaces but report defects on types (a bit unusual) so it needs to build its own Defect instance since the Report overloads already have the rule and target set by the runner. 2008-10-30 Cedric Vivier * ConsiderAddingInterfaceRule.cs: New. Rule to check if a type could declare it implements an interface. 2008-10-27 Sebastien Pouliot * FinalizersShouldCallBaseClassFinalizerRule.cs: Moved to Correctness since this is not (API) design. * Gendarme.Rules.Design.mdp: Remove (moved) rule from build. * Makefile.am: Remove (moved) rule and unit test from build. 2008-10-26 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: Moved to Correctness since this is not (API) design. * MarkAssemblyWithAssemblyVersionRule.cs: New. Rule that checks if the assembly name has a version number. * MarkAssemblyWithAttributeRule.cs: New. Abstract class to check for the presence of a specific attribute in an assembly. * MarkAssemblyWithCLSCompliantRule.cs: New. Rule that checks if the assembly has a [CLSCompliant] attribute. * MarkAssemblyWithComVisibleRule.cs: New. Rule that checks if the assembly has a [ComVisible] attribute. * Gendarme.Rules.Design.mdp: New. Add new rules to the project file and remove the moved one. * Makefile.am: Add(3) and remove(1) rules and tests. 2008-10-25 Sebastien Pouliot * AvoidSmallNamespaceRule.cs: Rename Namespace to NamespaceDefinition. 2008-10-25 Cedric Vivier * AvoidVisibleFieldsRule.cs: Change text to reflect the new rule name. 2008-10-24 Sebastien Pouliot * AvoidSmallNamespaceRule.cs: Update TearDown call with API change. * ConsiderConvertingFieldToNullableRule.cs: Change GetValueTypeField visibility to private. * DeclareEventHandlersCorrectlyRule.cs: Update TearDown call with API change. * DefineAZeroValueRule.cs: Add null check in GetZeroValueField (self-test) * PreferEventsOverMethodsRule.cs: New. Rule to warn about methods that looks like candidates for events. * Makefile.am: Add new rule and test to the build and sort all source filenames 2008-10-21 Sebastien Pouliot * DeclareEventHandlersCorrectlyRule.cs: Avoid specialization of CheckParameterName parameters (self-test). * EnsureSymmetryForOverloadedOperatorsRule.cs: Avoid specialization of CheckOperatorPair parameters (self-test). 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Design.xml, * doc/Gendarme.Rules.Design: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-19 Sebastien Pouliot * AvoidSmallNamespaceRule.cs: New. Rule to warn about namespaces that have very few visible types. * DeclareEventHandlersCorrectlyRule.cs: Reduce long chain (self-test) and avoid unneeded specialized of soem methods (self-test). * InternalNamespacesShouldNotExposeTypesRule.cs: New. Rule to warn if an internal namespace declare types that are visible outside the assembly, making the namespace itself visible. * Gendarme.Rules.Design.mdp: Add new rule to MD project file. * Makefile.am: Add new rule and test to the build. 2008-10-16 Sebastien Pouliot * DeclareEventHandlersCorrectlyRule.cs, EnumsShouldUseInt32Rule.cs: Fix XML documentation to be valid (otherwise it wont generate docs) 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-10-06 Sebastien Pouliot * AvoidRefAndOutParametersRule.cs: Add XML documentation and two [FxCopCompatibility] attributes. Ignore p/invokes since they often need ref and out but should not be visible (but there's a specific rule for that). * AvoidVisibleNestedTypesRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * ConsiderConvertingFieldToNullableRule.cs: Add XML documentation. Avoid unnecessary specialization in IsHasField (self-test). * ConsiderConvertingMethodToPropertyRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Remove duplicate check. * ConsiderUsingStaticTypeRule.cs: Add XML documentation. Fix constructor parameter check. * DeclareEventHandlersCorrectlyRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Add more precise handling of generics. 2008-10-05 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Ignore enums, interfaces and delegates. Split CheckType and avoid unneeded specialization of some parameters (self-tests). * DisposableTypesShouldHaveFinalizerRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Ignore enums and delegates. * DoNotDeclareVirtualMethodsInSealedTypeRule.cs: New. Rule to check if sealed types introduce new virtual methods. * DontDeclareProtectedFieldsInSealedClassRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Ignore enums, value types and delegates. Add check for members (not just fields). * EnsureSymmetryForOverloadedOperatorsRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Ignore delegates. * Makefile.am: Add new rule and test to the build. 2008-10-04 Sebastien Pouliot * EnumsShouldDefineAZeroValueRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * EnumsShouldUseInt32Rule.cs: Avoid throwing an exception in an invalid case. Add XML documentation and [FxCopCompatibility] attribute. * FinalizersShouldBeProtectedRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * FinalizersShouldCallBaseClassFinalizerRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * FlagsShouldNotDefineAZeroValueRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Lessen severity if the field is named "None". * ImplementEqualsAndGetHashCodeInPairRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Ignore delegates. 2008-10-03 Sebastien Pouliot * ImplementIComparableCorreclyRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * MainShouldNotBePublicRule.cs: Add XML documentation. * MissingAttributeUsageOnCustomAttributeRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * OperatorEqualsShouldBeOverloadedRule.cs: Add XML documentation and two [FxCopCompatibility] attributes. Ignore delegates. * OverrideEqualsMethodRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Ignore delegates. * PreferIntegerOrStringForIndexersRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * ProvideAlternativeNamesForOperatorOverloadsRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Ignore delegates. 2008-10-02 Sebastien Pouliot * TypesShouldBeInsideNamespacesRule.cs: Add XML documentation. Add [FxCopCompatibility] attribute mapping. * TypesWithDisposableFieldsShouldBeDisposableRule.cs: Add XML documentation. Add [FxCopCompatibility] attribute mapping. Add more cases where we return DoesNotApply. Remove case for explicit abstract since this won't compile anyway. * TypesWithNativeFieldsShouldBeDisposableRule.cs: Add XML documentation. Add [FxCopCompatibility] attribute mapping. Add more cases where we return DoesNotApply. Remove case for explicit abstract since this won't compile anyway. * UsingCloneWithoutImplementingICloneableRule.cs: Rename rule to ImplementICloneableCorrectlyRule. Add XML documentation. 2008-09-30 Sebastien Pouliot * AbstractTypesShouldNotHavePublicConstructorsRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * AttributeArgumentsShouldHaveAccessorsRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * AvoidEmptyInterfaceRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * AvoidMultidimensionalIndexerRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * AvoidPropertiesWithoutGetAccessorRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * AvoidPublicInstanceFieldsRule.cs: Rename to AvoidVisibleFieldsRule. Add XML documentation and [FxCopCompatibility] attribute. 2008-09-19 Sebastien Pouliot * DeclareEventHandlersCorrectlyRule.cs: Remove the unneeded call to String.Format (only a string parameter) [self-test] 2008-09-19 Néstor Salceda * DeclareEventHandlersCorrectlyRule.cs: Fix the false positive found by Sebastien when running the self-test target. The problem was for the generic EventHandler; and use this delegate is correct because the compiler enforces the type safety. 2008-09-18 Sebastien Pouliot * DeclareEventHandlersCorrectlyRule.cs: I misguided Nestor :( The logic is now to report against the EventDefinition (in the assembly being analyzed) instead of reporting against the delegate (which could be outside of the developer's control). 2008-09-18 Néstor Salceda * DeclareEventHandlersCorrectlyRule.cs: New. Rule that check conventions when you are writting events. * Gendarme.Rules.Design.mdp: Updated MD project file. * Makefile.am: Added rule and test to the build. 2008-08-28 Sebastien Pouliot * AvoidRefAndOutParametersRule.cs: Add the attributes for the two fxcop rules that match this one. * OperatorEqualsShouldBeOverloadedRule.cs: This does not apply to delegates. 2008-08-26 Sebastien Pouliot * ImplementGenericCollectionInterfacesRule.cs: Moving to Design.Generic * Makefile.am, Gendarme.Rules.Design.mdp: Remove rule from build files. 2008-08-10 Sebastien Pouliot * AbstractTypesShouldNotHavePublicConstructorsRule.cs, AvoidEmptyInterfaceRule.cs, AvoidPropertiesWithoutGetAccessorRule.cs, DisposableTypesShouldHaveFinalizerRule.cs, DontDeclareProtectedFieldsInSealedClassRule.cs, EnumsShouldDefineAZeroValueRule.cs, FinalizersShouldBeProtectedRule.cs, FinalizersShouldCallBaseClassFinalizerRule.cs, FlagsShouldNotDefineAZeroValueRule.cs, MissingAttributeUsageOnCustomAttributeRule.cs, OverrideEqualsMethodRule.cs, TypesShouldBeInsideNamespacesRule.cs, UsingCloneWithoutImplementingICloneableRule.cs: Use shorter override. 2008-08-06 Peter Johanson * AvoidPublicInstanceFieldsRule.cs: Make the rule not apply to private or internal nested types. 2008-08-02 Sebastien Pouliot * ConsiderConvertingFieldToNullableRule.cs: Don't duplicate FX check in both Initialize and CheckType (removed). * ImplementGenericCollectionInterfacesRule.cs: Move FX check into the Initialize method - this will make it faster for 1.x assemblies. 2008-07-23 Nestor Salceda * ConsiderUsingStaticTypeRule.cs: Fix the rule in order to avoid false positives with empty clases and inheritance. 2008-07-13 Sebastien Pouliot * AvoidMultidimensionalIndexerRule.cs: New. Rule that warns if indexers using multidimentional indexes are found. * PreferIntegerOrStringForIndexersRule.cs: New. Rule that warns if indexers uses something other that string, integers or object as their index. * Gendarme.Rules.Design.mdp: Add rule to MD project file. * Makefile.am: Add rule and test to the build. 2008-07-13 Sebastien Pouliot * AvoidRefAndOutParametersRule.cs: New. Rule to warn for visible API that expose ref or out parameters. This help keeping the public API as simple as possible. * ConsiderConvertingFieldToNullableRule.cs: Change some methods (using ref) from protected (no need) to private. * Gendarme.Rules.Design.mdp: Add rule to MD project file. * Makefile.am: Add rule and test to the build. 2008-07-12 Sebastien Pouliot * ConsiderUsingStaticTypeRule.cs: New. Rule that warn if a type could be changed into a static type. This rule is 2.0+ specific. * Makefile.am: Add rule and test to the build. 2008-07-08 Sebastien Pouliot * Makefile.am: Rebuild if the framework has changed. 2008-06-08 Sebastien Pouliot * AvoidVisibleNestedTypesRule.cs: New. Rule that warn about nested types that are visible. * Gendarme.Rules.Design.mdp: Add rule to MD project file. * Makefile.am: Add rule and test to the build. 2008-05-04 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: Simplify finding Dispose methods a bit (self-test). 2008-05-04 Sebastien Pouliot * UsingCloneWithoutImplementingICloneableRule.cs: Change rule not to warn when Clone return something else than System.Object since implementing ICloneable won't be enough anyway (and changing to System.Object just add unneeded casts). 2008-05-01 Sebastien Pouliot * ConsiderConvertingFieldToNullableRule.cs: New. Rule to promote the use of nullable fields inside types [Cedric Vivier]. * Makefile.am: Add rule and test to the build. 2008-04-26 Sebastien Pouliot * ConsiderConvertingMethodToPropertyRule.cs: Add checks for methods starting with Has*. Patch from Cedric Vivier. 2008-04-12 Sebastien Pouliot * OperatorEqualsShouldBeOverloadedRule.cs: Fix Problem/Solution attributes to match the rule. Found by Ben Motmans. 2008-04-11 Sebastien Pouliot * ConsiderConvertingMethodToPropertyRule.cs: Don't apply the rule to overrides. Don't check Set* methods but report them if we find an appropriate Get* method (single defect). 2008-04-09 Sebastien Pouliot * ImplementEqualsAndGetHashCodeInPairRule.cs: Fix message (spotted by Andy Hume). 2008-04-08 Nestor Salceda * TypesWithDisposableFieldsShouldBeDisposableRule.cs: Fixed a typo. 2008-04-03 Daniel Abramov * ImplementGenericCollectionInterfacesRule.cs: New rule to check if the class implementing IEnumerable implements IEnumerable too (only for .NET 2.0+). * Gendarme.Rules.Design.mdp: Add rule to MD project file. * Makefile.am: Add rule and test to the build. 2008-03-30 Sebastien Pouliot * ImplementIComparableCorreclyRule.cs: New. Rule to check that IComparable, and it's generic version: IComparable, are implemented correctly, i.e. override Equals and provide the ==, !=, < and > operators. * Gendarme.Rules.Design.mdp: Add rule to MD project file. * Makefile.am: Add rule and test to the build. 2008-03-16 Sebastien Pouliot * AvoidPublicInstanceFieldsRule.cs: Ignore code generated by CSC for anonymous types (i.e. inner type that defines public fields). 2008-03-12 Sebastien Pouliot * Makefile.am: Add reference to Test.Rules to the unit test assembly. 2008-02-16 Sebastien Pouliot * TypesWithDisposableFieldsShouldBeDisposableRule.cs: Don't check code generated by compilers or tools since the developer cannot do (much) on them. 2008-02-15 Sebastien Pouliot * AvoidEmptyInterfaceRule.cs: Oops, wrong/duplicate rule. 2008-02-15 Sebastien Pouliot * AbstractTypesShouldNotHavePublicConstructorsRule.cs * AttributeArgumentsShouldHaveAccessorsRule.cs * AvoidEmptyInterfaceRule.cs * AvoidPropertiesWithoutGetAccessorRule.cs * AvoidPublicInstanceFieldsRule.cs * ConsiderConvertingMethodToPropertyRule.cs * DefineAZeroValueRule.cs * DisposableFieldsShouldBeDisposedRule.cs * DisposableTypesShouldHaveFinalizerRule.cs * DontDeclareProtectedFieldsInSealedClassRule.cs * EnsureSymmetryForOverloadedOperatorsRule.cs * EnumsShouldDefineAZeroValueRule.cs * EnumsShouldUseInt32Rule.cs * FinalizersShouldBeProtectedRule.cs * FinalizersShouldCallBaseClassFinalizerRule.cs * FlagsShouldNotDefineAZeroValueRule.cs * ImplementEqualsAndGetHashCodeInPairRule.cs * MainShouldNotBePublicRule.cs * MissingAttributeUsageOnCustomAttributeRule.cs * OperatorEqualsShouldBeOverloadedRule.cs * OverrideEqualsMethodRule.cs * ProvideAlternativeNamesForOperatorOverloadsRule.cs * TypesShouldBeInsideNamespacesRule.cs * TypesWithDisposableFieldsShouldBeDisposableRule.cs * TypesWithNativeFieldsShouldBeDisposableRule.cs * UsingCloneWithoutImplementingICloneableRule.cs: Update rules wrt framework changes. 2008-02-07 Sebastien Pouliot * EnumsShouldUseInt32Rule.cs: New. Rule to warn about enumations that are not based on Int32. * Gendarme.Rules.Design.mdp: Update project file. * Gendarme.Rules.Design.xml.in: Add new rule description. * Makefile.am: Add new rule/test to the build. 2008-02-07 Nestor Salceda * DisposableTypesShouldHaveFinalizerRule.cs, FinalizersShouldCallBaseClassFinalizerRule.cs, FinalizersShouldBeProtectedRule.cs: Replaced TypeDefinition.GetFinalizer with TypeDefinition.GetMethod for avoid some warnings when compiling. 2008-01-29 Sebastien Pouliot * ProvideAlternativeNamesForOperatorOverloadsRule.cs: Change op_Inequality alternative to (not) Equals instead of Compare. 2008-01-28 Sebastien Pouliot * ProvideAlternativeNamesForOperatorOverloadsRule.cs: Adapt for API changes in MethodSignature. 2008-01-27 Sebastien Pouliot * TypesShouldBeInsideNamespacesRule.cs: Don't report nested types since the declaring type will already be reported and a single *fix* is required (and more related to the declaring type than then nested one). 2008-01-24 Sebastien Pouliot * ImplementEqualsAndGetHashCodeInPairRule.cs: This replace Gendarme. Rule.BadPractice.ImplementingEqualsButNotGetHashCodeAndViceVersaRule. Renamed, moved & rockified. * Gendarme.Rules.Design.xml.in: Moved description. * Makefile.am: Added (moved) rule and tests. 2008-01-18 Sebastien Pouliot * DisposableHelper.cs: Removed. * EnsureSymmetryForOverloadedOperatorsTest.cs: New. Rule that ensure operators are overloaded in symmetry [Andreas Noever]. * DisposableFieldsShouldBeDisposedRule.cs: Adapted to use rocks instead of DisposableHelper. * OperatorEqualsShouldBeOverloadedTest.cs: New. Rule that ensure that operator == is overloaded when required [Andreas Noever]. * OverrideEqualsMethodTest.cs: New. Rule that ensure that method Equals is overriden when required [Andreas Noever]. * ProvideAlternativeNamesForOperatorOverloadsTest.cs: New. Rule that ensure alternate methods are provided for operators [Andreas Noever]. * TypesWithDisposableFieldsShouldBeDisposableRule.cs: Adapted to use rocks instead of DisposableHelper. * TypesWithNativeFieldsShouldBeDisposableRule.cs: Adapted to use rocks instead of DisposableHelper. * Gendarme.Rules.Design.xml.in: Add new rule descriptions. * Makefile.am: Add new rules/tests to the build. 2008-01-14 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: Exclude generated code from results (to reduce false positives). * FinalizersShouldBeProtectedRule.cs: New. Rule to ensure that every finalizer is protected. * FinalizersShouldCallBaseClassFinalizerRule.cs: New. Rule to ensure that every finalizer calls it's base class. * Gendarme.Rules.Design.mdp: Add new files to MD project file. * Gendarme.Rules.Design.xml.in: Added new rule descriptions. * Makefile.am: Add new rules/tests to the build. 2008-01-13 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: Add check for static fields. * DisposableTypesShouldHaveFinalizerRule.cs: Add check for static fields. * TypesWithDisposableFieldsShouldBeDisposableRule.cs: Add checks for structs and static fields. * TypesWithNativeFieldsShouldBeDisposableRule.cs: Add checks for structs and static fields. 2008-01-12 Sebastien Pouliot * DisposableFieldsShouldBeDisposedRule.cs: New. Rule that check that disposable fields are disposed by the Dispose method. [Andreas Noever] * DisposableHelper.cs: Helper methods for new rules [Andreas Noever] * DisposableTypesShouldHaveFinalizerRule.cs: New. Rule that check that classes with disposable fields have a finalizer. [Andreas Noever] * TypesWithDisposableFieldsShouldBeDisposableRule.cs: New. Rule that check that classes with disposable types implements IDisposable [Andreas Noever]. * TypesWithNativeFieldsShouldBeDisposableRule.cs: New. Rule that check that classes with native fields implements IDisposable [Andreas Noever] * Gendarme.Rules.Design.mdp: Add new files to MD project file. * Gendarme.Rules.Design.xml.in: Added new rule descriptions. * Makefile.am: Add new rules/tests to the build. 2008-01-12 Sebastien Pouliot * AttributeArgumentsShouldHaveAccessorsRule.cs: New. Rule that check that all attribute's constructors have read-only properties (get) that match their parameters [Daniel Abramov] * Gendarme.Rules.Design.xml.in: Added new rule descriptions. * Makefile.am: Add new rules/tests to the build. 2008-01-05 Sebastien Pouliot * MissingAttributeUsageOnCustomAttributeRule.cs: New. Rule that checks for attributes without a [AttributeUsage] attribute [Daniel Abramov] * Gendarme.Rules.Design.xml.in: Added new rule descriptions. * Gendarme.Rules.Design.mdp: Added files to MonoDevelop project file. * Makefile.am: Add new rules/tests to the build. 2008-01-04 Sebastien Pouliot * AvoidPublicInstanceFieldsRule.cs: New. Rule to check for public instance fields that could be converted into properties [Adrian Tsai] * ConsiderConvertingMethodToPropertyRule.cs: New. Rule to check for methods that could be converted into properties [Adrian Tsai] * Gendarme.Rules.Design.xml.in: Added new rule descriptions. * Gendarme.Rules.Design.mdp: Added files to MonoDevelop project file. * Makefile.am: Add new rules/tests to the build. 2007-12-28 Sebastien Pouliot * MainShouldNotBePublicRule.cs: New. Rule to check that the Main entry point isn't visible outside it's assembly. By Daniel Abramov. * Gendarme.Rules.Design.xml.in: Added new rule description. * Gendarme.Rules.Design.mdp: Add new file to MonoDevelop project file. * Makefile.am: Add new rule/tests to the build. 2007-12-26 Sebastien Pouliot * AbstractTypesShouldNotHavePublicConstructorsRule.cs: New. Rule to check for public constructors inside abstract classes. * AvoidEmptyInterfaceRule.cs: New. Rule to check for empty interfaces * AvoidPropertiesWithoutGetAccessorRule.cs: New. Rule to check for properties with only a setter. * DefineAZeroValueRule.cs: New. Abstract base class for [EnumsShould|FlagsShouldNot]DefineAZeroValueRule. * DontDeclareProtectedFieldsInSealedClassRule.cs: Updated to use simpler Location ctor. * EnumsShouldDefineAZeroValueRule.cs: New. Rule to check that all enums, except flags, provide a 0 value. * FlagsShouldNotDefineAZeroValueRule.cs: New. Rule to check that all flags don't provide a 0 value. * TypesShouldBeInsideNamespacesRule.cs: New. Rule to check that types are defined inside namspaces. * UsingCloneWithoutImplementingICloneableRule.cs: Updated to use simpler Location ctor and rocks. * Gendarme.Rules.Design.mdp: Add new files to MonoDevelop project file. * Gendarme.Rules.Design.xml.in: Update rules descriptions. * Makefile.am: Add new rules to the build. 2007-11-22 Sebastien Pouliot * DontDeclareProtectedFieldsInSealedClassRule.cs: Avoid creating MessageCollection unless needed. * UsingCloneWithoutImplementingICloneableRule.cs: Avoid creating MessageCollection unless needed. Also check Clone methods that return the current type (not just System.Object) 2007-10-27 Nestor Salceda * Gendarme.Rules.Design.xml.in: Added Uri with the documentation for the rules. 2007-10-07 Sebastien Pouliot * DontDeclareProtectedFieldsInSealedClassRule.cs: New rule (Nidhi Rawal, GSoC 2007) * UsingCloneWithoutImplementingICloneableRule.cs: New rule (Nidhi Rawal, GSoC 2007) * Gendarme.Rules.Design.mdp: New. Project file for MonoDevelop. * Gendarme.Rules.Design.xml.in: New. Rule descriptions. * Makefile.am: New. Build file for rules and unit tests. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/MarkAssemblyWithAssemblyVersionRule.cs0000664000175000017500000000520312413742070034121 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.MarkAssemblyWithAssemblyVersionRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if an assembly does not contain a [AssemblyVersion] /// attribute. Early and correct versioning of assemblies is easy and crucial for consumers /// of your assemblies. Note that the [AssemblyVersion] should /// match the [AssemblyFileVersion] attribute (if it exists). /// /// /// Good example: /// /// [assembly: AssemblyVersion ("1.0.0.0")] /// /// /// This rule is available since Gendarme 2.2 [Problem ("This assembly is not decorated with the [AssemblyVersion] attribute.")] [Solution ("Add the missing [AssemblyVersion] attribute with a valid version number.")] [FxCopCompatibility ("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion")] public class MarkAssemblyWithAssemblyVersionRule : Rule, IAssemblyRule { // [AssemblyVersion] is not compiled into a "real" custom attribute so // we're not inheriting from MarkAssemblyWithAttributeRule for this rule public RuleResult CheckAssembly (AssemblyDefinition assembly) { if (!assembly.Name.Version.IsEmpty ()) return RuleResult.Success; Runner.Report (assembly, Severity.Critical, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/DeclareEventHandlersCorrectlyRule.cs0000664000175000017500000001665112413742070033547 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.DeclareEventHandlersCorrectlyRule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; using Mono.Cecil; namespace Gendarme.Rules.Design { /// /// This rule will fire if an event is declared with a signature which does not match /// the .NET guidelines. The return type of the event should be void (because there /// is no good way to handle return values if multiple delegates are attached to the /// event). And the event should take two arguments. The first should be of type /// System.Object and be named 'sender'. The second should be of type /// System.EventArgs (or a subclass) and named 'e'. This helps tools /// such as visual designers identify the delegates and methods which may be /// attached to events. Note that .NET 2.0 added a generic System.EventHandler /// type which can be used to easily create events with the correct signature. /// /// /// Bad example: /// /// // the second parameter (which should be System.EventArgs or a derived class) is missing /// delegate void MyDelegate (int sender); /// /// class Bad { /// public event MyDelegate CustomEvent; /// } /// /// /// /// Good example (delegate): /// /// delegate void MyDelegate (int sender, EventArgs e); /// /// class Good { /// public event MyDelegate CustomEvent; /// } /// /// /// /// Good example (generics): /// /// class Good { /// public event EventHandler<EventArgs> CustomEvent; /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("The event has an incorrect signature.")] [Solution ("You should correct the return type, parameter types, or parameter names.")] [FxCopCompatibility ("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")] public class DeclareEventHandlersCorrectlyRule : Rule, ITypeRule { static IList valid_event_handler_types = new List (); private bool CheckReturnVoid (IMetadataTokenProvider eventType, IMethodSignature invoke) { TypeReference rtype = invoke.ReturnType; if (rtype.IsNamed ("System", "Void")) return true; string msg = String.Format (CultureInfo.InvariantCulture, "The delegate should return void, not {0}", rtype.GetFullName ()); Runner.Report (eventType, Severity.Medium, Confidence.High, msg); return false; } private bool CheckAmountOfParameters (IMetadataTokenProvider eventType, IMethodSignature invoke) { if (invoke.HasParameters && (invoke.Parameters.Count == 2)) return true; Runner.Report (eventType, Severity.Medium, Confidence.High, "The delegate should have 2 parameters"); return false; } private bool CheckParameterTypes (IMetadataTokenProvider eventType, IMethodSignature invoke) { bool ok = true; if (!invoke.HasParameters) return ok; IList pdc = invoke.Parameters; int count = pdc.Count; if (count >= 1) { TypeReference ptype = pdc [0].ParameterType; if (!ptype.IsNamed ("System", "Object")) { string msg = String.Format (CultureInfo.InvariantCulture, "The first parameter should have an object, not {0}", ptype.GetFullName ()); Runner.Report (eventType, Severity.Medium, Confidence.High, msg); ok = false; } } if (count >= 2) { if (!pdc [1].ParameterType.Inherits ("System", "EventArgs")) { Runner.Report (eventType, Severity.Medium, Confidence.High, "The second parameter should be a subclass of System.EventArgs"); ok = false; } } return ok; } private bool CheckParameterName (IMetadataTokenProvider eventType, ParameterReference invokeParameter, string expectedName) { if (invokeParameter.Name == expectedName) return true; string msg = String.Format (CultureInfo.InvariantCulture, "The expected name is {0}, not {1}", expectedName, invokeParameter.Name); Runner.Report (eventType, Severity.Low, Confidence.High, msg); return false; } public RuleResult CheckType (TypeDefinition type) { if (!type.HasEvents) return RuleResult.DoesNotApply; // Note: this is a bit more complex than it seems at first sight // The "real" defect is on the delegate type, which can be a type (reference) outside the // specified assembly set (i.e. where we have no business to report defects against) but // we still want to report the defect against the EventDefinition (which is inside one of // the specified assemblies) foreach (EventDefinition each in type.Events) { TypeReference tr = each.EventType; // don't check the same type over and over again if (valid_event_handler_types.Contains (tr)) continue; TypeDefinition td = tr.Resolve (); if (td == null) continue; //If we are using the Generic //EventHandler, the compiler forces //us to write the correct signature bool valid = (td.HasGenericParameters) ? CheckGenericDelegate (td) : CheckDelegate (td); // avoid re-processing the same *valid* type multiple times if (valid) valid_event_handler_types.Add (tr); } return Runner.CurrentRuleResult; } private bool CheckDelegate (TypeReference type) { MethodReference invoke = type.GetMethod (MethodSignatures.Invoke); if (invoke == null) return false; // we cannot short-circuit since we would miss reporting some defects bool valid = CheckReturnVoid (type, invoke); valid &= CheckAmountOfParameters (type, invoke); valid &= CheckParameterTypes (type, invoke); IList pdc = invoke.Parameters; int count = pdc.Count; if (count > 0) { valid &= CheckParameterName (type, pdc [0], "sender"); if (count > 1) valid &= CheckParameterName (type, pdc [1], "e"); } return valid; } private bool CheckGenericDelegate (TypeReference type) { if (type.IsNamed ("System", "EventHandler`1")) return true; Runner.Report (type, Severity.Medium, Confidence.High, "Generic delegates should use EventHandler"); return false; } public override void TearDown () { valid_event_handler_types.Clear (); base.TearDown (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/AvoidPropertiesWithoutGetAccessorRule.cs0000664000175000017500000000601112413742070034451 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.AvoidPropertiesWithoutGetAccessorRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if an externally visible type contains a property with a setter but /// not a getter. This is confusing to users and can make it difficult to use shared /// objects. Instead either add a getter or make the property a method. /// /// /// Bad examples: /// /// public double Seed { /// // no get since there's no use case for it /// set { /// seed = value; /// } /// } /// /// public sting Password { /// // no get as we don't want to expose the password /// set { /// password = value; /// } /// } /// /// /// /// Good examples: /// /// public double Seed { /// get { /// return seed; /// } /// set { /// seed = value; /// } /// } /// /// public void SetPassword (string value) /// { /// password = value; /// } /// /// [Problem ("This type contains properties which only have setters.")] [Solution ("Add a getter to the property or change the property into a method.")] [FxCopCompatibility ("Microsoft.Design", "CA1044:PropertiesShouldNotBeWriteOnly")] public class AvoidPropertiesWithoutGetAccessorRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies to type with properties if (!type.HasProperties) return RuleResult.DoesNotApply; // rule applies foreach (PropertyDefinition property in type.Properties) { MethodDefinition setter = property.SetMethod; if (setter != null) { if (property.GetMethod == null) { Runner.Report (setter, Severity.Medium, Confidence.Total); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/UseFlagsAttributeRule.cs0000664000175000017500000001277112413742070031232 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.UseFlagsAttributeRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Diagnostics; using System.Globalization; using System.Linq; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule will fire if an enum's values look like they are intended to /// be composed together with the bitwise OR operator and the enum is not /// decorated with System.FlagsAttribute. Using FlagsAttribute will /// allow System.Enum.ToString() to return a better string when /// values are ORed together and helps indicate to readers of the code /// the intended usage of the enum. /// /// /// Bad example: /// /// [Serializable] /// enum Options { /// First = 1, /// Second = 2, /// Third = 4, /// All = First | Second | Third, /// } /// /// /// /// Good example: /// /// [Flags] /// [Serializable] /// enum Options { /// First = 1, /// Second = 2, /// Third = 4, /// All = First | Second | Third, /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("The enum seems to be composed of flag values, but is not decorated with [Flags].")] [Solution ("Add [Flags] to the enum,  change the values so that they are not powers of two, or ignore the defect.")] [FxCopCompatibility ("Microsoft.Design", "CA1027:MarkEnumsWithFlags")] public sealed class UseFlagsAttributeRule : Rule, ITypeRule { private List values = new List (); private void GetValues (TypeDefinition type) { values.Clear (); foreach (FieldDefinition field in type.Fields) { if (field.IsStatic) { object o = field.Constant; ulong value; if (o is ulong) { value = (ulong) o; if (value != 0 && !values.Contains (value)) values.Add (value); } else { long v = Convert.ToInt64 (o, CultureInfo.InvariantCulture); if (v > 0) { value = (ulong) v; if (!values.Contains (value)) values.Add (value); } else if (v < 0) { values.Clear (); break; } } } } } static bool IsPowerOfTwo (ulong x) { Debug.Assert (x > 0, "x is not positive"); return (x & (x - 1)) == 0; } private bool IsBitmask (ulong x) { for (int i = 0; i < values.Count && x != 0; ++i) { ulong bit = values [i]; if (IsPowerOfTwo (bit)) x &= ~bit; } return x == 0; } private int CountSequential () { int count = 0; int currentCount = 1; for (int i = 1; i < values.Count; ++i) { if (values [i] == values [i - 1] + 1) { ++currentCount; } else { count = Math.Max (currentCount, count); currentCount = 0; } } return Math.Max (currentCount, count); } public RuleResult CheckType (TypeDefinition type) { if (!type.IsEnum) return RuleResult.DoesNotApply; if (type.IsFlags ()) return RuleResult.DoesNotApply; GetValues (type); if (values.Count < 3) return RuleResult.Success; #if DEBUG Log.WriteLine (this); Log.WriteLine (this, "------------------------------------"); Log.WriteLine (this, type); Log.WriteLine (this, "values: {0}", string.Join (" ", (from x in values select x.ToString ("X4")).ToArray ())); #endif int numFlags = 0; int numMasks = 0; foreach (ulong value in values) { if (IsPowerOfTwo (value)) ++numFlags; else if (IsBitmask (value)) ++numMasks; } Log.WriteLine (this, "numFlags: {0}", numFlags); Log.WriteLine (this, "numMasks: {0}", numMasks); // The enum is bad if all of the values are powers of two or composed // of defined powers of two, if (numFlags + numMasks == values.Count) { values.Sort (); // sometimes enums are all sequential but not in order int numSequential = CountSequential (); Log.WriteLine (this, "numSequential: {0}", numSequential); // and there are not too many sequential values (so we don't // complain about stuff like 1, 2, 3, 4, 5, 6). if (numSequential < 3) { Confidence confidence = values.Count >= 4 && numMasks == 0 ? Confidence.High : Confidence.Normal; Runner.Report (type, Severity.Medium, confidence); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/EnumsShouldDefineAZeroValueRule.cs0000664000175000017500000000524312413742070033150 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.EnumsShouldDefineAZeroValueRule // // Authors: // Sebastien Pouliot // // 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.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule ensures that every non-flags enumeration contains a 0 /// value. This is important because if a field is not explicitly initialized .NET /// will zero-initialize it and, if the enum has no zero value, then it will be /// initialized to an invalid value. /// /// /// Bad example: /// /// enum Position { /// First = 1, /// Second /// } /// /// /// /// Good example: /// /// enum Position { /// First, /// Second /// } /// /// [Problem ("This enumeration does not provide a member with a value of 0.")] [Solution ("Add a new member in the enum with a value of 0.")] [FxCopCompatibility ("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")] public class EnumsShouldDefineAZeroValueRule : DefineAZeroValueRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule apply only on enums if (!type.IsEnum) return RuleResult.DoesNotApply; // rule doesn't apply on [Flags] if (type.IsFlags ()) return RuleResult.DoesNotApply; // rule applies! FieldDefinition field = GetZeroValueField (type); if (field != null) return RuleResult.Success; Runner.Report (type, Severity.Low, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/AvoidPublicInstanceFieldsRule.cs0000664000175000017500000000762512413742070032654 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.AvoidPublicInstanceFieldsRule // // Authors: // Adrian Tsai // // Copyright (c) 2007 Adrian Tsai // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { // TODO: It'd be nice if this rule also fired for fields with public access and internal visibility. // This is a common and serious design error so it seems like it should be reported at // least at low severity. /// /// This rule fires if a type contains externally visible fields. Instead use /// a property which allows you to change the implementation without breaking /// binary compatibility with other assemblies. /// /// /// Bad example: /// /// public class Foo { /// public int Value; /// } /// /// /// /// Good example: /// /// public class Foo { /// private int v; /// public int Value { /// get { /// return v; /// } /// set { /// v = value; /// } /// } /// /// /// Prior to Gendarme 2.2 this rule was named AvoidPublicInstanceFieldsRule. [Problem ("This type contains visible instance fields. A field should be an implementation detail and encapsulated within a property or method.")] [Solution ("Use a property or method instead.")] [FxCopCompatibility ("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] public class AvoidVisibleFieldsRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule doesn't apply on enums, interfaces, delegates or to compiler/tools-generated code // e.g. CSC compiles anonymous methods as an inner type that expose public fields if (type.IsEnum || type.IsInterface || !type.HasFields || type.IsDelegate () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // rule doesn't apply to type non (externally) visible if (!type.IsVisible ()) return RuleResult.DoesNotApply; foreach (FieldDefinition fd in type.Fields) { if (!fd.IsVisible () || fd.IsSpecialName || fd.HasConstant || fd.IsInitOnly) continue; string name = fd.Name; if (fd.FieldType.IsArray) { string s = String.Format (CultureInfo.InvariantCulture, "Consider changing the field '{0}' to a private or internal field and add a 'Set{1}{2}' method.", name, Char.ToUpper (name [0], CultureInfo.InvariantCulture).ToString (CultureInfo.InvariantCulture), name.Substring (1)); Runner.Report (fd, Severity.Medium, Confidence.Total, s); } else { string s = String.Format (CultureInfo.InvariantCulture, "Field '{0}' should be private or internal and its value accessed through a property.", name); Runner.Report (fd, Severity.Medium, Confidence.Total, s); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/AvoidSmallNamespaceRule.cs0000664000175000017500000001324212413742070031477 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.AvoidSmallNamespaceRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if a namespace contains less than five (by default) visible types. Note /// that this rule enumerates the types in all the assemblies being analyzed instead of /// simply considering each assembly in turn. /// The rule exempts: /// /// specialized namespacese.g. *.Design, /// *.Interop and *.Permissions /// internal namespacesnamespaces without any visible /// (outside the assemble) types /// small assembliesthat contains a single namespace but less than /// the minimal number of types (e.g. addins) /// assembly entry pointthe namespace of the type being /// used in an assemble (EXE) entry-point /// /// /// /// Bad example: /// /// namespace MyStuff.Special { /// // single type inside a namespace /// public class Helper { /// } /// } /// /// /// /// Good example: /// /// namespace MyStuff { /// public class Helper { /// } /// // ... many other types ... /// } /// /// [Problem ("This namespaces contains very few visible types.")] [Solution ("Consider merging this namespace with its parent or a sibling.")] [EngineDependency (typeof (NamespaceEngine))] [FxCopCompatibility ("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes")] public class AvoidSmallNamespaceRule : Rule, IAssemblyRule { private const int Default = 5; private int minimum = Default; /// /// The minimum number of types which must exist within a namespace. /// [DefaultValue (Default)] [Description ("The minimum of types that should exists inside a namespace.")] public int Minimum { get { return minimum; } set { if (value < 0) throw new ArgumentOutOfRangeException ("Minimum", "Must be positive"); minimum = value; } } HashSet ignore = new HashSet (); public RuleResult CheckAssembly (AssemblyDefinition assembly) { MethodDefinition entry_point = assembly.EntryPoint; if (entry_point != null) { // for EXE assemblies ignore the namespace of the entry point ignore.AddIfNew (entry_point.DeclaringType.Namespace); } // ignore assemblies with a single namespace int count = 0; string single = null; foreach (string ns in NamespaceEngine.NamespacesInside (assembly)) { // no type inside the assembly if (ns == null) break; // only count if there are some visible types inside the namespace bool visible = false; foreach (TypeDefinition type in NamespaceEngine.TypesInside (ns)) { if (type.IsVisible ()) { visible = true; break; } } if (visible) { single = ns; count++; } // no need to go more than 2 if (count > 1) break; } if (count == 1) ignore.AddIfNew (single); return RuleResult.Success; } public override void TearDown () { // check every namespaces inside the assembly set being analyzed foreach (string ns in NamespaceEngine.AllNamespaces ()) { // skip specialized namespaces if (NamespaceDefinition.IsSpecialized (ns)) continue; if (ignore.Contains (ns)) continue; int count = 0; foreach (TypeDefinition type in NamespaceEngine.TypesInside (ns)) { if (type.IsVisible ()) count++; // no early termination here so we can report the correct count } // don't report namespaces that are not visible outside the assembly // e.g. VS.NET adds a .Properties namespace to SWF apps if ((count > 0) && (count < Minimum)) { NamespaceDefinition n = NamespaceDefinition.GetDefinition (ns); string msg = String.Format (CultureInfo.CurrentCulture, "Only {0} visible types are defined inside this namespace.", count); // overloads of Report cannot be used here since the 'target' has been lost in the runner Runner.Report (new Defect (this, n, n, Severity.Low, Confidence.Total, msg)); } } ignore.Clear (); base.TearDown (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/UseCorrectDisposeSignaturesRule.cs0000664000175000017500000002001612413742070033276 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.UseCorrectDisposeSignaturesRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// There is a convention that should be followed when implementing IDisposable. Part /// of this convention is that Dispose methods should have specific signatures. In /// particular an IDisposable type's Dispose methods should either be nullary or unary /// with a bool argument, Dispose () should not be virtual, Dispose (bool) should /// not be public, and unsealed types should have a protected virtual Dispose (bool) method. /// For more details see: [http://www.bluebytesoftware.com/blog/2005/04/08/DGUpdateDisposeFinalizationAndResourceManagement.aspx]. /// /// /// Bad example: /// /// public class Unsealed : IDisposable /// { /// ~Unsealed () /// { /// Dispose (false); /// } /// /// public void Dispose () /// { /// Dispose (true); /// GC.SuppressFinalize (this); /// } /// /// // This is not virtual so resources in derived classes cannot be /// // cleaned up in a timely fashion if Unsealed.Dispose () is called. /// protected void Dispose (bool disposing) /// { /// if (!Disposed) { /// // clean up my resources /// Disposed = true; /// } /// } /// /// protected bool Disposed { /// get; /// set; /// } /// } /// /// /// /// Good example: /// /// public class Unsealed : IDisposable /// { /// // Unsealed classes should have a finalizer even if they do nothing /// // in the Dispose (false) case to ensure derived classes are cleaned /// // up properly. /// ~Unsealed () /// { /// Dispose (false); /// } /// /// public Unsealed () /// { /// } /// /// public void Work () /// { /// // In general all public methods should throw ObjectDisposedException /// // if Dispose has been called. /// if (Disposed) { /// throw new ObjectDisposedException (GetType ().Name); /// } /// } /// /// public void Dispose () /// { /// Dispose (true); /// GC.SuppressFinalize (this); /// } /// /// protected virtual void Dispose (bool disposing) /// { /// // Multiple Dispose calls should be OK. /// if (!Disposed) { /// if (disposing) { /// // None of our fields have been finalized so it's safe to /// // clean them up here. /// } /// /// // Our fields may have been finalized so we should only /// // touch native fields (e.g. IntPtr or UIntPtr fields) here. /// Disposed = true; /// } /// } /// /// protected bool Disposed { /// get; /// private set; /// } /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("An IDisposable type does not conform to the guidelines for its Dispose methods.")] [Solution ("Fix the signature of the methods or add the Dispose (bool) overload.")] public sealed class UseCorrectDisposeSignaturesRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.IsInterface || type.IsEnum || type.IsDelegate ()) return RuleResult.DoesNotApply; if (type.Implements ("System", "IDisposable")) { Log.WriteLine (this); Log.WriteLine (this, "----------------------------------"); Log.WriteLine (this, type); MethodDefinition dispose0 = null; MethodDefinition dispose1 = null; FindDisposeMethods (type, ref dispose0, ref dispose1); // The compiler will normally require that the type have a declaration for // Dispose unless the base class also implements IDisposable. In that // case we'll ignore any defects because the type doesn't actually // implement IDisposable. if (dispose0 != null || dispose1 != null) { CheckDispose0 (dispose0); CheckDispose1 (type, dispose1); } } return Runner.CurrentRuleResult; } private void FindDisposeMethods (TypeDefinition type, ref MethodDefinition dispose0, ref MethodDefinition dispose1) { foreach (MethodDefinition method in type.Methods.Where (m => m.Name == "Dispose")) { if (MethodSignatures.Dispose.Matches (method)) { dispose0 = method; } else if (DisposeBool.Matches (method)) { dispose1 = method; } else { string message = "Found a Dispose method with a bad signature."; Log.WriteLine (this, "{0}", message); Runner.Report (method, Severity.Medium, Confidence.Total, message); } } } private void CheckDispose0 (MethodDefinition dispose0) { if (dispose0 != null) { if (dispose0.IsVirtual && !dispose0.IsFinal) { string message = "Dispose () should not be virtual."; Log.WriteLine (this, "{0}", message); Runner.Report (dispose0, Severity.Medium, Confidence.Total, message); } if (!dispose0.IsVirtual && (dispose0.Attributes & MethodAttributes.NewSlot) == 0) { string message = "The type should not hide the base class Dispose () method."; Log.WriteLine (this, "{0}", message); Runner.Report (dispose0, Severity.Medium, Confidence.Total, message); } } } private void CheckDispose1 (TypeDefinition type, MethodDefinition dispose1) { if (type.IsSealed) { if (dispose1 != null) { // sealed classes don't need Dispose (bool) if (!dispose1.IsPrivate && DirectlyImplementsIDisposable (type)) { string message = "Dispose (bool) should be private for sealed types."; Log.WriteLine (this, "{0}", message); Runner.Report (dispose1, Severity.Medium, Confidence.Total, message); } } } else { if (dispose1 == null) { if (DirectlyImplementsIDisposable (type)) { string message = "Unsealed types should have a protected virtual Dispose (bool) method."; Log.WriteLine (this, "{0}", message); Runner.Report (type, Severity.Medium, Confidence.Total, message); } } else { if (!dispose1.IsFamily) { string message = "Dispose (bool) should be protected for unsealed types."; Log.WriteLine (this, "{0}", message); Runner.Report (type, Severity.Medium, Confidence.Total, message); } if (!dispose1.IsPrivate && !dispose1.IsVirtual) { string message = "Dispose (bool) should be virtual for unsealed types."; Log.WriteLine (this, "{0}", message); Runner.Report (type, Severity.Medium, Confidence.Total, message); } } } } static bool DirectlyImplementsIDisposable (TypeDefinition type) { if (type.HasInterfaces) { foreach (TypeReference candidate in type.Interfaces) { if (candidate.IsNamed ("System", "IDisposable")) return true; } } return false; } private static readonly MethodSignature DisposeBool = new MethodSignature ("Dispose", "System.Void", new string [] { "System.Boolean"}); } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/FlagsShouldNotDefineAZeroValueRule.cs0000664000175000017500000000600512413742070033573 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.FlagsShouldNotDefineAZeroValueRule // // Authors: // Sebastien Pouliot // // 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.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule ensures that enumerations decorated with the [System.Flags]   /// attribute do not contain a 0 value. This value would not be usable   /// with bitwise operators. /// /// /// Bad example (using 0 for a normal value): /// /// [Flags] /// [Serializable] /// enum Access { /// Read = 0, /// Write = 1 /// } /// /// /// /// Bad example (using None): /// /// [Flags] /// [Serializable] /// enum Access { /// // this is less severe since the name of the 0 value helps /// None = 0, /// Read = 1, /// Write = 2 /// } /// /// /// /// Good example: /// /// [Flags] /// [Serializable] /// enum Access { /// Read = 1, /// Write = 2 /// } /// /// [Problem ("This enumeration flag defines a value of 0, which cannot be used in boolean operations.")] [Solution ("Remove the 0 value(s) from the flag.")] [FxCopCompatibility ("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")] public class FlagsShouldNotDefineAZeroValueRule : DefineAZeroValueRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule apply only on [Flags] (this takes care of checking for enums) if (!type.IsFlags ()) return RuleResult.DoesNotApply; // rule applies! FieldDefinition field = GetZeroValueField (type); if (field == null) return RuleResult.Success; // it's less likely an error if the field is named "None" Severity s = field.Name == "None" ? Severity.Medium : Severity.High; Runner.Report (field, s, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/EnumeratorsShouldBeStronglyTypedRule.cs0000664000175000017500000000735112413742070034335 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.EnumeratorsShouldBeStronglyTypedRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks that types which implements System.Collections.IEnumerator interface /// have strongly typed version of the IEnumerator.Current property. /// This is needed to avoid casting every time this property is used. /// /// /// Bad example: /// /// class Bad : IEnumerator { /// object Current /// { /// get { return current; } /// } /// // other IEnumerator members /// } /// /// /// /// Good example: /// /// class Good : IEnumerator { /// object IEnumerator.Current /// { /// get { return current; } /// } /// public Exception Current /// { /// get { return (Exception)current; } /// } /// // other IEnumerator members /// } /// /// /// /// Types inheriting from System.Collections.CollectionBase, System.Collections.DictionaryBase /// or System.Collections.ReadOnlyCollectionBase are exceptions to this rule. [Problem ("Types that implement IEnumerator interface should have strongly typed version of IEnumerator.Current property")] [Solution ("Explicitly implement IEnumerator.Current and add strongly typed alternative to it")] [FxCopCompatibility ("Microsoft.Design", "CA1038:EnumeratorsShouldBeStronglyTyped")] public class EnumeratorsShouldBeStronglyTypedRule : StronglyTypedRule, ITypeRule { private MethodSignature [] Empty = { }; private static string [] Current = { "Current" }; protected override MethodSignature [] GetMethods () { return Empty; } protected override string [] GetProperties () { return Current; } protected override string InterfaceName { get { return "IEnumerator"; } } protected override string InterfaceNamespace { get { return "System.Collections"; } } override public RuleResult CheckType (TypeDefinition type) { TypeReference baseType = type; while (baseType != null) { if (baseType.Namespace == "System.Collections") { switch (baseType.Name) { case "CollectionBase": case "DictionaryBase": case "ReadOnlyCollectionBase": return RuleResult.DoesNotApply; } } TypeDefinition td = baseType.Resolve (); if (td != null) baseType = td.BaseType; else baseType = null; } return base.CheckType (type); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/AttributeArgumentsShouldHaveAccessorsRule.cs0000664000175000017500000001117512413742070035314 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.AttributeArgumentsShouldHaveAccessorsRule // // Authors: // Daniel Abramov // // Copyright (C) 2007 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if a parameter to an Attribute constructor is not exposed /// using a properly cased property. This is a problem because it is generally not useful /// to set state within an attribute without providing a way to get at that state. /// /// /// Bad example: /// /// [AttributeUsage (AttributeTargets.All)] /// public sealed class AttributeWithRequiredProperties : Attribute { /// private int storedFoo; /// private string storedBar; /// /// // we have no corresponding property with the name 'Bar' so the rule will fail /// public AttributeWithRequiredProperties (int foo, string bar) /// { /// storedFoo = foo; /// storedBar = bar; /// } /// /// public int Foo { /// get { /// return storedFoo; /// } /// } /// } /// /// /// /// Good example: /// /// [AttributeUsage (AttributeTargets.All)] /// public sealed class AttributeWithRequiredProperties : Attribute { /// private int storedFoo; /// private string storedBar; /// /// public AttributeWithRequiredProperties (int foo, string bar) /// { /// storedFoo = foo; /// storedBar = bar; /// } /// /// public int Foo { /// get { /// return storedFoo; /// } /// } /// /// public string Bar { /// get { /// return storedBar; /// } /// } /// } /// /// [Problem ("All parameter values passed to this type's constructors should be visible through read-only properties.")] [Solution ("Add the missing property getters to the type.")] [FxCopCompatibility ("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments")] public class AttributeArgumentsShouldHaveAccessorsRule : Rule, ITypeRule { private List allProperties = new List (); public RuleResult CheckType (TypeDefinition type) { // rule applies only to attributes if (!type.IsAttribute ()) return RuleResult.DoesNotApply; // look through getters allProperties.Clear (); TypeDefinition t = type; // Walk up the inheritance tree so that inherited properties are counted do { foreach (PropertyDefinition property in t.Properties) { if (property.GetMethod != null) { allProperties.Add (property.Name); } } t = t.BaseType != null ? t.BaseType.Resolve () : null; } while (t != null && !t.IsNamed ("System", "Attribute")); // look through parameters foreach (MethodDefinition constructor in type.Methods) { if (!constructor.IsConstructor) continue; foreach (ParameterDefinition param in constructor.Parameters) { // pascal case it string correspondingPropertyName = Char.ToUpper (param.Name [0], CultureInfo.InvariantCulture).ToString (CultureInfo.InvariantCulture) + param.Name.Substring (1); if (!allProperties.Contains (correspondingPropertyName)) { string s = String.Format (CultureInfo.InvariantCulture, "Add '{0}' property to the attribute class.", correspondingPropertyName); Runner.Report (param, Severity.Medium, Confidence.High, s); allProperties.Add (correspondingPropertyName); // to avoid double catching same property (e.g. from different constructors) } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ConsiderConvertingFieldToNullableRule.cs0000664000175000017500000001150712413742070034364 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ConsiderConvertingFieldToNullableRule // // Authors: // Cedric Vivier // // Copyright (c) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks for pairs of fields which seem to provide the same /// functionality as a single nullable field. If the assembly targets version 2.0, /// or more recent, of the CLR then the rule will fire to let you know that a /// nullable field can be used instead. The rule will ignore assemblies targeting /// earlier versions of the CLR. /// /// /// Bad example: /// /// public class Bad { /// bool hasFoo; /// int foo; /// } /// /// /// /// Good example: /// /// public class Good { /// int? foo; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This field looks like it can be simplified using a nullable type.")] [Solution ("Change the field's type to a nullable type or ignore the defect.")] public class ConsiderConvertingFieldToNullableRule : Rule, ITypeRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // Nullable cannot be used if the assembly target runtime is earlier than 2.0 Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentModule.Runtime >= TargetRuntime.Net_2_0); }; } static bool IsHasField (FieldReference fd, ref string prefix, ref string suffix) { if (!fd.FieldType.IsNamed ("System", "Boolean")) return false; string name = fd.Name; if (name.Length < 4) return false; if (ExtractRemainder (name, "has", ref suffix)) { prefix = string.Empty; return true; } if (ExtractRemainder (name, "_has", ref suffix)) { prefix = "_"; return true; } if (ExtractRemainder (name, "m_has", ref suffix)) { prefix = "m_"; return true; } return false; } static bool ExtractRemainder (string full, string prefix, ref string suffix) { if ((full.Length > prefix.Length) && full.StartsWith (prefix, StringComparison.OrdinalIgnoreCase)) { suffix = full.Substring(prefix.Length); return true; } return false; } public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || !type.HasFields || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; //collect *has* fields foreach (FieldDefinition fd in type.Fields) { if (!fd.FieldType.IsValueType || fd.IsSpecialName || fd.HasConstant || fd.IsInitOnly) continue; string prefix = null, suffix = null; if (IsHasField(fd, ref prefix, ref suffix) && HasValueTypeField(type, string.Concat(prefix,suffix)) ) { //TODO: check if they are both used in the same method? does the complexity worth it? string s = (Runner.VerbosityLevel > 0) ? String.Format (CultureInfo.InvariantCulture, "Field '{0}' should probably be a nullable if '{1}' purpose is to inform if '{0}' has been set.", fd.Name, suffix) : string.Empty; Runner.Report (fd, Severity.Low, Confidence.Low, s); } } return Runner.CurrentRuleResult; } private static bool HasValueTypeField (TypeDefinition type, string name) { return (null != GetValueTypeField (type, name)); } private static FieldDefinition GetValueTypeField (TypeDefinition type, string name) { foreach (FieldDefinition field in type.Fields) { if (field.FieldType.IsValueType && !field.FieldType.GetElementType ().IsNamed ("System", "Nullable`1") && 0 == string.Compare(name, field.Name, StringComparison.OrdinalIgnoreCase)) return field; } return null; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ConsiderAddingInterfaceRule.cs0000664000175000017500000001552512413742070032333 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ConsiderAddingInterfaceRule // // Authors: // Cedric Vivier // Sebastien Pouliot // // Copyright (C) 2008 Cedric Vivier // 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.Generic; using System.Globalization; using System.Linq; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if a type implements members which are declared in an /// interface, but the type does not implement the interface. Implementing /// the interface will normally make the type more reuseable and will help /// clarify the type's semantics. /// /// /// Bad example: /// /// public interface IDoable { /// public void Do (); /// } /// /// public class MyClass { /// public void Do () /// { /// } /// } /// /// /// /// Good example: /// /// public interface IDoable { /// public void Do (); /// } /// /// public class MyClass : IDoable { /// public void Do () /// { /// } /// } /// /// /// Types and methods with generic constraints are presently ignored by the rule. [Problem ("This type implements an interface's members, but does not implement the interface.")] [Solution ("If the semantics of the type's members are compatible with the interface then inherit from the interface. Otherwise ignore the defect.")] public class ConsiderAddingInterfaceRule : Rule, ITypeRule { private bool reference_only = true; public bool ReferencesOnly { get { return reference_only; } set { reference_only = value; } } public RuleResult CheckType (TypeDefinition type) { //type does not apply if not an interface or is an empty interface if (!type.IsInterface || !type.HasMethods) return RuleResult.DoesNotApply; //TODO: take into account [InternalsVisibleTo] on iface's assembly AssemblyDefinition current_assembly = type.Module.Assembly; if (type.IsVisible ()) { // We should not, by default, promote the implementation of interfaces in assemblies that // do not, already, refer to the current one because: // (a) we could be suggesting circular references (solvable, or not, by refactoring) // (b) it has a very HIGH performance cost, with verry LITTLE value (in # of defects) string current_assembly_name = current_assembly.Name.Name; foreach (AssemblyDefinition assembly in Runner.Assemblies) { // by default only process assemblies (from the set) that refers to the current one // or the current one itself if (!ReferencesOnly || (current_assembly_name == assembly.Name.Name) || assembly.References (current_assembly_name)) { CheckAssemblyTypes (assembly, type); } } } else { // if the interface is not visible then we only check this assembly CheckAssemblyTypes (current_assembly, type); } return Runner.CurrentRuleResult; } static bool HasConstraints (IEnumerable genericParameters) { foreach (GenericParameter gp in genericParameters) { if (gp.HasConstraints || (gp.Attributes != GenericParameterAttributes.NonVariant)) return true; } return false; } static bool HasConstraints (IGenericParameterProvider gp) { if (!gp.HasGenericParameters) return false; return HasConstraints (gp.GenericParameters); } private void CheckAssemblyTypes (AssemblyDefinition assembly, TypeDefinition iface) { // FIXME: ignore interfaces with generic constraints if (HasConstraints (iface)) return; foreach (ModuleDefinition module in assembly.Modules) { foreach (TypeDefinition type in module.GetAllTypes ()) { // FIXME: ignore type with generic constraints if (HasConstraints (type)) continue; if (DoesTypeStealthilyImplementInterface (type, iface)) { string msg = string.Format (CultureInfo.InvariantCulture, "Type implements '{0}' interface but does not declare it.", iface); // use our own Defect since the *real* target (of analysis) is 'type' not 'iface' Runner.Report (new Defect (this, type, type, Severity.Medium, Confidence.High, msg)); } } } } private static bool DoesTypeStealthilyImplementInterface (TypeDefinition type, TypeDefinition iface) { //ignore already uninteresting types below (self, enum, struct, static class) if (type == iface || type.IsEnum || type.IsValueType || type.IsStatic ()) return false; //if type has less methods than the interface no need to check further if (!type.HasMethods) return false; IList mdc = iface.Methods; if (type.Methods.Count < mdc.Count) return false; //type already publicly says it implements the interface if (type.Implements (iface.Namespace, iface.Name)) return false; foreach (MethodDefinition m in mdc) { // FIXME: ignore methods with generic constraints if (HasConstraints (m)) return false; //if any candidate fails we can return right away //since the interface will never be fully implemented MethodDefinition candidate = type.GetMethod (MethodAttributes.Public, m.Name); if (null == candidate || !candidate.IsPublic || candidate.IsStatic) return false; //ok interesting candidate! let's check if it matches the signature if (!m.CompareSignature (candidate)) return false; // FIXME: ignore methods with generic constraints if (HasConstraints (candidate)) return false; } if (iface.HasInterfaces) { foreach (TypeReference tr in iface.Interfaces) { TypeDefinition td = tr.Resolve (); if (td == null) continue; if (!DoesTypeStealthilyImplementInterface (type, td)) return false; } } return true; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/PreferIntegerOrStringForIndexersRule.cs0000664000175000017500000000640612413742070034235 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.PreferIntegerOrStringForIndexersRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { // TODO: Is there a reason that the summary does not mention System.Object? /// /// This rule checks for indexer properties which use unusual types as indexes. /// Recommended types include Int32, Int64 and String. /// Using other types can be OK if the indexer is providing an abstraction onto a /// logical data store, but this is often not the case. /// /// /// Bad example: /// /// public bool this [DateTime date] { /// get { /// return false; /// } /// } /// /// /// /// Good example: /// /// public bool IsSomethingPlanned (DateTime date) /// { /// return false; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This indexer should be using integers or strings for its indexes.")] [Solution ("Convert this indexer into a method if an integer or a string cannot be used.")] [FxCopCompatibility ("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers")] public class PreferIntegerOrStringForIndexersRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule only applies to indexers if (method.Name != "get_Item") return RuleResult.DoesNotApply; // ok if the method is not visible outside the assembly if (!method.IsVisible ()) return RuleResult.Success; foreach (ParameterDefinition parameter in method.Parameters) { TypeReference ptype = parameter.ParameterType; bool ok = (ptype.Namespace == "System"); if (ok) { switch (ptype.Name) { case "Int32": case "Int64": case "String": case "Object": // tolerable in some circumstances break; default: ok = false; break; } } if (!ok) Runner.Report (parameter, Severity.Medium, Confidence.Total); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/DoNotDeclareVirtualMethodsInSealedTypeRule.cs0000664000175000017500000000603412413742070035275 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.DoNotDeclareVirtualMethodsInSealedTypeRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule ensure that sealed types (i.e. types that you can't inherit from) /// do not define new virtual methods. Such methods would only be useful in /// sub-types. Note that some compilers, like C# and VB.NET compilers, do not allow you /// to define such methods. /// /// /// Bad example: /// /// public sealed class MyClass { /// // note that C# compilers won't allow this to compile /// public virtual int GetAnswer () /// { /// return 42; /// } /// } /// /// /// /// Good example: /// /// public sealed class MyClass { /// public int GetAnswer () /// { /// return 42; /// } /// } /// /// [Problem ("This sealed type introduces new virtual methods.")] [Solution ("Change the accessibility to public or private to represent its true intended use.")] [FxCopCompatibility ("Microsoft.Design", "CA1048:DoNotDeclareVirtualMembersInSealedTypes")] public class DoNotDeclareVirtualMethodsInSealedTypeRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies only to sealed types, but not to enum, value types and delegate (sealed) if (!type.IsSealed || type.IsEnum || type.IsValueType || type.IsDelegate ()) return RuleResult.DoesNotApply; foreach (MethodDefinition method in type.Methods) { // method is virtual and not final (sealed) if (method.IsVirtual && !method.IsFinal) { // so just make sure it's not an override of an ancestor if (!method.IsOverride ()) Runner.Report (method, Severity.Low, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Makefile.in0000664000175000017500000007422112642235731026526 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Design ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -d:CODE_ANALYSIS console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AbstractTypesShouldNotHavePublicConstructorsRule.cs \ AttributeArgumentsShouldHaveAccessorsRule.cs \ AvoidEmptyInterfaceRule.cs \ AvoidMultidimensionalIndexerRule.cs \ AvoidPropertiesWithoutGetAccessorRule.cs \ AvoidPublicInstanceFieldsRule.cs \ AvoidRefAndOutParametersRule.cs \ AvoidSmallNamespaceRule.cs \ AvoidVisibleNestedTypesRule.cs \ ConsiderAddingInterfaceRule.cs \ ConsiderConvertingFieldToNullableRule.cs \ ConsiderConvertingMethodToPropertyRule.cs \ ConsiderUsingStaticTypeRule.cs \ DeclareEventHandlersCorrectlyRule.cs \ DefineAZeroValueRule.cs \ DisposableTypesShouldHaveFinalizerRule.cs \ DoNotDeclareSettersOnCollectionPropertiesRule.cs \ DoNotDeclareVirtualMethodsInSealedTypeRule.cs \ DontDeclareProtectedFieldsInSealedClassRule.cs \ EnsureSymmetryForOverloadedOperatorsRule.cs \ EnumeratorsShouldBeStronglyTypedRule.cs \ EnumsShouldDefineAZeroValueRule.cs \ EnumsShouldUseInt32Rule.cs \ FinalizersShouldBeProtectedRule.cs \ FlagsShouldNotDefineAZeroValueRule.cs \ ImplementEqualsAndGetHashCodeInPairRule.cs \ ImplementIComparableCorreclyRule.cs \ InternalNamespacesShouldNotExposeTypesRule.cs \ ListsAreStronglyTypedRule.cs \ MainShouldNotBePublicRule.cs \ MarkAssemblyWithAssemblyVersionRule.cs \ MarkAssemblyWithAttributeRule.cs \ MarkAssemblyWithCLSCompliantRule.cs \ MarkAssemblyWithComVisibleRule.cs \ MissingAttributeUsageOnCustomAttributeRule.cs \ OperatorEqualsShouldBeOverloadedRule.cs \ OverrideEqualsMethodRule.cs \ PreferEventsOverMethodsRule.cs \ PreferIntegerOrStringForIndexersRule.cs \ PreferUriOverStringRule.cs \ PreferXmlAbstractionsRule.cs \ ProvideAlternativeNamesForOperatorOverloadsRule.cs \ ProvideTryParseAlternativeRule.cs \ StronglyTypedRule.cs \ StronglyTypeICollectionMembersRule.cs \ TypesShouldBeInsideNamespacesRule.cs \ UseFlagsAttributeRule.cs \ UseCorrectDisposeSignaturesRule.cs \ UsingCloneWithoutImplementingICloneableRule.cs tests_sources = \ AbstractTypesShouldNotHavePublicConstructorsTest.cs \ AttributeArgumentsShouldHaveAccessorsTest.cs \ AvoidEmptyInterfaceTest.cs \ AvoidMultidimensionalIndexerTest.cs \ AvoidPropertiesWithoutGetAccessorTest.cs \ AvoidPublicInstanceFieldsTest.cs \ AvoidRefAndOutParametersTest.cs \ AvoidSmallNamespaceTest.cs \ AvoidVisibleNestedTypesTest.cs \ ConsiderAddingInterfaceTest.cs \ ConsiderConvertingFieldToNullableTest.cs \ ConsiderConvertingMethodToPropertyTest.cs \ ConsiderUsingStaticTypeTest.cs \ DeclareEventHandlersCorrectlyTest.cs \ DisposableTypesShouldHaveFinalizerTest.cs \ DoNotDeclareSettersOnCollectionPropertiesTest.cs \ DoNotDeclareVirtualMethodsInSealedTypeTest.cs \ DontDeclareProtectedFieldsInSealedClassTest.cs \ EnsureSymmetryForOverloadedOperatorsTest.cs \ EnumeratorsShouldBeStronglyTypedTest.cs \ EnumsShouldDefineAZeroValueTest.cs \ EnumsShouldUseInt32Test.cs \ FinalizersShouldBeProtectedTest.cs \ FlagsShouldNotDefineAZeroValueTest.cs \ GlobalSuppressions.cs \ ImplementEqualsAndGetHashCodeInPairTest.cs \ ImplementIComparableCorreclyTest.cs \ InternalNamespacesShouldNotExposeTypesTest.cs \ ListsAreStronglyTypedTest.cs \ MainShouldNotBePublicTest.cs \ MarkAssemblyWithAssemblyVersionTest.cs \ MarkAssemblyWithCLSCompliantTest.cs \ MarkAssemblyWithComVisibleTest.cs \ MissingAttributeUsageOnCustomAttributeTest.cs \ OperatorEqualsShouldBeOverloadedTest.cs \ OverrideEqualsMethodTest.cs \ PreferEventsOverMethodsTest.cs \ PreferIntegerOrStringForIndexersTest.cs \ PreferUriOverStringTest.cs \ PreferXmlAbstractionsTest.cs \ ProvideTryParseAlternativeTest.cs \ ProvideAlternativeNamesForOperatorOverloadsTest.cs \ StronglyTypeICollectionMembersTest.cs \ TypesShouldBeInsideNamespacesTest.cs \ UseFlagsAttributeTest.cs \ UseCorrectDisposeSignaturesTest.cs \ UsingCloneWithoutImplementingICloneableTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Design/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Design/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Design/AvoidVisibleNestedTypesRule.cs0000664000175000017500000000575212413742070032406 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.AvoidVisibleNestedTypesRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks for nested types which are externally visible. Such types are often /// confused with namespaces which makes them more difficult to document and find by /// developers. In most cases it is better to make these types private or to scope them /// within a namespace instead of a type. /// /// /// Bad example: /// /// public class Outer { /// public class Inner { /// // ... /// } /// } /// /// /// /// Good example (visibility): /// /// public class Outer { /// internal class Inner { /// // ... /// } /// } /// /// /// /// Good example (unnested): /// /// public class Outer { /// // ... /// } /// /// public class Inner { /// // ... /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This type is both nested and visible outside the assembly. Nested types are often confused with namespaces.")] [Solution ("Change the nested type to be invisible outside the assembly or un-nest it.")] [FxCopCompatibility ("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] public class AvoidVisibleNestedTypesRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // apply only to nested types if (!type.IsNested) return RuleResult.DoesNotApply; // it's ok if the type is not visible if (!type.IsVisible ()) return RuleResult.Success; // otherwise we warn about the nested type Runner.Report (type, Severity.Medium, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ListsAreStronglyTypedRule.cs0000664000175000017500000000753112413742070032131 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ListsAreStronglyTypedRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks that types which implements System.Collections.IList interface /// have strongly typed versions of IList.Item, IList.Add, IList.Contains, IList.IndexOf, IList.Insert and IList.Remove. /// This is needed to avoid casting every time these members are used. /// /// /// Bad example: /// /// class Bad : IList { /// public int Add (object value) /// { /// // method code /// } /// // other IList methods and properties without their strongly typed versions /// } /// /// /// /// Good example: /// /// class Good : Ilist { /// public int Add (object value) /// { /// // method code /// } /// public int Add (Exception value) /// { /// return ((IList)this).Add ((object)value); /// } /// // other IList methods and properties with their strongly typed versions /// } /// /// [Problem ("Types that implement IList should have strongly typed versions of IList.Item, IList.Add, IList.Contains, IList.IndexOf, IList.Insert and IList.Remove")] [Solution ("Explicitly implement IList members and provide strongly typed alternatives to them.")] [FxCopCompatibility ("Microsoft.Design", "CA1039:ListsAreStronglyTyped")] public class ListsAreStronglyTypedRule : StronglyTypedRule, ITypeRule { private static string [] Item = new string [] { "Item" }; private static string[] SystemObject = new string[] {"System.Object"}; private static MethodSignature Add = new MethodSignature ("Add", "System.Int32", SystemObject); private static MethodSignature Contains = new MethodSignature ("Contains", "System.Boolean", SystemObject); private static MethodSignature IndexOf = new MethodSignature ("IndexOf", "System.Int32", SystemObject); private static MethodSignature Insert = new MethodSignature ("Insert", "System.Void", new string [] { "System.Int32", "System.Object" }); private static MethodSignature Remove = new MethodSignature ("Remove", "System.Void", SystemObject); private static MethodSignature [] Signatures = { Add, Contains, IndexOf, Insert, Remove, }; protected override MethodSignature [] GetMethods () { return Signatures; } protected override string [] GetProperties () { return Item; } protected override string InterfaceName { get { return "IList"; } } protected override string InterfaceNamespace { get { return "System.Collections"; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/TypesShouldBeInsideNamespacesRule.cs0000664000175000017500000000565012413742070033521 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.TypesShouldBeInsideNamespacesRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule will fire if a type which is visible outside the assembly is not declared /// within a namespace. Using namespaces greatly reduces the probability of name /// collisions, allows tools such as auto-complete to operate better, and can make /// the assemblies API clearer. /// /// /// Bad example: /// /// using System; /// /// public class Configuration { /// } /// /// /// /// Good example: /// /// using System; /// /// namespace My.Stuff { /// public class Configuration { /// } /// } /// /// [Problem ("This type is visible outside the assembly so it should be defined inside a namespace to avoid conflicts.")] [Solution ("Move this type inside a namespace or reduce it's visibility (e.g. internal or private).")] [FxCopCompatibility ("Microsoft.Design", "CA1050:DeclareTypesInNamespaces")] public class TypesShouldBeInsideNamespacesRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule doesn't apply to nested types, since the declaring type will already be reported if (type.IsNested) return RuleResult.DoesNotApply; // rule applies to only to types visible outside the assembly if (!type.IsVisible ()) return RuleResult.DoesNotApply; // rule applies! // check if the type resides inside a namespace if (!String.IsNullOrEmpty (type.Namespace)) return RuleResult.Success; Runner.Report (type, Severity.Low, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/OverrideEqualsMethodRule.cs0000664000175000017500000000567112413742070031731 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.OverrideEqualsMethodRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule warns when a type overloads the equality == operator but does not /// override the Object.Equals method. /// /// /// Bad example: /// /// class DoesNotOverrideEquals { /// public static bool operator == (DoesNotOverloadOperatorEquals a, DoesNotOverloadOperatorEquals b) /// { /// return true; /// } /// } /// /// /// /// Good example: /// /// class OverridesEquals { /// public static bool operator == (OverridesEquals a, OverridesEquals b) /// { /// return true; /// } /// /// public override bool Equals (object obj) /// { /// OverridesEquals other = (obj as OverridesEquals); /// if (other == null) { /// return false; /// } /// return (this == other); /// } /// } /// /// [Problem ("This type overloads the == operator but doesn't override the Equals method.")] [Solution ("Override the Equals method to match the results of the == operator.")] [FxCopCompatibility ("Microsoft.Usage", "CA2224:OverrideEqualsOnOverloadingOperatorEquals")] public class OverrideEqualsMethodRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || type.IsInterface || type.IsDelegate ()) return RuleResult.DoesNotApply; MethodDefinition equality = type.GetMethod (MethodSignatures.op_Equality); if ((equality == null) || type.HasMethod (MethodSignatures.Equals)) return RuleResult.Success; Runner.Report (equality, Severity.High, Confidence.High); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/DontDeclareProtectedFieldsInSealedClassRule.cs0000664000175000017500000000707012413742070035411 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.DoNotDeclareProtectedFieldsInSealedTypeRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule ensures that sealed types (i.e. types that you can't inherit from) /// do not define family (protected in C#) fields or methods. Instead make the /// member private so that its accessibility is not misleading. /// /// /// Bad example (field): /// /// public sealed class MyClass { /// protected int someValue; /// } /// /// /// /// Bad example (method): /// /// public sealed class MyClass { /// protected int GetAnswer () /// { /// return 42; /// } /// } /// /// /// /// Good example (field): /// /// public sealed class MyClass { /// private int someValue; /// } /// /// /// /// Good example (method): /// /// public sealed class MyClass { /// private int GetAnswer () /// { /// return 42; /// } /// } /// /// /// Prior to Gendarme 2.2 this rule applied only to fields and was named DoNotDeclareProtectedFieldsInSealedClassRule [Problem ("This sealed type contains family (protected in C#) fields and/or methods.")] [Solution ("Change the access to private to make it clear that the type is not intended to be subclassed.")] [FxCopCompatibility ("Microsoft.Design", "CA1047:DoNotDeclareProtectedMembersInSealedTypes")] public class DoNotDeclareProtectedMembersInSealedTypeRule: Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies only to sealed types, but not to enum, value types and delegate (sealed) if (!type.IsSealed || type.IsEnum || type.IsValueType || type.IsDelegate ()) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { if (field.IsFamily) { Runner.Report (field, Severity.Low, Confidence.Total); } } foreach (MethodDefinition method in type.Methods) { if (method.IsFamily) { // make sure it's not an override of an ancestor if (!method.IsOverride ()) Runner.Report (method, Severity.Low, Confidence.Total); } } return Runner.CurrentRuleResult; } } } ProvideAlternativeNamesForOperatorOverloadsRule.cs0000664000175000017500000002244312413742070036410 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design// // Gendarme.Rules.Design.ProvideAlternativeNamesForOperatorOverloadsRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { // TODO: Shouldn't this only fire for externally visible operators? /// /// The rule ensure that all overloaded operators are also accessible using named /// alternatives because some languages, like VB.NET, cannot use overloaded operators. /// For those languages named methods should be implemented that provide the same /// functionality. This rule verifies that a named alternative exists for each overloaded operator. /// /// op_UnaryPlusPlus /// op_UnaryNegationNegate /// op_LogicalNotLogicalNot /// op_OnesComplementOnesComplement /// /// /// op_IncrementIncrement /// op_DecrementDecrement /// op_TrueIsTrue /// op_FalseIsFalse /// /// /// op_AdditionAdd /// op_SubtractionSubtract /// op_MultiplyMultiply /// op_DivisionDivide /// op_ModulusModulus /// /// /// op_BitwiseAndBitwiseAnd /// op_BitwiseOrBitwiseOr /// op_ExclusiveOrExclusiveOr /// /// /// op_LeftShiftLeftShift /// op_RightShiftRightShift /// /// /// op_EqualityEquals /// op_Inequality(not) Equals /// op_GreaterThanCompare /// op_LessThanCompare /// op_GreaterThanOrEqualCompare /// op_LessThanOrEqualCompare /// /// /// /// Bad example: /// /// class DoesNotImplementAlternative { /// public static int operator + (DoesNotOverloadOperatorEquals a, DoesNotOverloadOperatorEquals b) /// { /// return 0; /// } /// } /// /// /// /// Good example: /// /// class DoesImplementAdd { /// public static int operator + (DoesImplementAdd a, DoesImplementAdd b) /// { /// return 0; /// } /// /// public int Add (DoesImplementAdd a) /// { /// return this + a; /// } ///} /// /// [Problem ("This type contains overloaded operators but doesn't provide named alternatives.")] [Solution ("Add named methods equivalent to the operators for language that do not support them (e.g. VB.NET).")] [FxCopCompatibility ("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")] public class ProvideAlternativeNamesForOperatorOverloadsRule : Rule, ITypeRule { static string [] NoParameter = new string [] { }; static string [] OneParameter = new string [] { null }; //new string [1] = one parameter of any type static MethodSignature Compare = new MethodSignature ("Compare", null, OneParameter); static KeyValuePair [] AlternativeMethodNames = new KeyValuePair [] { //unary new KeyValuePair (MethodSignatures.op_UnaryPlus, new MethodSignature ("Plus", null, NoParameter)), new KeyValuePair (MethodSignatures.op_UnaryNegation, new MethodSignature ("Negate", null, NoParameter)), new KeyValuePair (MethodSignatures.op_LogicalNot, new MethodSignature ("LogicalNot", null, NoParameter)), new KeyValuePair (MethodSignatures.op_OnesComplement, new MethodSignature ("OnesComplement", null, NoParameter)), new KeyValuePair (MethodSignatures.op_Increment, new MethodSignature ("Increment", null, NoParameter)), new KeyValuePair (MethodSignatures.op_Decrement, new MethodSignature ("Decrement", null, NoParameter)), new KeyValuePair (MethodSignatures.op_True, new MethodSignature ("IsTrue", null, NoParameter)), new KeyValuePair (MethodSignatures.op_False, new MethodSignature ("IsFalse", null, NoParameter)), //binary new KeyValuePair (MethodSignatures.op_Addition, new MethodSignature ("Add", null, OneParameter)), new KeyValuePair (MethodSignatures.op_Subtraction, new MethodSignature ("Subtract", null, OneParameter)), new KeyValuePair (MethodSignatures.op_Multiply, new MethodSignature ("Multiply", null, OneParameter)), new KeyValuePair (MethodSignatures.op_Division, new MethodSignature ("Divide", null, OneParameter)), new KeyValuePair (MethodSignatures.op_Modulus, new MethodSignature ("Modulus", null, OneParameter)), new KeyValuePair (MethodSignatures.op_BitwiseAnd, new MethodSignature ("BitwiseAnd", null, OneParameter)), new KeyValuePair (MethodSignatures.op_BitwiseOr, new MethodSignature ("BitwiseOr", null, OneParameter)), new KeyValuePair (MethodSignatures.op_ExclusiveOr, new MethodSignature ("ExclusiveOr", null, OneParameter)), new KeyValuePair (MethodSignatures.op_LeftShift, new MethodSignature ("LeftShift", null, OneParameter)), new KeyValuePair (MethodSignatures.op_RightShift, new MethodSignature ("RightShift", null, OneParameter)), // new KeyValuePair (MethodSignatures.op_Equality, MethodSignatures.Equals), //handled by OverrideEqualsMethodRule new KeyValuePair (MethodSignatures.op_Inequality, MethodSignatures.Equals), new KeyValuePair (MethodSignatures.op_GreaterThan, Compare), new KeyValuePair (MethodSignatures.op_LessThan, Compare), new KeyValuePair (MethodSignatures.op_GreaterThanOrEqual, Compare), new KeyValuePair (MethodSignatures.op_LessThanOrEqual, Compare), }; public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || type.IsInterface || type.IsDelegate ()) return RuleResult.DoesNotApply; foreach (var kv in AlternativeMethodNames) { MethodDefinition op = type.GetMethod (kv.Key); if (op == null) continue; bool alternativeDefined = false; foreach (MethodDefinition alternative in type.Methods) { if (kv.Value.Matches (alternative)) { alternativeDefined = true; break; } } if (!alternativeDefined) { string s = String.Format (CultureInfo.InvariantCulture, "This type implements the '{0}' operator. Some languages do not support overloaded operators so an alternative '{1}' method should be provided.", kv.Key.Name, kv.Value.Name); Runner.Report (op, Severity.Medium, Confidence.High, s); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/DisposableTypesShouldHaveFinalizerRule.cs0000664000175000017500000000676212413742070034601 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.DisposableTypesShouldHaveFinalizerRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule will fire for types which implement System.IDisposable, contain /// native fields such as System.IntPtr, System.UIntPtr, and /// System.Runtime.InteropServices.HandleRef, but do not define a finalizer. /// /// /// Bad example: /// /// class NoFinalizer { /// IntPtr field; /// } /// /// /// /// Good example: /// /// class HasFinalizer { /// IntPtr field; /// /// ~HasFinalizer () /// { /// UnmanagedFree (field); /// } /// } /// /// [Problem ("This type contains native fields but does not have a finalizer.")] [Solution ("Add a finalizer, calling Dispose(true), to release unmanaged resources.")] [FxCopCompatibility ("Microsoft.Usage", "CA2216:DisposableTypesShouldDeclareFinalizer")] public class DisposableTypesShouldHaveFinalizerRule : Rule, ITypeRule { const string Struct = "Consider using a class since a struct cannot define a finalizer."; public RuleResult CheckType (TypeDefinition type) { // rule applies only to types, interfaces and structures (value types) if (type.IsEnum || type.IsDelegate () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // rule onyly applies to type that implements IDisposable if (!type.Implements ("System", "IDisposable")) return RuleResult.DoesNotApply; // no problem is a finalizer is found if (type.HasMethod (MethodSignatures.Finalize)) return RuleResult.Success; // otherwise check for native types foreach (FieldDefinition field in type.Fields) { // we can't dispose static fields in IDisposable if (field.IsStatic) continue; if (!field.FieldType.GetElementType ().IsNative ()) continue; Runner.Report (field, Severity.High, Confidence.High); } // special case: a struct cannot define a finalizer so it's a // bad candidate to hold references to unmanaged resources if (type.IsValueType && (Runner.CurrentRuleResult == RuleResult.Failure)) Runner.Report (type, Severity.High, Confidence.High, Struct); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/InternalNamespacesShouldNotExposeTypesRule.cs0000664000175000017500000000625512413742070035462 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.InternalNamespacesShouldNotExposeTypesRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks for externally visible types that reside inside internal namespaces, i.e. /// namespaces ending with Internal or Impl. /// /// /// Bad example: /// /// namespace MyStuff.Internal { /// public class Helper { /// } /// } /// /// /// /// Good example (internal type): /// /// namespace MyStuff.Internal { /// internal class Helper { /// } /// } /// /// /// /// Good example (non-internal namespace): /// /// namespace MyStuff { /// public class Helper { /// } /// } /// /// [Problem ("This internal namespace should not expose visible types outside the assembly.")] [Solution ("If the type needs to be public move it in another namespace, otherwise make the type internal.")] [EngineDependency (typeof (NamespaceEngine))] public class InternalNamespacesShouldNotExposeTypesRule : Rule, IAssemblyRule { public RuleResult CheckAssembly (AssemblyDefinition assembly) { // check every namespaces inside the assembly using the NamespaceEngine foreach (string ns in NamespaceEngine.NamespacesInside (assembly)) { // rule only apply to "internal" namespaces if (!ns.EndsWith (".Internal", StringComparison.Ordinal) && !ns.EndsWith (".Impl", StringComparison.Ordinal)) { continue; } foreach (TypeDefinition type in NamespaceEngine.TypesInside (ns)) { // only report for this assembly if (type.Module.Assembly != assembly) continue; // report all types inside that namespace if (type.IsVisible ()) Runner.Report (type, Severity.Medium, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/AvoidRefAndOutParametersRule.cs0000664000175000017500000001330412413742070032464 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.AvoidRefAndOutParametersRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if a method uses ref or out parameters. /// These are advanced features that can easily be misunderstood and misused /// (by the consumer). This can result in an API that is difficult to use so /// avoid them whenever possible. /// An alternative is to use one of the new generic Tuple types (FX v4 and later) /// as the return value. /// No defect will be reported if the method: /// /// follows the bool Try*(X out) pattern; or /// implement an interface requiring the use of ref or out parameters. /// In the later case defects will be reported against the interface itself (if analyzed /// by Gendarme). /// /// /// /// Bad example: /// /// public bool NextJob (ref int id, out string display) /// { /// if (id < 0) /// return false; /// display = String.Format ("Job #{0}", id++); /// return true; /// } /// /// /// /// Good example: /// /// private int id = 0; /// /// private int GetNextId () /// { /// int id = this.id++; /// return id; /// } /// /// public string NextJob () /// { /// return String.Format ("Job #{0}", Id); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method use ref and/or out parameters in a visible API which can confuse many developers.")] [Solution ("The most common reason to do this is to return multiple values from a method which can be rewritten so that it returns a custom type instead.")] [FxCopCompatibility ("Microsoft.Design", "CA1021:AvoidOutParameters")] [FxCopCompatibility ("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] public class AvoidRefAndOutParametersRule : Rule, IMethodRule { static bool IsSignatureDictatedByInterface (MethodDefinition method, TypeReference type) { if (type == null) return false; TypeDefinition td = type.Resolve (); if (td == null) return false; foreach (TypeReference intf_ref in td.Interfaces) { TypeDefinition intr = intf_ref.Resolve (); if (intr == null) continue; if (intr.HasMethods) { foreach (MethodDefinition md in intr.Methods) { if (method.CompareSignature (md)) return true; } } // check if the interface inherits from another interface with this signature if (IsSignatureDictatedByInterface (method, intr.BaseType)) return true; } // check if a base type is implementing an interface with this signature return IsSignatureDictatedByInterface (method, td.BaseType); } static bool IsSignatureDictatedByInterface (MethodDefinition method) { // quick-out: if the method implements an interface then it's virtual if (!method.IsVirtual) return false; // check if the interface itself has the defect (always reported) TypeDefinition type = method.DeclaringType; if (type.IsInterface) return false; return IsSignatureDictatedByInterface (method, type); } public RuleResult CheckMethod (MethodDefinition method) { // rule only applies to visible methods with parameters // we also exclude all p/invokes since we have a rule for them not to be visible if (method.IsPInvokeImpl || !method.HasParameters || !method.IsVisible ()) return RuleResult.DoesNotApply; foreach (ParameterDefinition parameter in method.Parameters) { string how = null; if (parameter.IsOut) { // out is permitted for the "bool Try* (...)" pattern if (method.ReturnType.IsNamed ("System", "Boolean") && method.Name.StartsWith ("Try", StringComparison.Ordinal)) { continue; } how = "out"; } else if (parameter.ParameterType.IsByReference) { how = "ref"; } // report the method is it is not dictated by an interface if ((how != null) && !IsSignatureDictatedByInterface (method)) { // goal is to keep the API as simple as possible so this is more severe for public than protected methods Severity severity = method.IsPublic ? Severity.Medium : Severity.Low; string msg = String.Format (CultureInfo.InvariantCulture, "Parameter '{0}' passed by reference ({1}).", parameter.Name, how); Runner.Report (parameter, severity, Confidence.Total, msg); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/PreferEventsOverMethodsRule.cs0000664000175000017500000000747512413742070032432 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.PreferEventsOverMethodsRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Design { /// /// This rule checks for method names that suggest they are providing similar /// functionality to .NET events. When possible the method(s) should be replaced /// with a real event. If the methods are not using or providing /// event-like features then they should be renamed since such names can confuse consumers /// about what the method is really doing. /// /// /// Bad example: /// /// public delegate void MouseUpCallback (int x, int y, MouseButtons buttons); /// /// public class MouseController { /// private MouseUpCallback mouse_up_callback; /// /// public void RaiseMouseUp (Message msg) /// { /// if (mouse_up_callback != null) { /// mouse_up_callback (msg.X, msg.Y, msg.Buttons); /// } /// } /// /// public void ProcessMessage (Message msg) /// { /// switch (msg.Id) { /// case MessageId.MouseUp: { /// RaiseMouseUp (msg); /// break; /// } /// // ... more ... /// default: /// break; /// } /// } /// } /// /// /// /// Good example: /// /// public class MouseController { /// public event EventHandler<MessageEvent> MouseUp; /// /// public void ProcessMessage (Message msg) /// { /// switch (msg.Id) { /// case MessageId.MouseUp: { /// EventHandler<MessageEvent> handler = MouseUp; /// if (handler != null) { /// handler (new MessageEvent (msg)); /// } /// break; /// } /// // ... more ... /// default: /// break; /// } /// } /// } /// /// [Problem ("This method's name suggests that it could be replaced by an event.")] [Solution ("Replace the method(s) by events or rename the method to something less confusing.")] [FxCopCompatibility ("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")] public class PreferEventsOverMethodsRule : Rule, IMethodRule { static string [] SuspectPrefixes = { "AddOn", "RemoveOn", "Fire", "Raise" }; public RuleResult CheckMethod (MethodDefinition method) { // does not apply to properties and events if (method.IsSpecialName) return RuleResult.DoesNotApply; // check if the method name starts with one of the usual suspects string name = method.Name; foreach (string suspect in SuspectPrefixes) { if (name.StartsWith (suspect, StringComparison.Ordinal)) { Runner.Report (method, Severity.Medium, Confidence.Normal); // won't happen more than once return RuleResult.Failure; } } return RuleResult.Success; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/DoNotDeclareSettersOnCollectionPropertiesRule.cs0000664000175000017500000001025312413742070036071 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.DoNotDeclareSettersOnCollectionPropertiesRule // // Authors: // Sebastien Pouliot // // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// The rule detect System.Collections.ICollection and /// System.Collections.Generic.ICollection<T> properties that declare a visible setter. /// There is rarely a need to be able to replace the collection (e.g. most collections provide a Clear /// method) and having a getter only does not prevent the consumer from adding and removing items in the collection. /// Also read-only properties have special support for binary and XML serialization, making your code more useful. /// A special exception is made for System.Security.PermissionSet and types that derives from it. /// /// /// Bad example: /// /// public class Holder { /// public string Name { get; set; } /// public ICollection<string> List { get; set; } /// } /// /// public static Holder Copy (Holder h) /// { /// Holder copy = new Holder (); /// copy.Name = h.Name; /// // bad, same list would be shared between instances /// copy.List = h.List; /// copy.List.AddRange (h.List); /// return copy; /// } /// /// /// /// Good example: /// /// public class Holder { /// List<string> list; /// /// public Holder () /// { /// list = new List<string> (); /// } /// /// public string Name { get; set; } /// /// public ICollection<string> List { /// get { return list; } /// } /// } /// /// public static Holder Copy (Holder h) /// { /// Holder copy = new Holder (); /// copy.Name = h.Name; /// copy.List.AddRange (h.List); /// return copy; /// } /// /// [Problem ("A visible setter is declared for an ICollection (or derived) property")] [Solution ("Replace the setter with a method or decrease the setter visibility")] [FxCopCompatibility ("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public class DoNotDeclareSettersOnCollectionPropertiesRule : Rule, ITypeRule { static bool IsICollection (TypeReference type) { if (type.Implements ("System.Collections", "ICollection")) return true; return type.Implements ("System.Collections.Generic", "ICollection`1"); } static bool IsSpecialCase (TypeReference type) { return type.Inherits ("System.Security", "PermissionSet"); } public RuleResult CheckType (TypeDefinition type) { if (!type.HasProperties || !type.IsVisible ()) return RuleResult.DoesNotApply; bool is_interface = type.IsInterface; foreach (PropertyDefinition pd in type.Properties) { MethodDefinition setter = pd.SetMethod; if ((setter == null) || (!is_interface && !setter.IsVisible ())) continue; TypeReference ptype = pd.PropertyType; if (IsICollection (ptype) && !IsSpecialCase (ptype)) Runner.Report (setter, Severity.Medium, Confidence.High); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/AvoidMultidimensionalIndexerRule.cs0000664000175000017500000000544212413742070033451 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.AvoidMultidimensionalIndexerRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks for externally visible indexer properties which have more /// than one index argument. These can be confusing to some developers and /// IDEs with auto-complete don't always handle them as well as methods so /// it can be hard to know which argument is which. /// /// /// Bad example: /// /// public int this [int x, int y] { /// get { /// return 0; /// } /// } /// /// /// /// Good example: /// /// public int Get (int x, int y) /// { /// return 0; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This indexer use multiple indexes which can impair its usability.")] [Solution ("Consider converting the indexer into a method.")] [FxCopCompatibility ("Microsoft.Design", "CA1023:IndexersShouldNotBeMultidimensional")] public class AvoidMultidimensionalIndexerRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule only applies to indexers if (method.Name != "get_Item") return RuleResult.DoesNotApply; // if there is a single argument or if the method is not visible outside the assembly if ((method.HasParameters && (method.Parameters.Count == 1)) || !method.IsVisible ()) return RuleResult.Success; Runner.Report (method, Severity.Medium, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/PreferUriOverStringRule.cs0000664000175000017500000001713012413742070031555 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.PreferUriOverStringRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Collections.Generic; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using System; using System.Linq; using System.Collections.Generic; using System.Globalization; namespace Gendarme.Rules.Design { /// /// Checks methods and properties to ensure that System.Uri is used in place /// of or in addition to strings where appropriate. /// /// /// Bad example 1: /// /// string Uri { get; set; } /// /// /// /// Bad example 2: /// /// string GetUri () { return "http://www.mono-project.com"; } /// /// /// /// Bad example 3: /// /// void SendRequest (string url) { /// ... /// } /// /// /// /// Good example 1: /// /// Uri Uri { get; set; } /// /// /// /// Bad example 2: /// /// Uri GetUri () { return new Uri ("http://www.mono-project.com"); } /// /// /// /// Good example 3: /// /// void SendRequest (string url) { /// SendRequest (new Uri(url)); /// } /// void SendRequest (Uri url) { /// ... /// } /// /// [Problem ("A method, parameter, or property with uri, url, or urn in the name is or returns a System.String instead of a System.Uri.")] [Solution ("Use System.Uri in place of System.String, or add an additional overload that takes a System.Uri.")] [FxCopCompatibility ("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings")] [FxCopCompatibility ("Microsoft.Design", "CA1055:UriReturnValuesShouldNotBeStrings")] [FxCopCompatibility ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")] public class PreferUriOverStringRule : Rule, IMethodRule { private static readonly char [] url_enders = { 'i', 'n', 'l' }; private Bitmask methodBitmask = new Bitmask (); private static int FindTokenStart (string memberName, string token, int start) { int index = start; // We assume the name is pascal- or camel- cased: to prevent false-positives (such as the urn in return), // the position is only returned if the character is the first in the string, or is an uppercase letter. while ((index = memberName.IndexOf (token, index, StringComparison.OrdinalIgnoreCase)) != -1) { if (index == 0 || Char.IsUpper (memberName [index])) break; index += token.Length; } return index; } private static bool IsUri (string memberName) { int index = 0; while ((index = FindTokenStart(memberName, "ur", index)) != -1){ if (memberName.Length <= index + 2) break; if (url_enders.Contains(Char.ToLower(memberName[index + 2], CultureInfo.InvariantCulture))) return true; index += 2; } return false; } private static bool IsOkay (TypeReference type, string memberName) { if (type == null) return true; return !(type.Namespace == "System" && type.Name == "String") || !IsUri (memberName); } private bool FindBadParameters (Collection parameters) { // Every uri parameter that is a string is recorded by the bitmask. // Note: we're assuming the number of parameters will fit into the bitmask. methodBitmask.ClearAll (); var defect = false; for (int i = 0; i < parameters.Count; i++) { var param = parameters [i]; var type = param.ParameterType; if (IsOkay (type, param.Name)) continue; defect = true; methodBitmask.Set (1 << i); } return defect; } private void ReportBadParameters (Collection parameters) { for (var i = 0; i < parameters.Count; i++) { long bit = 1 << i; if (!methodBitmask.Get (bit)) continue; Runner.Report (parameters [i], Severity.Medium, Confidence.Normal); } } private void CheckParameters (MethodDefinition method) { // attributes are a special case where Uri cannot be used and has it's own // rule to cover this: Gendarme.Rules.Correctness.AttributeStringLiteralShouldParseCorrectlyRule if (method.IsConstructor && method.DeclaringType.Inherits ("System", "Attribute")) return; var methodParams = method.Parameters; if (!FindBadParameters (methodParams)) return; var ok = false; // Find each of the overloads for the method being checked. foreach (var overload in method.DeclaringType.Methods) { var overloadParams = overload.Parameters; var numOverloadParams = overloadParams.Count; if (overload == method || overload.Name != method.Name || numOverloadParams != methodParams.Count) continue; ok = true; // Find each parameter that was a string in the original, but should be a Uri for (int i = 0; i < numOverloadParams; i++) { long bit = 1 >> i; if (!methodBitmask.Get (bit)) continue; var paramType = overloadParams [i].ParameterType; ok = paramType.Namespace == "System" && paramType.Name == "Uri"; // If this overload didn't replace the string with a uri, skip to the next one. if (!ok) break; } // End the method early if a valid overload was found. if (ok) return; } // If we've gotten this far, then there is a problem with at least one parameter and // there are no suitable replacement overloads. Report every bad parameter. ReportBadParameters (methodParams); } public RuleResult CheckMethod (MethodDefinition method) { // Check property getters/setters. In order to prevent the property from // being reported twice, setters are only checked if the property has no getter. PropertyDefinition property = method.IsProperty () ? method.GetPropertyByAccessor () : null; if (property != null) { // however do not exclude automatic properties (getter/setter marked a generated code) if ((method.IsSetter && property.GetMethod != null) || property.IsGeneratedCode ()) return RuleResult.DoesNotApply; if (!IsOkay (property.PropertyType, property.Name)) Runner.Report (property, Severity.Medium, Confidence.Normal); } else { // exclude generated code like webservices if (method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // Check the method's parameters. if (method.HasParameters) CheckParameters (method); // Check the method's return type. if (!IsOkay (method.ReturnType, method.Name)) Runner.Report (method, Severity.Medium, Confidence.Normal); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/OperatorEqualsShouldBeOverloadedRule.cs0000664000175000017500000001001112413742070034217 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.OperatorEqualsShouldBeOverloadedRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if a type overloads operator add +, or overloads operator subtract -, /// or is a value type and overrides Object.Equals, but equals == is /// not overloaded. /// /// /// Bad example (add/substract): /// /// class DoesNotOverloadOperatorEquals { /// public static int operator + (DoesNotOverloadOperatorEquals a) /// { /// return 0; /// } /// /// public static int operator - (DoesNotOverloadOperatorEquals a) /// { /// return 0; /// } /// } /// /// /// /// Bad example (value type): /// /// struct OverridesEquals { /// public override bool Equals (object obj) /// { /// return base.Equals (obj); /// } /// } /// /// /// /// Good example: /// /// struct OverloadsOperatorEquals { /// public static int operator + (OverloadsOperatorEquals a) /// { /// return 0; /// } /// /// public static int operator - (OverloadsOperatorEquals a) /// { /// return 0; /// } /// /// public static bool operator == (OverloadsOperatorEquals a, OverloadsOperatorEquals b) /// { /// return a.Equals (b); /// } /// /// public override bool Equals (object obj) /// { /// return base.Equals (obj); /// } /// } /// /// [Problem ("This type is a value type and overrides the Equals method or it overloads + and - operators but does not overload the == operator.")] [Solution ("Overload the == operator to match the results of the Equals method.")] [FxCopCompatibility ("Microsoft.Design", "CA1013:OverloadOperatorEqualsOnOverloadingAddAndSubtract")] [FxCopCompatibility ("Microsoft.Usage", "CA2231:OverloadOperatorEqualsOnOverridingValueTypeEquals")] public class OperatorEqualsShouldBeOverloadedRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || type.IsInterface || type.IsDelegate ()) return RuleResult.DoesNotApply; if (type.HasMethod (MethodSignatures.op_Addition) && type.HasMethod (MethodSignatures.op_Subtraction)) { if (!type.HasMethod (MethodSignatures.op_Equality)) { Runner.Report (type, Severity.Low, Confidence.High, "This type implements the addition (+) and subtraction (-) operators. It should also implement the equality (==) operator."); } } if (type.IsValueType) { if (type.HasMethod (MethodSignatures.Equals) && !type.HasMethod (MethodSignatures.op_Equality)) { Runner.Report (type, Severity.Medium, Confidence.High, "This type overrides Object.Equals. It should also implement the equality (==) operator."); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/FinalizersShouldBeProtectedRule.cs0000664000175000017500000000647012413742070033242 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.FinalizersShouldBeProtectedRule // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule verifies that finalizers are only visible to the type's family (e.g. protected in C#). /// If they are not family then they can be called from user code which could lead to /// problems. Note that this restriction is enforced by the C# and VB.NET compilers /// but other compilers may not do so. /// /// /// Bad example (IL): /// /// .class family auto ansi beforefieldinit BadPublicFinalizer extends /// [mscorlib]System.Object /// { /// .method public hidebysig instance void Finalize() cil managed /// { /// // ... /// } /// } /// /// /// /// Good example (C#): /// /// public class GoodProtectedFinalizer { /// // compiler makes it protected /// ~GoodProtectedFinalizer () /// { /// } /// } /// /// /// /// Good example (IL): /// /// .class family auto ansi beforefieldinit GoodProtectedFinalizer extends /// [mscorlib]System.Object /// { /// .method family hidebysig instance void Finalize() cil managed /// { /// // ... /// } /// } /// /// [Problem ("The finalizer for this type isn't protected (family) and can therefore be called by user level code.")] [Solution ("Change the finalizer visibility to protected (family).")] [FxCopCompatibility ("Microsoft.Usage", "CA2221:FinalizersShouldBeProtected")] public class FinalizersShouldBeProtectedRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { MethodDefinition finalizer = type.GetMethod (MethodSignatures.Finalize); if (finalizer == null) // no finalizer found return RuleResult.DoesNotApply; // good finalizer: if (finalizer.IsFamily && !finalizer.IsFamilyAndAssembly && !finalizer.IsFamilyOrAssembly) return RuleResult.Success; Runner.Report (finalizer, Severity.High, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/StronglyTypeICollectionMembersRule.cs0000664000175000017500000000625712413742070033762 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.StronglyTypeICollectionMembersRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks that types which implements System.Collections.ICollection interface /// have strongly typed version of the ICollection.CopyTo method. /// This is needed to avoid casting every time this method is used. /// /// /// Bad example: /// /// class Bad : ICollection { /// public void CopyTo (Array array, int index) /// { /// // method code /// } /// // other ICollection members /// } /// /// /// /// Good example: /// /// class Good : ICollection { /// public void ICollection.CopyTo (Array array, int index) /// { /// // method code /// } /// public void CopyTo (Exception [] array, int index) /// { /// ((ICollection)this).CopyTo(array, index); /// } /// } /// /// [Problem ("Types that implement ICollection interface should have strongly typed version of ICollection.CopyTo method")] [Solution ("Explicitly implement ICollection.CopyTo and add strongly typed alternative to it")] [FxCopCompatibility ("Microsoft.Design", "CA1035:ICollectionImplementationsHaveStronglyTypedMembers")] public class StronglyTypeICollectionMembersRule : StronglyTypedRule, ITypeRule { private static string [] Empty = new string [] { }; private static MethodSignature [] CopyTo = new MethodSignature [] { new MethodSignature ("CopyTo", "System.Void", new string [] { "System.Array", "System.Int32" }) }; protected override MethodSignature [] GetMethods () { return CopyTo; } protected override string [] GetProperties () { return Empty; } protected override string InterfaceName { get { return "ICollection"; } } protected override string InterfaceNamespace { get { return "System.Collections"; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/MarkAssemblyWithAttributeRule.cs0000664000175000017500000000373012413742070032742 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.MarkAssemblyWithAttributeRule abstract rule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { abstract public class MarkAssemblyWithAttributeRule : Rule, IAssemblyRule { abstract protected string AttributeNamespace { get; } abstract protected string AttributeName { get; } abstract protected Severity Severity { get; } public RuleResult CheckAssembly (AssemblyDefinition assembly) { if (!assembly.HasCustomAttributes) return RuleResult.DoesNotApply; if (assembly.HasAttribute (AttributeNamespace, AttributeName)) return RuleResult.Success; Runner.Report (assembly, Severity, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ImplementIComparableCorreclyRule.cs0000664000175000017500000001207312413742070033364 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ImplementIComparableCorrectlyRule // // Authors: // Sebastien Pouliot // // 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; using System.Text; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Design { /// /// This rule checks for types that implement System.IComparable and verifies /// that the type overrides the Equals(object) method and overloads the ==, /// !=, < and > operators. /// /// /// Bad example: /// /// public struct Comparable : IComparable { /// /// private int x; /// /// public int CompareTo (object obj) /// { /// return x.CompareTo (((Comparable)obj).x); /// } /// } /// /// /// /// Good example: /// /// public struct Comparable : IComparable { /// /// public int CompareTo (object obj) /// { /// return x.CompareTo (((Comparable)obj).x); /// } /// /// public override bool Equals (object obj) /// { /// return x == ((Comparable) obj).x; /// } /// /// static public bool operator == (Comparable left, Comparable right) /// { /// return (left.x == right.x); /// } /// /// static public bool operator != (Comparable left, Comparable right) /// { /// return (left.x != right.x); /// } /// /// static public bool operator > (Comparable left, Comparable right) /// { /// return (left.x > right.x); /// } /// /// static public bool operator < (Comparable left, Comparable right) /// { /// return (left.x < right.x); /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This type implements IComparable so it should override Equals(object) and overload the ==, !=, < and > operators.")] [Solution ("Implement the suggested method and/or operators.")] [FxCopCompatibility ("Microsoft.Design", "CA1036:OverrideMethodsOnComparableTypes")] public class ImplementIComparableCorrectlyRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule does not apply to enums, interfaces and to generated code if (type.IsEnum || type.IsInterface || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // rule only applies if the type implements IComparable or IComparable // Note: we do not use Implements rock because we do not want a recursive answer bool icomparable = false; foreach (TypeReference iface in type.Interfaces) { if (iface.Namespace != "System") continue; // catch both System.IComparable and System.IComparable`1 if (iface.Name.StartsWith ("IComparable", StringComparison.Ordinal)) { icomparable = true; break; } } if (!icomparable) return RuleResult.DoesNotApply; // type should override Equals(object) if (!type.HasMethod (MethodSignatures.Equals)) Runner.Report (type, Severity.High, Confidence.High, "Missing Equals(object) override."); // type should implement overloads for ==, !=, < and > operators // note: report all missing operators as single defect bool equality = type.HasMethod (MethodSignatures.op_Equality); bool inequality = type.HasMethod (MethodSignatures.op_Inequality); bool less_than = type.HasMethod (MethodSignatures.op_LessThan); bool greater_than = type.HasMethod (MethodSignatures.op_GreaterThan); if (!equality || !inequality || !less_than || !greater_than) { StringBuilder sb = new StringBuilder ("Missing operators:"); if (!equality) sb.Append (" op_Equality (==)"); if (!inequality) sb.Append (" op_Inequality (!=)"); if (!less_than) sb.Append (" op_LessThan (<)"); if (!greater_than) sb.Append (" op_GreaterThan (>)"); // not all languages support operator overloading so we lower the severity a bit Runner.Report (type, Severity.Medium, Confidence.High, sb.ToString ()); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/MarkAssemblyWithComVisibleRule.cs0000664000175000017500000000502012413742070033025 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.MarkAssemblyWithComVisibleRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if an assembly does not contain a [ComVisible] attribute. /// Unless the assembly is designed with COM interoperability in mind it is better to declare /// it as non-COM visible, i.e. [ComVisible (false)]. /// /// /// Good example: /// /// // by default everything in this assembly is not visible to COM consumers /// [assembly: ComVisible (false)] /// /// /// This rule is available since Gendarme 2.2 [Problem ("This assembly is not decorated with the [ComVisible] attribute.")] [Solution ("Add this attribute to ease the use (or non-use) of your assembly by COM consumers.")] [FxCopCompatibility ("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] public class MarkAssemblyWithComVisibleRule : MarkAssemblyWithAttributeRule { protected override string AttributeNamespace { get { return "System.Runtime.InteropServices"; } } protected override string AttributeName { get { return "ComVisibleAttribute"; } } protected override Severity Severity { get { return Severity.Medium; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/PreferXmlAbstractionsRule.cs0000664000175000017500000001076012413742070032112 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.PreferXmlAbstractionsRule // // Authors: // Cedric Vivier // // Copyright (C) 2009 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if an externally visible method or property uses an XmlDocument, /// XPathDocument or XmlNode argument. The problem with this is that it ties /// your API to a specific implementation so it is difficult to change later. Instead use /// abstract types like IXPathNavigable, XmlReader, XmlWriter, or subtypes /// of XmlNode. /// /// /// Bad example (property): /// /// public class Application { /// public XmlDocument UserData { /// get { /// return userData; /// } /// } /// } /// /// /// /// Good example (property): /// /// public class Application { /// public IXPathNavigable UserData { /// get { /// return userData; /// } /// } /// } /// /// /// /// Bad example (method parameter): /// /// public class Application { /// public bool IsValidUserData (XmlDocument userData) /// { /// /* implementation */ /// } /// } /// /// /// /// Good example (method parameter): /// /// public class Application { /// public bool IsValidUserData (XmlReader userData) /// { /// /* implementation */ /// } /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("This visible method uses XmlDocument, XPathDocument or XmlNode in its signature. This makes changing the implementation more difficult than it should be.")] [Solution ("Use IXPathNavigable, XmlReader, XmlWriter, or a subtype of XmlNode instead.")] [FxCopCompatibility ("Microsoft.Design", "CA1059:MembersShouldNotExposeCertainConcreteTypes")] public class PreferXmlAbstractionsRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { foreach (AssemblyNameReference name in e.CurrentModule.AssemblyReferences) { if (name.Name == "System.Xml") { Active = true; return; } } Active = false; //no System.Xml assembly reference has been found }; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.IsVisible ()) return RuleResult.DoesNotApply; MethodReturnType mrt = method.MethodReturnType; if (IsSpecificXmlType (mrt.ReturnType)) Runner.Report (mrt, GetSeverity (method), Confidence.High); if (method.HasParameters) { foreach (ParameterDefinition parameter in method.Parameters) { if (parameter.IsOut) continue; //out params already have their rule if (IsSpecificXmlType (parameter.ParameterType)) Runner.Report (parameter, GetSeverity (method), Confidence.High); } } return Runner.CurrentRuleResult; } static bool IsSpecificXmlType (TypeReference type) { if (type.Namespace == "System.Xml") { string name = type.Name; return ((name == "XmlDocument") || (name == "XmlNode")); } return type.IsNamed ("System.Xml.XPath", "XPathDocument"); } static Severity GetSeverity (MethodDefinition method) { return method.IsPublic ? Severity.Medium : Severity.Low; } } } AbstractTypesShouldNotHavePublicConstructorsRule.cs0000664000175000017500000000526012413742070036575 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design// // Gendarme.Rules.Design.AbstractTypesShouldNotHavePublicConstructorsRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if an abstract type has a public constructor. This is /// a bit misleading because the constructor can only be called by the constructor of /// a derived type. To make the type's semantics clearer make the constructor /// protected. /// /// /// Bad example: /// /// abstract public class MyClass { /// public MyClass () /// { /// } /// } /// /// /// /// Good example: /// /// abstract public class MyClass { /// protected MyClass () /// { /// } /// } /// /// [Problem ("This abstract type defines public constructor(s).")] [Solution ("Change the constructor access to protected.")] [FxCopCompatibility ("Microsoft.Design", "CA1012:AbstractTypesShouldNotHaveConstructors")] public class AbstractTypesShouldNotHavePublicConstructorsRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule apply only on abstract types if (!type.IsAbstract) return RuleResult.DoesNotApply; // rule applies! foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor && method.IsPublic) { Runner.Report (method, Severity.Low, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/MainShouldNotBePublicRule.cs0000664000175000017500000000676312413742070031773 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.MainShouldNotBePublicRule // // Authors: // Daniel Abramov // // Copyright (C) 2007 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if an assembly's entry point (typically named Main) is visible /// to other assemblies. It is better to make this method private so that only the CLR /// can call the method. /// /// /// Bad example: /// /// public class MainClass { /// public void Main () /// { /// } /// } /// /// /// /// Good example (type is not externally visible): /// /// internal class MainClass { /// public void Main () /// { /// } /// } /// /// /// /// Good example (method is not externally visible): /// /// public class MainClass { /// internal void Main () /// { /// } /// } /// /// [Problem ("The entry point (Main) of this assembly is visible to the outside world (ref: C# Programming Guide).")] [Solution ("Reduce the visibility of the method or type if your language allows it. It may not be possible in some language, like VB.NET).")] public class MainShouldNotBePublicRule : Rule, IAssemblyRule { private const string VisualBasic = "Microsoft.VisualBasic"; public RuleResult CheckAssembly (AssemblyDefinition assembly) { // assembly must have an entry point to be examined MethodDefinition entry_point = assembly.EntryPoint; if (entry_point == null) return RuleResult.DoesNotApply; // RULE APPLIES // we have to check declaringType's visibility so // if we can't get access to it (is this possible?) we abandon // also, if it is not public, we don't have to continue our work // - we can't reach Main () anyways TypeDefinition type = entry_point.DeclaringType.Resolve (); if (type == null || !type.IsPublic) return RuleResult.Success; // at last, if Main () is not public, then it's okay if (!entry_point.IsPublic) return RuleResult.Success; if (assembly.References (VisualBasic)) { Runner.Report (type, Severity.Medium, Confidence.High, "Reduce class or module visibility (from public)."); } else { Runner.Report (entry_point, Severity.Medium, Confidence.Total, "Change method visibility to private or internal."); } return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/StronglyTypedRule.cs0000664000175000017500000001147412413742070030463 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ListsAreStronglyTypedRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { abstract public class StronglyTypedRule : Rule, ITypeRule { abstract protected MethodSignature [] GetMethods (); abstract protected string [] GetProperties (); abstract protected string InterfaceName { get; } abstract protected string InterfaceNamespace { get; } MethodSignature [] signatures; string [] propertyNames; int methodsLeft, propertiesLeft; virtual public RuleResult CheckType (TypeDefinition type) { if (type.IsAbstract || type.IsGeneratedCode () || !type.Implements (InterfaceNamespace, InterfaceName)) return RuleResult.DoesNotApply; signatures = GetMethods (); propertyNames = GetProperties (); methodsLeft = signatures.Length; propertiesLeft = propertyNames.Length; TypeDefinition baseType = type; while (methodsLeft > 0 || propertiesLeft > 0) { ProcessType (baseType); if (baseType.BaseType == null) break; TypeDefinition td = baseType.BaseType.Resolve (); if (td == null) break; baseType = td; } if (propertiesLeft > 0) { foreach (string propertyName in propertyNames) { if (propertyName == null) continue; Runner.Report (type, Severity.Medium, Confidence.High, "Type does not have strongly typed version of property " + propertyName); } } if (methodsLeft > 0) { foreach (MethodSignature signature in signatures) { if (signature == null) continue; Runner.Report (type, Severity.Medium, Confidence.High, "Type does not have strongly typed version of method " + signature.Name); } } return Runner.CurrentRuleResult; } private void ProcessType (TypeDefinition baseType) { if (baseType.HasMethods && methodsLeft > 0) ProcessMethods (baseType); if (baseType.HasProperties && propertiesLeft > 0) ProcessProperties (baseType); } static bool IsWeak (TypeReference type) { if (type.Namespace != "System") return false; string name = type.Name; return ((name == "Object") || (name == "Array") || (name == "Object[]")); } static bool IsWeak (string typeName) { return ((typeName == "System.Object") || (typeName == "System.Array") || (typeName == "System.Object[]")); } private void ProcessProperties (TypeDefinition baseType) { foreach (PropertyDefinition property in baseType.Properties) { for (int i = 0; i < propertyNames.Length; i++) { if (propertyNames [i] == null || propertyNames [i] != property.Name) continue; if (!IsWeak (property.PropertyType)) { propertiesLeft--; propertyNames [i] = null; } } } } private void ProcessMethods (TypeDefinition baseType) { foreach (MethodDefinition method in baseType.Methods) { if (!method.HasParameters || method.IsProperty ()) continue; for (int i = 0; i < signatures.Length; i++) { var methodParameters = method.Parameters; if (signatures [i] == null || method.Name != signatures [i].Name || methodParameters.Count != signatures [i].Parameters.Count) continue; bool foundStrong = true; for (int j = 0; j < methodParameters.Count; j++) { if (!IsWeak (signatures [i].Parameters [j])) continue; if (IsWeak (methodParameters [j].ParameterType)) foundStrong = false; } if (foundStrong) { methodsLeft--; // null means strongly typed version of this signature was found signatures [i] = null; } } } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ConsiderUsingStaticTypeRule.cs0000664000175000017500000000750512413742070032422 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ConsiderUsingStaticTypeRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks for types that contain only static members and, if the assembly /// targets the CLR version 2.0 or later, suggests that the type be made static /// or, for earlier versions, that the type be made sealed. /// /// /// Bad example: /// /// public class Class { /// public static void Method () /// { /// } /// } /// /// /// /// Good example (targetting CLR 2.0 and later): /// /// public static class Class { /// public static void Method () /// { /// } /// } /// /// /// /// Good example (targetting CLR 1.x): /// /// public sealed class Class { /// public static void Method () /// { /// } /// } /// /// [Problem ("This type contains only static fields and methods and should be static.")] [Solution ("Change this type into a static (or sealed for 1.x) type gain clarity and better error reporting.")] [FxCopCompatibility ("Microsoft.Design", "CA1052:StaticHolderTypesShouldBeSealed")] public class ConsiderUsingStaticTypeRule : Rule, ITypeRule { static bool IsAllStatic (TypeDefinition type) { if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) { // let's the default ctor pass (since it's always here for 1.x code) if (!method.IsStatic && method.HasParameters) return false; } else { if (!method.IsStatic) return false; } } } if (type.HasFields) { foreach (FieldDefinition field in type.Fields) { if (!field.IsStatic) return false; } } return true; } public RuleResult CheckType (TypeDefinition type) { // rule applies only if the type isn't: an enum, an interface, a struct, a delegate or compiler generated if (type.IsEnum || type.IsInterface || type.IsValueType || type.IsDelegate () || type.IsGeneratedCode () || type.BaseType != null && !type.BaseType.IsNamed ("System", "Object")) return RuleResult.DoesNotApply; // success if the type is already static or, before 2.0, is it's sealed if ((type.Module.Runtime >= TargetRuntime.Net_2_0) ? type.IsStatic () : type.IsSealed) return RuleResult.Success; if (IsAllStatic (type)) { // no technical reason not to use a static type exists Runner.Report (type, Severity.Medium, Confidence.High); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/EnumsShouldUseInt32Rule.cs0000664000175000017500000000775312413742070031404 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.EnumsShouldUseInt32Rule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { // TODO: It would be really nice to explain why this is a problem. Presumably it is for // compatibility with other .NET languages which may not support non-int enums... // It might also be a good idea if it only fired for publicly visible enums. /// /// Enumaration types should avoid specifying a non-default storage type for their values /// unless it is required for interoperability (e.g. with native code). If you do use a non-default /// type for the enum, and the enum is externally visible, then prefer the CLS-compliant /// integral types: System.Byte, System.Int16, System.Int32, and System.Int64. /// /// /// Bad examples: /// /// public enum SmallEnum : byte { /// Zero, /// One /// } /// /// [Flags] /// public enum SmallFlag : ushort { /// One = 1, /// // ... /// Sixteen = 1 << 15 /// } /// /// /// /// Good example: /// /// public enum SmallEnum { /// Zero, /// One /// } /// /// [Flags] /// public enum SmallFlag { /// One = 1, /// // ... /// Sixteen = 1 << 15 /// } /// /// [Problem ("Unless required for interoperability this enumeration should use Int32 as its underling storage type.")] [Solution ("Remove the base type from the enumeration declaration (it will then default to Int32).")] [FxCopCompatibility ("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32")] public class EnumsShouldUseInt32Rule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule apply only on enums if (!type.IsEnum) return RuleResult.DoesNotApply; // rule applies! TypeReference ftype = null; foreach (FieldDefinition field in type.Fields) { // we looking for the special value__ if (!field.IsStatic) { ftype = field.FieldType; break; } } Severity severity = Severity.Critical; if ((ftype != null) && (ftype.Namespace == "System")) { switch (ftype.Name) { case "Int32": return RuleResult.Success; // some are bad choice (when possible) but usable by all CLS compliant languages case "Byte": case "Int16": case "Int64": severity = Severity.High; break; // while others are not usable in non-CLS compliant languages default: // System.SByte, System.UInt16, System.UInt32, System.UInt64 severity = Severity.Critical; break; } } string text = String.Format (CultureInfo.InvariantCulture, "Enums should use System.Int32 instead of '{0}'.", ftype.GetFullName ()); Runner.Report (type, severity, Confidence.Total, text); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/EnsureSymmetryForOverloadedOperatorsRule.cs0000664000175000017500000001223412413742070035215 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.EnsureSymmetryForOverloadedOperatorsRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks for operators that are not overloaded in pairs. Some compilers, like /// the C# compilers, require you to implement some of the pairs, but other languages might /// not. The following pairs are checked: /// /// Addition and Substraction /// Multiplication and Division /// Division and Modulus /// Equality and Inequality /// True and False /// GreaterThan and LessThan /// GreaterThanOrEqual and LessThanOrEqual /// /// /// /// Bad example: /// /// class DoesNotOverloadAdd { /// public static int operator - (DoesNotOverloadAdd left, DoesNotOverloadAdd right) /// { /// return 0; /// } /// } /// /// /// /// Good example: /// /// class Good { /// public static int operator + (Good right, Good left) /// { /// return 0; /// } /// /// public static int operator - (Good right, Good left) /// { /// return 0; /// } /// } /// /// [Problem ("This type should overload symetric operators together (e.g. == and !=, + and -).")] [Solution ("Add the missing operator.")] [FxCopCompatibility ("Microsoft.Usage", "CA2226:OperatorsShouldHaveSymmetricalOverloads")] public class EnsureSymmetryForOverloadedOperatorsRule : Rule, ITypeRule { private const string Message = "The '{0}' operator is present, for symmetry, the '{1}' operator should be added."; static KeyValuePair [] SymmetricOperators_Warning = new KeyValuePair [] { new KeyValuePair (MethodSignatures.op_Addition, MethodSignatures.op_Subtraction), new KeyValuePair (MethodSignatures.op_Multiply, MethodSignatures.op_Division), new KeyValuePair (MethodSignatures.op_Division, MethodSignatures.op_Modulus), }; static KeyValuePair [] SymmetricOperators_Error = new KeyValuePair [] { new KeyValuePair (MethodSignatures.op_GreaterThan, MethodSignatures.op_LessThan), new KeyValuePair (MethodSignatures.op_GreaterThanOrEqual, MethodSignatures.op_LessThanOrEqual), new KeyValuePair (MethodSignatures.op_Equality, MethodSignatures.op_Inequality), new KeyValuePair (MethodSignatures.op_True, MethodSignatures.op_False), }; public RuleResult CheckType (TypeDefinition type) { if (type.IsInterface || type.IsEnum || type.IsDelegate ()) return RuleResult.DoesNotApply; foreach (var kv in SymmetricOperators_Warning) CheckOperatorPair (kv, type, Severity.Medium); foreach (var kv in SymmetricOperators_Error) CheckOperatorPair (kv, type, Severity.High); return Runner.CurrentRuleResult; } private void CheckOperatorPair (KeyValuePair pair, TypeReference type, Severity severity) { MethodDefinition op = type.GetMethod (pair.Key); if (op == null) { //first one not defined pair = new KeyValuePair (pair.Value, pair.Key); //reverse op = type.GetMethod (pair.Key); if (op == null) return; //neither one is defined } else { if (type.HasMethod (pair.Value)) return; //both are defined } string s = string.Format (CultureInfo.InvariantCulture, Message, pair.Key.Name, pair.Value.Name); Runner.Report (op, severity, Confidence.Total, s); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/0000775000175000017500000000000012642235742025374 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ChangeLog0000664000175000017500000003647712413742070027160 0ustar00directhexdirecthex000000000000002010-06-04 Sebastien Pouliot * Tests.Rules.Performance.csproj: Fix unit tests for solution (non makefile) builds 2010-05-24 Sebastien Pouliot * GlobalSuppressions.cs: * MarkAssemblyWithAssemblyVersionTest.cs: * MarkAssemblyWithCLSCompliantTest.cs: * MarkAssemblyWithComVisibleTest.cs: Add FxCop compatibility unit tests 2010-01-24 Sebastien Pouliot * ProvideTryParseAlternativeTest.cs: New. Unit tests for ProvideTryParseAlternativeRule 2010-01-19 Jb Evain * DisposableTypesShouldHaveFinalizerTest.cs: add test for generated types closing on a native field. 2009-12-13 Sebastien Pouliot * DisposableTypesShouldHaveFinalizerTest.cs: Add test cases for structs 2009-02-21 Jesse Jones * UseCorrectDisposeSignaturesTest.cs: added new rule. 2009-01-12 Jesse Jones * UseFlagsAttributeRule.cs: added. 2008-11-07 Alan McGovern * Tests.Rules.Design.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-27 Sebastien Pouliot * FinalizersShouldBeProtectedTest.cs: Updated not to depend on another (moved) test type definition. * FinalizersShouldCallBaseClassFinalizerTest.cs: Moved to Correctness since this is not (API) design. * Test.Rules.Design.mdp: remove the moved test from the MD project file. 2008-10-26 Sebastien Pouliot * MarkAssemblyWithAssemblyVersionTest.cs: New. Unit tests for MarkAssemblyWithAssemblyVersionRule. * MarkAssemblyWithCLSCompliantTest.cs: New. Unit tests for MarkAssemblyWithCLSCompliantRule. * MarkAssemblyWithComVisibleTest.cs: New. Unit tests for MarkAssemblyWithComVisibleRule. * DisposableFieldsShouldBeDisposedTest.cs: Moved to Correctness since this is not (API) design. * Test.Rules.Design.mdp: Add new tests and remove the moved test from the MD project file. 2008-10-24 Sebastien Pouliot * PreferEventsOverMethodsTest.cs: New. Unit tests for PreferEventsOverMethodsRule 2008-10-19 Sebastien Pouliot * AvoidMultidimensionalIndexerTest.cs: Fix namespace. * AvoidSmallNamespaceTest.cs: New. Unit tests for AvoidSmallNamespaceRule. * AvoidVisibleNestedTypesTest.cs: Fix namespace. * InternalNamespacesShouldNotExposeTypesTest.cs: New. Unit tests for InternalNamespacesShouldNotExposeTypesRule. * PreferIntegerOrStringForIndexersTest.cs: Fix namespace. * Test.Rules.Design.mdp: Add new test to MD project file. 2008-10-06 Sebastien Pouliot * AvoidVisibleNestedTypesTest.cs: Remove unneeded 'using' clauses. * ConsiderConvertingFieldToNullableTest.cs: Remove unneeded 'using' clauses. * ConsiderConvertingMethodToPropertyTest.cs: Add more coverage. Remove unneeded 'using' clauses. * ConsiderUsingStaticTypeTest.cs: Add more coverage. * DeclareEventHandlersCorrectlyTest.cs: Add more coverage. Remove unneeded 'using' clauses. 2008-10-05 Sebastien Pouliot * DisposableFieldsShouldBeDisposedTest.cs: Add more coverage. * DisposableTypesShouldHaveFinalizerTest.cs: Use new, shorter, syntax for tests. Remove unneeded 'using' clauses. * DoNotDeclareVirtualMethodsInSealedTypeTest.cs: New. Unit tests for DoNotDeclareVirtualMethodsInSealedTypeRule. * DontDeclareProtectedFieldsInSealedClassTest.cs: Use new, shorter, syntax for tests. Add test cases for new features (members) and more coverage. Remove unneeded 'using' clauses. * EnsureSymmetryForOverloadedOperatorsTest.cs: Use new, shorter, syntax for tests. Add more coverage. Remove unneeded 'using' clauses. 2008-10-04 Sebastien Pouliot * EnumsShouldDefineAZeroValueTest.cs, EnumsShouldUseInt32Test.cs, FinalizersShouldBeProtectedTest.cs, FinalizersShouldCallBaseClassFinalizerTest.cs, FlagsShouldNotDefineAZeroValueTest.cs, ImplementEqualsAndGetHashCodeInPairTest.cs: Use new, shorter, syntax for tests. Add more coverage. Remove unneeded 'using' clauses. 2008-10-03 Sebastien Pouliot * MainShouldNotBePublicTest.cs: Use new, shorter, syntax for tests. Add more coverage. Remove unneeded 'using' clauses. * OperatorEqualsShouldBeOverloadedTest.cs: Use new, shorter, syntax for tests. Add more coverage. Remove unneeded 'using' clauses. * OverrideEqualsMethodTest.cs: Use new, shorter, syntax for tests. Add more coverage. Remove unneeded 'using' clauses. * PreferIntegerOrStringForIndexersTest.cs: Remove unneeded 'using' clauses. * ProvideAlternativeNamesForOperatorOverloadsTest.cs: Use new, shorter, syntax for tests. Add more coverage. Remove unneeded 'using' clauses. 2008-10-02 Sebastien Pouliot * TypesShouldBeInsideNamespacesTest.cs: Use new, shorter, syntax for tests. Remove unneeded 'using' clauses. * TypesWithDisposableFieldsShouldBeDisposableTest.cs: Use new, shorter, syntax for tests. Add more coverage. Remove unneeded 'using' clauses. * TypesWithNativeFieldsShouldBeDisposableTest.cs: Use new, shorter, syntax for tests. Add more coverage. Remove unneeded 'using' clauses. * UsingCloneWithoutImplementingICloneableTest.cs: Rename type. Remove unneeded 'using' clauses. 2008-09-30 Sebastien Pouliot * AbstractTypesShouldNotHavePublicConstructorsTest.cs: Convert to new test syntax. Add more coverage. * AttributeArgumentsShouldHaveAccessorsTest.cs: Convert to new test syntax. * AvoidEmptyInterfaceTest.cs: Convert to new test syntax. * AvoidMultidimensionalIndexerTest.cs: Remove unneeded "using". * AvoidPropertiesWithoutGetAccessorTest.cs: Convert to new test syntax. * AvoidPublicInstanceFieldsTest.cs: Convert to new test syntax. Add more coverage. Remove some warnings. 2008-09-19 Néstor Salceda * DeclareEventHandlersCorrectlyTest.cs: A little test for the false positive found with EventHandler. The compiler forces us to write a valid signature. 2008-09-18 Sebastien Pouliot * DeclareEventHandlersCorrectlyTest.cs: With the "fixed" logic there are now two defects reported for ClassWithTwoFields. 2008-09-18 Néstor Salceda * DeclareEventHandlersCorrectlyTest.cs: New. Unit tests for DeclareEventHandlersCorrectlyRule. * Test.Rules.Design.mdp: Updated MD project file. 2008-09-15 Sebastien Pouliot * DisposableFieldsShouldBeDisposedTest.cs: Add two ignored test cases where the Dispose calls are done by anonymous delegates. Also converted tests to the new, shorter, syntax. 2008-08-26 Sebastien Pouliot * ImplementGenericCollectionInterfacesTest.cs: Move to Design.Generic * Test.Rules.Design.mdp, Tests.Rules.Design.csproj: Update 2008-08-06 Peter Johanson * AvoidPublicInstanceFieldsTest.cs: Test nested types with various visibilities. The rule does not apply to private or internal nested types. 2008-08-02 Sebastien Pouliot * ConsiderConvertingFieldToNullableTest.cs: Add test case for FX version (Initialize check) and a few others to complete coverage. * ImplementGenericCollectionInterfacesTest.cs: Change FX version test case to check Initialize (not CheckType) method. 2008-07-23 Nestor Salceda * ConsiderUsingStaticTypeTest.cs: Fix the existing tests because they are a bit confusing. This new tests removes several false positives. 2008-07-13 Sebastien Pouliot * AvoidMultidimensionalIndexerTest.cs: New. Unit tests for AvoidMultidimensionalIndexerRule. * PreferIntegerOrStringForIndexersTest.cs: New. Unit tests for PreferIntegerOrStringForIndexersRule. * Test.Rules.Design.mdp: Add tests to MD project file. 2008-07-13 Sebastien Pouliot * AvoidRefAndOutParametersTest.cs: New. Unit tests for AvoidRefAndOutParametersRule. * Test.Rules.Design.mdp: Add tests to MD project file. 2008-07-12 Sebastien Pouliot * ConsiderUsingStaticTypeTest.cs: New. Unit tests for ConsiderUsingStaticTypeRule. 2008-06-08 Sebastien Pouliot * AvoidVisibleNestedTypesTest.cs: New. Unit tests for AvoidVisibleNestedTypesRule. * Test.Rules.Design.mdp: Add tests to MD project file. 2008-05-04 Sebastien Pouliot * UsingCloneWithoutImplementingICloneableTest.cs: Update test cases to new format. Change expected result when Clone does not return System.Object. 2008-05-01 Sebastien Pouliot * ConsiderConvertingFieldToNullableRuleTest.cs: New. Test cases for ConsiderConvertingFieldToNullableRule [Cedric Vivier]. 2008-04-26 Sebastien Pouliot * ConsiderConvertingMethodToPropertyTest.cs: Add test cases for Has. Patch from Cedric Vivier. 2008-04-11 Sebastien Pouliot * ConsiderConvertingMethodToPropertyTest.cs: Ignore Set* without a Get* methods. Ignore overrides (can be out of developer's control, but the base virtual method will be reported if not). Update to use new test helpers. 2008-04-03 Daniel Abramov * ImplementGenericCollectionInterfacesTest.cs: New. Unit tests for ImplementGenericCollectionInterfacesRule. * Test.Rules.Design.mdp: Add rule to MD project file. 2008-04-03 Sebastien Pouliot * Test.Rules.Design.mdp: Add missing reference to Test.Rules assembly [Daniel Abramov] 2008-03-30 Sebastien Pouliot * ImplementIComparableCorreclyTest.cs: New. Unit tests for ImplementIComparableCorreclyRule. * Test.Rules.Design.mdp: Add new rule to MD project. 2008-02-16 Sebastien Pouliot * DontDeclareProtectedFieldsInSealedClassTest.cs: Fix name change. 2008-02-15 Sebastien Pouliot * AbstractTypesShouldNotHavePublicConstructorsTest.cs * AttributeArgumentsShouldHaveAccessorsTest.cs * AvoidEmptyInterfaceTest.cs * AvoidPropertiesWithoutGetAccessorTest.cs * AvoidPublicInstanceFieldsTest.cs * ConsiderConvertingMethodToPropertyTest.cs * DisposableFieldsShouldBeDisposedTest.cs * DisposableTypesShouldHaveFinalizerTest.cs * DontDeclareProtectedFieldsInSealedClassTest.cs * EnsureSymmetryForOverloadedOperatorsTest.cs * EnumsShouldDefineAZeroValueTest.cs * EnumsShouldUseInt32Test.cs * FinalizersShouldBeProtectedTest.cs * FinalizersShouldCallBaseClassFinalizerTest.cs * FlagsShouldNotDefineAZeroValueTest.cs * ImplementEqualsAndGetHashCodeInPairTest.cs * MainShouldNotBePublicTest.cs * MissingAttributeUsageOnCustomAttributeTest.cs * OperatorEqualsShouldBeOverloadedTest.cs * OverrideEqualsMethodTest.cs * ProvideAlternativeNamesForOperatorOverloadsTest.cs * TypesShouldBeInsideNamespacesTest.cs * TypesWithDisposableFieldsShouldBeDisposableTest.cs * TypesWithNativeFieldsShouldBeDisposableTest.cs * UsingCloneWithoutImplementingICloneableTest.cs: Update unit tests wrt framework changes 2008-02-07 Sebastien Pouliot * EnumsShouldUseInt32Test.cs: New. Unit tests. * Test.Rules.Design.mdp: Update project file. 2008-02-07 Nestor Salceda * FinalizersShouldCallBaseClassFinalizerTest.cs:Replaced TypeDefinition.GetFinalizer with TypeDefinition.GetMethod for avoid some warnings when compiling. 2008-01-29 Sebastien Pouliot * ProvideAlternativeNamesForOperatorOverloadsTest.cs: Add "override Equals" in EverythingIsThere class. 2008-01-27 Sebastien Pouliot * TypesShouldBeInsideNamespacesTest.cs: Adapt nested types test cases because we don't report them anymore. 2008-01-24 Sebastien Pouliot * ImplementEqualsAndGetHashCodeInPairTest.cs: Tests (updated and) moved from BadPractice. 2008-01-18 Sebastien Pouliot * EnsureSymmetryForOverloadedOperatorsTest.cs: New. Unit tests by Andreas Noever * OperatorEqualsShouldBeOverloadedTest.cs: New. Unit tests by Andreas Noever * OverrideEqualsMethodTest.cs: New. Unit tests by Andreas Noever * ProvideAlternativeNamesForOperatorOverloadsTest.cs: New. Unit tests by Andreas Noever 2008-01-13 Sebastien Pouliot * FinalizersShouldBeProtectedTest.cs: New. Unit tests by Daniel Abramov * FinalizersShouldCallBaseClassFinalizerTest.cs: New. Unit tests by Daniel Abramov * Test.Rules.Design.mdp: Added new tests to MD project file. 2008-01-13 Sebastien Pouliot * DisposableFieldsShouldBeDisposedTest.cs: Add test case for static fields. * DisposableTypesShouldHaveFinalizerTest.cs: Add test case for static fields. * TypesWithDisposableFieldsShouldBeDisposableTest.cs: Add test cases for structs and static fields. * TypesWithNativeFieldsShouldBeDisposableTest.cs: Add test cases for structs and static fields. 2008-01-13 Sebastien Pouliot * DisposableFieldsShouldBeDisposedTest.cs: New. Unit tests by Andreas Noever. * DisposableTypesShouldHaveFinalizerTest.cs: New. Unit tests by Andreas Noever. * TypesWithDisposableFieldsShouldBeDisposableTest.cs: New. Unit tests by Andreas Noever. * TypesWithNativeFieldsShouldBeDisposableTest.cs: New. Unit tests by Andreas Noever. * Test.Rules.Design.mdp: Added new tests to MD project file. 2008-01-12 Sebastien Pouliot * AttributeArgumentsShouldHaveAccessorsTest.cs: New. Unit tests from Daniel Abramov. 2008-01-05 Sebastien Pouliot * MissingAttributeUsageOnCustomAttributeTest.cs: New. Unit tests from Daniel Abramov. * Test.Rules.Design.mdp: Add new unit tests to MonoDevelop project file. 2008-01-04 Sebastien Pouliot * AvoidPublicInstanceFieldsTest.cs: New. Unit tests from Adrian Tsai * ConsiderConvertingMethodToPropertyTest.cs: New. Unit tests from Adrian Tsai * Test.Rules.Design.mdp: Add new unit tests to MonoDevelop project file. 2007-12-28 Sebastien Pouliot * MainShouldNotBePublicTest.cs: New. Unit tests from Daniel Abramov. * Test.Rules.Design.mdp: Add new unit test to MonoDevelop project file. 2007-12-26 Sebastien Pouliot * AbstractTypesShouldNotHavePublicConstructorsTest.cs: New. Unit tests * AvoidEmptyInterfaceTest.cs: New. Unit tests * AvoidPropertiesWithoutGetAccessorTest.cs: New. Unit tests * EnumsShouldDefineAZeroValueTest.cs: New. Unit tests * FlagsShouldNotDefineAZeroValueTest.cs: New. Unit tests * TypesShouldBeInsideNamespacesTest.cs: New. Unit tests * UsingCloneWithoutImplementingICloneableTest.cs: Add test cases for inheritance. * Test.Rules.Design.mdp: Add new unit test to MonoDevelop project file. 2007-11-22 Sebastien Pouliot * UsingCloneWithoutImplementingICloneableTest.cs: Add a test case where the Clone method return the type itself (not System.Object) since this is also a good candidate for ICloneable 2007-10-08 Sebastien Pouliot * Makefile.am: Add missing file 2007-10-07 Sebastien Pouliot * DontDeclareProtectedFieldsInSealedClassTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * UsingCloneWithoutImplementingICloneableTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * Test.Rules.Design.mdp: New. Project file for MonoDevelop. UsingCloneWithoutImplementingICloneableTest.cs0000664000175000017500000000673712413742070036433 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for ImplementICloneableCorrectlyRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-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; using System.Collections; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design{ [TestFixture] public class ImplementICloneableCorrectlyTest : TypeRuleTestFixture { public class UsingCloneAndImplementingICloneable: ICloneable { public virtual object Clone () { return this.MemberwiseClone (); } } public class UsingCloneWithoutImplementingICloneable { public object Clone () { return this.MemberwiseClone (); } } [Test] public void CorrectSignatures () { AssertRuleDoesNotApply (); AssertRuleFailure (1); } public class NeitherUsingCloneNorImplementingICloneable { public object clone () { return this; } } public class AnotherExampleOfNotUsingBoth { public int Clone () { return 1; } } public class OneMoreExample { public object Clone (int i) { return this.MemberwiseClone (); } } public class CloningType { public CloningType Clone () { return new CloningType (); } } [Test] public void WrongSignatures () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } // ArrayList implements ICloneable but it located in another assembly (mscorlib) public class MyArrayList : ArrayList { public override object Clone () { return new MyArrayList (); } } public class SecondLevelClone : UsingCloneAndImplementingICloneable { // CS0108 on purpose public object Clone () { return new SecondLevelClone (); } } public class SecondLevelCloneWithOverride : UsingCloneAndImplementingICloneable { public override object Clone () { return new SecondLevelCloneWithOverride (); } } [Test] public void DeepInheritance () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/OperatorEqualsShouldBeOverloadedTest.cs0000664000175000017500000000635512413742070035166 0ustar00directhexdirecthex00000000000000// // Unit tests for OperatorEqualsShouldBeOverloadedRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class OperatorEqualsShouldBeOverloadedTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } class NoOperator { public void DoStuff () { } } [Test] public void TestNoOperator () { AssertRuleSuccess (); } class OnlyOneOperator { public static OnlyOneOperator operator + (OnlyOneOperator a, OnlyOneOperator b) { return new OnlyOneOperator (); } } [Test] public void TestOnlyOneOperator () { AssertRuleSuccess (); } class EverythingOK { public static EverythingOK operator + (EverythingOK a, EverythingOK b) { return new EverythingOK (); } public static EverythingOK operator - (EverythingOK a, EverythingOK b) { return new EverythingOK (); } public static bool operator == (EverythingOK a, EverythingOK b) { return true; } public static bool operator != (EverythingOK a, EverythingOK b) { return true; } } [Test] public void TestEverythingOK () { AssertRuleSuccess (); } class NoEquals { public static NoEquals operator + (NoEquals a, NoEquals b) { return null; } public static NoEquals operator - (NoEquals a, NoEquals b) { return null; } } [Test] public void TestNoEquals () { AssertRuleFailure (1); } struct StructNoOperator { public void DoWork () { } } [Test] public void TestStructNoOperator () { AssertRuleSuccess (); } struct StructNoEquality { public override bool Equals (object obj) { return base.Equals (obj); } } [Test] public void TestStructNoEquality () { AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/PreferUriOverStringTest.cs0000664000175000017500000000637012413742070032510 0ustar00directhexdirecthex00000000000000// // Unit Tests for PreferUriOverStringRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Design { public class GoodUris { public Uri MyUri { get; set; } public int NotAUrl { get; set; } public string Urn { get; set; } public string CUR { get; set; } public Uri GetUri () { return null; } public Uri GetNewLink (Uri oldUrl) { return null; } public void OverloadedMethod (string uri) { } public void OverloadedMethod (Uri uri) { } } public class BadUris { public string SomeUri { get; set; } public string BadUrnMethod (string urlParam) { return null; } } public class UriAttribute : Attribute { public UriAttribute (string uri) { Uri = uri; } // note: automatic properties are, alas, decorated as generated code public string Uri { get; set; } } [System.CodeDom.Compiler.GeneratedCodeAttribute ("System.Web.Services", "2.0.50727.42")] public class WebService { private bool IsLocalFileSystemWebService (string url) { return false; } } [TestFixture] public class PreferUriOverStringTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // The rule doesn't apply to setters if a getter is present. AssertRuleDoesNotApply ("set_SomeUri"); } [Test] public void Good () { AssertRuleSuccess (SimpleMethods.EmptyMethod); AssertRuleSuccess ("GetUri"); AssertRuleSuccess("get_CUR"); AssertRuleSuccess ("GetNewLink"); AssertRuleSuccess ("OverloadedMethod", new Type [] { typeof (string) }); } [Test] public void Bad () { AssertRuleFailure ("get_SomeUri", 1); AssertRuleFailure ("BadUrnMethod", 2); } [Test] public void Attribute () { AssertRuleSuccess (".ctor"); AssertRuleFailure ("get_Uri", 1); } [Test] public void GeneratedCode () { AssertRuleDoesNotApply ("IsLocalFileSystemWebService"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ConsiderUsingStaticTypeTest.cs0000664000175000017500000000725412413742070033352 0ustar00directhexdirecthex00000000000000// // Unit tests for ConsiderUsingStaticTypeRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design { [TestFixture] public class ConsiderUsingStaticTypeTest : TypeRuleTestFixture { [Test] public void SkipOnNonClassesTest () { AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } static class StaticClass { static void Show () { Console.WriteLine ("hello"); } } [Test] public void SuccessOnStaticClassTest () { TypeDefinition type = DefinitionLoader.GetTypeDefinition (typeof (ConsiderUsingStaticTypeTest).Assembly, "Test.Rules.Design.ConsiderUsingStaticTypeTest/StaticClass"); AssertRuleSuccess (type); } class CouldBeStaticClass { static void Show () { Console.WriteLine ("hello"); } } [Test] public void FailOnCouldBeStaticClassTest () { AssertRuleFailure (1); } public class EmptyClass { // this creates a public ctor } [Test] public void EmptyClassHasDefaultPublicInstanceCtor () { AssertRuleFailure (); } //You cannot do this class static //This is the same testcase that EventArgs inheritance public class InheritAddingStatic : EmptyClass { static private int x; static public void Show () { Console.WriteLine (x); } } public class InheritAddingInstance : EmptyClass { string Message = "Hello"; public void Display () { Console.WriteLine (Message); } } [Test] public void SkipOnInheritanceTest () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } public class ClassWithOnlyFields { int x; char c; } [Test] public void SuccessOnClassWithOnlyFieldsTest () { AssertRuleSuccess (); } public class ClassWithOnlyMethods { public void MakeStuff () { } } [Test] public void SuccessOnClassWithOnlyMethodsTest () { AssertRuleSuccess (); } public class ClassWithNonDefaultConstructor { public ClassWithNonDefaultConstructor (int x) { } static void Show () { Console.WriteLine ("hello"); } } [Test] public void NonDefaultConstructor () { AssertRuleSuccess (); } } } DoNotDeclareSettersOnCollectionPropertiesTest.cs0000664000175000017500000000765112413742070036751 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for DoNotDeclareSettersOnCollectionPropertiesRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Security; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Design { [TestFixture] public class DoNotDeclareSettersOnCollectionPropertiesTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.GeneratedType); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } public interface IGoodInterface { ICollection Collection { get; } ICollection GenericCollection { get; } } public class TypeImplementingGoodInterface : IGoodInterface { public ICollection Collection { get; private set; } public ICollection GenericCollection { get; private set; } } public struct GoodStruct { private ArrayList list; public IDictionary Dictionary { get; private set; } public ArrayList List { get { return list; } } } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } // interface members are not "declared" as public - but they force a type to do so! public interface IBadInterface { ICollection Collection { get; set; } ICollection GenericCollection { get; set; } } public class TypeImplementingBadInterface : IBadInterface { public ICollection Collection { get; set; } public ICollection GenericCollection { get; set; } } public struct BadStruct { public IDictionary Dictionary { private get; set; } public ArrayList List { get; set; } } [Test] public void Bad () { AssertRuleFailure (2); AssertRuleFailure (2); AssertRuleFailure (2); } public class SecurityPermissions { public PermissionSet Permissions { get; set; } public NamedPermissionSet NamedPermissions { get; set; } } public class Indexers { int [] array; public int this [int index] { get { return array [index]; } set { array [index] = value; } } public int this [int x, int y] { get { return array [x]; } set { array [y] = value; } } } public class Arrays { public Array Array { get; set; } } [Test] public void SpecialCases () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); } } } ProvideAlternativeNamesForOperatorOverloadsTest.cs0000664000175000017500000001770712413742070037346 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for ProvideAlternativeNamesForOperatorOverloadsRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class ProvideAlternativeNamesForOperatorOverloadsTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } class NoOperator { public void DoStuff () { } } [Test] public void TestNoOperator () { AssertRuleSuccess (); } class EverythingIsThere { public static EverythingIsThere operator + (EverythingIsThere a) { return null; } public static EverythingIsThere operator - (EverythingIsThere a) { return null; } public static EverythingIsThere operator ! (EverythingIsThere a) { return null; } public static EverythingIsThere operator ~ (EverythingIsThere a) { return null; } public static EverythingIsThere operator ++ (EverythingIsThere a) { return null; } public static EverythingIsThere operator -- (EverythingIsThere a) { return null; } public static bool operator true (EverythingIsThere a) { return false; } public static bool operator false (EverythingIsThere a) { return true; } public static EverythingIsThere operator + (EverythingIsThere a, EverythingIsThere b) { return null; } public static EverythingIsThere operator - (EverythingIsThere a, EverythingIsThere b) { return null; } public static EverythingIsThere operator * (EverythingIsThere a, EverythingIsThere b) { return null; } public static EverythingIsThere operator / (EverythingIsThere a, EverythingIsThere b) { return null; } public static EverythingIsThere operator % (EverythingIsThere a, EverythingIsThere b) { return null; } public static EverythingIsThere operator & (EverythingIsThere a, EverythingIsThere b) { return null; } public static EverythingIsThere operator | (EverythingIsThere a, EverythingIsThere b) { return null; } public static EverythingIsThere operator ^ (EverythingIsThere a, EverythingIsThere b) { return null; } public static EverythingIsThere operator << (EverythingIsThere a, int b) { return null; } public static EverythingIsThere operator >> (EverythingIsThere a, int b) { return null; } public static bool operator > (EverythingIsThere a, EverythingIsThere b) { return false; } public static bool operator >= (EverythingIsThere a, EverythingIsThere b) { return false; } public static bool operator < (EverythingIsThere a, EverythingIsThere b) { return false; } public static bool operator <= (EverythingIsThere a, EverythingIsThere b) { return false; } public static bool operator != (EverythingIsThere a, EverythingIsThere b) { return false; } public static bool operator == (EverythingIsThere a, EverythingIsThere b) { return false; } //for != public EverythingIsThere Plus () { return null; } public EverythingIsThere Negate () { return null; } public EverythingIsThere LogicalNot () { return null; } public EverythingIsThere OnesComplement () { return null; } public EverythingIsThere Increment () { return null; } public EverythingIsThere Decrement () { return null; } public EverythingIsThere IsTrue () { return null; } public EverythingIsThere IsFalse () { return null; } public EverythingIsThere Add (EverythingIsThere other) { return null; } public EverythingIsThere Subtract (EverythingIsThere other) { return null; } public EverythingIsThere Multiply (EverythingIsThere other) { return null; } public EverythingIsThere Divide (EverythingIsThere other) { return null; } public EverythingIsThere Modulus (EverythingIsThere other) { return null; } public EverythingIsThere BitwiseAnd (EverythingIsThere other) { return null; } public EverythingIsThere BitwiseOr (EverythingIsThere other) { return null; } public EverythingIsThere ExclusiveOr (EverythingIsThere other) { return null; } public EverythingIsThere LeftShift (EverythingIsThere other) { return null; } public EverythingIsThere RightShift (EverythingIsThere other) { return null; } public int Compare (EverythingIsThere other) { return 0; } public override bool Equals (object obj) { return base.Equals (obj); } } [Test] public void TestEverythingIsThere () { AssertRuleSuccess (); } class MissingCompare { public static bool operator > (MissingCompare a, MissingCompare b) { return false; } public static bool operator >= (MissingCompare a, MissingCompare b) { return false; } public static bool operator < (MissingCompare a, MissingCompare b) { return false; } public static bool operator <= (MissingCompare a, MissingCompare b) { return false; } public static bool operator != (MissingCompare a, MissingCompare b) { return false; } public static bool operator == (MissingCompare a, MissingCompare b) { return false; } //for != } [Test] public void TestMissingCompare () { AssertRuleFailure (5); } class MissingUnary { public static MissingUnary operator + (MissingUnary a) { return null; } public static MissingUnary operator - (MissingUnary a) { return null; } public static MissingUnary operator ! (MissingUnary a) { return null; } public static MissingUnary operator ~ (MissingUnary a) { return null; } public static MissingUnary operator ++ (MissingUnary a) { return null; } public static MissingUnary operator -- (MissingUnary a) { return null; } public static bool operator true (MissingUnary a) { return false; } public static bool operator false (MissingUnary a) { return true; } } [Test] public void TestMissingUnary () { AssertRuleFailure (8); } class MissingBinary { public static MissingBinary operator + (MissingBinary a, MissingBinary b) { return null; } public static MissingBinary operator - (MissingBinary a, MissingBinary b) { return null; } public static MissingBinary operator * (MissingBinary a, MissingBinary b) { return null; } public static MissingBinary operator / (MissingBinary a, MissingBinary b) { return null; } public static MissingBinary operator % (MissingBinary a, MissingBinary b) { return null; } public static MissingBinary operator & (MissingBinary a, MissingBinary b) { return null; } public static MissingBinary operator | (MissingBinary a, MissingBinary b) { return null; } public static MissingBinary operator ^ (MissingBinary a, MissingBinary b) { return null; } public static MissingBinary operator << (MissingBinary a, int b) { return null; } public static MissingBinary operator >> (MissingBinary a, int b) { return null; } } [Test] public void TestMissingBinary () { AssertRuleFailure (10); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ImplementIComparableCorreclyTest.cs0000664000175000017500000002431712413742070034317 0ustar00directhexdirecthex00000000000000// // Unit tests for ImplementIComparableCorrectlyRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Design { [TestFixture] public class ImplementIComparableCorrectlyTest : TypeRuleTestFixture { [Test] public void NotApplicable () { AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (); } // tests for IComparable public struct ComparableStruct : IComparable { private int x; public int CompareTo (object obj) { if (obj is ComparableStruct) return x.CompareTo (((ComparableStruct) obj).x); throw new ArgumentException ("wrong type", "obj"); } } public struct ComparableStructEquals : IComparable { private int x; public int CompareTo (object obj) { if (obj is ComparableStructEquals) return x.CompareTo (((ComparableStructEquals) obj).x); throw new ArgumentException ("wrong type", "obj"); } public override bool Equals (object obj) { if (obj is ComparableStructEquals) return x == ((ComparableStructEquals) obj).x; return false; } } public struct ComparableStructComplete : IComparable { private int x; public int CompareTo (object obj) { if (obj is ComparableStructComplete) return x.CompareTo (((ComparableStructComplete) obj).x); throw new ArgumentException ("wrong type", "obj"); } public override bool Equals (object obj) { if (obj is ComparableStructComplete) return x == ((ComparableStructComplete) obj).x; return false; } static public bool operator == (ComparableStructComplete left, ComparableStructComplete right) { return (left.x == right.x); } static public bool operator != (ComparableStructComplete left, ComparableStructComplete right) { return (left.x != right.x); } static public bool operator > (ComparableStructComplete left, ComparableStructComplete right) { return (left.x > right.x); } static public bool operator < (ComparableStructComplete left, ComparableStructComplete right) { return (left.x < right.x); } } [Test] public void NonGenericStruct () { // missing Equals and operators AssertRuleFailure (2); // missing operators AssertRuleFailure (1); // complete AssertRuleSuccess (); } public class ComparableClass : IComparable { private int x; public int CompareTo (object obj) { ComparableClass cc = (obj as ComparableClass); if (cc == null) throw new ArgumentException ("wrong type", "obj"); return x.CompareTo (cc.x); } static public bool operator == (ComparableClass left, ComparableClass right) { return (left.x == right.x); } static public bool operator != (ComparableClass left, ComparableClass right) { return (left.x != right.x); } static public bool operator > (ComparableClass left, ComparableClass right) { return (left.x > right.x); } static public bool operator < (ComparableClass left, ComparableClass right) { return (left.x < right.x); } } public class ComparableClassEquals : IComparable { private int x; public int CompareTo (object obj) { ComparableClassEquals cc = (obj as ComparableClassEquals); if (cc == null) throw new ArgumentException ("wrong type", "obj"); return x.CompareTo (cc.x); } public override bool Equals (object obj) { ComparableClassEquals cc = (obj as ComparableClassEquals); if (cc == null) return false; return x == cc.x; } static public bool operator == (ComparableClassEquals left, ComparableClassEquals right) { return (left.x == right.x); } static public bool operator != (ComparableClassEquals left, ComparableClassEquals right) { return (left.x != right.x); } } public class ComparableClassComplete : IComparable { private int x; public int CompareTo (object obj) { ComparableClassComplete cc = (obj as ComparableClassComplete); if (cc == null) throw new ArgumentException ("wrong type", "obj"); return x.CompareTo (cc.x); } public override bool Equals (object obj) { ComparableClassComplete cc = (obj as ComparableClassComplete); if (cc == null) return false; return x == cc.x; } static public bool operator == (ComparableClassComplete left, ComparableClassComplete right) { return (left.x == right.x); } static public bool operator != (ComparableClassComplete left, ComparableClassComplete right) { return (left.x != right.x); } static public bool operator > (ComparableClassComplete left, ComparableClassComplete right) { return (left.x > right.x); } static public bool operator < (ComparableClassComplete left, ComparableClassComplete right) { return (left.x < right.x); } } [Test] public void NonGenericObject () { // missing Equals (but has evey required operators) AssertRuleFailure (1); // missing some operators (> and <) AssertRuleFailure (1); // complete AssertRuleSuccess (); } // tests for IComparable public struct GenericComparableStruct : IComparable { private int x; public int CompareTo (GenericComparableStruct other) { return x.CompareTo (other.x); } } public struct GenericComparableStructEquals : IComparable { private int x; public int CompareTo (GenericComparableStructEquals other) { return x.CompareTo (other.x); } public override bool Equals (object obj) { if (obj is GenericComparableStructEquals) return x == ((GenericComparableStructEquals) obj).x; return false; } } public struct GenericComparableStructComplete : IComparable { private int x; public int CompareTo (GenericComparableStructComplete other) { return x.CompareTo (other.x); } public override bool Equals (object obj) { if (obj is GenericComparableStructComplete) return x == ((GenericComparableStructComplete) obj).x; return false; } static public bool operator == (GenericComparableStructComplete left, GenericComparableStructComplete right) { return (left.x == right.x); } static public bool operator != (GenericComparableStructComplete left, GenericComparableStructComplete right) { return (left.x != right.x); } static public bool operator > (GenericComparableStructComplete left, GenericComparableStructComplete right) { return (left.x > right.x); } static public bool operator < (GenericComparableStructComplete left, GenericComparableStructComplete right) { return (left.x < right.x); } } [Test] public void GenericStruct () { // missing Equals and operators AssertRuleFailure (2); // missing operators AssertRuleFailure (1); // complete AssertRuleSuccess (); } // both IComparable and IComparable public class BothComparableStruct : IComparable, IComparable { private int x; public int CompareTo (object obj) { if (obj is BothComparableStruct) return x.CompareTo (((BothComparableStruct) obj).x); throw new ArgumentException ("wrong type", "obj"); } public int CompareTo (BothComparableStruct other) { return x.CompareTo (other.x); } } public struct BothComparableStructComplete : IComparable, IComparable { private int x; public int CompareTo (object obj) { if (obj is BothComparableStructComplete) return x.CompareTo (((BothComparableStructComplete) obj).x); throw new ArgumentException ("wrong type", "obj"); } public int CompareTo (BothComparableStructComplete other) { return x.CompareTo (other.x); } public override bool Equals (object obj) { if (obj is BothComparableStructComplete) return x == ((BothComparableStructComplete) obj).x; return false; } static public bool operator == (BothComparableStructComplete left, BothComparableStructComplete right) { return (left.x == right.x); } static public bool operator != (BothComparableStructComplete left, BothComparableStructComplete right) { return (left.x != right.x); } static public bool operator > (BothComparableStructComplete left, BothComparableStructComplete right) { return (left.x > right.x); } static public bool operator < (BothComparableStructComplete left, BothComparableStructComplete right) { return (left.x < right.x); } } [Test] public void BothClass () { // missing Equals and operators AssertRuleFailure (2); // complete AssertRuleSuccess (); } } } MissingAttributeUsageOnCustomAttributeTest.cs0000664000175000017500000000724212413742070036340 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for MissingAttributeUsageOnCustomAttributeRule // // Authors: // Daniel Abramov // // Copyright (C) Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Framework; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Design { internal class NotAttribute { } internal class NoUsageDefinedAttribute : Attribute { } [AttributeUsage (AttributeTargets.Method)] internal class UsageDefinedInheritsNoUsageDefinedAttribute : NoUsageDefinedAttribute { } [AttributeUsage (AttributeTargets.Method)] internal class UsageDefinedAttribute : Attribute { } internal class NoUsageDefinedInheritsUsageDefinedAttribute : UsageDefinedAttribute { } [TestFixture] public class MissingAttributeUsageOnCustomAttributeTest { private ITypeRule rule; private AssemblyDefinition assembly; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new MissingAttributeUsageOnCustomAttributeRule (); runner = new TestRunner (rule); } private TypeDefinition GetTest () { return assembly.MainModule.GetType (typeof (T).FullName); } [Test] public void TestNotAttribute () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestNoUsageDefinedAttribute () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestNoUsageDefinedInheritsUsageDefinedAttribute () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestUsageDefinedAttribute () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestUsageDefinedInheritsNoUsageDefinedAttribute () { TypeDefinition type = GetTest (); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/PreferIntegerOrStringForIndexersTest.cs0000664000175000017500000000567112413742070035167 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferIntegerOrStringForIndexersRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class PreferIntegerOrStringForIndexersTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public int this [int index] { get { return 0; } } protected int this [string name] { get { return 0; } } public int this [object o] { get { return 0; } } protected int this [long index] { get { return 0; } } public int this [DateTime date] { get { return 0; } } [Test] public void Visible () { AssertRuleSuccess ("get_Item", new Type [] { typeof (int) }); AssertRuleSuccess ("get_Item", new Type [] { typeof (string) }); AssertRuleSuccess ("get_Item", new Type [] { typeof (object) }); AssertRuleSuccess ("get_Item", new Type [] { typeof (long) }); AssertRuleFailure ("get_Item", new Type [] { typeof (DateTime) }, 1); } class NonVisibleType { public int this [DateTime date] { get { return 0; } } } public class VisibleType { internal int this [DateTime date] { get { return 0; } } } [Test] public void NonVisible () { AssertRuleSuccess ("get_Item", new Type [] { typeof (DateTime) }); AssertRuleSuccess ("get_Item", new Type [] { typeof (DateTime) }); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/DisposableTypesShouldHaveFinalizerTest.cs0000664000175000017500000001031612413742070035516 0ustar00directhexdirecthex00000000000000// // Unit tests for DisposableTypesShouldHaveFinalizerRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // Copyright (C) 2008-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 System.Runtime.InteropServices; using Gendarme.Rules.Design; using Gendarme.Framework.Rocks; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design { class HasFinalizer : IDisposable { IntPtr A; ~HasFinalizer () { } public void Dispose () { throw new NotImplementedException (); } IEnumerator GetBytes () { for (int i = 0; i < 10; i++) yield return Marshal.ReadByte (A, i); } } class NoFinalizer : IDisposable { IntPtr A; public void Dispose () { throw new NotImplementedException (); } } class NotDisposable { IntPtr A; } class NoNativeField : IDisposable { object A; public void Dispose () { throw new NotImplementedException (); } } class NativeFieldArray : IDisposable { IntPtr [] A; public void Dispose () { throw new NotImplementedException (); } } class NotDisposableBecauseStatic : IDisposable { static IntPtr A; public void Dispose () { throw new NotImplementedException (); } } // note: struct cannot have finalizer struct NoNativeDisposableStruct : IDisposable { public void Dispose () { throw new NotImplementedException (); } } struct NativeFieldDisposableStruct : IDisposable { IntPtr ptr; public void Dispose () { throw new NotImplementedException (); } } [TestFixture] public class DisposableTypesShouldHaveFinalizerTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Delegate); } [Test] public void DoesNotApplyGeneratedCode () { var declaring_type = DefinitionLoader.GetTypeDefinition (); Assert.IsTrue (declaring_type.HasNestedTypes, "HasFinalizer-HasNestedTypes"); Assert.AreEqual (1, declaring_type.NestedTypes.Count, "HasFinalized-NestedTypesCount-1"); var type = declaring_type.NestedTypes [0]; Assert.IsTrue (type.IsGeneratedCode (), "NestedType-IsGeneratedCode-True"); AssertRuleDoesNotApply (type); } [Test] public void TestHasFinalizer () { AssertRuleSuccess (); } [Test] public void TestNoFinalizer () { AssertRuleFailure (1); } [Test] public void TestNotDisposable () { AssertRuleDoesNotApply (); } [Test] public void TestNoNativeFields () { AssertRuleSuccess (); } [Test] public void TestNativeFieldArray () { AssertRuleFailure (1); } [Test] public void TestNotDisposableBecauseStatic () { AssertRuleSuccess (); } [Test] public void Struct () { AssertRuleSuccess (); AssertRuleFailure (2); // one field + struct } } } InternalNamespacesShouldNotExposeTypesTest.cs0000664000175000017500000000472112413742070036326 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for InternalNamespacesShouldNotExposeTypesRule // // Authors: // Sebastien Pouliot // // 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; using System.Reflection; using Mono.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Ok.Internal { internal interface InternalInterface { } class PrivateType { public class WithNestPublicType { } } } namespace Bad.Enum.Internal { public enum Internal { Private, Internal } } namespace Bad.Delegate.Impl { public delegate void Internal (object sender, EventArgs e); } namespace Test.Rules.Design { [TestFixture] public class InternalNamespacesShouldNotExposeTypesTest : AssemblyRuleTestFixture { AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } [Test] public void Namespaces () { AssertRuleFailure (assembly, 2); string e1 = "Bad.Enum.Internal.Internal"; string e2 = "Bad.Delegate.Impl.Internal"; string a1 = (Runner.Defects [0].Location as TypeDefinition).FullName; string a2 = (Runner.Defects [1].Location as TypeDefinition).FullName; Assert.IsTrue (a1 == e1 || a2 == e1, e1); Assert.IsTrue (a1 == e2 || a2 == e2, e2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/Makefile.in0000664000175000017500000003141612642235731027444 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Design/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Design.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Design/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Design/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/OverrideEqualsMethodTest.cs0000664000175000017500000000466412413742070032661 0ustar00directhexdirecthex00000000000000// // Unit tests for OverrideEqualsMethodRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class OverrideEqualsMethodTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } class NoOperator { public void DoStuff () { } } [Test] public void TestNoOperator () { AssertRuleSuccess (); } class EverythingOK { public static bool operator == (EverythingOK a, EverythingOK b) { return true; } public static bool operator != (EverythingOK a, EverythingOK b) { return true; } public override bool Equals (object obj) { return base.Equals (obj); } } [Test] public void TestEverythingOK () { AssertRuleSuccess (); } class NoEquals { public static bool operator == (NoEquals a, NoEquals b) { return true; } public static bool operator != (NoEquals a, NoEquals b) { return true; } } [Test] public void TestNoEquals () { AssertRuleFailure (1); } } } AbstractTypesShouldNotHavePublicConstructorsTest.cs0000664000175000017500000000622612413742070037527 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for AbstractTypesShouldNotHavePublicConstructorsRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { public abstract class PublicAbstractClass { public abstract int X { get; } } public abstract class PublicAbstractClassWithPublicCtor { public PublicAbstractClassWithPublicCtor () { } } public abstract class PublicAbstractClassWithProtectedCtor { protected PublicAbstractClassWithProtectedCtor () { } } [TestFixture] public class AbstractTypesShouldNotHavePublicConstructorsTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // non-abstract class AssertRuleDoesNotApply (); } public abstract class NestedPublicAbstractClass { public abstract int X { get; } } public abstract class NestedPublicAbstractClassWithPublicCtors { public NestedPublicAbstractClassWithPublicCtors () { } public NestedPublicAbstractClassWithPublicCtors (int x) { } } public abstract class NestedPublicAbstractClassWithProtectedCtors { protected NestedPublicAbstractClassWithProtectedCtors () { } protected NestedPublicAbstractClassWithProtectedCtors (int x) { } } [Test] public void WithNoConstructors () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void WithPublicConstructors () { AssertRuleFailure (1); AssertRuleFailure (2); } [Test] public void WithProtectedConstructors () { AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ConsiderAddingInterfaceTest.cs0000664000175000017500000001477212413742070033265 0ustar00directhexdirecthex00000000000000// // Unit tests for ConsiderAddingInterfaceRule // // Authors: // Cedric Vivier // Sebastien Pouliot // // Copyright (C) 2008 Cedric Vivier // 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 Gendarme.Framework; using Gendarme.Rules.Design; using System; using System.Collections.Generic; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Design { interface IEmptyInterface { } interface INeverImplementedInterface { bool Never(string bar); } interface INeverImplementedInterface2 { bool Never2(string bar); } interface IAlreadyImplementedInterface { void Already(); } interface IBaseImplementedInterface { bool Base(string bar); } interface INotPubliclyImplementedInterface { void NotPublic(); } interface IPartiallyImplementedInterface { bool Foo(string bar); bool Bar(string foo); } interface IAlmostImplementedInterface { bool Almost(string bar); } interface IImplementedInterface { bool Implement(string bar); } interface IBothInterface { void Both(); } interface IImplementedInterface2 { bool Implement(string bar); void Implement2(); IEnumerable GenericArgs(IEnumerable l); bool GenericMethod(T l); } interface IExtra : IImplementedInterface2 { string Name { get; } } // looks like IExtra but it does not implement anything from IImplementedInterface2 public class Extra { public string Name { get { return String.Empty; } } } static class Never2BecauseStatic { public static bool Never2(string bar) { return true; } } class AlreadyImplemented : IAlreadyImplementedInterface { public void Already() {} } class BaseImplementingInterface : IBaseImplementedInterface { public bool Base(string bar) { return true; } } class BaseImplementsInterface : BaseImplementingInterface { public void NotBase() {} } class BaseImplementsInterface2 : BaseImplementsInterface { public void NotBase2() {} } class NotPubliclyImplemented { protected void NotPublic() {} } class NotPubliclyImplemented2 { private void NotPublic() {} } class NotPubliclyImplemented3 { static void NotPublic() {} } class PartiallyImplemented1 { public bool Foo(string bar) { return true; } } class PartiallyImplemented2 { public bool Bar(string foo) { return true; } } class AlmostImplemented1 { //because bar is int not string public bool Almost(int bar) { return true; } } class AlmostImplemented2 { //because return is int not bool public int Almost(string bar) { return 0; } } class Implemented { public int Noise(string bar) { return 0; } public int Noise2() { return 0; } public bool Implement(string bar) { return true; }//! public void Noise3(string n) {} } class ImplementedB { public bool Implement(string bar) { return true; } private void Both() {} } class Implemented2 { public bool Noise(string bar) { return true; } public bool Noise2() { return true; } public bool Implement(string bar) { return true; }//! public void Implement2() {} public void Both() { } public IEnumerable GenericArgs(IEnumerable l) { return null; }//! public bool GenericMethod(T l) { return true; } } interface IUnconstrainedGeneric { T GetIt (); } interface IConstrainedGeneric where T : IFormattable { T GetIt (); } class ConstrainedGeneric where T : IDisposable { public T GetIt () { return default(T); } } class ConstrainedGenericSame where T : IFormattable { public T GetIt () { return default (T); } } public interface IUnconstrained { void SetIt (T value); } public interface IConstrained { void SetIt (T value) where T : IFormattable; } class Constrained { public void SetIt(T value) where T : IDisposable { } } class ConstrainedSame { public void SetIt (T value) where T : IFormattable { } } [TestFixture] public class ConsiderAddingInterfaceTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (SimpleTypes.Enum); // enum AssertRuleDoesNotApply (SimpleTypes.Class); // class AssertRuleDoesNotApply (SimpleTypes.Structure); // struct AssertRuleDoesNotApply (SimpleTypes.Delegate); // delegate } [Test] public void Success () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Failure () { //4 because IImplementedInterface2 could also derive from it AssertRuleFailure (4); AssertRuleFailure (1); AssertRuleFailure (1); } [Test] // bnc 665161 public void BaseInterface () { // Extra implement IExtra but not IImplementedInterface2 (which IExtra is derived from) AssertRuleSuccess (); } [Test] // bnc 665161 public void GenericConstraints () { // generic constraints on types AssertRuleSuccess> (); AssertRuleSuccess> (); // generic constraints on methods AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/Tests.Rules.Design.csproj0000775000175000017500000002054712413742070032225 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {BC57A292-B4FC-415F-BF9A-714A5E62E0E1} Library Properties Test Tests.Rules.Design v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full true bin\Debug\ TRACE;DEBUG;CODE_ANALYSIS prompt 4 AllRules.ruleset false pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {FC889577-F51A-469C-9F30-E967504E9E24} Gendarme.Rules.Design False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/StronglyTypeICollectionMembersTest.cs0000664000175000017500000000570012413742070034701 0ustar00directhexdirecthex00000000000000// // Test.Rules.Design.StronglyTypeICollectionMembersTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Design { [TestFixture] public class StronglyTypeICollectionMembersTest : TypeRuleTestFixture { class Case1 : ICollection { public void CopyTo (Array array, int index) { } public int Count { get { return 0; } } public bool IsSynchronized { get { return true; } } public object SyncRoot { get { return null; } } public IEnumerator GetEnumerator () { return String.Empty.GetEnumerator (); } } class Case2 : Case1 { public void CopyTo (object [] array, int index) { } } class Case3 : Case2 { public void CopyTo (Exception [] array, int index) { } } class Case4 : Case3 { } class Case5 : ICollection { void ICollection.CopyTo (Array array, int index) { } int ICollection.Count { get { return 0; } } bool ICollection.IsSynchronized { get { return false; } } object ICollection.SyncRoot { get { return null; } } IEnumerator IEnumerable.GetEnumerator () { return String.Empty.GetEnumerator (); } void CopyTo (Exception [] array, int index) { } } [Test] public void DoesNotApply () { // TODO: Write tests that don't apply. // AssertRuleDoesNotApply (); } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (); AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/AvoidPublicInstanceFieldsTest.cs0000664000175000017500000000746012413742070033600 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidVisibleFieldsRule // // Authors: // Adrian Tsai // Sebastien Pouliot // // Copyright (c) 2007 Adrian Tsai // Copyright (C) 2008, 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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { #pragma warning disable 169, 649 [TestFixture] public class AvoidVisibleFieldsTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } public class ClassProtectedField { protected int x; } public struct StructPublicField { public long y; } [Test] public void TestShouldBeCaught () { AssertRuleFailure (1); AssertRuleFailure (1); } public class ShouldBeIgnored { internal int y; private int z; } [Test] public void TestShouldBeIgnored () { AssertRuleSuccess (); } public class ArraySpecialCase { public byte [] key; public string [] files; } [Test] public void TestArraySpecialCase () { AssertRuleFailure (2); } public class StaticFieldCase { public static int x; } [Test] public void TestStaticCase () { AssertRuleFailure (1); } public class ConstSpecialCase { public const int x = 1; } public class ReadOnlySpecialCase { public readonly int x = 1; } [Test] public void TestConstSpecialCase () { AssertRuleSuccess (); } [Test] public void TestReadOnlySpecialCase () { AssertRuleSuccess (); } public class NestedPublic { public string name; } protected class NestedProtected { public string name; } private class NestedPrivate { public string name; } internal class NestedInternal { public string name; } [Test] public void TestNested () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } public class EventOnly { public event EventHandler Event; } public class NonEvent { public /* event */ EventHandler Event; } [Test] public void Events () { // a backing-field name 'Event' (like the event itself) will be added // by the compiler but it will not be visible (it will be private) AssertRuleSuccess (); // but there will be a failure if 'event' keyword is missing AssertRuleFailure (1); } } } DontDeclareProtectedFieldsInSealedClassTest.cs0000664000175000017500000000742712413742070036267 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for DoNotDeclareProtectedMembersInSealedTypeRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class DoNotDeclareProtectedMembersInSealedTypeTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // delegates are always sealed - but the rule does not apply to them AssertRuleDoesNotApply (SimpleTypes.Delegate); // enums are always sealed - but the rule does not apply to them AssertRuleDoesNotApply (SimpleTypes.Enum); // interfaces are not sealed - and the rule does not apply to them AssertRuleDoesNotApply (SimpleTypes.Interface); // struct are always sealed - but we can't declare protected fields in them AssertRuleDoesNotApply (SimpleTypes.Structure); } public sealed class SealedClassWithProtectedField { protected int i; protected double d; } [Test] public void SealedClassWithProtectedFieldTest () { AssertRuleFailure (2); } public sealed class SealedClassWithoutProtectedFields { public string s; private float f; } [Test] public void SealedClassWithoutProtectedFieldsTest () { AssertRuleSuccess (); } public sealed class SealedClassWithProtectedMethod { protected int GetInt () { return 42; } } [Test] public void SealedClassWithProtectedMethodTest () { AssertRuleFailure (1); } public sealed class SealedClassWithoutProtectedMethods { public string GetInfo () { return String.Empty; } } [Test] public void SealedClassWithoutProtectedMethodsTest () { AssertRuleSuccess (); } public class UnsealedClass { protected double d; protected int j; protected void Show () { Console.WriteLine ("{0} - {1}", j, d); } } [Test] public void Unsealed () { AssertRuleDoesNotApply (); } public abstract class AbstractClass { protected abstract string GetIt (); } public sealed class SealedClass : AbstractClass { public int GetInt () { return 42; } protected override string GetIt () { return String.Empty; } public override string ToString () { return base.ToString (); } } [Test] public void Override () { AssertRuleDoesNotApply (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/FlagsShouldNotDefineAZeroValueTest.cs0000664000175000017500000000534012413742070034523 0ustar00directhexdirecthex00000000000000// // Unit tests for FlagsShouldNotDefineAZeroValueTest // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [Flags] enum PrivateFlagsWithZeroValue { Zero = 0, One = 1, Two = 2 } [Flags] internal enum InternalFlagsWithoutZeroValue { Zero = 1, One = 2, Two = 4 } [TestFixture] public class FlagsShouldNotDefineAZeroValueTest : TypeRuleTestFixture { public enum NestedPublicEnumWithZeroValue { Zero } private enum NestedPrivateEnumWithoutZeroValue { FirstBit = 1, SecondBit = 2, ThirdBit = 4 } [Flags] private enum NestedInternalFlagsWithZeroValue { GhostBit = 0, FirstBit, } [Test] public void NotAFlag () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } [Test] public void FlagsWithoutZeroValue () { AssertRuleSuccess (); } [Test] public void FlagsWithZeroValue () { AssertRuleFailure (1); AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ListsAreStronglyTypedTest.cs0000664000175000017500000002036312413742070033056 0ustar00directhexdirecthex00000000000000// // Test.Rules.Design.ListsAreStronglyTypedTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Design { [TestFixture] public class ListsAreStronglyTypedTest : TypeRuleTestFixture { class ImplicitlyImplementsIList : IList { #region Long interface implementation public int Add (object value) { throw new NotImplementedException (); } public void Clear () { throw new NotImplementedException (); } public bool Contains (object value) { throw new NotImplementedException (); } public int IndexOf (object value) { throw new NotImplementedException (); } public void Insert (int index, object value) { throw new NotImplementedException (); } public bool IsFixedSize { get { throw new NotImplementedException (); } } public bool IsReadOnly { get { throw new NotImplementedException (); } } public void Remove (object value) { throw new NotImplementedException (); } public void RemoveAt (int index) { throw new NotImplementedException (); } public object this [int index] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } public void CopyTo (Array array, int index) { throw new NotImplementedException (); } public int Count { get { throw new NotImplementedException (); } } public bool IsSynchronized { get { throw new NotImplementedException (); } } public object SyncRoot { get { throw new NotImplementedException (); } } public IEnumerator GetEnumerator () { throw new NotImplementedException (); } #endregion } class ExplicitlyImplementsIList : IList { #region Long interface implementation int IList.Add (object value) { throw new NotImplementedException (); } void IList.Clear () { throw new NotImplementedException (); } bool IList.Contains (object value) { throw new NotImplementedException (); } int IList.IndexOf (object value) { throw new NotImplementedException (); } void IList.Insert (int index, object value) { throw new NotImplementedException (); } bool IList.IsFixedSize { get { throw new NotImplementedException (); } } bool IList.IsReadOnly { get { throw new NotImplementedException (); } } void IList.Remove (object value) { throw new NotImplementedException (); } void IList.RemoveAt (int index) { throw new NotImplementedException (); } object IList.this [int index] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } void ICollection.CopyTo (Array array, int index) { throw new NotImplementedException (); } int ICollection.Count { get { throw new NotImplementedException (); } } bool ICollection.IsSynchronized { get { throw new NotImplementedException (); } } object ICollection.SyncRoot { get { throw new NotImplementedException (); } } IEnumerator IEnumerable.GetEnumerator () { throw new NotImplementedException (); } #endregion } class Case1 : ImplicitlyImplementsIList { } class Case2 : ExplicitlyImplementsIList { } class Case3 : Case2 { public int Add (Exception value) { throw new NotImplementedException (); } public bool Contains (Exception value) { throw new NotImplementedException (); } public int IndexOf (Exception value) { throw new NotImplementedException (); } public void Insert (int index, Exception value) { throw new NotImplementedException (); } public void Remove (Exception value) { throw new NotImplementedException (); } public Exception this [int index] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } } class Case4 : Case2 { public void Insert (int index, Exception value) { throw new NotImplementedException (); } public void Remove (Exception value) { throw new NotImplementedException (); } public Exception this [int index] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } } class Case5 : IList { #region Long interface implementation int IList.Add (object value) { throw new NotImplementedException (); } void IList.Clear () { throw new NotImplementedException (); } bool IList.Contains (object value) { throw new NotImplementedException (); } int IList.IndexOf (object value) { throw new NotImplementedException (); } void IList.Insert (int index, object value) { throw new NotImplementedException (); } bool IList.IsFixedSize { get { throw new NotImplementedException (); } } bool IList.IsReadOnly { get { throw new NotImplementedException (); } } void IList.Remove (object value) { throw new NotImplementedException (); } void IList.RemoveAt (int index) { throw new NotImplementedException (); } object IList.this [int index] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } void ICollection.CopyTo (Array array, int index) { throw new NotImplementedException (); } #endregion int ICollection.Count { get { throw new NotImplementedException (); } } bool ICollection.IsSynchronized { get { throw new NotImplementedException (); } } object ICollection.SyncRoot { get { throw new NotImplementedException (); } } IEnumerator IEnumerable.GetEnumerator () { throw new NotImplementedException (); } public int Add (Exception value) { throw new NotImplementedException (); } public bool Contains (Exception value) { throw new NotImplementedException (); } public int IndexOf (Exception value) { throw new NotImplementedException (); } public void Insert (int index, Exception value) { throw new NotImplementedException (); } public void Remove (Exception value) { throw new NotImplementedException (); } public Exception this [int index] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (6); AssertRuleFailure (6); AssertRuleFailure (6); AssertRuleFailure (6); AssertRuleFailure (3); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/EnumeratorsShouldBeStronglyTypedTest.cs0000664000175000017500000000552512413742070035265 0ustar00directhexdirecthex00000000000000// // Test.Rules.Design.EnumeratorsShouldBeStronglyTypedTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Design { [TestFixture] public class EnumeratorsShouldBeStronglyTypedTest : TypeRuleTestFixture { class Case1 : IEnumerator { object IEnumerator.Current { get { return null; } } public bool MoveNext () { return true; } public void Reset () { } } class Case2 : Case1 { } class Case3 : Case2 { public int Current { get { return 0; } } } class Case4 : Case3 { } class Case5 : IEnumerator { object IEnumerator.Current { get { return null; } } bool IEnumerator.MoveNext () { return true; } void IEnumerator.Reset () { } int Current { get { return 0; } } } class DerivedFromCollectionBase : CollectionBase { } class DerivedFromDictionaryBase : DictionaryBase { } class DerivedFromReadOnlyCollectionBase : ReadOnlyCollectionBase { } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (SimpleTypes.Class); } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (); AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/AvoidVisibleNestedTypesTest.cs0000664000175000017500000000620212413742070033324 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidVisibleNestedTypesRule // // Authors: // Sebastien Pouliot // // 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 Gendarme.Framework; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class AvoidVisibleNestedTypesTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // note: SimpleTypes.* are nested AssertRuleDoesNotApply (); // enum AssertRuleDoesNotApply (); // interface AssertRuleDoesNotApply (); } public enum PublicEnum { } public interface PublicInterface { } public class PublicClass { } public struct PublicStruct { } [Test] public void Public () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } protected enum ProtectedEnum { } protected interface ProtectedInterface { } protected class ProtectedClass { } protected struct ProtectedStruct { } [Test] public void Protected () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } private enum PrivateEnum { } private interface PrivateInterface { } private class PrivateClass { } private struct PrivateStruct { } [Test] public void Private () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } private enum InternalEnum { } private interface InternalInterface { } private class InternalClass { } private struct InternalStruct { } [Test] public void Internal () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/MarkAssemblyWithAssemblyVersionTest.cs0000664000175000017500000000675612413742070035066 0ustar00directhexdirecthex00000000000000// // Unit tests for MarkAssemblyWithAssemblyVersionRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.Diagnostics.CodeAnalysis; using System.IO; using Mono.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design { [TestFixture] public class MarkAssemblyWithAssemblyVersionTest : AssemblyRuleTestFixture { [TestFixtureSetUp] public void FixtureSetUp () { Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } static AssemblyDefinition CreateAssembly (string name, ModuleKind kind) { return AssemblyDefinition.CreateAssembly ( new AssemblyNameDefinition (name, new Version (0, 0)), name, kind); } [Test] public void Good () { AssemblyDefinition assembly = CreateAssembly ("GoodVersion", ModuleKind.Dll); assembly.Name.Version = new Version (1, 2, 3, 4); AssertRuleSuccess (assembly); } [Test] public void Bad () { AssemblyDefinition assembly = CreateAssembly ("BadVersion", ModuleKind.Dll); assembly.Name.Version = new Version (); AssertRuleFailure (assembly, 1); } [Test] public void FxCop_ManuallySuppressed () { AssemblyDefinition assembly = CreateAssembly ("SuppressedVersion", ModuleKind.Dll); TypeDefinition type = DefinitionLoader.GetTypeDefinition (); MethodDefinition ctor = DefinitionLoader.GetMethodDefinition (type, ".ctor", new Type [] { typeof (string), typeof (string) }); CustomAttribute ca = new CustomAttribute (assembly.MainModule.Import (ctor)); ca.ConstructorArguments.Add ( new CustomAttributeArgument ( assembly.MainModule.TypeSystem.String, "Microsoft.Design")); ca.ConstructorArguments.Add ( new CustomAttributeArgument ( assembly.MainModule.TypeSystem.String, "CA1016:MarkAssembliesWithAssemblyVersion")); assembly.CustomAttributes.Add (ca); var stream = new MemoryStream (); assembly.Write (stream); stream.Position = 0; assembly = AssemblyDefinition.ReadAssembly (stream); AssertRuleDoesNotApply (assembly); } [Test] public void FxCop_GloballySuppressed () { AssemblyDefinition assembly = DefinitionLoader.GetAssemblyDefinition (this.GetType ()); // see GlobalSuppressions.cs AssertRuleDoesNotApply (assembly); } } } AttributeArgumentsShouldHaveAccessorsTest.cs0000664000175000017500000001406112413742070036161 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for AttributeArgumentsShouldHaveAccessorsRule // // Authors: // Daniel Abramov // // Copyright (C) Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { internal class JustClass { public JustClass (int data) { } } internal class EmptyAttribute : Attribute { public EmptyAttribute () { } } internal class NearlyEmptyAttribute : Attribute { public NearlyEmptyAttribute () { } public string SomeAnotherAccessor { get { return "hello, world"; } } } internal sealed class OneAccessorMissingAttribute : Attribute { private string foo; private int bar; public OneAccessorMissingAttribute (string foo, int bar) { this.foo = foo; this.bar = bar; } public string Foo { get { return foo; } } public string SomeAnotherAccessor { get { return "hello, world"; } } } internal sealed class TwoAccessorsMissingAttribute : Attribute { private string foo; private int bar; public TwoAccessorsMissingAttribute (string foo, int bar) { this.foo = foo; this.bar = bar; } public string SomeAnotherAccessor { get { return "hello, world"; } } } internal sealed class NoAccessorsMissingAttribute : Attribute { private string foo; private int bar; public NoAccessorsMissingAttribute (string foo, int bar) { this.foo = foo; this.bar = bar; } public string Foo { get { return foo; } } public int Bar { get { return bar; } } public string SomeAnotherAccessor { get { return "hello, world"; } } } internal sealed class MultiConstructorNoAccessorsMissingAttribute : Attribute { private string foo; private int bar; private bool foobar; public MultiConstructorNoAccessorsMissingAttribute (string foo, int bar) { this.foo = foo; this.bar = bar; } public MultiConstructorNoAccessorsMissingAttribute (string foo, bool foobar) { this.foo = foo; this.foobar = foobar; } public string Foo { get { return foo; } } public int Bar { get { return bar; } } public bool Foobar { get { return foobar; } } public string SomeAnotherAccessor { get { return "hello, world"; } } } internal sealed class MultiConstructorOneAccessorMissingAttribute : Attribute { private string foo; private int bar; private bool foobar; public MultiConstructorOneAccessorMissingAttribute (string foo, int bar) { this.foo = foo; this.bar = bar; } public MultiConstructorOneAccessorMissingAttribute (string foo, bool foobar) { this.foo = foo; this.foobar = foobar; } public int Bar { get { return bar; } } public bool Foobar { get { return foobar; } } public string SomeAnotherAccessor { get { return "hello, world"; } } } internal sealed class MultiConstructorTwoAccessorsMissingAttribute : Attribute { private string foo; private int bar; private bool foobar; public MultiConstructorTwoAccessorsMissingAttribute (string foo, int bar) { this.foo = foo; this.bar = bar; } public MultiConstructorTwoAccessorsMissingAttribute (string foo, bool foobar) { this.foo = foo; this.foobar = foobar; } public bool Foobar { get { return foobar; } } public string SomeAnotherAccessor { get { return "hello, world"; } } } internal abstract class FooAttribute : Attribute { protected FooAttribute (string foo) { this.Foo = foo; } public string Foo { get; private set; } } internal class FooBarAttribute : FooAttribute { protected FooBarAttribute (string foo, string bar) : base (foo) { this.Bar = bar; } public string Bar { get; private set; } } [TestFixture] public class AttributeArgumentsShouldHaveAccessorsTest : TypeRuleTestFixture { [Test] public void TestEmptyAttribute () { AssertRuleSuccess (); } [Test] public void TestJustClass () { AssertRuleDoesNotApply (); } [Test] public void TestMultiConstructorNoAccessorsMissingAttribute () { AssertRuleSuccess (); } [Test] public void TestMultiConstructorOneAccessorMissingAttribute () { AssertRuleFailure (1); } [Test] public void TestMultiConstructorTwoAccessorsMissingAttribute () { AssertRuleFailure (2); } [Test] public void TestNearlyEmptyttribute () { AssertRuleSuccess (); } [Test] public void TestNoAccessorsMissingAttribute () { AssertRuleSuccess (); } [Test] public void TestOneAccessorMissingAttribute () { AssertRuleFailure (1); } [Test] public void TestTwoAccessorsMissingAttribute () { AssertRuleFailure (2); } [Test] public void TestInheritedPropertiesAttribute () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/AvoidRefAndOutParametersTest.cs0000664000175000017500000001061212413742070033412 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidRefAndOutParametersRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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 Gendarme.Framework; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class AvoidRefAndOutParametersTest : MethodRuleTestFixture { private bool PrivateByReference (ref DateTime date) { date = date.AddDays (1); return date.IsDaylightSavingTime (); } internal void InternalOut (string input, out string output) { output = input; } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("PrivateByReference"); AssertRuleDoesNotApply ("InternalOut"); } public bool PublicByReference (ref DateTime date) { date = date.AddDays (1); return date.IsDaylightSavingTime (); } [Test] public void Reference () { AssertRuleFailure ("PublicByReference", 1); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "Severity"); } protected void ProtectedOut (string input, out string output) { output = input; } public bool TrySomething (string something, out DateTime date) { date = DateTime.ParseExact (something, null, null); return date.IsDaylightSavingTime (); } [Test] public void Out () { AssertRuleFailure ("ProtectedOut", 1); Assert.AreEqual (Severity.Low, Runner.Defects [0].Severity, "Severity"); AssertRuleSuccess ("TrySomething"); } public interface InterfaceWithRef { void Ref (string input, ref string output); } public interface InterfaceWithOut { bool Out (int input, out long output); } public abstract class PoorType : InterfaceWithOut, InterfaceWithRef { public bool Out (int input, out long output) { throw new NotImplementedException (); } abstract public void Ref (string input, ref string output); } public class InheritedButStillPoor : PoorType { public override void Ref (string input, ref string output) { throw new NotImplementedException (); } } public interface InterfaceHidingAnOut : InterfaceWithOut { bool TryOut (int input, out long output); } public class InheritedHiddenOut : InterfaceHidingAnOut { public bool TryOut (int input, out long output) { throw new NotImplementedException (); } public bool Out (int input, out long output) { throw new NotImplementedException (); } } [Test] public void Interfaces () { AssertRuleFailure ("Ref", 1); AssertRuleFailure ("Out", 1); // PoorType did not had any choice (but we'll only blame the interfaces) AssertRuleSuccess ("Ref"); AssertRuleSuccess ("Out"); // neither did InheritedButStillPoor AssertRuleSuccess ("Ref"); // Try pattern in an interface AssertRuleSuccess ("TryOut"); // Try pattern dictated by interface (does not matter) AssertRuleSuccess ("TryOut"); // again the type has no choice but implement InterfaceWithOut.Out AssertRuleSuccess ("Out"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ConsiderConvertingFieldToNullableTest.cs0000664000175000017500000000726512413742070035321 0ustar00directhexdirecthex00000000000000// // Unit Test for ConsiderConvertingFieldToNullable Rule. // // Authors: // Cedric Vivier // // (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design { #pragma warning disable 169 public class ClassWithOnePotentialNullable { bool hasFoo; int foo; int bar; } public class ClassWithThreePotentialNullable { bool hasFoo; int foo; bool _hasBar; double _bar; bool m_hasIstic; double m_istic; } public class ClassWithoutPotentialNullable { int hasFoo; int foo; } public class ClassWithoutPotentialNullable2 { bool hasFoo; int bar; int food; } public class ClassWithoutPotentialNullable3 { bool hasFoo; string foo; } public class ClassWithProperNullable { int? foo; } public class ClassWithProperNullable2 { bool hasFoo; int? foo; } public enum SomeEnum { HasValue, Value } public class ClassWithSmallFieldNames { bool has; string foo; } public class ClassWithNonHasBool { bool initialized; string foo; } #pragma warning restore 169 [TestFixture] public class ConsiderConvertingFieldToNullableTest : TypeRuleTestFixture { [Test] public void ClassesWithPotentialNullable () { AssertRuleFailure (1); AssertRuleFailure (3); } [Test] public void ClassesWithoutPotentialNullable () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void ClassesWithProperNullable () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void TypesWhichDoNotApply () { AssertRuleDoesNotApply (); } [Test] public void NotApplicableBefore2_0 () { // ensure that the rule does not apply for types defined in 1.x assemblies TypeDefinition violator = DefinitionLoader.GetTypeDefinition (); TargetRuntime realRuntime = violator.Module.Runtime; try { // fake assembly runtime version and do the check violator.Module.Runtime = TargetRuntime.Net_1_1; Rule.Active = true; Rule.Initialize (Runner); Assert.IsFalse (Rule.Active, "Active"); } catch { // rollback violator.Module.Runtime = realRuntime; Rule.Active = true; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/DeclareEventHandlersCorrectlyTest.cs0000664000175000017500000001250112413742070034464 0ustar00directhexdirecthex00000000000000// // Unit tests for DeclareEventHandlersCorrectly rule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Design; using Test.Rules.Fixtures; using Test.Rules.Definitions; using NUnit.Framework; namespace Test.Rules.Design { [TestFixture] public class DeclareEventHandlesCorrectlyTest : TypeRuleTestFixture { [Test] public void SkipOnCanonicalScenariosTest () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); AssertRuleDoesNotApply (SimpleTypes.Enum); } delegate void GoodDelegate (object sender, EventArgs e); class ClassWithGoodDelegate { public event GoodDelegate CustomEventA; public event GoodDelegate CustomEventB; } [Test] public void SuccessOnClassWithGoodDelegateTest () { AssertRuleSuccess (); } delegate int DelegateReturningNonVoid (object sender, EventArgs e); class ClassWithDelegateReturningNonVoid { public event DelegateReturningNonVoid CustomEvent; } [Test] public void FailOnClassWithDelegateReturningNonVoidTest () { AssertRuleFailure (1); } delegate void DelegateWithOneParameter (int sender); class ClassWithDelegateWithOneParameter { public event DelegateWithOneParameter CustomEvent; } [Test] public void FailOnClassWithDelegateWithOneParameterTest () { //The amount of parameters //And the type warning for the first AssertRuleFailure (2); } delegate void DelegateWithBadTypes (int sender, char e); class ClassWithDelegateWithBadTypes { public event DelegateWithBadTypes CustomEvent; } [Test] public void FailOnClassWithDelegateWithBadTypesTest () { AssertRuleFailure (2); } delegate void DelegateWithObject (object sender, int e); class ClassWithDelegateWithObject { public event DelegateWithObject CustomEvent; } [Test] public void FailOnClassWithDelegateWithObjectTest () { AssertRuleFailure (1); } delegate void DelegateWithEventArgs (int sender, EventArgs e); class ClassWithDelegateWithEventArgs { public event DelegateWithEventArgs CustomEvent; } [Test] public void FailOnClassWithDelegateWithEventArgsTest () { AssertRuleFailure (1); } delegate void DelegateWithoutSender (object obj, EventArgs e); class ClassWithDelegateWithoutSender { public event DelegateWithoutSender CustomEvent; } [Test] public void FailOnClassWithDelegateWithoutSenderTest () { AssertRuleFailure (1); } delegate void DelegateWithoutE (object sender, EventArgs eventArgs); class ClassWithDelegateWithoutE { public event DelegateWithoutE CustomEvent; } [Test] public void FailOnClassWithDelegateWithoutETest () { AssertRuleFailure (1); } class ClassWithTwoFields { public event DelegateWithoutE CustomEvent; public event DelegateWithoutE CustomEvent1; } [Test] public void FailOnClassWithTwoFieldsTest () { AssertRuleFailure (2); } delegate int SampleDelegate (); class ClassWithDelegate { SampleDelegate myDelegate; } [Test] public void SuccessOnClassWithDelegateTest () { AssertRuleDoesNotApply (); } class ClassWithGenericEventHandler { public event EventHandler handler; } [Test] public void SuccessOnClassWithGenericEventHandlerTest () { AssertRuleSuccess (); } delegate void DelegateWithGenerics (object obj, List list); class ClassWithGenericDelegate { public event DelegateWithGenerics CustomEvent; } public delegate void MyOwnEventHandler(object sender, T e); class ClassWithNonEventHandlerEvent { public event MyOwnEventHandler CustomEvent; } [Test] public void FailureOnClassWithBadDelegateUsingGenericsTest () { AssertRuleFailure (3); AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ConsiderConvertingMethodToPropertyTest.cs0000664000175000017500000001124512413742070035575 0ustar00directhexdirecthex00000000000000// // Unit tests for ConsiderConvertingMethodToPropertyRule // // Authors: // Adrian Tsai // Sebastien Pouliot // // Copyright (c) 2007 Adrian Tsai // 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.Collections; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class ConsiderConvertingMethodToPropertyTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.GeneratedCodeMethod); AssertRuleDoesNotApply ("GetEnumerator"); } public class ShouldBeCaught { int Foo; bool Bar; int GetFoo () { return Foo; } bool IsBar () { return Bar; } bool HasFoo () { return (0 != Foo); } // note: won't be reported since it does not return void int SetFoo (int value) { return (Foo = value); } void SetBar (bool value) { Bar = value; } } [Test] public void TestShouldBeCaught () { AssertRuleFailure ("GetFoo"); AssertRuleFailure ("IsBar"); AssertRuleFailure ("HasFoo"); AssertRuleSuccess ("SetFoo"); AssertRuleSuccess ("SetBar"); } public class ShouldBeIgnored { int getfoo; int GetFoo { get { return getfoo; } set { getfoo = value; } } bool HasFoo { get { return false; } } byte [] Baz; byte [] GetBaz () { return Baz; } byte [] HasBaz () { return null; } } [Test] public void TestShouldBeIgnored () { AssertRuleDoesNotApply ("get_GetFoo"); AssertRuleDoesNotApply ("GetBaz"); AssertRuleDoesNotApply ("get_HasFoo"); AssertRuleDoesNotApply ("HasBaz"); } public class ShouldBeIgnoredMultipleValuesInSet { long value; public long GetMyValue () { return value; } public void SetMyValue (int value, int factor) { this.value = (long)(value * factor); } } [Test] public void TestShouldBeIgnoredMultipleValuesInSet () { AssertRuleFailure ("GetMyValue"); // ignored, too many parameters to be converted into a property AssertRuleSuccess ("SetMyValue"); } public class GetConstructor { public GetConstructor () { } // Should be ignored } [Test] public void TestGetConstructor () { AssertRuleDoesNotApply (".ctor"); } private void GetVoid () { } private bool GetBool () { return true; } internal class Base { public virtual bool GetBool () { return true; } } internal class Inherit : Base { public override bool GetBool () { return false; } } [Test] public void GetOnly () { AssertRuleFailure ("GetBool", 1); AssertRuleFailure ("GetBool", 1); // we can't blame Inherit for Base bad choice since it can be outside the // developer's control to change (e.g. in another assembly) AssertRuleDoesNotApply ("GetBool"); // a Get* method that return void is badly named but it's not the issue at hand AssertRuleSuccess ("GetVoid"); } private void SetObject (object value) { // no getter so it should be ignored // otherwise by fixing this th euser would only trigger another rule } [Test] public void SetOnly () { AssertRuleSuccess ("SetObject"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ProvideTryParseAlternativeTest.cs0000664000175000017500000000757012413742070034066 0ustar00directhexdirecthex00000000000000// // Unit tests for ProvideTryParseAlternativeRule // // Author: // Sebastien Pouliot // // 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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class ProvideTryParseAlternativeTest : TypeRuleTestFixture { class ClassWithoutMethods { } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); } interface IParseOnly { IParseOnly Parse (string s); } interface ITryParseToo { ITryParseToo Parse (string s); bool TryParse (string s, out ITryParseToo value); } [Test] public void Interfaces () { AssertRuleFailure (1); AssertRuleSuccess (); } class ClassParseOnly { ClassParseOnly Parse (string s) { return null; } } class ClassTryParseToo { ClassTryParseToo Parse (string s) { return null; } bool TryParse (string s, out ClassTryParseToo value) { value = null; return false; } } [Test] public void Classes () { AssertRuleFailure (1); AssertRuleSuccess (); AssertRuleSuccess (); } class StructParseOnly { StructParseOnly Parse (string s) { return null; } } class StructTryParseToo { StructTryParseToo Parse (string s) { return null; } bool TryParse (string s, out StructTryParseToo value) { value = null; return false; } } [Test] public void Structures () { AssertRuleFailure (1); AssertRuleSuccess (); } class BadTryParse { // bad candidate - does not return 'bool' static void TryParse (string s, out BadTryParse btp) { btp = new BadTryParse (); } // bad candidate - first parameter is not 'string' static bool TryParse (char c, out BadTryParse btp) { btp = new BadTryParse (); return true; } // bad candidate - last parameter is not 'out ' static bool TryParse (string s, BadTryParse btp) { btp = new BadTryParse (); return true; } static BadTryParse Parse (string s) { return new BadTryParse (); } } class BadParse { private bool AParse (string s) { return true; } private bool Parse () { return true; } static bool TryParse (string s, out BadParse value) { value = null; return true; } } [Test] public void WrongSignature () { // no valid TryParse was found - but the Parse is valid AssertRuleFailure (1); // no valid Parse - a TryParse without Parse is not a defect AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/MainShouldNotBePublicTest.cs0000664000175000017500000000775212413742070032721 0ustar00directhexdirecthex00000000000000// // Unit tests for MainShouldNotBePublicRule // // Authors: // Daniel Abramov // // Copyright (C) Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class MainShouldNotBePublicTest : AssemblyRuleTestFixture { private AssemblyDefinition goodAssembly; private AssemblyDefinition anotherGoodAssembly; private AssemblyDefinition badAssembly; private AssemblyDefinition vbBadAssembly; private AssemblyDefinition noEntryPointAssembly; [TestFixtureSetUp] public void FixtureSetUp () { GenerateRequiredAssemblies (); } static AssemblyDefinition CreateAssembly (string name, ModuleKind kind) { return AssemblyDefinition.CreateAssembly ( new AssemblyNameDefinition (name, new Version (0, 0)), name, ModuleKind.Console); } static AssemblyDefinition CreateTestAssembly (string name, TypeAttributes classAttributes, MethodAttributes mainAttributes) { var assembly = CreateAssembly (name, ModuleKind.Console); var testClass = new TypeDefinition ("", "MainClass", classAttributes, assembly.MainModule.TypeSystem.Object); assembly.MainModule.Types.Add (testClass); var mainMethod = new MethodDefinition ("Main", mainAttributes, assembly.MainModule.TypeSystem.Void); testClass.Methods.Add (mainMethod); assembly.EntryPoint = mainMethod; return assembly; } private void GenerateRequiredAssemblies () { // public class, private method goodAssembly = CreateTestAssembly ( "GoodAssembly", TypeAttributes.Class | TypeAttributes.Public, MethodAttributes.Static | MethodAttributes.Private); // internal class, public method anotherGoodAssembly = CreateTestAssembly ( "AnotherGoodAssembly", TypeAttributes.Class | TypeAttributes.NotPublic, MethodAttributes.Static | MethodAttributes.Public); // public class, public method badAssembly = CreateTestAssembly ( "BadAssembly", TypeAttributes.Class | TypeAttributes.Public, MethodAttributes.Static | MethodAttributes.Public); // has a reference to Micrisoft.VisualBasic assembly (i.e. likely compiled VB.NET) vbBadAssembly = CreateTestAssembly ( "BadAssembly", TypeAttributes.Class | TypeAttributes.Public, MethodAttributes.Static | MethodAttributes.Public); vbBadAssembly.MainModule.AssemblyReferences.Add (new AssemblyNameReference ("Microsoft.VisualBasic", new Version (1, 0, 0, 0))); // no entry point noEntryPointAssembly = CreateAssembly ("NoEntryPointAssembly", ModuleKind.Dll); } [Test] public void Success () { AssertRuleSuccess (goodAssembly); AssertRuleSuccess (anotherGoodAssembly); } [Test] public void Failure () { AssertRuleFailure (badAssembly, 1); AssertRuleFailure (vbBadAssembly, 1); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (noEntryPointAssembly); } } } DoNotDeclareVirtualMethodsInSealedTypeTest.cs0000664000175000017500000001053312413742070036144 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test// // Unit tests for DoNotDeclareVirtualMethodsInSealedTypeRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008,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.Generic; using Mono.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { public sealed class SealedClassWithoutVirtualMethods { public int GetInt () { return 42; } } [TestFixture] public class DoNotDeclareVirtualMethodsInSealedTypeTest : TypeRuleTestFixture { private TypeDefinition sealed_class_with_virtual_method; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (unit); sealed_class_with_virtual_method = new TypeDefinition ( "Test.Rules.Design", "SealedClassWithVirtualMethods", TypeAttributes.Sealed | TypeAttributes.Public, assembly.MainModule.TypeSystem.Object); assembly.MainModule.Types.Add (sealed_class_with_virtual_method); var virtual_method = new MethodDefinition ( "VirtualGetInt", MethodAttributes.Virtual | MethodAttributes.Public, assembly.MainModule.TypeSystem.Int32); sealed_class_with_virtual_method.Methods.Add (virtual_method); } [Test] public void DoesNotApply () { // delegates are always sealed - but the rule does not apply to them AssertRuleDoesNotApply (SimpleTypes.Delegate); // enums are always sealed - but the rule does not apply to them AssertRuleDoesNotApply (SimpleTypes.Enum); // interfaces are not sealed - and the rule does not apply to them AssertRuleDoesNotApply (SimpleTypes.Interface); // struct are always sealed - but we can't declare protected fields in them AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void SealedClassWithVirtualMethodTest () { AssertRuleFailure (sealed_class_with_virtual_method, 1); } public class UnsealedClass { public virtual int GetInt () { return 42; } } [Test] public void Unsealed () { AssertRuleDoesNotApply (); } public abstract class AbstractClass { public abstract string GetZit (); } public sealed class SealedClass : AbstractClass { public int GetInt () { return 42; } public override string GetZit () { return String.Empty; } public override string ToString () { return base.ToString (); } } [Test] public void Override () { AssertRuleDoesNotApply (); AssertRuleSuccess (); } // extracted from mono/mcs/class/corlib/System.Collections.Generic/EqualityComparer.cs // they override 'T', not string, base methods sealed class InternalStringComparer : EqualityComparer { public override int GetHashCode (string obj) { if (obj == null) return 0; return obj.GetHashCode (); } public override bool Equals (string x, string y) { if (x == null) return y == null; if ((object) x == (object) y) return true; return x.Equals (y); } } [Test] public void Generic () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/EnumsShouldDefineAZeroValueTest.cs0000664000175000017500000000541712413742070034102 0ustar00directhexdirecthex00000000000000// // Unit tests for EnumsShouldDefineAZeroValueRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using System.Reflection; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design { enum PrivateEnumWithZeroValue { Zero, One, Two } internal enum InternalEnumWithoutZeroValue { One = 1, Two, Three } [TestFixture] public class EnumsShouldDefineAZeroValueTest : TypeRuleTestFixture { public enum NestedPublicEnumWithZeroValue { Zero } [Flags] private enum NestedInternalFlagsWithZeroValue { GhostBit = 0, FirstBit, } [Flags] private enum NestedPrivateFlagsWithoutZeroValue { FirstBit = 1, SecondBit = 2, ThirdBit = 4 } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void EnumWithZeroValue () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void EnumWithoutZeroValue () { AssertRuleFailure (); } [Test] public void FlagWithoutZeroValue () { AssertRuleDoesNotApply (); } [Test] public void FlagWithZeroValue () { // flags are ignored by the rule AssertRuleDoesNotApply (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/MarkAssemblyWithComVisibleTest.cs0000664000175000017500000000551212413742070033762 0ustar00directhexdirecthex00000000000000// // Unit tests for MarkAssemblyWithComVisibleRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design { [TestFixture] public class MarkAssemblyWithComVisibleTest : AssemblyRuleTestFixture { private AssemblyDefinition assembly; private CustomAttribute comvisible; private CustomAttribute clscompliant; [TestFixtureSetUp] public void FixtureSetUp () { assembly = AssemblyDefinition.CreateAssembly (new AssemblyNameDefinition ("ComVisible", new Version ()), "ComVisible", ModuleKind.Dll); comvisible = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor")); clscompliant = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor")); Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } [Test] public void DoesNotApply () { // no attribute assembly.CustomAttributes.Clear (); AssertRuleDoesNotApply (assembly); } [Test] public void Good () { assembly.CustomAttributes.Clear (); assembly.CustomAttributes.Add (comvisible); AssertRuleSuccess (assembly); } [Test] public void Bad () { assembly.CustomAttributes.Clear (); assembly.CustomAttributes.Add (clscompliant); AssertRuleFailure (assembly, 1); } [Test] public void FxCop_GloballySuppressed () { AssemblyDefinition assembly = DefinitionLoader.GetAssemblyDefinition (this.GetType ()); // see GlobalSuppressions.cs AssertRuleDoesNotApply (assembly); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/GlobalSuppressions.cs0000664000175000017500000000151312413742070031552 0ustar00directhexdirecthex00000000000000// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. // // To add a suppression to this file, right-click the message in the // Error List, point to "Suppress Message(s)", and click // "In Project Suppression File". // You do not need to add suppressions to this file manually. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Design", "CA1016:MarkAssembliesWithAssemblyVersion")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Design", "CA1017:MarkAssembliesWithComVisible")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")] mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/AvoidPropertiesWithoutGetAccessorTest.cs0000664000175000017500000000757612413742070035421 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidPropertiesWithoutGetAccessorRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { public abstract class PublicAbstract { public abstract int Value { get; set; } } public abstract class PublicAbstractGetOnly { public abstract int Value { get; } } public abstract class PublicAbstractSetOnly { public abstract int Value { set; } } public interface IPublic { int Value { get; set; } } public interface IPublicGetOnly { int Value { get; } } public interface IPublicSetOnly { int Value { set; } } public class PublicClassInterface : IPublic { public int Value { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } } public class PublicClassExplicitInterface : IPublic { int IPublic.Value { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } } public class PublicClass { public int Value { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } } public class PublicSetOnlyInheritClass : PublicAbstractSetOnly { public override int Value { set { throw new NotImplementedException (); } } } public class PublicSetOnlyImplementClass : IPublicSetOnly { public int Value { set { throw new NotImplementedException (); } } } #if false // this cannot be compiled with CSC - error CS0082 public class PublicGetIsNotAGetterClass : IPublicSetOnly { // try to confuse the rule public int get_Value () { return 42; } public int Value { set { throw new NotImplementedException (); } } } #endif public class PublicSetIsNotASetterClass { public void set_Value () { } } [TestFixture] public class AvoidPropertiesWithoutGetAccessorTest : TypeRuleTestFixture { [Test] public void WithNoProperties () { AssertRuleDoesNotApply (); } [Test] public void WithBothGetAndSet () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void WithOnlyGet () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void WithOnlySet () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleDoesNotApply (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/AvoidEmptyInterfaceTest.cs0000664000175000017500000000361412413742070032462 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidEmptyInterfaceRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class AvoidEmptyInterfaceTest : TypeRuleTestFixture { interface IAmEmpty { } interface IAmNotEmpty { int GetMe (); } interface IImplementSeveralInterfaces : IAmEmpty, IAmNotEmpty { } [Test] public void NotAnInterface () { AssertRuleDoesNotApply (); } [Test] public void Empty () { AssertRuleFailure (1); } [Test] public void NotEmpty () { AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/PreferXmlAbstractionsTest.cs0000664000175000017500000000703712413742070033044 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferXmlAbstractionsRule // // Authors: // Cedric Vivier // // Copyright (C) 2009 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using System.Xml; using System.Xml.XPath; namespace Test.Rules.Design { [TestFixture] public class PreferXmlAbstractionsTest : MethodRuleTestFixture { static bool raisedAnalyzeModuleEvent; [SetUp] public void RaiseAnalyzeModuleEvent () { if (raisedAnalyzeModuleEvent) return; raisedAnalyzeModuleEvent = true; ((TestRunner) Runner).OnModule (DefinitionLoader.GetTypeDefinition ().Module); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("PrivateBadReturn"); AssertRuleDoesNotApply ("PrivateBadParameter"); } [Test] public void Success () { AssertRuleSuccess ("VisibleReturn"); AssertRuleSuccess ("VisibleParameter"); AssertRuleSuccess ("VisibleParameter2"); AssertRuleSuccess ("VisibleOutParameter"); } [Test] public void Failure () { AssertRuleFailure ("VisibleBadReturn", 1); AssertRuleFailure ("VisibleBadParameter", 1); AssertRuleFailure ("VisibleBadParameters", 2); AssertRuleFailure ("VisibleBadReturnAndParameter", 2); AssertRuleFailure ("VisibleBadReturnAndParameter2", 2); } private XmlDocument PrivateBadReturn () { return null; } private void PrivateBadParameter (XmlNode input) { } public IXPathNavigable VisibleReturn () { return null; } protected void VisibleParameter (XmlReader input) { } public void VisibleParameter2 (IXPathNavigable input) { } public void VisibleOutParameter (out XmlDocument output) { output = null; } public XmlDocument VisibleBadReturn () { return null; } public void VisibleBadParameter (XmlNode input) { } protected void VisibleBadParameters (XmlNode input, XmlDocument doc) { } public XmlNode VisibleBadReturnAndParameter (XmlDocument input) { return null; } public XPathDocument VisibleBadReturnAndParameter2 (XPathDocument doc) { return doc; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/MarkAssemblyWithCLSCompliantTest.cs0000664000175000017500000000552412413742070034221 0ustar00directhexdirecthex00000000000000// // Unit tests for MarkAssemblyWithCLSCompliantRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design { [TestFixture] public class MarkAssemblyWithCLSCompliantTest : AssemblyRuleTestFixture { private AssemblyDefinition assembly; private CustomAttribute comvisible; private CustomAttribute clscompliant; [TestFixtureSetUp] public void FixtureSetUp () { assembly = AssemblyDefinition.CreateAssembly (new AssemblyNameDefinition ("CLSCompliant", new Version ()), "CLSCompliant", ModuleKind.Dll); comvisible = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor")); clscompliant = new CustomAttribute (DefinitionLoader.GetMethodDefinition (".ctor")); Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } [Test] public void DoesNotApply () { // no attribute assembly.CustomAttributes.Clear (); AssertRuleDoesNotApply (assembly); } [Test] public void Good () { assembly.CustomAttributes.Clear (); assembly.CustomAttributes.Add (clscompliant); AssertRuleSuccess (assembly); } [Test] public void Bad () { assembly.CustomAttributes.Clear (); assembly.CustomAttributes.Add (comvisible); AssertRuleFailure (assembly, 1); } [Test] public void FxCop_GloballySuppressed () { AssemblyDefinition assembly = DefinitionLoader.GetAssemblyDefinition (this.GetType ()); // see GlobalSuppressions.cs AssertRuleDoesNotApply (assembly); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/Makefile.am0000664000175000017500000000015012413742070027415 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Design.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/UseFlagsAttributeTest.cs0000664000175000017500000000674112413742070032161 0ustar00directhexdirecthex00000000000000// // Unit tests for UseFlagsAttributeRule // // Authors: // Jesse Jones // // Copyright (C) 2009 // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design { [TestFixture] public sealed class UseFlagsAttributeTest : TypeRuleTestFixture { [Flags] private enum NotApplicable1 { // has FlagsAttribute One = 1, Two = 2, Four = 4, } private enum Good1 { // not enough non-zero values Zero, One, Two, } private enum Good2 { // values are sequential One = 1, Two = 2, Three = 3, } private enum Good3 { // values are sequential One = 1, Two = 2, Three = 3, Four = 4, Five = 5, Six = 6, } private enum Good4 { // last value is not a bitmask One = 1, Two = 2, Four = 4, Fifteen = 15, } private enum Good5 { // if a value is negative we assume it can't be a flag One = 1, Two = 2, Four = 4, MinusOne = -1, } private enum Good6 { // sequential (with duplicate values) UIS_SET = 1, UIS_CLEAR = 2, UIS_INITIALIZE = 3, UISF_HIDEFOCUS = 0x1, UISF_HIDEACCEL = 0x2, UISF_ACTIVE = 0x4 } private enum Bad1 { One = 1, Two = 2, Four = 4, } private enum Bad2 { One = 1, Four = 4, Two = 2, } private enum Bad3 { One = 1, Two = 2, Four = 4, AliasedFour = 4, } private enum Bad4 { One = 1, Two = 2, Four = 4, All = One | Two | Four, } private enum Bad5 : long { // long is a bit of a special case for the rule One = 1, Four = 4, Two = 2, } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); AssertRuleDoesNotApply (); } [Test] public void Cases () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/FinalizersShouldBeProtectedTest.cs0000664000175000017500000000525312413742070034167 0ustar00directhexdirecthex00000000000000// // Unit tests for FinalizersShouldBeProtectedRule // // Authors: // Daniel Abramov // // Copyright (C) Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { internal class NoFinalizerClass { } internal class ProtectedFinalizerClass { ~ProtectedFinalizerClass () { } } [TestFixture] public class FinalizersShouldBeProtectedTest : TypeRuleTestFixture { private TypeDefinition non_protected_finalizer_class; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (unit); non_protected_finalizer_class = new TypeDefinition ( "Test.Rules.Design", "PublicFinalizerClass", TypeAttributes.Public, assembly.MainModule.TypeSystem.Object); assembly.MainModule.Types.Add (non_protected_finalizer_class); var finalizer = new MethodDefinition ( "Finalize", MethodAttributes.Public | MethodAttributes.Virtual, assembly.MainModule.TypeSystem.Void); non_protected_finalizer_class.Methods.Add (finalizer); } [Test] public void TestNoFinalizerClass () { AssertRuleDoesNotApply(); } [Test] public void TestProtectedFinalizerClass () { AssertRuleSuccess (); } [Test] public void TestNonProtectedFinalizerDefinedClass () { AssertRuleFailure (non_protected_finalizer_class, 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/AvoidMultidimensionalIndexerTest.cs0000664000175000017500000000630212413742070034374 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidMultidimensionalIndexerRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class AvoidMultidimensionalIndexerTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } Type [] intint = new Type [] { typeof (int), typeof (int) }; Type [] stringstring = new Type [] { typeof (string), typeof (string) }; public int this [int index] { get { return 0; } } protected int this [string name] { get { return 0; } } public int this [int x, int y] { get { return 0; } } protected int this [string name, string subname] { get { return 0; } } [Test] public void Visible () { // single argument indexers AssertRuleSuccess ("get_Item", new Type [] { typeof (int) }); AssertRuleSuccess ("get_Item", new Type [] { typeof (string) }); // multiple argument indexers AssertRuleFailure ("get_Item", intint, 1); AssertRuleFailure ("get_Item", stringstring, 1); } class NonVisibleType { public int this [int x, int y] { get { return 0; } } protected int this [string name, string subname] { get { return 0; } } } public class VisibleType { private int this [int x, int y] { get { return 0; } } internal int this [string name, string subname] { get { return 0; } } } [Test] public void NonVisible () { AssertRuleSuccess ("get_Item", intint); AssertRuleSuccess ("get_Item", stringstring); // visible type with non visible members AssertRuleSuccess ("get_Item", intint); AssertRuleSuccess ("get_Item", stringstring); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/EnsureSymmetryForOverloadedOperatorsTest.cs0000664000175000017500000001353712413742070036153 0ustar00directhexdirecthex00000000000000// // Unit tests for EnsureSymmetryForOverloadedOperatorsRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Design; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class EnsureSymmetryForOverloadedOperatorsTest : TypeRuleTestFixture { private AssemblyDefinition assembly; private TypeDefinition type; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.Design.EnsureSymmetryForOverloadedOperatorsTest"); } public TypeDefinition CreateType (string name, string [] methods, int parameterCount) { TypeDefinition testType = new TypeDefinition ("", name, TypeAttributes.Class, type.BaseType); assembly.MainModule.Types.Add (testType); TypeDefinition returnType = new TypeDefinition ("System", "Boolean", TypeAttributes.Class, type.BaseType); assembly.MainModule.Types.Add (returnType); foreach (string method in methods) { MethodDefinition mDef = new MethodDefinition (method, MethodAttributes.Static | MethodAttributes.SpecialName, returnType); for (int i = 0; i < parameterCount; i++) mDef.Parameters.Add (new ParameterDefinition (testType)); testType.Methods.Add (mDef); } return testType; } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void NoOperator () { AssertRuleSuccess (SimpleTypes.Class); AssertRuleSuccess (SimpleTypes.Structure); } class EverythingOK { public static EverythingOK operator + (EverythingOK a, EverythingOK b) { return null; } public static EverythingOK operator - (EverythingOK a, EverythingOK b) { return null; } public static EverythingOK operator * (EverythingOK a, EverythingOK b) { return null; } public static EverythingOK operator / (EverythingOK a, EverythingOK b) { return null; } public static EverythingOK operator % (EverythingOK a, EverythingOK b) { return null; } public static bool operator > (EverythingOK a, EverythingOK b) { return false; } public static bool operator >= (EverythingOK a, EverythingOK b) { return false; } public static bool operator < (EverythingOK a, EverythingOK b) { return false; } public static bool operator <= (EverythingOK a, EverythingOK b) { return false; } public static bool operator != (EverythingOK a, EverythingOK b) { return false; } public static bool operator == (EverythingOK a, EverythingOK b) { return false; } public static bool operator true (EverythingOK a) { return false; } public static bool operator false (EverythingOK a) { return true; } } [Test] public void TestEverythingOK () { AssertRuleSuccess (); } class Missing1 { public static Missing1 operator + (Missing1 a, Missing1 b) { return null; } public static Missing1 operator * (Missing1 a, Missing1 b) { return null; } } [Test] public void TestMissing1 () { AssertRuleFailure (2); } class Missing2 { public static Missing2 operator - (Missing2 a, Missing2 b) { return null; } public static Missing2 operator / (Missing2 a, Missing2 b) { return null; } } [Test] public void TestMissing2 () { // divide fires for multiply and modulus AssertRuleFailure (3); } [Test] public void TestModulus () { TypeDefinition type = this.CreateType ("Modulus", new string [] { "op_Modulus" }, 2); AssertRuleFailure (type, 1); } [Test] public void TestGreater () { TypeDefinition type = this.CreateType ("Greater", new string [] { "op_GreaterThan", "op_GreaterThanOrEqual" }, 2); AssertRuleFailure (type, 2); } [Test] public void TestLess () { TypeDefinition type = this.CreateType ("Less", new string [] { "op_LessThan", "op_LessThanOrEqual" }, 2); AssertRuleFailure (type, 2); } [Test] public void TestEquality () { TypeDefinition type = this.CreateType ("Equality", new string [] { "op_Equality" }, 2); AssertRuleFailure (type, 1); } [Test] public void TestInequality () { TypeDefinition type = this.CreateType ("Inequality", new string [] { "op_Inequality" }, 2); AssertRuleFailure (type, 1); } [Test] public void TestTrue () { TypeDefinition type = this.CreateType ("True", new string [] { "op_True" }, 1); AssertRuleFailure (type, 1); } [Test] public void TestFalse () { TypeDefinition type = this.CreateType ("False", new string [] { "op_False" }, 1); AssertRuleFailure (type, 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/TypesShouldBeInsideNamespacesTest.cs0000664000175000017500000000756512413742070034457 0ustar00directhexdirecthex00000000000000// // Unit tests for TypesShouldBeInsideNamespacesRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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.Reflection; using Mono.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; public class PublicTypeOutsideNamescape { public class NestedPublicTypeOutsideNamescape { } protected class NestedProtectedTypeOutsideNamespace { } internal class NestedInternalTypeOutsideNamespace { } private class NestedPrivateClassOutsideNamespace { } } internal class InternalTypeOutsideNamespace { } class PrivateClassOutsideNamespace { } namespace Test.Rules.Design { public class PublicTypeInsideNamescape { public class NestedPublicTypeInsideNamescape { } protected class NestedProtectedTypeInsideNamespace { } internal class NestedInternalTypeInsideNamespace { } private class NestedPrivateTypeInsideNamespace { } } internal class InternalTypeInsideNamespace { } class PrivateClassInsideNamespace { } [TestFixture] public class TypesShouldBeInsideNamespacesTest : TypeRuleTestFixture { private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } private TypeDefinition GetType (string name) { return assembly.MainModule.GetType (name); } [Test] public void OutsideNamespace () { AssertRuleFailure (1); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } [Test] public void NestedOutsideNamespace () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (GetType ("PublicTypeOutsideNamescape/NestedProtectedTypeOutsideNamespace")); AssertRuleDoesNotApply (GetType ("PublicTypeOutsideNamescape/NestedPrivateClassOutsideNamespace")); } [Test] public void InsideNamespace () { AssertRuleSuccess (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } [Test] public void NestedInsideNamespace () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (GetType ("Test.Rules.Design.PublicTypeInsideNamescape/NestedProtectedTypeInsideNamespace")); AssertRuleDoesNotApply (GetType ("Test.Rules.Design.PublicTypeInsideNamescape/NestedPrivateTypeInsideNamespace")); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/PreferEventsOverMethodsTest.cs0000664000175000017500000000533212413742070033347 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferEventsOverMethodsRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class PreferEventsOverMethodsTest : MethodRuleTestFixture { public class DoesNotApplyCases { public int AddOn { get { return 0; } set { ; } } public event EventHandler RemoveOn; } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("get_AddOn"); AssertRuleDoesNotApply ("set_AddOn"); AssertRuleDoesNotApply ("add_RemoveOn"); AssertRuleDoesNotApply ("remove_RemoveOn"); } public class BadCases { public void AddOn () { } public void RemoveOn () { } public void FireMissile () { } public void RaiseHell () { } } [Test] public void Bad () { AssertRuleFailure ("AddOn", 1); AssertRuleFailure ("RemoveOn", 1); AssertRuleFailure ("FireMissile", 1); AssertRuleFailure ("RaiseHell", 1); } public class GoodCases { public void GetAddOn () { } public void SetRemoveOn () { } public void MoonFire () { } public void LowRaise () { } } [Test] public void Good () { AssertRuleSuccess ("GetAddOn"); AssertRuleSuccess ("SetRemoveOn"); AssertRuleSuccess ("MoonFire"); AssertRuleSuccess ("LowRaise"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/EnumsShouldUseInt32Test.cs0000664000175000017500000000524012413742070032320 0ustar00directhexdirecthex00000000000000// // Unit tests for EnumsShouldUseInt32Rule // // Authors: // Sebastien Pouliot // // 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 Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class EnumsShouldUseInt32Test : TypeRuleTestFixture { public enum DefaultEnum { } public enum ByteEnum : byte { } public enum SignedByteEnum : sbyte { } public enum ShortEnum : short { } public enum UnsignedShortEnum : ushort { } public enum IntEnum : int { } public enum UnsignedIntEnum : uint { } public enum LongEnum : long { } public enum UnsignedLongEnum : ulong { } [Test] public void NotAnEnum () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void Ok () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { // CLS compliant types: Byte, Int16 or Int64 (Int32 is CLS but Ok) AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } [Test] public void ReallyBad () { // i.e. using non-CLS compliant types, SByte, UInt16, UInt32 or UInt64 AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/ImplementEqualsAndGetHashCodeInPairTest.cs0000664000175000017500000001127212413742070035451 0ustar00directhexdirecthex00000000000000// // Unit tests for ImplementEqualsAndGetHashCodeInPairRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class ImplementEqualsAndGetHashCodeInPairTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } public class ImplementsEqualsButNotGetHashCode { public override bool Equals (Object obj) { return this == obj; } } [Test] public void EqualsButNotGetHashCodeTest () { AssertRuleFailure (1); } public class ImplementsGetHashCodeButNotEquals { public override int GetHashCode () { return 2; } } [Test] public void GetHashCodeButNotEqualsTest () { AssertRuleFailure (1); } public class ImplementsNoneOfThem { public void test () { } } [Test] public void NoneOfThemTest () { AssertRuleSuccess (); } public class ImplementsBothOfThem { public override int GetHashCode () { return 2; } public new bool Equals (Object obj) { return this == obj; } } [Test] public void BothOfThemTest () { AssertRuleSuccess (); } public class ImplementsEqualsUsesObjectGetHashCode { public override bool Equals (Object obj) { return this == obj; } public static void Main (string [] args) { int j = 0; ImplementsEqualsUsesObjectGetHashCode i = new ImplementsEqualsUsesObjectGetHashCode (); j = i.GetHashCode (); } } [Test] public void ImplementsEqualsUsesObjectGetHashCodeTest () { AssertRuleFailure (1); } public class ImplementsEqualsReuseBaseGetHashCode { public override bool Equals (Object obj) { return this == obj; } public override int GetHashCode() { return base.GetHashCode(); } public static void Main (string [] args) { int j = 0; ImplementsEqualsUsesObjectGetHashCode i = new ImplementsEqualsUsesObjectGetHashCode (); j = i.GetHashCode (); } } [Test] public void ImplementsEqualsReuseBaseGetHashCodeTest () { AssertRuleSuccess (); } public class ImplementsGetHashCodeUsesObjectEquals { public override int GetHashCode () { return 1; } public static void Main (string [] args) { ImplementsGetHashCodeUsesObjectEquals i = new ImplementsGetHashCodeUsesObjectEquals (); ImplementsGetHashCodeUsesObjectEquals i1 = new ImplementsGetHashCodeUsesObjectEquals (); i.Equals (i1); } } [Test] public void ImplementsGetHashCodeUsesObjectEqualsTest () { AssertRuleFailure (1); } public class ImplementingEqualsWithTwoArgs { public bool Equals (Object obj1, Object obj2) { return obj1 == obj2; } } [Test] public void EqualsWithTwoArgsTest () { AssertRuleSuccess (); } public class ImplementingGetHashCodeWithOneArg { public int GetHashCode (int j) { return j*2; } } [Test] public void GetHashCodeWithOneArgTest () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/UseCorrectDisposeSignaturesTest.cs0000664000175000017500000001277612413742070034243 0ustar00directhexdirecthex00000000000000// // Unit tests for UseCorrectDisposeSignaturesRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Rules.Design; using NUnit.Framework; using System; using System.Runtime.InteropServices; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Design { [TestFixture] public class UseCorrectDisposeSignaturesTest : TypeRuleTestFixture { public sealed class Good1 : IDisposable { public void Dispose () // sealed class does not need Dispose (bool) { } } public sealed class Good2 : IDisposable { public void Dispose () // but a sealed class may have Dispose (bool) { Dispose (true); } private void Dispose (bool disposing) { } } public sealed class Good3 { public void Dispose () // non-disposable types can have weird Dispose methods { // (altho OnlyUseDisposeForIDisposableTypesRule will complain) Dispose (1); } private void Dispose (int disposing) { } } public class Good4 : IDisposable { public void Dispose () // unsealed class needs Dispose (bool) { Dispose (true); } protected virtual void Dispose (bool disposing) { } } public class Good5 : Good4 { protected override void Dispose (bool disposing) // can override Dispose { } } public class Good6 : Good4 // but don't have to { } public sealed class Good7 : Good4 { protected override void Dispose (bool disposing) // Dispose can be protected in a sealed class if a base implements IDisposable { } } // This is a bit of an icky case: CriticalHandle is the guy who // implements IDisposable so Good8 does not need to mention // IDisposable. public abstract class Good8 : CriticalHandle, IDisposable { protected Good8 (IntPtr invalidHandleValue) : base (invalidHandleValue) { } } public sealed class Bad1 : IDisposable { public void Dispose () // types cannot have weird Dispose methods { Dispose (1); } private void Dispose (int disposing) { } } public sealed class Bad2 : IDisposable { public void Dispose () // types cannot have weird Dispose methods { Dispose (true); } private int Dispose (bool disposing) { return 1; } } public sealed class Bad3 : IDisposable { public void Dispose () // Dispose (bool) must be private for sealed classes { Dispose (true); } public void Dispose (bool disposing) { } } public struct Bad4 : IDisposable { public void Dispose () // Dispose (bool) must be private for sealed classes { Dispose (true); } public void Dispose (bool disposing) { } } public class Bad5 : IDisposable { public void Dispose () // unsealed class needs Dispose (bool) { } } public class Bad6 : IDisposable { public void Dispose () // unsealed class needs protected Dispose (bool) { Dispose (true); } private void Dispose (bool disposing) { } } public class Bad7 : IDisposable { public void Dispose () // unsealed class needs virtual Dispose (bool) { Dispose (true); } protected void Dispose (bool disposing) { } } public class Bad8 : IDisposable { public virtual void Dispose () // Dispose () should not be virtual { Dispose (true); } protected virtual void Dispose (bool disposing) { } } public class Bad9 : Good4 { public new void Dispose () // can't declare a new Dispose () method { Dispose (true); } protected override void Dispose (bool disposing) { } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void Cases () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Test/AvoidSmallNamespaceTest.cs0000664000175000017500000000764112413742070032434 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidSmallNamespaceRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Rules.Design; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design { [TestFixture] public class AvoidSmallNamespaceTest : AssemblyRuleTestFixture { AssemblyDefinition assembly; private MethodDefinition Add (string namespaceName, string typeName, string methodName) { TypeDefinition type = new TypeDefinition (namespaceName, typeName, TypeAttributes.Class | TypeAttributes.Public, assembly.MainModule.TypeSystem.Object); MethodDefinition method = new MethodDefinition (methodName, MethodAttributes.Static | MethodAttributes.Private, assembly.MainModule.TypeSystem.Void); type.Methods.Add (method); assembly.MainModule.Types.Add (type); return method; } [TestFixtureSetUp] public void FixtureSetUp () { assembly = AssemblyDefinition.CreateAssembly ( new AssemblyNameDefinition ("Assembly", new Version (1, 0)), "Module", ModuleKind.Console); } [SetUp] public void SetUp () { // mess up logic so engines will re-run each time on the same assembly instance // (normally this can't happen as AssemblyDefinition are immutable as far as Gendarme is concerned) Runner.Assemblies.Clear (); Rule.Initialize (Runner); assembly.MainModule.Types.Clear (); } [Test] public void SingleNamespace () { Add ("Namespace", "Type", "Method"); AssertRuleSuccess (assembly); } [Test] public void GlobalNamespace () { Add ("Namespace", "Type", "Method"); Add (String.Empty, "Type", "Method"); // we don't ignore the global namespace if it contains visible types AssertRuleFailure (assembly, 2); } [Test] public void SpecializationNamespaces () { Add ("Namespace", "Type", "Method"); Add ("Namespace.Design", "Type", "Method"); Add ("Namespace.Interop", "Type", "Method"); Add ("Namespace.Permissions", "Type", "Method"); // Namespace is too small, but others won't be reported AssertRuleFailure (assembly, 1); } [Test] public void MultipleNamespacesNotEnoughTypes () { Add ("Namespace", "Type", "Method"); Add ("Namespace.Second", "Uho", "Failure"); AssertRuleFailure (assembly, 2); } [Test] public void FakeEntryPoint () { try { assembly.EntryPoint = Add ("Main", "Main", "Main"); AssertRuleSuccess (assembly); } finally { assembly.EntryPoint = null; } } [Test] public void Zero () { int minimum = Rule.Minimum; try { Rule.Minimum = 0; AssertRuleSuccess (assembly); } finally { Rule.Minimum = minimum; } } [Test] [ExpectedException (typeof (ArgumentOutOfRangeException))] public void Minimum () { Rule.Minimum = Int32.MinValue; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ConsiderConvertingMethodToPropertyRule.cs0000664000175000017500000001156412413742070034652 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ConsiderConvertingMethodToPropertyRule // // Authors: // Adrian Tsai // Sebastien Pouliot // // Copyright (c) 2007 Adrian Tsai // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { // TODO: It might be worthwhile if this rule used some sort of simple heuristic // to ignore large or slow methods. /// /// This rule checks for methods whose definition looks similar to a property. /// For example, methods beginning with Is, Get or Set may /// be better off as properties. But note that this should not be done if the method /// takes a non-trivial amount of time to execute. /// /// /// Bad example: /// /// public class Bad { /// int foo; /// /// public int GetFoo () /// { /// return foo; /// } /// } /// /// /// /// Good example: /// /// public class Good { /// int foo; /// /// public int Foo { /// get { /// return foo; /// } /// } /// } /// /// [Problem ("This method looks like a candidate to be a property.")] [Solution ("Either make the method a property or ignore the defect.")] [FxCopCompatibility ("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] public class ConsiderConvertingMethodToPropertyRule : Rule, IMethodRule { static readonly string [] whitelist = { "GetEnumerator", "GetHashCode", "GetType", "GetTypeCode", "GetValue", "HasElementTypeImpl"}; private const string Void = "System.Void"; string [] parameter = new string [1]; // report if there is a SetX (value) that match string ReportAssociatedSetter (MethodDefinition getter) { string name = "Set" + getter.Name.Substring (3); parameter [0] = getter.ReturnType.GetFullName (); MethodDefinition setter = getter.DeclaringType.GetMethod (name, Void, parameter); return setter == null ? String.Empty : setter.GetFullName (); } public RuleResult CheckMethod (MethodDefinition method) { // rules do not apply to constructors, methods returning an array, properties if (method.IsConstructor || method.IsSpecialName) return RuleResult.DoesNotApply; // we don't apply the rule to overrides since the base method can be // outside the developer's control (and if not this is the *one* that // should be reported) if (method.IsVirtual && !method.IsNewSlot) return RuleResult.DoesNotApply; // ignore methods returning arrays TypeReference return_type = method.ReturnType; if (return_type.IsArray) return RuleResult.DoesNotApply; // rules do not apply to code generated by the compiler (e.g. anonymous methods) // or generated by a tool (e.g. web services) if (method.IsGeneratedCode ()) return RuleResult.DoesNotApply; string name = method.Name; // ignore the some common Get* method names used in the framework foreach (string s in whitelist) { if (name == s) return RuleResult.DoesNotApply; } // rule applies // If it starts with "get" or "is" or "has", has no parameters and returns something bool get = name.StartsWith ("get", StringComparison.OrdinalIgnoreCase); bool isp = name.StartsWith ("is", StringComparison.OrdinalIgnoreCase); bool has = name.StartsWith ("has", StringComparison.OrdinalIgnoreCase); if ((get || isp || has) && !method.HasParameters && !return_type.IsNamed ("System", "Void")) { // if it's a getter then look for a setter (to complete the report) string msg = get ? ReportAssociatedSetter (method) : String.Empty; Runner.Report (method, Severity.Low, Confidence.Normal, msg); return RuleResult.Failure; } return RuleResult.Success; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Makefile.am0000664000175000017500000000750112413742070026505 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AbstractTypesShouldNotHavePublicConstructorsRule.cs \ AttributeArgumentsShouldHaveAccessorsRule.cs \ AvoidEmptyInterfaceRule.cs \ AvoidMultidimensionalIndexerRule.cs \ AvoidPropertiesWithoutGetAccessorRule.cs \ AvoidPublicInstanceFieldsRule.cs \ AvoidRefAndOutParametersRule.cs \ AvoidSmallNamespaceRule.cs \ AvoidVisibleNestedTypesRule.cs \ ConsiderAddingInterfaceRule.cs \ ConsiderConvertingFieldToNullableRule.cs \ ConsiderConvertingMethodToPropertyRule.cs \ ConsiderUsingStaticTypeRule.cs \ DeclareEventHandlersCorrectlyRule.cs \ DefineAZeroValueRule.cs \ DisposableTypesShouldHaveFinalizerRule.cs \ DoNotDeclareSettersOnCollectionPropertiesRule.cs \ DoNotDeclareVirtualMethodsInSealedTypeRule.cs \ DontDeclareProtectedFieldsInSealedClassRule.cs \ EnsureSymmetryForOverloadedOperatorsRule.cs \ EnumeratorsShouldBeStronglyTypedRule.cs \ EnumsShouldDefineAZeroValueRule.cs \ EnumsShouldUseInt32Rule.cs \ FinalizersShouldBeProtectedRule.cs \ FlagsShouldNotDefineAZeroValueRule.cs \ ImplementEqualsAndGetHashCodeInPairRule.cs \ ImplementIComparableCorreclyRule.cs \ InternalNamespacesShouldNotExposeTypesRule.cs \ ListsAreStronglyTypedRule.cs \ MainShouldNotBePublicRule.cs \ MarkAssemblyWithAssemblyVersionRule.cs \ MarkAssemblyWithAttributeRule.cs \ MarkAssemblyWithCLSCompliantRule.cs \ MarkAssemblyWithComVisibleRule.cs \ MissingAttributeUsageOnCustomAttributeRule.cs \ OperatorEqualsShouldBeOverloadedRule.cs \ OverrideEqualsMethodRule.cs \ PreferEventsOverMethodsRule.cs \ PreferIntegerOrStringForIndexersRule.cs \ PreferUriOverStringRule.cs \ PreferXmlAbstractionsRule.cs \ ProvideAlternativeNamesForOperatorOverloadsRule.cs \ ProvideTryParseAlternativeRule.cs \ StronglyTypedRule.cs \ StronglyTypeICollectionMembersRule.cs \ TypesShouldBeInsideNamespacesRule.cs \ UseFlagsAttributeRule.cs \ UseCorrectDisposeSignaturesRule.cs \ UsingCloneWithoutImplementingICloneableRule.cs EXTRA_TESTS_OPTIONS += -d:CODE_ANALYSIS tests_sources = \ AbstractTypesShouldNotHavePublicConstructorsTest.cs \ AttributeArgumentsShouldHaveAccessorsTest.cs \ AvoidEmptyInterfaceTest.cs \ AvoidMultidimensionalIndexerTest.cs \ AvoidPropertiesWithoutGetAccessorTest.cs \ AvoidPublicInstanceFieldsTest.cs \ AvoidRefAndOutParametersTest.cs \ AvoidSmallNamespaceTest.cs \ AvoidVisibleNestedTypesTest.cs \ ConsiderAddingInterfaceTest.cs \ ConsiderConvertingFieldToNullableTest.cs \ ConsiderConvertingMethodToPropertyTest.cs \ ConsiderUsingStaticTypeTest.cs \ DeclareEventHandlersCorrectlyTest.cs \ DisposableTypesShouldHaveFinalizerTest.cs \ DoNotDeclareSettersOnCollectionPropertiesTest.cs \ DoNotDeclareVirtualMethodsInSealedTypeTest.cs \ DontDeclareProtectedFieldsInSealedClassTest.cs \ EnsureSymmetryForOverloadedOperatorsTest.cs \ EnumeratorsShouldBeStronglyTypedTest.cs \ EnumsShouldDefineAZeroValueTest.cs \ EnumsShouldUseInt32Test.cs \ FinalizersShouldBeProtectedTest.cs \ FlagsShouldNotDefineAZeroValueTest.cs \ GlobalSuppressions.cs \ ImplementEqualsAndGetHashCodeInPairTest.cs \ ImplementIComparableCorreclyTest.cs \ InternalNamespacesShouldNotExposeTypesTest.cs \ ListsAreStronglyTypedTest.cs \ MainShouldNotBePublicTest.cs \ MarkAssemblyWithAssemblyVersionTest.cs \ MarkAssemblyWithCLSCompliantTest.cs \ MarkAssemblyWithComVisibleTest.cs \ MissingAttributeUsageOnCustomAttributeTest.cs \ OperatorEqualsShouldBeOverloadedTest.cs \ OverrideEqualsMethodTest.cs \ PreferEventsOverMethodsTest.cs \ PreferIntegerOrStringForIndexersTest.cs \ PreferUriOverStringTest.cs \ PreferXmlAbstractionsTest.cs \ ProvideTryParseAlternativeTest.cs \ ProvideAlternativeNamesForOperatorOverloadsTest.cs \ StronglyTypeICollectionMembersTest.cs \ TypesShouldBeInsideNamespacesTest.cs \ UseFlagsAttributeTest.cs \ UseCorrectDisposeSignaturesTest.cs \ UsingCloneWithoutImplementingICloneableTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/AvoidEmptyInterfaceRule.cs0000664000175000017500000000537312413742070031537 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.AvoidEmptyInterfaceRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Design { /// /// This rule fires if an interface declares no members. Empty interfaces are generally /// not useful except as markers to categorize types and attributes are the preferred /// way to handle that. /// /// /// Bad example: /// /// public interface IMarker { /// } /// /// public class MyClass : IMarker { /// } /// /// /// /// Good example: /// /// [MarkedByAnAttribute] /// public class MyClass { /// } /// /// [Problem ("This interface does not define any members. This is often a sign that the interface is used simply to mark up types.")] [Solution ("Review the interface usage. If it is used as a marker then consider replacing it with an attribute.")] [FxCopCompatibility ("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] public class AvoidEmptyInterfaceRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule only applies to interfaces if (!type.IsInterface) return RuleResult.DoesNotApply; // rule applies! // first check if the interface defines it's own members if (type.HasMethods) return RuleResult.Success; // otherwise it may implement more than one interface itself if (type.HasInterfaces && (type.Interfaces.Count > 1)) return RuleResult.Success; Runner.Report (type, Severity.Low, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/MarkAssemblyWithCLSCompliantRule.cs0000664000175000017500000000512112413742070033263 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.MarkAssemblyWithCLSCompliantRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule fires if an assembly does not contain a [CLSCompliant] attribute. /// CLS compliant assemblies can be reused by any CLS-compliant language. It is a good practice /// to declare your global CLS goal at the assembly level and, if needed, mark some types or /// members that behave differently inside your assembly. /// /// /// Good example: /// /// // by default everything in this assembly is CLS compliant /// [assembly: CLSCompliant (true)] /// /// /// This rule is available since Gendarme 2.2 [Problem ("This assembly is not decorated with the [CLSCompliant] attribute.")] [Solution ("Add this attribute to ease the use (or non-use) of your assembly by CLS consumers.")] [FxCopCompatibility ("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")] public class MarkAssemblyWithCLSCompliantRule : MarkAssemblyWithAttributeRule { protected override string AttributeNamespace { get { return "System"; } } protected override string AttributeName { get { return "CLSCompliantAttribute"; } } protected override Severity Severity { get { return Severity.High; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ProvideTryParseAlternativeRule.cs0000664000175000017500000001266512413742070033140 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ProvideTryParseAlternativeRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; namespace Gendarme.Rules.Design { /// /// This rule will warn on any type that provide Parse(string...) /// method(s) without supplying TryParse alternative method(s). /// Using a TryParse method is easier since it is less-error prone /// (no need to handle all possible exceptions) and remove the performance /// issue regarding throwing/catching exceptions. /// /// /// Bad example: /// /// public struct Int32Tuple { /// private int first; /// private int second; /// /// public Int32Tuple (int a, int b) /// { /// first = a; /// second = b; /// } /// /// // documented to throw only Argument[Null]Exception or FormatException /// static Int32Tuple Parse (string s) /// { /// if (s == null) { /// throw new ArgumentNullException ("s"); /// } else if (s.Length == 0) { /// throw new ArgumentException ("s"); /// } else { /// string [] items = s.Split (':'); /// // without the try/catch it would be much harder to /// // be 100% certain of all possible exceptions - like /// // IndexOfOfRangeException and what Int32.Parse can throw /// try { /// int a = Int32.Parse (items [0]); /// int b = Int32.Parse (items [1]); /// return new Int32Tuple (a, b); /// } /// catch (Exception e) { /// throw new FormatException ("Invalid data", e); /// } /// } /// } /// } /// /// /// /// Good example: /// /// public struct Int32Tuple { /// private int first; /// private int second; /// /// public Int32Tuple (int a, int b) /// { /// first = a; /// second = b; /// } /// /// // documented to throw only Argument[Null]Exception or FormatException /// static Int32Tuple Parse (string s) /// { /// if (s == null) { /// throw new ArgumentNullException ("s"); /// } else if (s.Length == 0) { /// throw new ArgumentException ("s"); /// } else { /// // re-implemented using the exception-less TryParse /// Int32Tuple tuple; /// if (!TryParse (s, out tuple)) /// throw new FormatException ("Invalid data"); /// return tuple; /// } /// } /// /// static bool TryParse (string s, out Int32Tuple tuple) /// { /// tuple = new Int32Tuple (); /// if (String.IsNullOrEmpty (s)) /// return false; /// string [] items = s.Split (':'); /// if (items.Length != 2) /// return false; /// int a; /// if (!Int32.TryParse (s, out a)) /// return false; /// int b; /// if (!Int32.TryParse (s, out b)) /// return false; /// tuple.first = a; /// tuple.second = b; /// return true; /// } /// } /// /// /// This rule is available since Gendarme 2.8 [Problem ("This type provides a Parse(System.String) method without an, exception-less, TryParse alternative.")] [Solution ("Add a TryParse alternative method that allow parsing without any exception handling from the caller.")] public class ProvideTryParseAlternativeRule : Rule, ITypeRule { static bool HasTryParseMethod (TypeDefinition type) { foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) continue; if (MethodSignatures.TryParse.Matches (method)) return true; } return false; } public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || type.IsDelegate ()) return RuleResult.DoesNotApply; // we look for a Parse method defined in the type bool has_parse = false; foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) continue; if (MethodSignatures.Parse.Matches (method)) { // the type provides a " ::Parse(string)" method has_parse = true; break; } } // if no Parse method is found; or // if a Parse method is found along with a TryParse method if (!has_parse || HasTryParseMethod (type)) return RuleResult.Success; // otherwise we report a defect to add a TryParse alternative Runner.Report (type, Severity.Medium, Confidence.High); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/MissingAttributeUsageOnCustomAttributeRule.cs0000664000175000017500000000556312413742070035474 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.MissingAttributeUsageOnCustomAttributeRule // // Authors: // Daniel Abramov // // Copyright (C) 2007 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule verifies that every custom attribute (i.e. types that inherit from /// System.Attribute) is decorated with an [AttributeUsage] /// attribute to specify which kind of code instances of that custom attribute can be applied to. /// /// /// Bad example: /// /// // this applies to everything - but the meaning is not clear /// public sealed class SomeAttribute : Attribute { /// } /// /// /// /// Good examples: /// /// // this clearly applies to everything /// [AttributeUsage (AttributeTargets.All)] /// public sealed class AttributeApplyingToAnything : Attribute { /// } /// /// // while this applies only to fields /// [AttributeUsage (AttributeTargets.Field)] /// public sealed class AttributeApplyingToFields : Attribute { /// } /// /// [Problem ("This attribute does not specify the items it can be used upon.")] [Solution ("Specify [AttributeUsage] on this attribute type.")] [FxCopCompatibility ("Microsoft.Design", "CA1018:MarkAttributesWithAttributeUsage")] public class MissingAttributeUsageOnCustomAttributeRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies only to attributes if (!type.IsAttribute ()) return RuleResult.DoesNotApply; if (type.HasAttribute ("System", "AttributeUsageAttribute")) // it's ok return RuleResult.Success; Runner.Report (type, Severity.High, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/Gendarme.Rules.Design.csproj0000775000175000017500000002012712413742070031720 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {FC889577-F51A-469C-9F30-E967504E9E24} Library Properties Gendarme.Rules.Design Gendarme.Rules.Design v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Design.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Design.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/ImplementEqualsAndGetHashCodeInPairRule.cs0000664000175000017500000000755212413742070034530 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ImplementEqualsAndGetHashCodeInPairRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { /// /// This rule checks for types that either override the Equals(object) method /// without overriding GetHashCode() or override GetHashCode without /// overriding Equals. In order to work correctly types should always override /// these together. /// /// /// Bad example (missing GetHashCode): /// /// public class MissingGetHashCode { /// public override bool Equals (object obj) /// { /// return this == obj; /// } /// } /// /// /// /// Bad example (missing Equals): /// /// public class MissingEquals { /// public override int GetHashCode () /// { /// return 42; /// } /// } /// /// /// /// Good example: /// /// public class Good { /// public override bool Equals (object obj) /// { /// return this == obj; /// } /// /// public override int GetHashCode () /// { /// return 42; /// } /// } /// /// [Problem ("This type only implements one of Equals(Object) and GetHashCode().")] [Solution ("Implement the other method.")] [FxCopCompatibility ("Microsoft.Usage", "CA2218:OverrideGetHashCodeOnOverridingEquals")] public class ImplementEqualsAndGetHashCodeInPairRule : Rule, ITypeRule { private const string Message = "Type implements '{0}' but is missing '{1}'."; public RuleResult CheckType (TypeDefinition type) { // rule doesn't apply to interfaces and enums if (type.IsInterface || type.IsEnum || type.IsDelegate ()) return RuleResult.DoesNotApply; bool equals = type.HasMethod (MethodSignatures.Equals); bool getHashCode = type.HasMethod (MethodSignatures.GetHashCode); // if we have Equals but no GetHashCode method if (equals && !getHashCode) { string text = String.Format (CultureInfo.InvariantCulture, Message, MethodSignatures.Equals, MethodSignatures.GetHashCode); Runner.Report (type, Severity.Critical, Confidence.High, text); } // if we have GetHashCode but no Equals method if (!equals && getHashCode) { string text = String.Format (CultureInfo.InvariantCulture, Message, MethodSignatures.GetHashCode, MethodSignatures.Equals); Runner.Report (type, Severity.Medium, Confidence.High, text); } // we either have both Equals and GetHashCode or none (both fine) return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/DefineAZeroValueRule.cs0000664000175000017500000000342012413742070030754 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.DefineAZeroValueRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2007-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; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Design { abstract public class DefineAZeroValueRule : Rule { protected static FieldDefinition GetZeroValueField (TypeDefinition type) { if (type == null) return null; foreach (FieldDefinition field in type.Fields) { // the special __value field is not static like the others (user defined) if (!field.IsStatic) continue; object o = field.Constant; if ((o is int) && ((int) o == 0)) return field; } return null; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design/UsingCloneWithoutImplementingICloneableRule.cs0000664000175000017500000001016712413742070035553 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.ImplementICloneableCorrectlyRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design { // TODO: As of .NET 2.0 the Framework Design Guidelines recommend that ICloneable // not be used because it is so poorly specified. See // for example. This rule should probably be replaced with a new rule which fires for // types that implement ICloneable. /// /// This rule fires if you implement a object Clone() method without /// implementing the System.ICloneable interface. Either change the /// method so that it returns a better type than System.Object or implement /// ICloneable. /// Note: Be sure to document the behavior of your /// Clone method since the framework itself is not very clear, or consistent, between /// shallow and deep cloning. /// /// /// Bad example: /// /// public class MyClass { /// public object Clone () /// { /// MyClass myClass = new MyClass (); /// return myClass; /// } /// } /// /// /// /// Good example (ICloneable): /// /// public class MyClass : ICloneable { /// public object Clone () /// { /// MyClass myClass = new MyClass (); /// return myClass; /// } /// } /// /// /// /// Good example (not returning System.Object): /// /// public class MyClass { /// public MyClass Clone () /// { /// MyClass myClass = new MyClass (); /// return myClass; /// } /// } /// /// /// Prior to Gendarme 2.2 this rule was named UsingCloneWithoutImplementingICloneableRule [Problem ("This type provides a Clone() method which returns System.Object but does not implement the ICloneable interface.")] [Solution ("Use a better return type or implement the ICloneable interface.")] public class ImplementICloneableCorrectlyRule: Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies to type that doesn't implement System.IClonable if (type.Implements ("System", "ICloneable")) return RuleResult.DoesNotApply; foreach (MethodDefinition method in type.Methods) { // note: we don't use MethodSignatures.Clone because we want to // (a) check the return value ourselves // (b) deal with possibly multiple Clone methods if (method.Name != "Clone") continue; if (method.HasParameters) continue; // that return System.Object, e.g. public object Clone() // or the current type, e.g. public Clone() if (method.ReturnType.IsNamed ("System", "Object")) Runner.Report (method, Severity.Low, Confidence.High); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/0000775000175000017500000000000012642235743023622 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/ChangeLog0000664000175000017500000000732412413742070025372 0ustar00directhexdirecthex000000000000002009-07-07 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Ui.mdp: * Gendarme.Rules.Ui.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.UI.xml, doc/Gendarme.Rules.UI: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-14 Sebastien Pouliot * GtkSharpExecutableTargetRule.cs, SystemWindowsFormsExecutableTargetRule.cs, UseSTAThreadAttributeOnSWFEntryPointsRule.cs: Add XML documentation for the rules (then converted into media wiki format). 2008-08-25 Sebastien Pouliot * UseSTAThreadAttributeOnSWFEntryPointsRule.cs: Add mapping to CA2232 using [FxCopCompatibility] attribute. 2008-08-07 Sebastien Pouliot * ExecutableTargetRule.cs: Use new overload instead of using a String.Empty parameter. 2008-07-09 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-08 Sebastien Pouliot * Makefile.am: Rebuild if the framework has changed. 2008-05-01 Sebastien Pouliot * .cs: Renamed namespace from Ui to UI 2008-02-16 Sebastien Pouliot * ExecutableTargetRule.cs, GtkSharpExecutableTargetRule.cs, SystemWindowsFormsExecutableTargetRule.cs: Remove Toolkit property since it's not required anymore. 2008-02-15 Sebastien Pouliot * ExecutableTargetRule.cs * GtkSharpExecutableTargetRule.cs * SystemWindowsFormsExecutableTargetRule.cs * UseSTAThreadAttributeOnSWFEntryPointsRule.cs: Update rules wrt framework changes. 2008-01-21 Sebastien Pouliot * UseSTAThreadAttributeOnSWFEntryPointsRule.cs: New. Rule to check that SWF apps have the [STAThread] attribute on their entry point. [Daniel Abramov] * Makefile.am: Add rule and test to the build. * Gendarme.Rules.Ui.xml.in: Add rule description. 2007-11-29 Sebastien Pouliot * ExecutableTargetRule.cs: Move assembly reference checking code in order to reduce code duplication for both rules. * GtkSharpExecutableTargetRule.cs: Avoid code duplication. * SystemWindowsFormsExecutableTargetRule.cs: Avoid code duplication. 2007-10-07 Sebastien Pouliot * Gendarme.Rules.Ui.mdp: Update project file. 2006-11-08 Sebastien Pouliot * Gendarme.Rules.Ui.csproj: New. Build file for VS.NET 2006-11-07 Sebastien Pouliot * Gendarme.Rules.Ui.xml.in: Fix description for SWF target rule. 2006-11-06 Sebastien Pouliot * ChangeLog: New. Track changes to UI rules. * ExecutableTargetRule.cs: New. Abstract rule to detect /target:winexe in GUI applications. * Gendarme.Rules.Ui.mdp: New. MonoDevelop project file for rules. * Gendarme.Rules.Ui.xml.in: New. XML description of the rules. * GtkSharpExecutableTargetRule.cs: New. Rule for Gtk#. * Makefile.am: New. Build file. * SystemWindowsFormsExecutableTargetRule.cs: New. Rule for SWF. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/GtkSharpExecutableTargetRule.cs0000664000175000017500000000435312413742070031672 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Ui.GtkSharpExecutableTargetRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006-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; using Gendarme.Framework; namespace Gendarme.Rules.UI { /// /// An executable assembly, i.e. an .exe, refers to the gtk-sharp assembly but isn't /// compiled using -target:winexe. A console window will be created and shown /// under Windows (MS runtime) when the application is executed. /// /// /// Bad example: /// gmcs gtk.cs -pkg:gtk-sharp /// /// /// Good example: /// gmcs gtk.cs -pkg:gtk-sharp -target:winexe /// [Problem ("The assembly refers to the 'gtk-sharp.dll' assembly but isn't compiled using /target:winexe. A console window will be shown under Windows.")] // The base class has the solution text. public class GtkSharpExecutableTargetRule: ExecutableTargetRule { protected override string AssemblyName { get { return "gtk-sharp"; } } protected override byte[] GetAssemblyPublicKeyToken () { return new byte[] { 0x35, 0xe1, 0x01, 0x95, 0xda, 0xb3, 0xc9, 0x9f }; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Makefile.in0000664000175000017500000006546312642235732025703 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Ui ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -r:WindowsBase console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AddMatchingArrangeMeasureOverrideRule.cs \ ExecutableTargetRule.cs \ GtkSharpExecutableTargetRule.cs \ SystemWindowsFormsExecutableTargetRule.cs \ UseSTAThreadAttributeOnSWFEntryPointsRule.cs tests_sources = \ AddMatchingArrangeMeasureOverrideTest.cs \ ExecutableTargetTest.cs \ GtkSharpExecutableTargetTest.cs \ SystemWindowsFormsExecutableTargetTest.cs \ UseSTAThreadAttributeOnSWFEntryPointsTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Ui/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Ui/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/UseSTAThreadAttributeOnSWFEntryPointsRule.cs0000664000175000017500000001057112413742070034211 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.UI.UseSTAThreadAttributeOnSWFEntryPointsRule // // Authors: // Daniel Abramov // // (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; namespace Gendarme.Rules.UI { /// /// This rule checks executable assemblies, i.e. *.exe's, that reference /// System.Windows.Forms to /// ensure that their entry point is decorated with [System.STAThread] attribute /// and is not decorated with [System.MTAThread] attribute to ensure that Windows /// Forms work properly. /// /// /// Bad example #1 (no attributes): /// /// public class WindowsFormsEntryPoint { /// static void Main () /// { /// } /// } /// /// /// /// Bad example #2 (MTAThread) /// /// public class WindowsFormsEntryPoint { /// [MTAThread] /// static void Main () /// { /// } /// } /// /// /// /// Good example #1 (STAThread): /// /// public class WindowsFormsEntryPoint { /// [STAThread] /// static void Main () /// { /// } /// } /// /// /// /// Good example #2 (not Windows Forms): /// /// public class ConsoleAppEntryPoint { /// static void Main () /// { /// } /// } /// /// [Problem ("The System.Windows.Forms application's entry-point (Main) is missing an [STAThread] attribute.")] [Solution ("Add a [STAThread] attribute to your application's Main method.")] [FxCopCompatibility ("Microsoft.Usage", "CA2232:MarkWindowsFormsEntryPointsWithStaThread")] public class UseSTAThreadAttributeOnSWFEntryPointsRule : Rule, IAssemblyRule { private const string SystemWindowsForms = "System.Windows.Forms"; public RuleResult CheckAssembly (AssemblyDefinition assembly) { MethodDefinition entry_point = assembly.EntryPoint; // rule applies only if the assembly has an entry point if (entry_point == null) return RuleResult.DoesNotApply; bool referencesSWF = false; foreach (AssemblyNameReference assRef in assembly.MainModule.AssemblyReferences) { if (assRef.Name == SystemWindowsForms) { // SWF referenced referencesSWF = true; break; } } // rule applies only if the assembly reference System.Windows.Forms.dll if (!referencesSWF) return RuleResult.DoesNotApply; bool hasSTA = entry_point.HasAttribute ("System", "STAThreadAttribute"); bool hasMTA = entry_point.HasAttribute ("System", "MTAThreadAttribute"); // success if only [STAThread] attribute is present if (hasSTA && !hasMTA) return RuleResult.Success; string text = String.Empty; if (!hasSTA && hasMTA) text = "In order for Windows Forms to work properly, replace [System.MTAThread] attribute with [System.STAThread] on the entry point."; else if (hasSTA && hasMTA) text = "In order for Windows Forms to work properly, remove [System.MTAThread] attribute from the entry point, leaving [System.STAThread] there."; else if (!hasSTA && !hasMTA) text = "In order for Windows Forms to work properly, place [System.STAThread] attribute upon the entry point."; // note: assembly rule reporting a method defect Runner.Report (entry_point, Severity.High, Confidence.Total, text); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/SystemWindowsFormsExecutableTargetRule.cs0000664000175000017500000000453312413742070034015 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Ui.SystemWindowsFormsExecutableTargetRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006-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; using Gendarme.Framework; namespace Gendarme.Rules.UI { /// /// An executable assembly, i.e. an .exe, refers to the System.Windows.Forms assembly /// but isn't compiled using -target:winexe. A console window will be created /// and shown under Windows (MS runtime) when the application is executed which is /// probably not desirable for a winforms application. /// /// /// Bad example: /// gmcs swf.cs -pkg:dotnet /// /// /// Good example: /// gmcs swf.cs -pkg:dotnet -target:winexe /// [Problem ("The assembly refers to the 'System.Windows.Forms.dll' assembly but isn't compiled using /target:winexe. A console window will be shown under Windows.")] // The base class has the solution text. public class SystemWindowsFormsExecutableTargetRule : ExecutableTargetRule { protected override string AssemblyName { get { return "System.Windows.Forms"; } } protected override byte[] GetAssemblyPublicKeyToken () { return new byte[] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 }; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/0000775000175000017500000000000012642235743024541 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/ChangeLog0000664000175000017500000000340412413742070026304 0ustar00directhexdirecthex000000000000002008-11-07 Alan McGovern * Tests.Rules.Ui.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-03 Sebastien Pouliot * .cs: Rename back to Ui (from UI) to let the new test1 make target work correctly (namespace must match directory name) 2008-05-11 Andres G. Aragoneses * Test.Rules.Ui.mdp: Fix references. 2008-05-01 Sebastien Pouliot * .cs: Renamed namespaces from Ui to UI 2008-03-04 Sebastien Pouliot * ExecutableTargetTest.cs, GtkSharpExecutableTargetTest.cs, SystemWindowsFormsExecutableTargetTest.cs: Fix namespace to be identical to other unit tests. 2008-02-15 Sebastien Pouliot * GtkSharpExecutableTargetTest.cs * SystemWindowsFormsExecutableTargetTest.cs * UseSTAThreadAttributeOnSWFEntryPointsTest.cs Updated unit tests wrt framework changes. 2008-01-21 Sebastien Pouliot * UseSTAThreadAttributeOnSWFEntryPointsTest.cs: New. Unit tests from Daniel Abramov (with a bit more coverage by myself). 2007-10-07 Sebastien Pouliot * Test.Rules.Ui.mdp: Update project file. 2006-11-08 Sebastien Pouliot * Tests.Rules.Ui.csproj: New. Build file for VS.NET 2006-11-06 Sebastien Pouliot * ChangeLog: New. Track changes to UI rules. * ExecutableTargetTest.cs: New. Data (assemblies) for tests. * GtkSharpExecutableTargetTest.cs: New. Tests for Gtk# apps. * Makefile.am: New. Build file. * SystemWindowsFormsExecutableTargetTest.cs: New. Tests for SWF apps. * Test.Rules.Ui.mdp: New. MonoDevelop project file for unit tests. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/AddMatchingArrangeMeasureOverrideTest.cs0000664000175000017500000000650112413742070034407 0ustar00directhexdirecthex00000000000000// // Test.Rules.Ui.AddMatchingArrangeMeasureOverrideTest // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Windows; using Mono.Cecil; using Gendarme.Rules.UI; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; // Mono 2.8 does not provide the PresentationFramework.dll assembly so we fake what we need to test (when compiled with xMCS) #if __MonoCS__ namespace System.Windows { public class FrameworkElement { protected virtual Size ArrangeOverride (Size finalSize) { return new Size (); } protected virtual Size MeasureOverride (Size availableSize) { return new Size (); } } } #endif namespace Test.Rules.Ui { public class BasicFrameworkElement : FrameworkElement { } public class GoodFrameworkElement : FrameworkElement { protected override Size ArrangeOverride (Size finalSize) { return base.ArrangeOverride (finalSize); } protected override Size MeasureOverride (Size availableSize) { return base.MeasureOverride (availableSize); } } public class BadArrangeOnlyElement : FrameworkElement { protected override Size ArrangeOverride (Size finalSize) { return base.ArrangeOverride (finalSize); } } public class BadMeasureOnlyElement : FrameworkElement { protected override Size MeasureOverride (Size availableSize) { return base.MeasureOverride (availableSize); } } [TestFixture] public class AddMatchingArrangeMeasureOverrideTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // Doesn't inhert from FrameworkElement AssertRuleDoesNotApply (SimpleTypes.Class); // Aren't classes AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); // Doesn't implement either method. AssertRuleDoesNotApply (); } [Test] public void Good () { AssertRuleSuccess (); } [Test] public void Bad () { // Only overrides ArrangeOverride method. AssertRuleFailure (1); // Only overrides MeasureOverride method. AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/Tests.Rules.Ui.csproj0000664000175000017500000001462612413742070030533 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {D6BDE725-945A-4A16-91E2-F1B16C67D93D} Library Properties Tests.Rules.Ui Tests.Rules.Ui 3.5 true v4.0 http://localhost/Tests.Rules.Ui/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.0 3.0 3.5 3.0 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {949C4D51-4581-402A-AC18-B1B41F395FDA} Gendarme.Rules.Ui False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/UseSTAThreadAttributeOnSWFEntryPointsTest.cs0000664000175000017500000001267012413742070035142 0ustar00directhexdirecthex00000000000000// // Unit tests for UseSTAThreadAttributeOnSWFEntryPointsTest // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.Collections; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Rules.UI; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Ui { internal class CommonMainClass { } internal class NoAttributesMain : CommonMainClass { public static void Main () { } } internal class STAThreadMain : CommonMainClass { [STAThread] public static void Main () { } } internal class MTAThreadMain : CommonMainClass { [MTAThread] public static void Main () { } } internal class BothSTAAndMTAThreadMain : CommonMainClass { [STAThread] [MTAThread] public static void Main () { } } [TestFixture] public class UseSTAThreadAttributeOnSWFEntryPointsTest { private UseSTAThreadAttributeOnSWFEntryPointsRule rule; private TestRunner runner; private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = System.Reflection.Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new UseSTAThreadAttributeOnSWFEntryPointsRule (); runner = new TestRunner (rule); } private AssemblyDefinition GetAssemblyAndInject (bool SWF) where TInjectedType : CommonMainClass { // return executable assembly with predefined entry point - Main () of TInjectedType string fullClassName = typeof (TInjectedType).FullName; AssemblyDefinition ass = CreateAssembly (typeof (TInjectedType).Name + "Assembly", ModuleKind.Console); if (SWF) { ass.MainModule.Kind = ModuleKind.Windows; AssemblyNameReference winFormsRef = new AssemblyNameReference ("System.Windows.Forms", new Version (2, 0, 0, 0)); winFormsRef.PublicKeyToken = new byte [] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 }; ass.MainModule.AssemblyReferences.Add (winFormsRef); } TypeDefinition mainClass = Inject (assembly.MainModule.GetType (fullClassName), ass); ass.EntryPoint = GetMethod (mainClass, "Main"); return ass; } static AssemblyDefinition CreateAssembly (string name, ModuleKind kind) { return AssemblyDefinition.CreateAssembly (new AssemblyNameDefinition (name, new Version ()), name, kind); } // horrible hack, we're pretending to copy a full loaded type into another assembly static TypeDefinition Inject (TypeDefinition type, AssemblyDefinition target) { var module = ModuleDefinition.ReadModule ( type.Module.FullyQualifiedName, new ReaderParameters { ReadingMode = ReadingMode.Immediate }); type = module.GetType (type.FullName); module.Types.Remove (type); target.MainModule.Types.Add (type); return type; } private MethodDefinition GetMethod (TypeDefinition type, string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } return null; } [Test] public void TestNoEntryPoint () { Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] public void TestNoTANonSWFAssembly () { Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (GetAssemblyAndInject (false))); } [Test] public void TestNoTASWFAssembly () { Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject (true))); } [Test] public void TestSTANonSWFAssembly () { Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (GetAssemblyAndInject (false))); } [Test] public void TestMTANonSWFAssembly () { Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (GetAssemblyAndInject (false))); } [Test] public void TestSTAThreadSWFAssembly () { Assert.AreEqual (RuleResult.Success, runner.CheckAssembly (GetAssemblyAndInject (true))); } [Test] public void TestMTAThreadSWFAssembly () { Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject (true))); } [Test] public void TestSTAAndMTAThreadSWFAssembly () { Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (GetAssemblyAndInject (true))); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/Makefile.in0000664000175000017500000003137712642235732026617 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Ui/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Ui.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Ui/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Ui/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/GtkSharpExecutableTargetTest.cs0000664000175000017500000000571412413742070032623 0ustar00directhexdirecthex00000000000000// // Unit tests for SystemWindowsFormsExecutableTargetRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006,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; using System.IO; using System.Reflection; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.UI; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Ui { [TestFixture] public class GtkSharpExecutableTargetTest { private IAssemblyRule rule; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { rule = new GtkSharpExecutableTargetRule (); runner = new TestRunner (rule); } [Test] public void Library () { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (Assembly.GetExecutingAssembly ().Location); // this (unit test) assembly is a library (dll) and has no entry point Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] public void ConsoleExe () { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (new MemoryStream (ExecutableTargetTest.conexe_exe)); // this assembly is a executable (exe) but doesn't refer to SWF Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] public void WinExe () { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (new MemoryStream (ExecutableTargetTest.gtk_winexe_exe)); // this assembly is a executable (exe), refer to gtk-sharp and is compiled with /winexe Assert.AreEqual (RuleResult.Success, runner.CheckAssembly (assembly)); } [Test] public void GtkExe () { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (new MemoryStream (ExecutableTargetTest.gtkexe_exe)); // this assembly is a executable (exe) and refer to gtk-sharp but isn't compiled with /winexe Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (assembly)); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/ExecutableTargetTest.cs0000664000175000017500000171127512413742070031166 0ustar00directhexdirecthex00000000000000// // Data for ExecutableTargetRule // // Authors: // Sebastien Pouliot // // Copyright (C) 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; namespace Test.Rules.Ui { public class ExecutableTargetTest { static public byte[] conexe_exe = { 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, 0x80, 0x00, 0x00, 0x00, 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, 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x03, 0x00, 0x17, 0xD2, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x0E, 0x01, 0x0B, 0x01, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x26, 0x00, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xB0, 0x25, 0x00, 0x00, 0x1C, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x84, 0x06, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x2E, 0x72, 0x73, 0x72, 0x63, 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x2E, 0x72, 0x65, 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x42, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x60, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x5C, 0x20, 0x00, 0x00, 0x54, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x2A, 0x1E, 0x02, 0x28, 0x10, 0x00, 0x00, 0x0A, 0x2A, 0x00, 0x00, 0x42, 0x53, 0x4A, 0x42, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x76, 0x32, 0x2E, 0x30, 0x2E, 0x35, 0x30, 0x37, 0x32, 0x37, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x6C, 0x00, 0x00, 0x00, 0xC4, 0x01, 0x00, 0x00, 0x23, 0x7E, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x3C, 0x02, 0x00, 0x00, 0x23, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x73, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x55, 0x53, 0x00, 0x74, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x23, 0x47, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x84, 0x04, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x23, 0x42, 0x6C, 0x6F, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x47, 0x15, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x33, 0x00, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x34, 0x00, 0x2D, 0x00, 0x06, 0x00, 0x58, 0x00, 0x46, 0x00, 0x06, 0x00, 0x75, 0x00, 0x46, 0x00, 0x06, 0x00, 0xAD, 0x00, 0x8E, 0x00, 0x06, 0x00, 0xBB, 0x00, 0x8E, 0x00, 0x06, 0x00, 0xCF, 0x00, 0x46, 0x00, 0x06, 0x00, 0xE8, 0x00, 0x46, 0x00, 0x06, 0x00, 0x03, 0x01, 0x46, 0x00, 0x06, 0x00, 0x1E, 0x01, 0x46, 0x00, 0x06, 0x00, 0x37, 0x01, 0x46, 0x00, 0x06, 0x00, 0x50, 0x01, 0x46, 0x00, 0x06, 0x00, 0x6F, 0x01, 0x46, 0x00, 0x06, 0x00, 0x8C, 0x01, 0x46, 0x00, 0x06, 0x00, 0xB6, 0x01, 0xA3, 0x01, 0x3B, 0x00, 0xCA, 0x01, 0x00, 0x00, 0x06, 0x00, 0xF9, 0x01, 0xD9, 0x01, 0x06, 0x00, 0x19, 0x02, 0xD9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x15, 0x00, 0x1D, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x3B, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x52, 0x20, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0x40, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x37, 0x02, 0x11, 0x00, 0x40, 0x00, 0x14, 0x00, 0x19, 0x00, 0x40, 0x00, 0x14, 0x00, 0x21, 0x00, 0x40, 0x00, 0x14, 0x00, 0x29, 0x00, 0x40, 0x00, 0x19, 0x00, 0x31, 0x00, 0x40, 0x00, 0x14, 0x00, 0x39, 0x00, 0x40, 0x00, 0x14, 0x00, 0x41, 0x00, 0x40, 0x00, 0x14, 0x00, 0x49, 0x00, 0x40, 0x00, 0x14, 0x00, 0x51, 0x00, 0x40, 0x00, 0x14, 0x00, 0x59, 0x00, 0x40, 0x00, 0x14, 0x00, 0x61, 0x00, 0x40, 0x00, 0x14, 0x00, 0x69, 0x00, 0x40, 0x00, 0x14, 0x00, 0x71, 0x00, 0x40, 0x00, 0x1E, 0x00, 0x81, 0x00, 0x40, 0x00, 0x24, 0x00, 0x89, 0x00, 0x40, 0x00, 0x10, 0x00, 0x09, 0x00, 0x40, 0x00, 0x10, 0x00, 0x2E, 0x00, 0x0B, 0x00, 0x29, 0x00, 0x2E, 0x00, 0x1B, 0x00, 0x36, 0x00, 0x2E, 0x00, 0x23, 0x00, 0x60, 0x00, 0x2E, 0x00, 0x33, 0x00, 0x60, 0x00, 0x2E, 0x00, 0x3B, 0x00, 0x66, 0x00, 0x2E, 0x00, 0x43, 0x00, 0x84, 0x00, 0x2E, 0x00, 0x4B, 0x00, 0x90, 0x00, 0x2E, 0x00, 0x53, 0x00, 0x60, 0x00, 0x2E, 0x00, 0x5B, 0x00, 0x60, 0x00, 0x2E, 0x00, 0x63, 0x00, 0x84, 0x00, 0x2E, 0x00, 0x6B, 0x00, 0x9C, 0x00, 0x2E, 0x00, 0x73, 0x00, 0xA5, 0x00, 0x2E, 0x00, 0x7B, 0x00, 0xAE, 0x00, 0x04, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x3E, 0x00, 0x63, 0x6F, 0x6E, 0x65, 0x78, 0x65, 0x2E, 0x65, 0x78, 0x65, 0x00, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x00, 0x63, 0x6F, 0x6E, 0x65, 0x78, 0x65, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x6C, 0x69, 0x62, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x00, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x2E, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x66, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x46, 0x69, 0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6F, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x47, 0x75, 0x69, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x43, 0x6F, 0x6D, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x72, 0x61, 0x64, 0x65, 0x6D, 0x61, 0x72, 0x6B, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x50, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x6E, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x69, 0x74, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x69, 0x61, 0x67, 0x6E, 0x6F, 0x73, 0x74, 0x69, 0x63, 0x73, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x61, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x69, 0x6E, 0x67, 0x4D, 0x6F, 0x64, 0x65, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x52, 0x65, 0x6C, 0x61, 0x78, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6C, 0x69, 0x74, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x61, 0x72, 0x67, 0x73, 0x00, 0x00, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x50, 0xB6, 0x51, 0x76, 0x18, 0xE6, 0x40, 0xAD, 0x65, 0x28, 0x65, 0x3B, 0xE4, 0x9B, 0xAB, 0x00, 0x08, 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89, 0x05, 0x00, 0x01, 0x01, 0x1D, 0x0E, 0x03, 0x20, 0x00, 0x01, 0x04, 0x20, 0x01, 0x01, 0x0E, 0x04, 0x20, 0x01, 0x01, 0x02, 0x05, 0x20, 0x01, 0x01, 0x11, 0x3D, 0x04, 0x20, 0x01, 0x01, 0x08, 0x0C, 0x01, 0x00, 0x07, 0x31, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x29, 0x01, 0x00, 0x24, 0x30, 0x33, 0x61, 0x39, 0x61, 0x64, 0x63, 0x32, 0x2D, 0x35, 0x33, 0x65, 0x64, 0x2D, 0x34, 0x33, 0x64, 0x32, 0x2D, 0x38, 0x38, 0x64, 0x36, 0x2D, 0x38, 0x61, 0x34, 0x30, 0x39, 0x32, 0x64, 0x64, 0x31, 0x35, 0x35, 0x38, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x01, 0x00, 0x18, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0xC2, 0xA9, 0x20, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x20, 0x32, 0x30, 0x30, 0x36, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x63, 0x6F, 0x6E, 0x65, 0x78, 0x65, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x00, 0x00, 0x08, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0x00, 0x01, 0x00, 0x54, 0x02, 0x16, 0x57, 0x72, 0x61, 0x70, 0x4E, 0x6F, 0x6E, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x68, 0x72, 0x6F, 0x77, 0x73, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xD2, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0xCC, 0x25, 0x00, 0x00, 0xCC, 0x15, 0x00, 0x00, 0x52, 0x53, 0x44, 0x53, 0x68, 0x06, 0x03, 0xA9, 0x81, 0x8F, 0x7F, 0x44, 0xA8, 0x5F, 0x7C, 0x8D, 0xC6, 0x6C, 0xFF, 0xEB, 0x01, 0x00, 0x00, 0x00, 0x43, 0x3A, 0x5C, 0x63, 0x79, 0x67, 0x77, 0x69, 0x6E, 0x5C, 0x68, 0x6F, 0x6D, 0x65, 0x5C, 0x70, 0x6F, 0x75, 0x70, 0x6F, 0x75, 0x5C, 0x73, 0x76, 0x6E, 0x5C, 0x63, 0x65, 0x63, 0x69, 0x6C, 0x5C, 0x67, 0x65, 0x6E, 0x64, 0x61, 0x72, 0x6D, 0x65, 0x5C, 0x63, 0x6F, 0x6E, 0x65, 0x78, 0x65, 0x5C, 0x6F, 0x62, 0x6A, 0x5C, 0x52, 0x65, 0x6C, 0x65, 0x61, 0x73, 0x65, 0x5C, 0x63, 0x6F, 0x6E, 0x65, 0x78, 0x65, 0x2E, 0x70, 0x64, 0x62, 0x00, 0x00, 0x54, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x43, 0x6F, 0x72, 0x45, 0x78, 0x65, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x65, 0x65, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x25, 0x00, 0x20, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x58, 0x40, 0x00, 0x00, 0xDC, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x02, 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x04, 0xEF, 0xFE, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x04, 0x3C, 0x02, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x01, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x34, 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x07, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x18, 0x00, 0x01, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x20, 0x00, 0xA9, 0x00, 0x20, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x20, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x36, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x08, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x01, 0x00, 0x41, 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x79, 0x00, 0x20, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x20, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x36, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 }; static public byte[] gtk_winexe_exe = { 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, 0x80, 0x00, 0x00, 0x00, 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, 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x03, 0x00, 0x03, 0xD9, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x0E, 0x01, 0x0B, 0x01, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x27, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x26, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x4C, 0x26, 0x00, 0x00, 0x1C, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x24, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x2E, 0x72, 0x73, 0x72, 0x63, 0x00, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x2E, 0x72, 0x65, 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x42, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x6C, 0x20, 0x00, 0x00, 0xE0, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4A, 0x00, 0x73, 0x10, 0x00, 0x00, 0x0A, 0x6F, 0x11, 0x00, 0x00, 0x0A, 0x28, 0x12, 0x00, 0x00, 0x0A, 0x00, 0x2A, 0x1E, 0x02, 0x28, 0x13, 0x00, 0x00, 0x0A, 0x2A, 0x00, 0x42, 0x53, 0x4A, 0x42, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x76, 0x32, 0x2E, 0x30, 0x2E, 0x35, 0x30, 0x37, 0x32, 0x37, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x6C, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x23, 0x7E, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x23, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x73, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x55, 0x53, 0x00, 0xEC, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x23, 0x47, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0xFC, 0x04, 0x00, 0x00, 0xE4, 0x00, 0x00, 0x00, 0x23, 0x42, 0x6C, 0x6F, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x47, 0x15, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x33, 0x00, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x3C, 0x00, 0x35, 0x00, 0x06, 0x00, 0x60, 0x00, 0x4E, 0x00, 0x06, 0x00, 0x7D, 0x00, 0x4E, 0x00, 0x06, 0x00, 0xB5, 0x00, 0x96, 0x00, 0x06, 0x00, 0xC3, 0x00, 0x96, 0x00, 0x06, 0x00, 0xD7, 0x00, 0x4E, 0x00, 0x06, 0x00, 0xF0, 0x00, 0x4E, 0x00, 0x06, 0x00, 0x0B, 0x01, 0x4E, 0x00, 0x06, 0x00, 0x26, 0x01, 0x4E, 0x00, 0x06, 0x00, 0x3F, 0x01, 0x4E, 0x00, 0x06, 0x00, 0x58, 0x01, 0x4E, 0x00, 0x06, 0x00, 0x77, 0x01, 0x4E, 0x00, 0x06, 0x00, 0x94, 0x01, 0x4E, 0x00, 0x06, 0x00, 0xBE, 0x01, 0xAB, 0x01, 0x3B, 0x00, 0xD2, 0x01, 0x00, 0x00, 0x06, 0x00, 0x01, 0x02, 0xE1, 0x01, 0x06, 0x00, 0x21, 0x02, 0xE1, 0x01, 0x0A, 0x00, 0x5D, 0x02, 0x59, 0x02, 0x06, 0x00, 0x6D, 0x02, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x19, 0x00, 0x21, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x43, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x63, 0x20, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0x48, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x4A, 0x02, 0x11, 0x00, 0x48, 0x00, 0x14, 0x00, 0x19, 0x00, 0x48, 0x00, 0x14, 0x00, 0x21, 0x00, 0x48, 0x00, 0x14, 0x00, 0x29, 0x00, 0x48, 0x00, 0x19, 0x00, 0x31, 0x00, 0x48, 0x00, 0x14, 0x00, 0x39, 0x00, 0x48, 0x00, 0x14, 0x00, 0x41, 0x00, 0x48, 0x00, 0x14, 0x00, 0x49, 0x00, 0x48, 0x00, 0x14, 0x00, 0x51, 0x00, 0x48, 0x00, 0x14, 0x00, 0x59, 0x00, 0x48, 0x00, 0x14, 0x00, 0x61, 0x00, 0x48, 0x00, 0x14, 0x00, 0x69, 0x00, 0x48, 0x00, 0x14, 0x00, 0x71, 0x00, 0x48, 0x00, 0x1E, 0x00, 0x81, 0x00, 0x48, 0x00, 0x24, 0x00, 0x89, 0x00, 0x48, 0x00, 0x10, 0x00, 0x91, 0x00, 0x48, 0x00, 0x10, 0x00, 0x09, 0x00, 0x64, 0x02, 0x32, 0x00, 0x99, 0x00, 0x75, 0x02, 0x36, 0x00, 0x09, 0x00, 0x48, 0x00, 0x10, 0x00, 0x2E, 0x00, 0x0B, 0x00, 0x3B, 0x00, 0x2E, 0x00, 0x1B, 0x00, 0x48, 0x00, 0x2E, 0x00, 0x23, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x33, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x3B, 0x00, 0x78, 0x00, 0x2E, 0x00, 0x43, 0x00, 0x96, 0x00, 0x2E, 0x00, 0x4B, 0x00, 0xA6, 0x00, 0x2E, 0x00, 0x53, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x5B, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x63, 0x00, 0x96, 0x00, 0x2E, 0x00, 0x6B, 0x00, 0xB2, 0x00, 0x2E, 0x00, 0x73, 0x00, 0xBB, 0x00, 0x2E, 0x00, 0x7B, 0x00, 0xC4, 0x00, 0x04, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x4F, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x3E, 0x00, 0x67, 0x74, 0x6B, 0x2D, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x2E, 0x65, 0x78, 0x65, 0x00, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x00, 0x67, 0x74, 0x6B, 0x5F, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x6C, 0x69, 0x62, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x00, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x2E, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x66, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x46, 0x69, 0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6F, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x47, 0x75, 0x69, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x43, 0x6F, 0x6D, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x72, 0x61, 0x64, 0x65, 0x6D, 0x61, 0x72, 0x6B, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x50, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x6E, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x69, 0x74, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x69, 0x61, 0x67, 0x6E, 0x6F, 0x73, 0x74, 0x69, 0x63, 0x73, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x61, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x69, 0x6E, 0x67, 0x4D, 0x6F, 0x64, 0x65, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x52, 0x65, 0x6C, 0x61, 0x78, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6C, 0x69, 0x74, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x67, 0x74, 0x6B, 0x2D, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x00, 0x61, 0x72, 0x67, 0x73, 0x00, 0x67, 0x74, 0x6B, 0x2D, 0x73, 0x68, 0x61, 0x72, 0x70, 0x00, 0x47, 0x74, 0x6B, 0x00, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x00, 0x54, 0x6F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x00, 0x43, 0x6F, 0x6E, 0x73, 0x6F, 0x6C, 0x65, 0x00, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4C, 0x69, 0x6E, 0x65, 0x00, 0x00, 0x00, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xF6, 0x3A, 0x90, 0x54, 0x85, 0x53, 0x47, 0xA4, 0x19, 0x74, 0x68, 0xE2, 0x7E, 0xEC, 0xC3, 0x00, 0x08, 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89, 0x05, 0x00, 0x01, 0x01, 0x1D, 0x0E, 0x03, 0x20, 0x00, 0x01, 0x04, 0x20, 0x01, 0x01, 0x0E, 0x04, 0x20, 0x01, 0x01, 0x02, 0x05, 0x20, 0x01, 0x01, 0x11, 0x3D, 0x04, 0x20, 0x01, 0x01, 0x08, 0x08, 0x35, 0xE1, 0x01, 0x95, 0xDA, 0xB3, 0xC9, 0x9F, 0x03, 0x20, 0x00, 0x0E, 0x04, 0x00, 0x01, 0x01, 0x0E, 0x0C, 0x01, 0x00, 0x07, 0x31, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x29, 0x01, 0x00, 0x24, 0x66, 0x36, 0x63, 0x66, 0x30, 0x39, 0x33, 0x35, 0x2D, 0x36, 0x32, 0x39, 0x64, 0x2D, 0x34, 0x36, 0x38, 0x36, 0x2D, 0x61, 0x65, 0x36, 0x35, 0x2D, 0x61, 0x37, 0x36, 0x32, 0x34, 0x65, 0x34, 0x65, 0x37, 0x37, 0x34, 0x31, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x01, 0x00, 0x18, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0xC2, 0xA9, 0x20, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x20, 0x32, 0x30, 0x30, 0x36, 0x00, 0x00, 0x0F, 0x01, 0x00, 0x0A, 0x67, 0x74, 0x6B, 0x2D, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x00, 0x00, 0x08, 0x01, 0x00, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0x00, 0x01, 0x00, 0x54, 0x02, 0x16, 0x57, 0x72, 0x61, 0x70, 0x4E, 0x6F, 0x6E, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x68, 0x72, 0x6F, 0x77, 0x73, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xD9, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x68, 0x26, 0x00, 0x00, 0x68, 0x16, 0x00, 0x00, 0x52, 0x53, 0x44, 0x53, 0x74, 0x1C, 0x2F, 0x52, 0x0E, 0x51, 0xBB, 0x4B, 0xB0, 0x53, 0xD3, 0xB5, 0xF7, 0x96, 0xE8, 0x5F, 0x01, 0x00, 0x00, 0x00, 0x43, 0x3A, 0x5C, 0x63, 0x79, 0x67, 0x77, 0x69, 0x6E, 0x5C, 0x68, 0x6F, 0x6D, 0x65, 0x5C, 0x70, 0x6F, 0x75, 0x70, 0x6F, 0x75, 0x5C, 0x73, 0x76, 0x6E, 0x5C, 0x63, 0x65, 0x63, 0x69, 0x6C, 0x5C, 0x67, 0x65, 0x6E, 0x64, 0x61, 0x72, 0x6D, 0x65, 0x5C, 0x67, 0x74, 0x6B, 0x2D, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x5C, 0x6F, 0x62, 0x6A, 0x5C, 0x44, 0x65, 0x62, 0x75, 0x67, 0x5C, 0x67, 0x74, 0x6B, 0x2D, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x2E, 0x70, 0x64, 0x62, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x27, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x43, 0x6F, 0x72, 0x45, 0x78, 0x65, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x65, 0x65, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x25, 0x00, 0x20, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x58, 0x40, 0x00, 0x00, 0xFC, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x02, 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x04, 0xEF, 0xFE, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x04, 0x5C, 0x02, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x38, 0x02, 0x00, 0x00, 0x01, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x34, 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x74, 0x00, 0x6B, 0x00, 0x2D, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0F, 0x00, 0x01, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x67, 0x00, 0x74, 0x00, 0x6B, 0x00, 0x2D, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x18, 0x00, 0x01, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x20, 0x00, 0xA9, 0x00, 0x20, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x20, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x36, 0x00, 0x00, 0x00, 0x48, 0x00, 0x0F, 0x00, 0x01, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x67, 0x00, 0x74, 0x00, 0x6B, 0x00, 0x2D, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x74, 0x00, 0x6B, 0x00, 0x2D, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x08, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x01, 0x00, 0x41, 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x79, 0x00, 0x20, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x20, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x20, 0x37, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 }; static public byte[] gtkexe_exe = { 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, 0x80, 0x00, 0x00, 0x00, 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, 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x03, 0x00, 0x2A, 0xD7, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x0E, 0x01, 0x0B, 0x01, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x26, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x34, 0x26, 0x00, 0x00, 0x1C, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x2E, 0x72, 0x73, 0x72, 0x63, 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x2E, 0x72, 0x65, 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x42, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0xE0, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x6C, 0x20, 0x00, 0x00, 0xC8, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4A, 0x00, 0x73, 0x10, 0x00, 0x00, 0x0A, 0x6F, 0x11, 0x00, 0x00, 0x0A, 0x28, 0x12, 0x00, 0x00, 0x0A, 0x00, 0x2A, 0x1E, 0x02, 0x28, 0x13, 0x00, 0x00, 0x0A, 0x2A, 0x00, 0x42, 0x53, 0x4A, 0x42, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x76, 0x32, 0x2E, 0x30, 0x2E, 0x35, 0x30, 0x37, 0x32, 0x37, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x6C, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x23, 0x7E, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x6C, 0x02, 0x00, 0x00, 0x23, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x73, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x55, 0x53, 0x00, 0xD8, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x23, 0x47, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0xE8, 0x04, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x23, 0x42, 0x6C, 0x6F, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x47, 0x15, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x33, 0x00, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x34, 0x00, 0x2D, 0x00, 0x06, 0x00, 0x58, 0x00, 0x46, 0x00, 0x06, 0x00, 0x75, 0x00, 0x46, 0x00, 0x06, 0x00, 0xAD, 0x00, 0x8E, 0x00, 0x06, 0x00, 0xBB, 0x00, 0x8E, 0x00, 0x06, 0x00, 0xCF, 0x00, 0x46, 0x00, 0x06, 0x00, 0xE8, 0x00, 0x46, 0x00, 0x06, 0x00, 0x03, 0x01, 0x46, 0x00, 0x06, 0x00, 0x1E, 0x01, 0x46, 0x00, 0x06, 0x00, 0x37, 0x01, 0x46, 0x00, 0x06, 0x00, 0x50, 0x01, 0x46, 0x00, 0x06, 0x00, 0x6F, 0x01, 0x46, 0x00, 0x06, 0x00, 0x8C, 0x01, 0x46, 0x00, 0x06, 0x00, 0xB6, 0x01, 0xA3, 0x01, 0x3B, 0x00, 0xCA, 0x01, 0x00, 0x00, 0x06, 0x00, 0xF9, 0x01, 0xD9, 0x01, 0x06, 0x00, 0x19, 0x02, 0xD9, 0x01, 0x0A, 0x00, 0x4A, 0x02, 0x46, 0x02, 0x06, 0x00, 0x5A, 0x02, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x15, 0x00, 0x1D, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x3B, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x63, 0x20, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0x40, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x37, 0x02, 0x11, 0x00, 0x40, 0x00, 0x14, 0x00, 0x19, 0x00, 0x40, 0x00, 0x14, 0x00, 0x21, 0x00, 0x40, 0x00, 0x14, 0x00, 0x29, 0x00, 0x40, 0x00, 0x19, 0x00, 0x31, 0x00, 0x40, 0x00, 0x14, 0x00, 0x39, 0x00, 0x40, 0x00, 0x14, 0x00, 0x41, 0x00, 0x40, 0x00, 0x14, 0x00, 0x49, 0x00, 0x40, 0x00, 0x14, 0x00, 0x51, 0x00, 0x40, 0x00, 0x14, 0x00, 0x59, 0x00, 0x40, 0x00, 0x14, 0x00, 0x61, 0x00, 0x40, 0x00, 0x14, 0x00, 0x69, 0x00, 0x40, 0x00, 0x14, 0x00, 0x71, 0x00, 0x40, 0x00, 0x1E, 0x00, 0x81, 0x00, 0x40, 0x00, 0x24, 0x00, 0x89, 0x00, 0x40, 0x00, 0x10, 0x00, 0x91, 0x00, 0x40, 0x00, 0x10, 0x00, 0x09, 0x00, 0x51, 0x02, 0x32, 0x00, 0x99, 0x00, 0x62, 0x02, 0x36, 0x00, 0x09, 0x00, 0x40, 0x00, 0x10, 0x00, 0x2E, 0x00, 0x0B, 0x00, 0x3B, 0x00, 0x2E, 0x00, 0x1B, 0x00, 0x48, 0x00, 0x2E, 0x00, 0x23, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x33, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x3B, 0x00, 0x78, 0x00, 0x2E, 0x00, 0x43, 0x00, 0x96, 0x00, 0x2E, 0x00, 0x4B, 0x00, 0xA2, 0x00, 0x2E, 0x00, 0x53, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x5B, 0x00, 0x72, 0x00, 0x2E, 0x00, 0x63, 0x00, 0x96, 0x00, 0x2E, 0x00, 0x6B, 0x00, 0xAE, 0x00, 0x2E, 0x00, 0x73, 0x00, 0xB7, 0x00, 0x2E, 0x00, 0x7B, 0x00, 0xC0, 0x00, 0x04, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x3C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x3E, 0x00, 0x67, 0x74, 0x6B, 0x65, 0x78, 0x65, 0x2E, 0x65, 0x78, 0x65, 0x00, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x00, 0x67, 0x74, 0x6B, 0x65, 0x78, 0x65, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x6C, 0x69, 0x62, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x00, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x2E, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x66, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x46, 0x69, 0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6F, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x47, 0x75, 0x69, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x43, 0x6F, 0x6D, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x72, 0x61, 0x64, 0x65, 0x6D, 0x61, 0x72, 0x6B, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x50, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x6E, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x69, 0x74, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x69, 0x61, 0x67, 0x6E, 0x6F, 0x73, 0x74, 0x69, 0x63, 0x73, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x61, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x69, 0x6E, 0x67, 0x4D, 0x6F, 0x64, 0x65, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x52, 0x65, 0x6C, 0x61, 0x78, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6C, 0x69, 0x74, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x61, 0x72, 0x67, 0x73, 0x00, 0x67, 0x74, 0x6B, 0x2D, 0x73, 0x68, 0x61, 0x72, 0x70, 0x00, 0x47, 0x74, 0x6B, 0x00, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x00, 0x54, 0x6F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x00, 0x43, 0x6F, 0x6E, 0x73, 0x6F, 0x6C, 0x65, 0x00, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4C, 0x69, 0x6E, 0x65, 0x00, 0x00, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x66, 0x55, 0xB1, 0xE5, 0x23, 0xED, 0x4B, 0x82, 0xAB, 0xB2, 0x3B, 0x01, 0x7F, 0x9E, 0xA7, 0x00, 0x08, 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89, 0x05, 0x00, 0x01, 0x01, 0x1D, 0x0E, 0x03, 0x20, 0x00, 0x01, 0x04, 0x20, 0x01, 0x01, 0x0E, 0x04, 0x20, 0x01, 0x01, 0x02, 0x05, 0x20, 0x01, 0x01, 0x11, 0x3D, 0x04, 0x20, 0x01, 0x01, 0x08, 0x08, 0x35, 0xE1, 0x01, 0x95, 0xDA, 0xB3, 0xC9, 0x9F, 0x03, 0x20, 0x00, 0x0E, 0x04, 0x00, 0x01, 0x01, 0x0E, 0x0C, 0x01, 0x00, 0x07, 0x31, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x29, 0x01, 0x00, 0x24, 0x66, 0x61, 0x61, 0x35, 0x30, 0x66, 0x32, 0x63, 0x2D, 0x36, 0x30, 0x66, 0x39, 0x2D, 0x34, 0x36, 0x34, 0x36, 0x2D, 0x39, 0x39, 0x38, 0x31, 0x2D, 0x39, 0x32, 0x30, 0x31, 0x61, 0x32, 0x61, 0x62, 0x39, 0x32, 0x31, 0x36, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x01, 0x00, 0x18, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0xC2, 0xA9, 0x20, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x20, 0x32, 0x30, 0x30, 0x36, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x67, 0x74, 0x6B, 0x65, 0x78, 0x65, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x00, 0x00, 0x08, 0x01, 0x00, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0x00, 0x01, 0x00, 0x54, 0x02, 0x16, 0x57, 0x72, 0x61, 0x70, 0x4E, 0x6F, 0x6E, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x68, 0x72, 0x6F, 0x77, 0x73, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0xD7, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00, 0x50, 0x26, 0x00, 0x00, 0x50, 0x16, 0x00, 0x00, 0x52, 0x53, 0x44, 0x53, 0x0A, 0x5A, 0x15, 0xB1, 0xBE, 0x54, 0x99, 0x4E, 0xB7, 0x44, 0x55, 0xD7, 0xB0, 0x9B, 0x42, 0x8F, 0x01, 0x00, 0x00, 0x00, 0x43, 0x3A, 0x5C, 0x63, 0x79, 0x67, 0x77, 0x69, 0x6E, 0x5C, 0x68, 0x6F, 0x6D, 0x65, 0x5C, 0x70, 0x6F, 0x75, 0x70, 0x6F, 0x75, 0x5C, 0x73, 0x76, 0x6E, 0x5C, 0x63, 0x65, 0x63, 0x69, 0x6C, 0x5C, 0x67, 0x65, 0x6E, 0x64, 0x61, 0x72, 0x6D, 0x65, 0x5C, 0x67, 0x74, 0x6B, 0x65, 0x78, 0x65, 0x5C, 0x6F, 0x62, 0x6A, 0x5C, 0x44, 0x65, 0x62, 0x75, 0x67, 0x5C, 0x67, 0x74, 0x6B, 0x65, 0x78, 0x65, 0x2E, 0x70, 0x64, 0x62, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x43, 0x6F, 0x72, 0x45, 0x78, 0x65, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x65, 0x65, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x25, 0x00, 0x20, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x58, 0x40, 0x00, 0x00, 0xDC, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x02, 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x04, 0xEF, 0xFE, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x04, 0x3C, 0x02, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x01, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x34, 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x07, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x74, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x67, 0x00, 0x74, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x18, 0x00, 0x01, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x20, 0x00, 0xA9, 0x00, 0x20, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x20, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x36, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x67, 0x00, 0x74, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x00, 0x74, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x08, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x01, 0x00, 0x41, 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x79, 0x00, 0x20, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x20, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x37, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 }; static public byte[] swf_winexe_exe = { 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, 0x80, 0x00, 0x00, 0x00, 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, 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x03, 0x00, 0x17, 0xD2, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x0E, 0x01, 0x0B, 0x01, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x2E, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x2E, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x34, 0x2E, 0x00, 0x00, 0x1C, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x04, 0x0F, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x2E, 0x72, 0x73, 0x72, 0x63, 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x2E, 0x72, 0x65, 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x42, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0xE0, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0xE0, 0x21, 0x00, 0x00, 0x54, 0x0C, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x28, 0x21, 0x00, 0x00, 0xB8, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x7E, 0x01, 0x00, 0x00, 0x04, 0x2A, 0x56, 0x73, 0x02, 0x00, 0x00, 0x06, 0x28, 0x12, 0x00, 0x00, 0x0A, 0x74, 0x02, 0x00, 0x00, 0x02, 0x80, 0x01, 0x00, 0x00, 0x04, 0x2A, 0x1E, 0x02, 0x28, 0x13, 0x00, 0x00, 0x0A, 0x2A, 0x5A, 0x28, 0x15, 0x00, 0x00, 0x0A, 0x16, 0x28, 0x16, 0x00, 0x00, 0x0A, 0x73, 0x07, 0x00, 0x00, 0x06, 0x28, 0x17, 0x00, 0x00, 0x0A, 0x2A, 0x7A, 0x03, 0x2C, 0x13, 0x02, 0x7B, 0x02, 0x00, 0x00, 0x04, 0x2C, 0x0B, 0x02, 0x7B, 0x02, 0x00, 0x00, 0x04, 0x6F, 0x18, 0x00, 0x00, 0x0A, 0x02, 0x03, 0x28, 0x19, 0x00, 0x00, 0x0A, 0x2A, 0x7A, 0x02, 0x73, 0x1A, 0x00, 0x00, 0x0A, 0x7D, 0x02, 0x00, 0x00, 0x04, 0x02, 0x17, 0x28, 0x1B, 0x00, 0x00, 0x0A, 0x02, 0x72, 0x01, 0x00, 0x00, 0x70, 0x6F, 0x1C, 0x00, 0x00, 0x0A, 0x2A, 0x36, 0x02, 0x28, 0x1D, 0x00, 0x00, 0x0A, 0x02, 0x28, 0x06, 0x00, 0x00, 0x06, 0x2A, 0x1E, 0x02, 0x28, 0x1F, 0x00, 0x00, 0x0A, 0x2A, 0x13, 0x30, 0x03, 0x00, 0x2D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x11, 0x7E, 0x03, 0x00, 0x00, 0x04, 0x2D, 0x20, 0x72, 0x0D, 0x00, 0x00, 0x70, 0xD0, 0x05, 0x00, 0x00, 0x02, 0x28, 0x20, 0x00, 0x00, 0x0A, 0x6F, 0x21, 0x00, 0x00, 0x0A, 0x73, 0x22, 0x00, 0x00, 0x0A, 0x0A, 0x06, 0x80, 0x03, 0x00, 0x00, 0x04, 0x7E, 0x03, 0x00, 0x00, 0x04, 0x2A, 0x1A, 0x7E, 0x04, 0x00, 0x00, 0x04, 0x2A, 0x1E, 0x02, 0x80, 0x04, 0x00, 0x00, 0x04, 0x2A, 0xB4, 0x00, 0x00, 0x00, 0xCE, 0xCA, 0xEF, 0xBE, 0x01, 0x00, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x6C, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2E, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2C, 0x20, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x6C, 0x69, 0x62, 0x2C, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x32, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x2C, 0x20, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x3D, 0x6E, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6C, 0x2C, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x4B, 0x65, 0x79, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x3D, 0x62, 0x37, 0x37, 0x61, 0x35, 0x63, 0x35, 0x36, 0x31, 0x39, 0x33, 0x34, 0x65, 0x30, 0x38, 0x39, 0x23, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x74, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x41, 0x44, 0x50, 0x41, 0x44, 0x50, 0xB4, 0x00, 0x00, 0x00, 0x42, 0x53, 0x4A, 0x42, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x76, 0x32, 0x2E, 0x30, 0x2E, 0x35, 0x30, 0x37, 0x32, 0x37, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x2C, 0x04, 0x00, 0x00, 0x23, 0x7E, 0x00, 0x00, 0x98, 0x04, 0x00, 0x00, 0x84, 0x05, 0x00, 0x00, 0x23, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x73, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x0A, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x23, 0x55, 0x53, 0x00, 0x64, 0x0A, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x23, 0x47, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x74, 0x0A, 0x00, 0x00, 0xE0, 0x01, 0x00, 0x00, 0x23, 0x42, 0x6C, 0x6F, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x57, 0x15, 0xA2, 0x01, 0x09, 0x01, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x33, 0x00, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x6B, 0x00, 0x56, 0x00, 0x0A, 0x00, 0x8C, 0x00, 0x4F, 0x00, 0x0E, 0x00, 0xA8, 0x00, 0x93, 0x00, 0x06, 0x00, 0xF2, 0x00, 0xDC, 0x00, 0x0A, 0x00, 0x35, 0x01, 0x24, 0x01, 0x0A, 0x00, 0x66, 0x01, 0x51, 0x01, 0x0A, 0x00, 0xC8, 0x01, 0xB6, 0x01, 0x0A, 0x00, 0xE5, 0x01, 0xB6, 0x01, 0x0A, 0x00, 0x1D, 0x02, 0xFE, 0x01, 0x0A, 0x00, 0x2B, 0x02, 0xFE, 0x01, 0x0A, 0x00, 0x3F, 0x02, 0xB6, 0x01, 0x0A, 0x00, 0x58, 0x02, 0xB6, 0x01, 0x0A, 0x00, 0x73, 0x02, 0xB6, 0x01, 0x0A, 0x00, 0x8E, 0x02, 0xB6, 0x01, 0x0A, 0x00, 0xA7, 0x02, 0xB6, 0x01, 0x0A, 0x00, 0xC0, 0x02, 0xB6, 0x01, 0x0A, 0x00, 0xDF, 0x02, 0xB6, 0x01, 0x0A, 0x00, 0xFC, 0x02, 0xB6, 0x01, 0x0A, 0x00, 0x26, 0x03, 0x13, 0x03, 0x4F, 0x00, 0x3A, 0x03, 0x00, 0x00, 0x0A, 0x00, 0x69, 0x03, 0x49, 0x03, 0x0A, 0x00, 0x89, 0x03, 0x49, 0x03, 0x0A, 0x00, 0xA7, 0x03, 0x49, 0x03, 0x06, 0x00, 0xDA, 0x03, 0xC2, 0x03, 0x06, 0x00, 0xF8, 0x03, 0x56, 0x00, 0x0A, 0x00, 0x12, 0x04, 0x4F, 0x00, 0x0E, 0x00, 0x25, 0x04, 0x93, 0x00, 0x0A, 0x00, 0x74, 0x04, 0x4F, 0x00, 0x06, 0x00, 0x80, 0x04, 0xDC, 0x00, 0x0E, 0x00, 0x8A, 0x04, 0x93, 0x00, 0x0E, 0x00, 0x9B, 0x04, 0x93, 0x00, 0x0E, 0x00, 0xBB, 0x04, 0x93, 0x00, 0x0A, 0x00, 0xCC, 0x04, 0x13, 0x03, 0x0A, 0x00, 0xE9, 0x04, 0x4F, 0x00, 0x0A, 0x00, 0xEE, 0x04, 0x4F, 0x00, 0x0A, 0x00, 0x12, 0x05, 0xB6, 0x01, 0x06, 0x00, 0x2E, 0x05, 0xDC, 0x00, 0x06, 0x00, 0x47, 0x05, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x15, 0x00, 0x1E, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x80, 0x01, 0x10, 0x00, 0x30, 0x00, 0x38, 0x00, 0x09, 0x00, 0x02, 0x00, 0x04, 0x00, 0x01, 0x00, 0x10, 0x00, 0x3F, 0x00, 0x38, 0x00, 0x0D, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x45, 0x00, 0x1E, 0x00, 0x09, 0x00, 0x03, 0x00, 0x08, 0x00, 0x11, 0x00, 0xAD, 0x00, 0x0A, 0x00, 0x01, 0x00, 0xFD, 0x00, 0x20, 0x00, 0x11, 0x00, 0x45, 0x01, 0x29, 0x00, 0x11, 0x00, 0x72, 0x01, 0x2D, 0x00, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x96, 0x08, 0xBD, 0x00, 0x0E, 0x00, 0x01, 0x00, 0x6D, 0x20, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0xC9, 0x00, 0x13, 0x00, 0x01, 0x00, 0x57, 0x20, 0x00, 0x00, 0x00, 0x00, 0x91, 0x18, 0xF1, 0x03, 0x1C, 0x00, 0x01, 0x00, 0x75, 0x20, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0xD7, 0x00, 0x1C, 0x00, 0x01, 0x00, 0x8C, 0x20, 0x00, 0x00, 0x00, 0x00, 0xC4, 0x00, 0x08, 0x01, 0x24, 0x00, 0x01, 0x00, 0xAB, 0x20, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x10, 0x01, 0x13, 0x00, 0x02, 0x00, 0xCA, 0x20, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0xC9, 0x00, 0x13, 0x00, 0x02, 0x00, 0xD8, 0x20, 0x00, 0x00, 0x00, 0x00, 0x83, 0x18, 0xC9, 0x00, 0x13, 0x00, 0x02, 0x00, 0xE0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x93, 0x08, 0x82, 0x01, 0x31, 0x00, 0x02, 0x00, 0x19, 0x21, 0x00, 0x00, 0x00, 0x00, 0x93, 0x08, 0x96, 0x01, 0x36, 0x00, 0x02, 0x00, 0x20, 0x21, 0x00, 0x00, 0x00, 0x00, 0x93, 0x08, 0xA2, 0x01, 0x3B, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x6A, 0x04, 0x00, 0x00, 0x01, 0x00, 0x28, 0x05, 0x39, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x41, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x49, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x51, 0x00, 0xC9, 0x00, 0x24, 0x00, 0x59, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x61, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x69, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x71, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x79, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x81, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x89, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x91, 0x00, 0xC9, 0x00, 0x4B, 0x00, 0x99, 0x00, 0xC9, 0x00, 0x50, 0x00, 0xA9, 0x00, 0xC9, 0x00, 0x56, 0x00, 0xB1, 0x00, 0xC9, 0x00, 0x13, 0x00, 0xB9, 0x00, 0xC9, 0x00, 0x13, 0x00, 0xC1, 0x00, 0xC9, 0x00, 0x60, 0x00, 0xC9, 0x00, 0x05, 0x04, 0xBF, 0x00, 0x09, 0x00, 0xC9, 0x00, 0x13, 0x00, 0xD1, 0x00, 0xC9, 0x00, 0x13, 0x00, 0xD9, 0x00, 0x31, 0x04, 0x1C, 0x00, 0xD9, 0x00, 0x44, 0x04, 0xC6, 0x00, 0xD9, 0x00, 0x66, 0x04, 0xCB, 0x00, 0xE1, 0x00, 0x08, 0x01, 0x13, 0x00, 0x19, 0x00, 0x08, 0x01, 0x24, 0x00, 0xE9, 0x00, 0xC9, 0x00, 0x13, 0x00, 0xF1, 0x00, 0xA9, 0x04, 0xD1, 0x00, 0x01, 0x01, 0xC3, 0x04, 0x4B, 0x00, 0x19, 0x00, 0xC9, 0x00, 0x13, 0x00, 0x09, 0x01, 0xC9, 0x00, 0x13, 0x00, 0x11, 0x00, 0xC9, 0x00, 0x13, 0x00, 0x11, 0x01, 0x00, 0x05, 0x18, 0x01, 0x11, 0x01, 0x1B, 0x05, 0x21, 0x01, 0x29, 0x00, 0xC9, 0x00, 0x27, 0x01, 0x29, 0x01, 0xC9, 0x00, 0x34, 0x01, 0x2E, 0x00, 0x23, 0x00, 0x7B, 0x01, 0x2E, 0x00, 0x7B, 0x00, 0xC0, 0x01, 0x2E, 0x00, 0x0B, 0x00, 0x44, 0x01, 0x2E, 0x00, 0x1B, 0x00, 0x51, 0x01, 0x2E, 0x00, 0x33, 0x00, 0x7B, 0x01, 0x2E, 0x00, 0x3B, 0x00, 0x81, 0x01, 0x2E, 0x00, 0x43, 0x00, 0x9F, 0x01, 0x2E, 0x00, 0x4B, 0x00, 0xAB, 0x01, 0x2E, 0x00, 0x53, 0x00, 0x7B, 0x01, 0x2E, 0x00, 0x5B, 0x00, 0x7B, 0x01, 0x2E, 0x00, 0x63, 0x00, 0x9F, 0x01, 0x2E, 0x00, 0x6B, 0x00, 0x3B, 0x01, 0x2E, 0x00, 0x73, 0x00, 0xB7, 0x01, 0x43, 0x00, 0x8B, 0x00, 0x66, 0x00, 0x43, 0x00, 0x83, 0x00, 0x5B, 0x00, 0x49, 0x00, 0x1B, 0x01, 0x3B, 0x01, 0x69, 0x00, 0x1B, 0x01, 0x3B, 0x01, 0x80, 0x00, 0xA3, 0x00, 0x5B, 0x00, 0xA3, 0x00, 0xF3, 0x00, 0x5B, 0x00, 0xA3, 0x00, 0x83, 0x00, 0x5B, 0x00, 0xA3, 0x00, 0x8B, 0x00, 0xD7, 0x00, 0x2F, 0x01, 0x02, 0x00, 0x01, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0xCF, 0x00, 0x17, 0x00, 0x00, 0x00, 0x35, 0x01, 0x41, 0x00, 0x00, 0x00, 0xAE, 0x01, 0x46, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x02, 0x00, 0x09, 0x00, 0x05, 0x00, 0x02, 0x00, 0x0A, 0x00, 0x07, 0x00, 0x01, 0x00, 0x0B, 0x00, 0x07, 0x00, 0x04, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x93, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5C, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x3E, 0x00, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x2E, 0x65, 0x78, 0x65, 0x00, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73, 0x00, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x2E, 0x50, 0x72, 0x6F, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x00, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x00, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x31, 0x00, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x41, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73, 0x42, 0x61, 0x73, 0x65, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x6C, 0x69, 0x62, 0x00, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x69, 0x6E, 0x64, 0x6F, 0x77, 0x73, 0x2E, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x00, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x49, 0x6E, 0x73, 0x74, 0x61, 0x6E, 0x63, 0x65, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x00, 0x2E, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x00, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x43, 0x6F, 0x6D, 0x70, 0x6F, 0x6E, 0x65, 0x6E, 0x74, 0x4D, 0x6F, 0x64, 0x65, 0x6C, 0x00, 0x49, 0x43, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x00, 0x63, 0x6F, 0x6D, 0x70, 0x6F, 0x6E, 0x65, 0x6E, 0x74, 0x73, 0x00, 0x44, 0x69, 0x73, 0x70, 0x6F, 0x73, 0x65, 0x00, 0x49, 0x6E, 0x69, 0x74, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x43, 0x6F, 0x6D, 0x70, 0x6F, 0x6E, 0x65, 0x6E, 0x74, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x73, 0x00, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x4D, 0x61, 0x6E, 0x61, 0x67, 0x65, 0x72, 0x00, 0x72, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x4D, 0x61, 0x6E, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x47, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x69, 0x7A, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x49, 0x6E, 0x66, 0x6F, 0x00, 0x72, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x4D, 0x61, 0x6E, 0x61, 0x67, 0x65, 0x72, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x00, 0x73, 0x65, 0x74, 0x5F, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x00, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x66, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x46, 0x69, 0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6F, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x47, 0x75, 0x69, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x43, 0x6F, 0x6D, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x72, 0x61, 0x64, 0x65, 0x6D, 0x61, 0x72, 0x6B, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x50, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x6E, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x69, 0x74, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x69, 0x61, 0x67, 0x6E, 0x6F, 0x73, 0x74, 0x69, 0x63, 0x73, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x61, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x69, 0x6E, 0x67, 0x4D, 0x6F, 0x64, 0x65, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x52, 0x65, 0x6C, 0x61, 0x78, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6C, 0x69, 0x74, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x47, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x43, 0x6F, 0x64, 0x65, 0x44, 0x6F, 0x6D, 0x2E, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x00, 0x47, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x43, 0x6F, 0x64, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x2E, 0x63, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73, 0x42, 0x61, 0x73, 0x65, 0x00, 0x53, 0x79, 0x6E, 0x63, 0x68, 0x72, 0x6F, 0x6E, 0x69, 0x7A, 0x65, 0x64, 0x00, 0x53, 0x54, 0x41, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x45, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x56, 0x69, 0x73, 0x75, 0x61, 0x6C, 0x53, 0x74, 0x79, 0x6C, 0x65, 0x73, 0x00, 0x53, 0x65, 0x74, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6C, 0x65, 0x54, 0x65, 0x78, 0x74, 0x52, 0x65, 0x6E, 0x64, 0x65, 0x72, 0x69, 0x6E, 0x67, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x00, 0x52, 0x75, 0x6E, 0x00, 0x64, 0x69, 0x73, 0x70, 0x6F, 0x73, 0x69, 0x6E, 0x67, 0x00, 0x49, 0x44, 0x69, 0x73, 0x70, 0x6F, 0x73, 0x61, 0x62, 0x6C, 0x65, 0x00, 0x43, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x00, 0x43, 0x6F, 0x6E, 0x74, 0x61, 0x69, 0x6E, 0x65, 0x72, 0x43, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C, 0x00, 0x41, 0x75, 0x74, 0x6F, 0x53, 0x63, 0x61, 0x6C, 0x65, 0x4D, 0x6F, 0x64, 0x65, 0x00, 0x73, 0x65, 0x74, 0x5F, 0x41, 0x75, 0x74, 0x6F, 0x53, 0x63, 0x61, 0x6C, 0x65, 0x4D, 0x6F, 0x64, 0x65, 0x00, 0x43, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C, 0x00, 0x73, 0x65, 0x74, 0x5F, 0x54, 0x65, 0x78, 0x74, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x65, 0x72, 0x4E, 0x6F, 0x6E, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6F, 0x64, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x54, 0x79, 0x70, 0x65, 0x00, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x00, 0x47, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x46, 0x72, 0x6F, 0x6D, 0x48, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x00, 0x67, 0x65, 0x74, 0x5F, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x00, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x00, 0x45, 0x64, 0x69, 0x74, 0x6F, 0x72, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x61, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x45, 0x64, 0x69, 0x74, 0x6F, 0x72, 0x42, 0x72, 0x6F, 0x77, 0x73, 0x61, 0x62, 0x6C, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x00, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x2E, 0x50, 0x72, 0x6F, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x2E, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2E, 0x72, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x73, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x46, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6D, 0x00, 0x31, 0x00, 0x00, 0x37, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x65, 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, 0x00, 0x65, 0x00, 0x73, 0x00, 0x2E, 0x00, 0x52, 0x00, 0x65, 0x00, 0x73, 0x00, 0x6F, 0x00, 0x75, 0x00, 0x72, 0x00, 0x63, 0x00, 0x65, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xD4, 0x39, 0x0B, 0xBD, 0x21, 0x3E, 0x47, 0x9A, 0xFE, 0x50, 0x19, 0x13, 0xD8, 0x3E, 0x7C, 0x00, 0x08, 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89, 0x03, 0x06, 0x12, 0x08, 0x04, 0x00, 0x00, 0x12, 0x08, 0x03, 0x20, 0x00, 0x01, 0x04, 0x08, 0x00, 0x12, 0x08, 0x03, 0x00, 0x00, 0x01, 0x03, 0x06, 0x12, 0x11, 0x04, 0x20, 0x01, 0x01, 0x02, 0x03, 0x06, 0x12, 0x15, 0x03, 0x06, 0x12, 0x19, 0x04, 0x00, 0x00, 0x12, 0x15, 0x04, 0x00, 0x00, 0x12, 0x19, 0x05, 0x00, 0x01, 0x01, 0x12, 0x19, 0x04, 0x08, 0x00, 0x12, 0x15, 0x04, 0x08, 0x00, 0x12, 0x19, 0x04, 0x20, 0x01, 0x01, 0x0E, 0x05, 0x20, 0x01, 0x01, 0x11, 0x51, 0x04, 0x20, 0x01, 0x01, 0x08, 0x04, 0x01, 0x00, 0x00, 0x00, 0x05, 0x20, 0x02, 0x01, 0x0E, 0x0E, 0x58, 0x01, 0x00, 0x4B, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x2E, 0x56, 0x69, 0x73, 0x75, 0x61, 0x6C, 0x53, 0x74, 0x75, 0x64, 0x69, 0x6F, 0x2E, 0x45, 0x64, 0x69, 0x74, 0x6F, 0x72, 0x73, 0x2E, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73, 0x44, 0x65, 0x73, 0x69, 0x67, 0x6E, 0x65, 0x72, 0x2E, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73, 0x53, 0x69, 0x6E, 0x67, 0x6C, 0x65, 0x46, 0x69, 0x6C, 0x65, 0x47, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x74, 0x6F, 0x72, 0x07, 0x38, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x06, 0x00, 0x01, 0x12, 0x65, 0x12, 0x65, 0x04, 0x00, 0x01, 0x01, 0x02, 0x05, 0x00, 0x01, 0x01, 0x12, 0x0D, 0x05, 0x20, 0x01, 0x01, 0x11, 0x7D, 0x40, 0x01, 0x00, 0x33, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2E, 0x54, 0x6F, 0x6F, 0x6C, 0x73, 0x2E, 0x53, 0x74, 0x72, 0x6F, 0x6E, 0x67, 0x6C, 0x79, 0x54, 0x79, 0x70, 0x65, 0x64, 0x52, 0x65, 0x73, 0x6F, 0x75, 0x72, 0x63, 0x65, 0x42, 0x75, 0x69, 0x6C, 0x64, 0x65, 0x72, 0x07, 0x32, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x08, 0x00, 0x01, 0x12, 0x80, 0x89, 0x11, 0x80, 0x8D, 0x05, 0x20, 0x00, 0x12, 0x80, 0x91, 0x07, 0x20, 0x02, 0x01, 0x0E, 0x12, 0x80, 0x91, 0x04, 0x07, 0x01, 0x12, 0x15, 0x06, 0x20, 0x01, 0x01, 0x11, 0x80, 0x99, 0x08, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x01, 0x00, 0x07, 0x31, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x29, 0x01, 0x00, 0x24, 0x62, 0x65, 0x37, 0x61, 0x30, 0x63, 0x66, 0x34, 0x2D, 0x64, 0x34, 0x31, 0x33, 0x2D, 0x34, 0x33, 0x63, 0x62, 0x2D, 0x39, 0x39, 0x31, 0x37, 0x2D, 0x36, 0x66, 0x36, 0x35, 0x33, 0x37, 0x65, 0x39, 0x35, 0x30, 0x64, 0x39, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x01, 0x00, 0x18, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0xC2, 0xA9, 0x20, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x20, 0x32, 0x30, 0x30, 0x36, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0x00, 0x01, 0x00, 0x54, 0x02, 0x16, 0x57, 0x72, 0x61, 0x70, 0x4E, 0x6F, 0x6E, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x68, 0x72, 0x6F, 0x77, 0x73, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xD2, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x50, 0x2E, 0x00, 0x00, 0x50, 0x1E, 0x00, 0x00, 0x52, 0x53, 0x44, 0x53, 0x08, 0xE8, 0x46, 0x22, 0x95, 0x9D, 0x8C, 0x4C, 0x8E, 0x35, 0x8A, 0xD9, 0x22, 0xEA, 0x10, 0xDB, 0x01, 0x00, 0x00, 0x00, 0x43, 0x3A, 0x5C, 0x63, 0x79, 0x67, 0x77, 0x69, 0x6E, 0x5C, 0x68, 0x6F, 0x6D, 0x65, 0x5C, 0x70, 0x6F, 0x75, 0x70, 0x6F, 0x75, 0x5C, 0x73, 0x76, 0x6E, 0x5C, 0x63, 0x65, 0x63, 0x69, 0x6C, 0x5C, 0x67, 0x65, 0x6E, 0x64, 0x61, 0x72, 0x6D, 0x65, 0x5C, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x5C, 0x6F, 0x62, 0x6A, 0x5C, 0x52, 0x65, 0x6C, 0x65, 0x61, 0x73, 0x65, 0x5C, 0x77, 0x69, 0x6E, 0x65, 0x78, 0x65, 0x2E, 0x70, 0x64, 0x62, 0x00, 0x00, 0xD8, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x2E, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x2E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x43, 0x6F, 0x72, 0x45, 0x78, 0x65, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x65, 0x65, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x25, 0x00, 0x20, 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, 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, 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, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x58, 0x40, 0x00, 0x00, 0xDC, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x02, 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x04, 0xEF, 0xFE, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x04, 0x3C, 0x02, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x01, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x34, 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x07, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x18, 0x00, 0x01, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x20, 0x00, 0xA9, 0x00, 0x20, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x20, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x36, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x08, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x01, 0x00, 0x41, 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x79, 0x00, 0x20, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x20, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x3F, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 }; static public byte[] swfexe_exe = { 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, 0x80, 0x00, 0x00, 0x00, 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, 0x50, 0x45, 0x00, 0x00, 0x4C, 0x01, 0x03, 0x00, 0x17, 0xD2, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x0E, 0x01, 0x0B, 0x01, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x26, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x34, 0x26, 0x00, 0x00, 0x1C, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x60, 0x2E, 0x72, 0x73, 0x72, 0x63, 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x2E, 0x72, 0x65, 0x6C, 0x6F, 0x63, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x42, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0xE0, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x02, 0x00, 0x05, 0x00, 0x6C, 0x20, 0x00, 0x00, 0xC8, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x73, 0x10, 0x00, 0x00, 0x0A, 0x6F, 0x11, 0x00, 0x00, 0x0A, 0x28, 0x12, 0x00, 0x00, 0x0A, 0x2A, 0x1E, 0x02, 0x28, 0x13, 0x00, 0x00, 0x0A, 0x2A, 0x00, 0x00, 0x00, 0x42, 0x53, 0x4A, 0x42, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x76, 0x32, 0x2E, 0x30, 0x2E, 0x35, 0x30, 0x37, 0x32, 0x37, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x6C, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0x00, 0x23, 0x7E, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x74, 0x02, 0x00, 0x00, 0x23, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x73, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x55, 0x53, 0x00, 0xE0, 0x04, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x23, 0x47, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0xF0, 0x04, 0x00, 0x00, 0xD8, 0x00, 0x00, 0x00, 0x23, 0x42, 0x6C, 0x6F, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x47, 0x15, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xFA, 0x01, 0x33, 0x00, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x34, 0x00, 0x2D, 0x00, 0x06, 0x00, 0x58, 0x00, 0x46, 0x00, 0x06, 0x00, 0x75, 0x00, 0x46, 0x00, 0x06, 0x00, 0xAD, 0x00, 0x8E, 0x00, 0x06, 0x00, 0xBB, 0x00, 0x8E, 0x00, 0x06, 0x00, 0xCF, 0x00, 0x46, 0x00, 0x06, 0x00, 0xE8, 0x00, 0x46, 0x00, 0x06, 0x00, 0x03, 0x01, 0x46, 0x00, 0x06, 0x00, 0x1E, 0x01, 0x46, 0x00, 0x06, 0x00, 0x37, 0x01, 0x46, 0x00, 0x06, 0x00, 0x50, 0x01, 0x46, 0x00, 0x06, 0x00, 0x6F, 0x01, 0x46, 0x00, 0x06, 0x00, 0x8C, 0x01, 0x46, 0x00, 0x06, 0x00, 0xB6, 0x01, 0xA3, 0x01, 0x3B, 0x00, 0xCA, 0x01, 0x00, 0x00, 0x06, 0x00, 0xF9, 0x01, 0xD9, 0x01, 0x06, 0x00, 0x19, 0x02, 0xD9, 0x01, 0x0A, 0x00, 0x51, 0x02, 0x3C, 0x02, 0x06, 0x00, 0x61, 0x02, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x15, 0x00, 0x1D, 0x00, 0x05, 0x00, 0x01, 0x00, 0x01, 0x00, 0x50, 0x20, 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x3B, 0x00, 0x0A, 0x00, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00, 0x00, 0x00, 0x86, 0x18, 0x40, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x37, 0x02, 0x11, 0x00, 0x40, 0x00, 0x14, 0x00, 0x19, 0x00, 0x40, 0x00, 0x14, 0x00, 0x21, 0x00, 0x40, 0x00, 0x14, 0x00, 0x29, 0x00, 0x40, 0x00, 0x19, 0x00, 0x31, 0x00, 0x40, 0x00, 0x14, 0x00, 0x39, 0x00, 0x40, 0x00, 0x14, 0x00, 0x41, 0x00, 0x40, 0x00, 0x14, 0x00, 0x49, 0x00, 0x40, 0x00, 0x14, 0x00, 0x51, 0x00, 0x40, 0x00, 0x14, 0x00, 0x59, 0x00, 0x40, 0x00, 0x14, 0x00, 0x61, 0x00, 0x40, 0x00, 0x14, 0x00, 0x69, 0x00, 0x40, 0x00, 0x14, 0x00, 0x71, 0x00, 0x40, 0x00, 0x1E, 0x00, 0x81, 0x00, 0x40, 0x00, 0x24, 0x00, 0x89, 0x00, 0x40, 0x00, 0x10, 0x00, 0x91, 0x00, 0x40, 0x00, 0x10, 0x00, 0x09, 0x00, 0x58, 0x02, 0x29, 0x00, 0x99, 0x00, 0x69, 0x02, 0x2D, 0x00, 0x09, 0x00, 0x40, 0x00, 0x10, 0x00, 0x2E, 0x00, 0x0B, 0x00, 0x32, 0x00, 0x2E, 0x00, 0x1B, 0x00, 0x3F, 0x00, 0x2E, 0x00, 0x23, 0x00, 0x69, 0x00, 0x2E, 0x00, 0x33, 0x00, 0x69, 0x00, 0x2E, 0x00, 0x3B, 0x00, 0x6F, 0x00, 0x2E, 0x00, 0x43, 0x00, 0x8D, 0x00, 0x2E, 0x00, 0x4B, 0x00, 0x99, 0x00, 0x2E, 0x00, 0x53, 0x00, 0x69, 0x00, 0x2E, 0x00, 0x5B, 0x00, 0x69, 0x00, 0x2E, 0x00, 0x63, 0x00, 0x8D, 0x00, 0x2E, 0x00, 0x6B, 0x00, 0xA5, 0x00, 0x2E, 0x00, 0x73, 0x00, 0xAE, 0x00, 0x2E, 0x00, 0x7B, 0x00, 0xB7, 0x00, 0x04, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x3C, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x3E, 0x00, 0x73, 0x77, 0x66, 0x65, 0x78, 0x65, 0x2E, 0x65, 0x78, 0x65, 0x00, 0x50, 0x72, 0x6F, 0x67, 0x72, 0x61, 0x6D, 0x00, 0x73, 0x77, 0x66, 0x65, 0x78, 0x65, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x6C, 0x69, 0x62, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x00, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x2E, 0x63, 0x74, 0x6F, 0x72, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x65, 0x66, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x46, 0x69, 0x6C, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6F, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x47, 0x75, 0x69, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x43, 0x6F, 0x6D, 0x56, 0x69, 0x73, 0x69, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x72, 0x61, 0x64, 0x65, 0x6D, 0x61, 0x72, 0x6B, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x50, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x6E, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x43, 0x6F, 0x6E, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x41, 0x73, 0x73, 0x65, 0x6D, 0x62, 0x6C, 0x79, 0x54, 0x69, 0x74, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x44, 0x69, 0x61, 0x67, 0x6E, 0x6F, 0x73, 0x74, 0x69, 0x63, 0x73, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x61, 0x62, 0x6C, 0x65, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x44, 0x65, 0x62, 0x75, 0x67, 0x67, 0x69, 0x6E, 0x67, 0x4D, 0x6F, 0x64, 0x65, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x2E, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x00, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x52, 0x65, 0x6C, 0x61, 0x78, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x52, 0x75, 0x6E, 0x74, 0x69, 0x6D, 0x65, 0x43, 0x6F, 0x6D, 0x70, 0x61, 0x74, 0x69, 0x62, 0x69, 0x6C, 0x69, 0x74, 0x79, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x00, 0x61, 0x72, 0x67, 0x73, 0x00, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x69, 0x6E, 0x64, 0x6F, 0x77, 0x73, 0x2E, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x00, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x00, 0x54, 0x6F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x00, 0x43, 0x6F, 0x6E, 0x73, 0x6F, 0x6C, 0x65, 0x00, 0x57, 0x72, 0x69, 0x74, 0x65, 0x4C, 0x69, 0x6E, 0x65, 0x00, 0x00, 0x00, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x86, 0x70, 0x91, 0x81, 0x3D, 0x34, 0x4C, 0xB3, 0xF7, 0xC2, 0x37, 0x50, 0xF6, 0x24, 0x94, 0x00, 0x08, 0xB7, 0x7A, 0x5C, 0x56, 0x19, 0x34, 0xE0, 0x89, 0x05, 0x00, 0x01, 0x01, 0x1D, 0x0E, 0x03, 0x20, 0x00, 0x01, 0x04, 0x20, 0x01, 0x01, 0x0E, 0x04, 0x20, 0x01, 0x01, 0x02, 0x05, 0x20, 0x01, 0x01, 0x11, 0x3D, 0x04, 0x20, 0x01, 0x01, 0x08, 0x03, 0x20, 0x00, 0x0E, 0x04, 0x00, 0x01, 0x01, 0x0E, 0x0C, 0x01, 0x00, 0x07, 0x31, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x00, 0x00, 0x29, 0x01, 0x00, 0x24, 0x38, 0x36, 0x33, 0x39, 0x65, 0x37, 0x36, 0x64, 0x2D, 0x35, 0x64, 0x31, 0x66, 0x2D, 0x34, 0x33, 0x61, 0x38, 0x2D, 0x39, 0x64, 0x39, 0x65, 0x2D, 0x64, 0x38, 0x39, 0x61, 0x34, 0x35, 0x33, 0x64, 0x65, 0x31, 0x32, 0x35, 0x00, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x01, 0x00, 0x18, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0xC2, 0xA9, 0x20, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x20, 0x32, 0x30, 0x30, 0x36, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x73, 0x77, 0x66, 0x65, 0x78, 0x65, 0x00, 0x00, 0x0B, 0x01, 0x00, 0x06, 0x4E, 0x6F, 0x76, 0x65, 0x6C, 0x6C, 0x00, 0x00, 0x08, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x01, 0x00, 0x01, 0x00, 0x54, 0x02, 0x16, 0x57, 0x72, 0x61, 0x70, 0x4E, 0x6F, 0x6E, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x54, 0x68, 0x72, 0x6F, 0x77, 0x73, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xD2, 0x4F, 0x45, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x50, 0x26, 0x00, 0x00, 0x50, 0x16, 0x00, 0x00, 0x52, 0x53, 0x44, 0x53, 0x0C, 0xE4, 0x0A, 0xD9, 0x5E, 0x60, 0xF0, 0x4D, 0x85, 0xA8, 0x41, 0xA2, 0x61, 0x8A, 0xE6, 0xFE, 0x01, 0x00, 0x00, 0x00, 0x43, 0x3A, 0x5C, 0x63, 0x79, 0x67, 0x77, 0x69, 0x6E, 0x5C, 0x68, 0x6F, 0x6D, 0x65, 0x5C, 0x70, 0x6F, 0x75, 0x70, 0x6F, 0x75, 0x5C, 0x73, 0x76, 0x6E, 0x5C, 0x63, 0x65, 0x63, 0x69, 0x6C, 0x5C, 0x67, 0x65, 0x6E, 0x64, 0x61, 0x72, 0x6D, 0x65, 0x5C, 0x73, 0x77, 0x66, 0x65, 0x78, 0x65, 0x5C, 0x6F, 0x62, 0x6A, 0x5C, 0x52, 0x65, 0x6C, 0x65, 0x61, 0x73, 0x65, 0x5C, 0x73, 0x77, 0x66, 0x65, 0x78, 0x65, 0x2E, 0x70, 0x64, 0x62, 0x00, 0x00, 0xD8, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEE, 0x26, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x43, 0x6F, 0x72, 0x45, 0x78, 0x65, 0x4D, 0x61, 0x69, 0x6E, 0x00, 0x6D, 0x73, 0x63, 0x6F, 0x72, 0x65, 0x65, 0x2E, 0x64, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x25, 0x00, 0x20, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x58, 0x40, 0x00, 0x00, 0xDC, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x02, 0x34, 0x00, 0x00, 0x00, 0x56, 0x00, 0x53, 0x00, 0x5F, 0x00, 0x56, 0x00, 0x45, 0x00, 0x52, 0x00, 0x53, 0x00, 0x49, 0x00, 0x4F, 0x00, 0x4E, 0x00, 0x5F, 0x00, 0x49, 0x00, 0x4E, 0x00, 0x46, 0x00, 0x4F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBD, 0x04, 0xEF, 0xFE, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x56, 0x00, 0x61, 0x00, 0x72, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x04, 0x00, 0x00, 0x00, 0x54, 0x00, 0x72, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x73, 0x00, 0x6C, 0x00, 0x61, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x04, 0x3C, 0x02, 0x00, 0x00, 0x01, 0x00, 0x53, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x01, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x34, 0x00, 0x62, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x70, 0x00, 0x61, 0x00, 0x6E, 0x00, 0x79, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x07, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x69, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x77, 0x00, 0x66, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x08, 0x00, 0x01, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x49, 0x00, 0x6E, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x73, 0x00, 0x77, 0x00, 0x66, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x18, 0x00, 0x01, 0x00, 0x4C, 0x00, 0x65, 0x00, 0x67, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x43, 0x00, 0x6F, 0x00, 0x70, 0x00, 0x79, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x20, 0x00, 0xA9, 0x00, 0x20, 0x00, 0x4E, 0x00, 0x6F, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x20, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x36, 0x00, 0x00, 0x00, 0x40, 0x00, 0x0B, 0x00, 0x01, 0x00, 0x4F, 0x00, 0x72, 0x00, 0x69, 0x00, 0x67, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6C, 0x00, 0x46, 0x00, 0x69, 0x00, 0x6C, 0x00, 0x65, 0x00, 0x6E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x73, 0x00, 0x77, 0x00, 0x66, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x2E, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x07, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x4E, 0x00, 0x61, 0x00, 0x6D, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x77, 0x00, 0x66, 0x00, 0x65, 0x00, 0x78, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x08, 0x00, 0x01, 0x00, 0x50, 0x00, 0x72, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x75, 0x00, 0x63, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x08, 0x00, 0x01, 0x00, 0x41, 0x00, 0x73, 0x00, 0x73, 0x00, 0x65, 0x00, 0x6D, 0x00, 0x62, 0x00, 0x6C, 0x00, 0x79, 0x00, 0x20, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6F, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 0x00, 0x2E, 0x00, 0x30, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 0x20, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x37, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 }; } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/Makefile.am0000664000175000017500000000014512413742070026565 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Ui.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Test/SystemWindowsFormsExecutableTargetTest.cs0000664000175000017500000000572412413742070034747 0ustar00directhexdirecthex00000000000000// // Unit tests for SystemWindowsFormsExecutableTargetRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006,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; using System.IO; using System.Reflection; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.UI; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Ui { [TestFixture] public class SystemWindowsFormsExecutableTargetTest { private IAssemblyRule rule; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { rule = new SystemWindowsFormsExecutableTargetRule (); runner = new TestRunner (rule); } [Test] public void Library () { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (Assembly.GetExecutingAssembly ().Location); // this (unit test) assembly is a library (dll) and has no entry point Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] public void ConsoleExe () { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (new MemoryStream (ExecutableTargetTest.conexe_exe)); // this assembly is a executable (exe) but doesn't refer to SWF Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckAssembly (assembly)); } [Test] public void WinExe () { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (new MemoryStream (ExecutableTargetTest.swf_winexe_exe)); // this assembly is a executable (exe), refer to SWF and is compiled with /winexe Assert.AreEqual (RuleResult.Success, runner.CheckAssembly (assembly)); } [Test] public void SwfExe () { AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly (new MemoryStream (ExecutableTargetTest.swfexe_exe)); // this assembly is a executable (exe) and refer to SWF but isn't compiled with /winexe Assert.AreEqual (RuleResult.Failure, runner.CheckAssembly (assembly)); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/ExecutableTargetRule.cs0000664000175000017500000000603512413742070030225 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Ui.ExecutableTargetRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2006-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; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.UI { [Solution ("Recompile the assembly using '/target:winexe' (gmcs syntax).")] abstract public class ExecutableTargetRule : Rule, IAssemblyRule { private bool CheckReferences (AssemblyDefinition assembly) { byte[] publicKeyToken = GetAssemblyPublicKeyToken (); foreach (AssemblyNameReference a in assembly.MainModule.AssemblyReferences) { // check name and public key token (but not version or culture) if (a.Name == AssemblyName) { byte[] token = a.PublicKeyToken; if (token != null) { if ((token[0] == publicKeyToken[0]) && (token[1] == publicKeyToken[1]) && (token[2] == publicKeyToken[2]) && (token[3] == publicKeyToken[3]) && (token[4] == publicKeyToken[4]) && (token[5] == publicKeyToken[5]) && (token[6] == publicKeyToken[6]) && (token[7] == publicKeyToken[7])) return true; } } } return false; } abstract protected string AssemblyName { get; } abstract protected byte[] GetAssemblyPublicKeyToken (); public RuleResult CheckAssembly (AssemblyDefinition assembly) { // 1. Check entry point, if no entry point then it's not an executable if (assembly.EntryPoint == null) return RuleResult.DoesNotApply; // 2. Check if the assembly references SWF or GTK# if (!CheckReferences (assembly)) return RuleResult.DoesNotApply; // *** ok, the rule applies! only Success or Failure from this point on *** // 3. On Windows a console window will appear if the subsystem isn't Windows // i.e. the assembly wasn't compiled with /target:winexe if (assembly.MainModule.Kind == ModuleKind.Windows) return RuleResult.Success; Runner.Report (assembly, Severity.Medium, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Makefile.am0000664000175000017500000000075712413742070025657 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AddMatchingArrangeMeasureOverrideRule.cs \ ExecutableTargetRule.cs \ GtkSharpExecutableTargetRule.cs \ SystemWindowsFormsExecutableTargetRule.cs \ UseSTAThreadAttributeOnSWFEntryPointsRule.cs EXTRA_TESTS_OPTIONS += -r:WindowsBase tests_sources = \ AddMatchingArrangeMeasureOverrideTest.cs \ ExecutableTargetTest.cs \ GtkSharpExecutableTargetTest.cs \ SystemWindowsFormsExecutableTargetTest.cs \ UseSTAThreadAttributeOnSWFEntryPointsTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/Gendarme.Rules.Ui.csproj0000664000175000017500000001346712413742070030236 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {949C4D51-4581-402A-AC18-B1B41F395FDA} Library Properties Gendarme.Rules.Ui Gendarme.Rules.Ui 3.5 true v4.0 http://localhost/Gendarme.Rules.Ui/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 1590 1571 ..\..\console\bin\Debug\Gendarme.Rules.Ui.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 ..\..\console\bin\Release\Gendarme.Rules.Ui.xml 1591 1570 AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Ui/AddMatchingArrangeMeasureOverrideRule.cs0000664000175000017500000001023212413742070033454 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Ui.AddMatchingArrangeMeasureOverrideRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.UI { /// /// An object that inherits from System.Windows.FrameworkElement and provides either /// an ArrangeOverride or MeasureOverride method should also provide the other. /// /// /// Bad example: /// /// class BadClass : System.Windows.FrameworkElement { /// protected override Size MeasureOverride (Size availableSize) /// { /// } /// } /// /// /// /// Good example: /// /// class GoodClass : System.Windows.FrameworkElement { /// protected override Size MeasureOverride (Size availableSize) /// { /// } /// protected override Size ArrangeOverride (Size finalSize) /// { /// } /// } /// /// [Problem ("A FrameworkElement provides either an ArrangeOverride or MeasureOverride method, but not the other.")] [Solution ("Add the counterpart ArrangeOverride or MeasureOverride method.")] public class AddMatchingArrangeMeasureOverrideRule : Rule, ITypeRule { private const string Size = "System.Windows.Size"; private static string [] parameters = { Size }; private static Func checkOverride = method => method.IsOverride (); private static MethodSignature arrangeSignature = new MethodSignature ("ArrangeOverride", Size, parameters, checkOverride); private static MethodSignature measureSignature = new MethodSignature ("MeasureOverride", Size, parameters, checkOverride); public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference System.Windows.Size, // then it will not be using the overrides Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { string assembly_name = e.CurrentAssembly.Name.Name; Active = ((assembly_name == "WindowsBase" || assembly_name == "System.Windows") || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Windows", "Size"); }) ); }; } public RuleResult CheckType (TypeDefinition type) { if (!type.IsClass || !type.HasMethods || !type.Inherits ("System.Windows", "FrameworkElement")) return RuleResult.DoesNotApply; var arrangeOverride = type.GetMethod (arrangeSignature); var measureOverride = type.GetMethod (measureSignature); // The class doesn't have either method. if (arrangeOverride == null && measureOverride == null) return RuleResult.DoesNotApply; // Only ArrangeOverride provided. if (arrangeOverride != null && measureOverride == null) Runner.Report (arrangeOverride, Severity.High, Confidence.Total); // Only MeasureOverride provided. if (measureOverride != null && arrangeOverride == null) Runner.Report (measureOverride, Severity.High, Confidence.Total); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/0000775000175000017500000000000012642235742025357 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/ChangeLog0000664000175000017500000000375512413742070027134 0ustar00directhexdirecthex000000000000002009-07-02 Jesse Jones * AvoidExtensionMethodOnSystemObjectRule.cs: Edited the solution text. 2008-12-13 Jesse Jones * AvoidExtensionMethodOnSystemObjectRule.cs: Fix AnalyzeModule so that it activates the rule properly when multiple assemblies or modules are being checked. 2008-11-30 Sebastien Pouliot * AvoidExtensionMethodOnSystemObjectRule.cs: Use HasParameters. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Design.Linq.mdp: * Gendarme.Rules.Design.Linq.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. * Gendarme.Rules.Design.Generic.csproj: Added an empty placeholder file in order to avoid breaking the build process. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Design.Linq.xml, doc/Gendarme.Rules.Design.Linq: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-14 Sebastien Pouliot * AvoidExtensionMethodOnSystemObjectRule.cs: Add XML documentation for the rules (then converted into media wiki format). 2008-09-10 Sebastien Pouliot * Gendarme.Rules.Design.Linq.mdp: New. Add MD project file. 2008-08-16 Sebastien Pouliot * AvoidExtensionMethodOnSystemObjectRule.cs: New. Rule to warn if an extension method extends System.Object. * Makefile.am: Main build file mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/AvoidExtensionMethodOnSystemObjectRule.cs0000664000175000017500000000745112413742070035467 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.Linq.AvoidExtensionMethodOnSystemObjectRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Linq { // ref: http://blogs.msdn.com/mirceat/archive/2008/03/13/linq-framework-design-guidelines.aspx /// /// Extension methods should not be used to extend System.Object. /// Such extension methods cannot be consumed by some languages, like VB.NET, /// which use late-binding on System.Object instances. /// /// /// Bad example: /// /// public static class Extensions { /// public static string ToDebugString (this object self) /// { /// return String.Format ("'{0}', type '{1}', hashcode: {2}", /// self.ToString (), self.GetType (), self.GetHashCode ()); /// } /// } /// /// /// /// Good example: /// /// public static class Extensions { /// public static string ToDebugString (this DateTime self) /// { /// return String.Format ("'{0}', type '{1}', hashcode: {2}", /// self.ToString (), self.GetType (), self.GetHashCode ()); /// } /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("This method extends System.Object. This will not work for VB.NET consumer.")] [Solution ("Either extend a subclass of System.Object or ignore the defect.")] public class AvoidExtensionMethodOnSystemObjectRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // extension methods are only available in FX3.5 // check runtime >= NET2_0 (fast) then check if [ExtensionAttribute] is referenced Runner.AnalyzeModule += (object o, RunnerEventArgs e) => { Active = (e.CurrentModule.Runtime >= TargetRuntime.Net_2_0 && e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Runtime.CompilerServices", "ExtensionAttribute"); }) ); }; } // rock-ify // not 100% bullet-proof against buggy compilers (or IL) static bool IsExtension (MethodDefinition method) { if (!method.IsStatic) return false; if (!method.HasParameters) return false; return method.HasAttribute ("System.Runtime.CompilerServices", "ExtensionAttribute"); } public RuleResult CheckMethod (MethodDefinition method) { if (!IsExtension (method)) return RuleResult.DoesNotApply; if (!method.Parameters [0].ParameterType.IsNamed ("System", "Object")) return RuleResult.Success; Runner.Report (method, Severity.High, Confidence.High); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Gendarme.Rules.Design.Linq.csproj0000664000175000017500000001236712413742070033530 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {EEC7B836-DB9D-4CB3-9829-53C223C9411F} Library Properties Gendarme.Rules.Design.Linq Gendarme.Rules.Design.Linq v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Design.Linq.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Design.Linq.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Makefile.in0000664000175000017500000006500712642235731027432 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Design.Linq ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = AvoidExtensionMethodOnSystemObjectRule.cs tests_sources = \ AvoidExtensionMethodOnSystemObjectTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Design.Linq/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Design.Linq/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Test/0000775000175000017500000000000012642235742026276 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Test/ChangeLog0000664000175000017500000000046712413742070030050 0ustar00directhexdirecthex000000000000002008-09-10 Sebastien Pouliot * Gendarme.Rules.Design.Linq.mdp: New. Add MD project file. 2008-08-16 Sebastien Pouliot * AvoidExtensionMethodOnSystemObjectTest.cs: New. Unit test for AvoidExtensionMethodOnSystemObjectRule. * Makefile.am: Main build file mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Test/Makefile.in0000664000175000017500000003144212642235731030345 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Design.Linq/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Design.Linq.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Design.Linq/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Design.Linq/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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: AvoidExtensionMethodOnSystemObjectTest.cs0000664000175000017500000000557212413742070036341 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Test// // Unit test for AvoidExtensionMethodOnSystemObjectRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.CompilerServices; using Gendarme.Rules.Design.Linq; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Tests.Rules.Design.Linq { public static class Extensions { public static string NotAnExtension (object self) { return String.Empty; } public static string ExtendObject (this object self) { return String.Format ("'{0}', type '{1}', hashcode: {2}", self.ToString (), self.GetType (), self.GetHashCode ()); } public static string ExtendValueType (this int self) { return self.ToString (); } public static string ExtendInterface (this ICloneable self) { return self.ToString (); } public static string ExtendEnum (this DateTimeKind self) { return self.ToString (); } public static string ExtendType (this OperatingSystem self) { return self.ToString (); } } [TestFixture] public class AvoidExtensionMethodOnSystemObjectTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (typeof (Extensions), "NotAnExtension"); } [Test] public void ExtendingSystemObject () { AssertRuleFailure (typeof (Extensions), "ExtendObject", 1); } [Test] public void Extending () { AssertRuleSuccess (typeof (Extensions), "ExtendValueType"); AssertRuleSuccess (typeof (Extensions), "ExtendInterface"); AssertRuleSuccess (typeof (Extensions), "ExtendEnum"); AssertRuleSuccess (typeof (Extensions), "ExtendType"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Test/Makefile.am0000664000175000017500000000015512413742070030324 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Design.Linq.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Test/Tests.Rules.Design.Linq.csproj0000664000175000017500000001214412413742070034020 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {19837D0F-A8ED-4733-97D0-F5EC9991658F} Library Properties Tests.Rules.Design.Linq Tests.Rules.Design.Linq v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {D47F1ACA-8AA6-4797-9644-57A8AFE2A86B} Tests.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {EEC7B836-DB9D-4CB3-9829-53C223C9411F} Gendarme.Rules.Design.Linq False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Linq/Makefile.am0000664000175000017500000000022012413742070027376 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = AvoidExtensionMethodOnSystemObjectRule.cs tests_sources = \ AvoidExtensionMethodOnSystemObjectTest.cs mono-tools-4.2/gendarme/rules/Test.Rules/0000775000175000017500000000000012642235741022441 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Test.Rules/ChangeLog0000664000175000017500000000363412413742070024213 0ustar00directhexdirecthex000000000000002008-11-14 Jesse Jones * common.make: Uses new options.make file. 2008-11-07 Alan McGovern * Test.Rules.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-30 Jesse Jones * Makefile.am: Added TESTS_OPTIONS which defines DEBUG and TRACE and disables warnings. 2008-10-26 Sebastien Pouliot * Test.Rules.mdp: Add Fixtures/AssemblyRuleTestFixture.cs 2008-09-20 Sebastien Pouliot * Makefile.am: Add the AssemblyRuleTestFixture to the build (something must have gone wrong in the last commit -or- it has been overwritten) 2008-08-17 Néstor Salceda * Makefile.am: Add the AssemblyRuleTestFixture to the build. 2008-07-10 Sebastien Pouliot * Makefile.am: A bit simplified (but still different from "real" rules Makefiles) 2008-05-16 Sebastien Pouliot * Makefile.am: Add Test.Rules.csproj to the dist. Make sure to clean the bin/ copy of the assembly (even if we don't put it there with the Makefile, the MD project does). 2008-05-10 Andres G. Aragoneses * Test.Rules.mdp: Update to fix build. 2008-05-10 Sebastien Pouliot * Makefile.am: Add Helpers/TestRunner to the build. 2008-04-28 Andres G. Aragoneses * Test.Rules.mdp: Workaround for bug#367145. 2008-03-24 Sebastien Pouliot * Makefile.am: Refer directly to Mono.Cecil assembly, not to a local copy, of it. 2008-03-12 Sebastien Pouliot * Makefile.am: New. Makefile support for this new helper assembly. 2008-03-11 Daniel Abramov * Test.Rules.mdp: New. MonoDevelop project file for common unit tests functionalities. mono-tools-4.2/gendarme/rules/Test.Rules/Test.Rules.csproj0000775000175000017500000001270012413742070025670 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {069148AF-86AB-4EE3-BFB9-429AE722461F} Library Properties Test.Rules Test.Rules v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Test.Rules/Makefile.in0000664000175000017500000004312012642235732024506 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Test.Rules ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(testdir)" "$(DESTDIR)$(testdir)" SCRIPTS = $(test_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(test_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/../../options.make $(srcdir)/Makefile.in \ ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 testdir = . test_SCRIPTS = test_DATA = framework = ../../bin/Gendarme.Framework.dll common_tests = Test.Rules.dll EXTRA_DIST = $(test_sources) Test.Rules.csproj CLEANFILES = Test.Rules.dll Test.Rules.dll.mdb $(common_tests) DISTCLEANFILES = Makefile.in test_sources = \ Definitions/SimpleMethods.cs \ Definitions/SimpleTypes.cs \ Fixtures/AssemblyRuleTestFixture.cs \ Fixtures/MethodRuleTestFixture.cs \ Fixtures/RuleTestFixture.cs \ Fixtures/TypeRuleTestFixture.cs \ Helpers/AssemblyCache.cs \ Helpers/DefinitionLoader.cs \ Helpers/TestRunner.cs test_build_sources = $(addprefix $(srcdir)/, $(test_sources)) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Test.Rules/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Test.Rules/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; $(srcdir)/../../options.make $(am__empty): $(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-testSCRIPTS: $(test_SCRIPTS) @$(NORMAL_INSTALL) @list='$(test_SCRIPTS)'; test -n "$(testdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(testdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(testdir)" || 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)$(testdir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(testdir)$$dir" || exit $$?; \ } \ ; done uninstall-testSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(test_SCRIPTS)'; test -n "$(testdir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(testdir)'; $(am__uninstall_files_from_dir) install-testDATA: $(test_DATA) @$(NORMAL_INSTALL) @list='$(test_DATA)'; test -n "$(testdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(testdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(testdir)" || 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)$(testdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(testdir)" || exit $$?; \ done uninstall-testDATA: @$(NORMAL_UNINSTALL) @list='$(test_DATA)'; test -n "$(testdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(testdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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)$(testdir)" "$(DESTDIR)$(testdir)"; 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: 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-testDATA install-testSCRIPTS 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: uninstall-testDATA uninstall-testSCRIPTS .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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 install-testDATA \ install-testSCRIPTS installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-testDATA uninstall-testSCRIPTS .PRECIOUS: Makefile $(common_tests): $(test_build_sources) $(framework) $(MCS) -target:library $(TESTS_OPTIONS) -pkg:mono-nunit -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(test_build_sources) all: $(common_tests) test: $(common_tests) run-test: test self-test: # 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-tools-4.2/gendarme/rules/Test.Rules/Helpers/0000775000175000017500000000000012642235741024043 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Test.Rules/Helpers/TestRunner.cs0000664000175000017500000001403212413742070026475 0ustar00directhexdirecthex00000000000000// // Gendarme.Framework.TestRunner // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Test.Rules.Helpers { /// /// To execute properly Gendarme.Framework.Runner keeps the state of /// two variables internally, the current I[Assembly|Type|Method]Rule /// and the current target (IMetadataTokenProvider to match the /// [Assembly|Module|Type|Method]Definition being analyzed). This /// class emulate this behavior and also reset the Defects count /// before each Check[Assembly|Type|Method] calls so we can easily /// Assert on Defects.Count. /// public class TestRunner : Runner { static TestRunner () { string mono_path = Environment.GetEnvironmentVariable ("MONO_PATH"); if (!String.IsNullOrEmpty (mono_path)) { string [] paths = mono_path.Split (':'); foreach (string path in paths) AssemblyResolver.Resolver.AddSearchDirectory (path); } } private RunnerEventArgs event_args; public TestRunner (IRule rule) { CurrentRule = rule; CurrentRule.Initialize (this); Rules.Clear (); Rules.Add (rule); IgnoreList = new BasicIgnoreList (this); Initialize (); } private RuleResult PreCheck (IMetadataTokenProvider obj) { if (obj == null) throw new ArgumentNullException ("obj", "Cannot check a null object"); Reset (); AssemblyDefinition assembly = obj.GetAssembly (); if (!Assemblies.Contains (assembly)) { Assemblies.Clear (); Assemblies.Add (assembly); Engines.Build (Assemblies); } CurrentTarget = obj; return IgnoreList.IsIgnored (CurrentRule, obj) ? RuleResult.DoesNotApply : RuleResult.Success; } private RuleResult PostCheck (RuleResult beforeTearingDown) { CurrentRule.TearDown (); //If current is not the default, and report the greater if (beforeTearingDown == RuleResult.DoesNotApply) return beforeTearingDown; if (CurrentRuleResult > beforeTearingDown) return CurrentRuleResult; return beforeTearingDown; } public RuleResult CheckAssembly (AssemblyDefinition assembly) { RuleResult result = PreCheck (assembly); if (result == RuleResult.Success) result = (CurrentRule as IAssemblyRule).CheckAssembly (assembly); return PostCheck (result); } public RuleResult CheckType (TypeDefinition type) { RuleResult result = PreCheck (type); if (result == RuleResult.Success) result = (CurrentRule as ITypeRule).CheckType (type); return PostCheck (result); } public RuleResult CheckMethod (MethodDefinition method) { RuleResult result = PreCheck (method); if (result == RuleResult.Success) result = (CurrentRule as IMethodRule).CheckMethod (method); return PostCheck (result); } // reuse the same instance private RunnerEventArgs Arguments { get { if (event_args == null) event_args = new RunnerEventArgs (this); return event_args; } } /// /// Calls the protected Runner.OnAssembly method, which raise the AnalyzeAssembly event. /// /// The AssemblyDefinition which will be used to fill the RunnerEventArgs parameter to OnAssembly. public void OnAssembly (AssemblyDefinition assembly) { Arguments.CurrentAssembly = assembly; Arguments.CurrentModule = null; Arguments.CurrentType = null; Arguments.CurrentMethod = null; base.OnAssembly (Arguments); } /// /// Calls the protected Runner.OnModule method, which raise the AnalyzeModule event. /// /// The ModuleDefinition which will be used to fill the RunnerEventArgs parameter to OnModule. public void OnModule (ModuleDefinition module) { Arguments.CurrentAssembly = module.Assembly; Arguments.CurrentModule = module; Arguments.CurrentType = null; Arguments.CurrentMethod = null; base.OnModule (Arguments); } /// /// Calls the protected Runner.OnType method, which raise the AnalyzeType event. /// /// The TypeDefinition which will be used to fill the RunnerEventArgs parameter to OnType. public void OnType (TypeDefinition type) { Arguments.CurrentAssembly = type.Module.Assembly; Arguments.CurrentModule = type.Module; Arguments.CurrentType = type; Arguments.CurrentMethod = null; base.OnType (Arguments); } /// /// Calls the protected Runner.OnMethod, which raise the AnalyzeMethod event. /// /// The MethodDefinition which will be used to fill the RunnerEventArgs parameter to OnMethod. public void OnMethod (MethodDefinition method) { Arguments.CurrentAssembly = method.DeclaringType.Module.Assembly; Arguments.CurrentModule = method.DeclaringType.Module; Arguments.CurrentType = (method.DeclaringType as TypeDefinition); Arguments.CurrentMethod = method; base.OnMethod (Arguments); } } } mono-tools-4.2/gendarme/rules/Test.Rules/Helpers/AssemblyCache.cs0000664000175000017500000000416712413742070027077 0ustar00directhexdirecthex00000000000000// // Test.Rules.Helpers.AssemblyCache // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Reflection; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Test.Rules.Helpers { /// /// Performs caching and mapping of AssemblyDefinitions. /// internal static class AssemblyCache { private static Dictionary cachedAssemblies = new Dictionary (); /// /// Gets an AssemblyDefinition for Reflection.Assembly or creates one. /// public static AssemblyDefinition GetDefinition (Assembly asm) { AssemblyDefinition def; if (cachedAssemblies.TryGetValue (asm, out def)) return def; def = AssemblyDefinition.ReadAssembly ( asm.Location, new ReaderParameters { AssemblyResolver = AssemblyResolver.Resolver }); def.MainModule.LoadDebuggingSymbols (); cachedAssemblies.Add (asm, def); return def; } } } mono-tools-4.2/gendarme/rules/Test.Rules/Helpers/DefinitionLoader.cs0000664000175000017500000001667712413742070027624 0ustar00directhexdirecthex00000000000000// // Test.Rules.Helpers.DefinitionLoader // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.Reflection; using Mono.Cecil; using Gendarme.Framework.Rocks; namespace Test.Rules.Helpers { /// /// Class that provides helper methods to load type and method definitions. /// public static class DefinitionLoader { /// /// Gets full name for a type to be loaded by Cecil, replacing '+' with '/' if one is nested. /// /// Type to get full name for. /// Full name using '/' as a nesting separator ready to be loaded by Cecil. private static string GetCecilNestedTypeName (string type) { return type.Replace ('+', '/'); } /// /// Gets full name for a type to be loaded by Cecil, replacing '+' with '/' if one is nested. /// /// Type to get full name for. /// Full name using '/' as a nesting separator ready to be loaded by Cecil. private static string GetCecilTypeName (Type type) { string name = type.FullName; if (type.IsGenericType) { int pos = name.IndexOf ("["); if (pos > 0) name = name.Substring (0, pos); } if (type.IsNested) return GetCecilNestedTypeName (name); return name; } private static bool MatchParameters (MethodDefinition method, Type [] parameters) { if (method.Parameters.Count != parameters.Length) return false; for (int i = 0; i < method.Parameters.Count; i++) { if (parameters [i].FullName != method.Parameters [i].ParameterType.FullName) return false; } return true; } /// /// Gets a MethodDefinition for method by its name and parameter types. /// /// Type which contains method to load. /// Name of the method to load. /// Array of method parameter types. /// MethodDefinition associated with the specified method. public static MethodDefinition GetMethodDefinition (TypeDefinition type, string methodName, Type [] methodParameters) { int ambiguous = 0; MethodDefinition result = null; foreach (MethodDefinition method in type.Methods) { if (method.Name != methodName) continue; if (methodParameters == null) { ambiguous++; result = method; continue; } // check parameters if (MatchParameters (method, methodParameters)) { result = method; break; } } if (result == null) { string msg = String.Format ("Method {0} was not found in class {1}.", methodName, type.FullName); throw new ArgumentException (msg, "methodName"); } // ambiguous (multiple overloads, parameters not specified) if (ambiguous > 1) { string msg = String.Format ("Name {0} is ambiguous between {1} overloads. You should also pass parameter types in this case.", methodName, ambiguous); throw new ArgumentException (msg, "methodName"); } return result; } /// /// Gets a MethodDefinition for method by its name and parameters. /// /// Name of the method to load. /// Array of method parameter types. /// Type which contains the method to load. /// MethodDefinition associated with the specified method. public static MethodDefinition GetMethodDefinition (string methodName, Type [] methodParameters) { TypeDefinition typeDefinition = GetTypeDefinition (typeof (T)); if (typeDefinition == null) throw new ArgumentException (string.Format ("Could not load {0} type.", typeof (T).FullName)); return GetMethodDefinition (typeDefinition, methodName, methodParameters); } /// /// Gets a MethodDefinition for method by its name. /// /// Name of the method to load. /// Type which contains the method to load. /// MethodDefinition associated with the specified method. public static MethodDefinition GetMethodDefinition (string methodName) { return GetMethodDefinition (methodName, null); } /// /// Gets AssemblyDefiniton containing the specified type. /// /// Type the definition to be retrieved for. /// AssemblyDefiniton containing the specified type. public static AssemblyDefinition GetAssemblyDefinition () { return GetAssemblyDefinition (typeof (T)); } /// Gets AssemblyDefiniton containing the specified type. /// /// Type the definition to be retrieved for. /// AssemblyDefiniton containing the specified type. public static AssemblyDefinition GetAssemblyDefinition (Type type) { return AssemblyCache.GetDefinition (type.Assembly); } /// /// Gets TypeDefinition for the specified type. /// /// Type to be retrieved. /// TypeDefinition associated with specified type. public static TypeDefinition GetTypeDefinition () { return GetTypeDefinition (typeof (T)); } /// /// Gets TypeDefinition for the specified type. /// /// Type name to be retrieved. /// TypeDefinition associated with specified type. public static TypeDefinition GetTypeDefinition (Type type) { return GetAssemblyDefinition (type) .MainModule.GetType (GetCecilTypeName (type)); } /// /// Gets TypeDefinition for the specified type. /// /// Type name to be retrieved. /// Assembly to look for the type in. /// TypeDefinition associated with specified type name. public static TypeDefinition GetTypeDefinition (Assembly assembly, string typeName) { return AssemblyCache.GetDefinition (assembly) .MainModule.GetType (GetCecilNestedTypeName (typeName)); // well, we don't really need to check if type is nested in this case } } } mono-tools-4.2/gendarme/rules/Test.Rules/Definitions/0000775000175000017500000000000012642235741024714 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Test.Rules/Definitions/SimpleTypes.cs0000664000175000017500000000676312413742070027527 0ustar00directhexdirecthex00000000000000// // Test.Rules.Definitions.SimpleTypes // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, includin // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.CodeDom.Compiler; using Test.Rules.Helpers; using Mono.Cecil; namespace Test.Rules.Definitions { /// /// Class that holds references to some widely-used types while testing. /// public static class SimpleTypes { /// /// A class to be used as the common one. /// class DeepThought { public DeepThought () { } public int Answer { get { return 42; } } } /// /// A structure to be used as the common one. /// struct Album { public string Name; public int Year; public int TrackCount; } /// /// An enum to be used as the common one. /// enum Songs { IAmTheWalrus, AllYouNeedIsLove, AcrossTheUniverse } /// /// An interface to be used as the common one. /// interface ILoveBeatles { void Listen (string songName); } /// /// A delegate to be used as the common one. /// delegate bool Filter (string s); /// /// A method decorated with the [GeneratedCode] attribute /// [GeneratedCode ("Gendarme", "2.2")] class Generated { public string GetIt () { return String.Empty; } } /// /// A simple class definition. /// public static TypeDefinition Class { get { return DefinitionLoader.GetTypeDefinition (); } } /// /// A simple interface definition. /// public static TypeDefinition Interface { get { return DefinitionLoader.GetTypeDefinition (); } } /// /// A simple enumeration definition. /// public static TypeDefinition Enum { get { return DefinitionLoader.GetTypeDefinition (); } } /// /// A simple structure definition. /// public static TypeDefinition Structure { get { return DefinitionLoader.GetTypeDefinition (); } } /// /// A simple deletage definition. /// public static TypeDefinition Delegate { get { return DefinitionLoader.GetTypeDefinition (); } } /// /// A simple generated type. /// public static TypeDefinition GeneratedType { get { return DefinitionLoader.GetTypeDefinition (); } } } } mono-tools-4.2/gendarme/rules/Test.Rules/Definitions/SimpleMethods.cs0000664000175000017500000000631512413742070030017 0ustar00directhexdirecthex00000000000000// // Test.Rules.Definitions.SimpleMethods // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.CodeDom.Compiler; using System.Runtime.InteropServices; using System.Text; using Test.Rules.Helpers; using Mono.Cecil; namespace Test.Rules.Definitions { /// /// Class that holds references to some widely-used methods while testing. /// public class SimpleMethods { /// /// A method to be used as an external one. /// [DllImport ("libc.so")] private static extern void strncpy (StringBuilder dest, string src, uint n); private SimpleMethods () { } /// /// Just a simple instance method with empty body. /// private void DoNothing () { } /// /// A method decorated with the [GeneratedCode] attribute /// [GeneratedCode ("Gendarme", "2.2")] private string Generated () { return String.Empty; } private static MethodDefinition external_method; private static MethodDefinition empty_method; private static MethodDefinition generated_method; /// /// Gets a MethodDefinition to private and static external method. /// public static MethodDefinition ExternalMethod { get { if (external_method == null) external_method = DefinitionLoader.GetMethodDefinition ("strncpy"); return external_method; } } /// /// Gets a MethodDefinition to private instance empty method. /// public static MethodDefinition EmptyMethod { get { if (empty_method == null) empty_method = DefinitionLoader.GetMethodDefinition ("DoNothing"); return empty_method; } } /// /// Gets a MethodDefinition to private instance generated method. /// public static MethodDefinition GeneratedCodeMethod { get { if (generated_method == null) generated_method = DefinitionLoader.GetMethodDefinition ("Generated"); return generated_method; } } } } mono-tools-4.2/gendarme/rules/Test.Rules/Fixtures/0000775000175000017500000000000012642235741024252 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Test.Rules/Fixtures/AssemblyRuleTestFixture.cs0000664000175000017500000000312112413742070031406 0ustar00directhexdirecthex00000000000000// // Test.Rules.Fixtures.AssemblyRuleTestFixture // Base class for assembly rule test fixtures which simplifies writting unit // tests for Gendarme. // // Authors: // Néstor Salceda // Based on a previous work of Daniel Abramov // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Mono.Cecil; namespace Test.Rules.Fixtures { public abstract class AssemblyRuleTestFixture : RuleTestFixture where TAssemblyRule : IAssemblyRule, new () { } } mono-tools-4.2/gendarme/rules/Test.Rules/Fixtures/MethodRuleTestFixture.cs0000664000175000017500000001664012413742070031061 0ustar00directhexdirecthex00000000000000// // Test.Rules.Fixtures.MethodRuleTestFixture // Base class for method rule test fixtures that simplifies the process of writing unit tests for Gendarme. // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Rocks; using Test.Rules.Helpers; using Mono.Cecil; namespace Test.Rules.Fixtures { /// /// Abstract class providing various helper methods that method test fixtures should inherit from. /// /// Type of rule to be tested. public abstract class MethodRuleTestFixture : RuleTestFixture where TMethodRule : IMethodRule, new () { /// /// Asserts that the rule does not apply to all methods of the type. /// /// Type containing the methods. protected void AssertRuleDoesNotApply () { foreach (MethodDefinition method in DefinitionLoader.GetTypeDefinition ().Methods) base.AssertRuleDoesNotApply (method); } /// /// Asserts that the rule does not apply to the method. /// /// Method to check. /// Type containing the method. protected void AssertRuleDoesNotApply (string method) { base.AssertRuleDoesNotApply (DefinitionLoader.GetMethodDefinition (method)); } /// /// Asserts that the rule does not apply to the method. /// /// Type containing the method to test. /// Method name. /// Parameter types. protected void AssertRuleDoesNotApply (string method, Type [] parameters) { base.AssertRuleDoesNotApply (DefinitionLoader.GetMethodDefinition (method, parameters)); } protected void AssertRuleDoesNotApply (Type type, string method) { TypeDefinition td = DefinitionLoader.GetTypeDefinition (type); base.AssertRuleDoesNotApply (DefinitionLoader.GetMethodDefinition (td, method, null)); } /// /// Asserts that the rule has been executed successfully for each method in the type. /// /// Type containing the methods. protected void AssertRuleSuccess () { foreach (MethodDefinition method in DefinitionLoader.GetTypeDefinition ().Methods) base.AssertRuleSuccess (method); } /// /// Asserts that the rule has been executed successfully. /// /// Type containing the method to test. /// Method name. protected void AssertRuleSuccess (string method) { base.AssertRuleSuccess (DefinitionLoader.GetMethodDefinition (method)); } /// /// Asserts that the rule has been executed successfully. /// /// Type containing the method to test. /// Method name. /// Parameter types. protected void AssertRuleSuccess (string method, Type [] parameters) { base.AssertRuleSuccess (DefinitionLoader.GetMethodDefinition (method, parameters)); } protected void AssertRuleSuccess (Type type, string method) { TypeDefinition td = DefinitionLoader.GetTypeDefinition (type); base.AssertRuleSuccess (DefinitionLoader.GetMethodDefinition (td, method, null)); } /// /// Asserts that the rule has failed to execute successfully for each method in the type. /// /// Type containing the methods. protected void AssertRuleFailure () { foreach (MethodDefinition method in DefinitionLoader.GetTypeDefinition ().Methods) base.AssertRuleFailure (method); } /// /// Asserts that the rule has failed to execute successfully for each method in the type. /// /// Type containing the methods. /// Expected defect count for each method. protected void AssertRuleFailure (int expectedCount) { foreach (MethodDefinition method in DefinitionLoader.GetTypeDefinition ().Methods) base.AssertRuleFailure (method, expectedCount); } /// /// Asserts that the rule has failed to execute successfully. /// /// Type containing the method to test. /// Method name. protected void AssertRuleFailure (string method) { base.AssertRuleFailure (DefinitionLoader.GetMethodDefinition (method)); } /// /// Asserts that the rule has failed to execute successfully. /// /// Type containing the method to test. /// Method name. /// Expected message count. protected void AssertRuleFailure (string method, int expectedCount) { base.AssertRuleFailure (DefinitionLoader.GetMethodDefinition (method), expectedCount); } /// /// Asserts that the rule has failed to execute successfully. /// /// Type containing the method to test. /// Method name. /// Parameter types. protected void AssertRuleFailure (string method, Type [] parameters) { base.AssertRuleFailure (DefinitionLoader.GetMethodDefinition (method, parameters)); } /// /// Asserts that the rule has failed to execute successfully. /// /// Type containing the method to test. /// Method name. /// Parameter types. /// Expected message count. protected void AssertRuleFailure (string method, Type [] parameters, int expectedCount) { base.AssertRuleFailure (DefinitionLoader.GetMethodDefinition (method, parameters), expectedCount); } protected void AssertRuleFailure (Type type, string method, int expectedCount) { TypeDefinition td = DefinitionLoader.GetTypeDefinition (type); base.AssertRuleFailure (DefinitionLoader.GetMethodDefinition (td, method, null), expectedCount); } } } mono-tools-4.2/gendarme/rules/Test.Rules/Fixtures/TypeRuleTestFixture.cs0000664000175000017500000000560112413742070030555 0ustar00directhexdirecthex00000000000000// // Test.Rules.Fixtures.TypeRuleTestFixture // Base class for type rule test fixtures that simplifies writing unit tests for Gendarme. // // Authors: // Daniel Abramov // // (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Test.Rules.Helpers; using Mono.Cecil; namespace Test.Rules.Fixtures { /// /// This class should be inherited by type rule testing fixtures. /// /// Type of rule to be tested. public abstract class TypeRuleTestFixture : RuleTestFixture where TTypeRule : ITypeRule, new () { /// /// Asserts that the rule does not apply to the type. /// /// Type to check. protected void AssertRuleDoesNotApply () { base.AssertRuleDoesNotApply (DefinitionLoader.GetTypeDefinition ()); } /// /// Asserts that the rule has been executed successfully. /// /// Type to check. protected void AssertRuleSuccess () { base.AssertRuleSuccess (DefinitionLoader.GetTypeDefinition ()); } /// /// Asserts that the rule has failed to execute successfully. /// /// Type to check. protected void AssertRuleFailure () { base.AssertRuleFailure (DefinitionLoader.GetTypeDefinition ()); } /// /// Asserts that the rule has failed to execute successfully. /// /// Expected defects count. /// Type to check. protected void AssertRuleFailure (int expectedCount) { base.AssertRuleFailure (DefinitionLoader.GetTypeDefinition (), expectedCount); } } }mono-tools-4.2/gendarme/rules/Test.Rules/Fixtures/RuleTestFixture.cs0000664000175000017500000001233412413742070027714 0ustar00directhexdirecthex00000000000000// // Test.Rules.Fixtures.RuleTestFixture // Base class for rule test fixtures that simplifies writing unit tests for Gendarme. // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Test.Rules.Helpers; using Mono.Cecil; using NUnit.Framework; namespace Test.Rules.Fixtures { /// /// Base class inRuleTestFixture helpers hierarchy providing methods for making assertions on rule execution results. /// /// Type of rule to be tested (e.g. IMethodRule, ITypeRule). /// Type of Cecil metadata token that TRule handles (e.g. MethodDefinition for IMethodRule). public abstract class RuleTestFixture where TRule : IRule, new () { private TRule rule; private TestRunner runner; public TRule Rule { get { return rule; } } public Runner Runner { get { return runner; } } public bool FireEvents { get; set; } /// /// Creates a RuleTestFixture instance, the runner and the rule itself. /// protected RuleTestFixture () { rule = new TRule (); runner = new TestRunner (rule); } /// /// Asserts that the rule does not apply to a particular token. /// /// Cecil metadata token to check. protected void AssertRuleDoesNotApply (TMetadataToken token) { RunRuleAndCheckResults (token, RuleResult.DoesNotApply, null); } /// /// Asserts that the rule has been executed successfully. /// /// Cecil metadata token to check. protected void AssertRuleSuccess (TMetadataToken token) { RunRuleAndCheckResults (token, RuleResult.Success, null); } /// /// Asserts that the rule has failed to execute successfully. /// /// Cecil metadata token to check. protected void AssertRuleFailure (TMetadataToken token) { RunRuleAndCheckResults (token, RuleResult.Failure, null); } /// /// Asserts that the rule has failed to execute successfully. /// /// Cecil metadata token to check. /// Expected defects count. protected void AssertRuleFailure (TMetadataToken token, int expectedCount) { RunRuleAndCheckResults (token, RuleResult.Failure, expectedCount); } /// /// Runs the rule and checks the results against the specified matcher. /// private void RunRuleAndCheckResults (TMetadataToken token, RuleResult expectedResult, int? expectedDefectCount) { RuleResult result = RunRule (token); Assert.AreEqual (expectedResult, result, "{0} failed on {1}: result should be {2} but got {3}.", typeof (TRule).Name, token, expectedResult, result); if (expectedDefectCount.HasValue) { Assert.AreEqual (expectedDefectCount.Value, runner.Defects.Count, "{0} failed on {1}: should have {2} defects but got {3}.", typeof (TRule).Name, token, expectedDefectCount.Value, runner.Defects.Count); } } /// /// Runs the rule, depending on its type. /// private RuleResult RunRule (TMetadataToken token) { if (token == null) throw new ArgumentNullException ("token"); MethodDefinition md = (token as MethodDefinition); if (md != null) { if (FireEvents) { runner.OnAssembly (md.DeclaringType.Module.Assembly); runner.OnType (md.DeclaringType); runner.OnMethod (md); } return runner.CheckMethod (token as MethodDefinition); } TypeDefinition td = (token as TypeDefinition); if (td != null) { if (FireEvents) { runner.OnAssembly (md.DeclaringType.Module.Assembly); runner.OnType (md.DeclaringType); } return runner.CheckType (td); } AssemblyDefinition ad = (token as AssemblyDefinition); if (ad != null) { if (FireEvents) runner.OnAssembly (td.Module.Assembly); return runner.CheckAssembly (ad); } throw new NotImplementedException (token.GetType ().ToString ()); } } } mono-tools-4.2/gendarme/rules/Test.Rules/Makefile.am0000664000175000017500000000157412413742070024476 0ustar00directhexdirecthex00000000000000include ../../options.make testdir=. test_SCRIPTS = test_DATA = framework=../../bin/Gendarme.Framework.dll common_tests=Test.Rules.dll EXTRA_DIST = $(test_sources) Test.Rules.csproj CLEANFILES = Test.Rules.dll Test.Rules.dll.mdb $(common_tests) DISTCLEANFILES = Makefile.in test_sources = \ Definitions/SimpleMethods.cs \ Definitions/SimpleTypes.cs \ Fixtures/AssemblyRuleTestFixture.cs \ Fixtures/MethodRuleTestFixture.cs \ Fixtures/RuleTestFixture.cs \ Fixtures/TypeRuleTestFixture.cs \ Helpers/AssemblyCache.cs \ Helpers/DefinitionLoader.cs \ Helpers/TestRunner.cs test_build_sources = $(addprefix $(srcdir)/, $(test_sources)) $(common_tests): $(test_build_sources) $(framework) $(MCS) -target:library $(TESTS_OPTIONS) -pkg:mono-nunit -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(test_build_sources) all: $(common_tests) test: $(common_tests) run-test: test self-test: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/0000775000175000017500000000000012642235742024455 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/ChangeLog0000664000175000017500000004643512413742070026234 0ustar00directhexdirecthex000000000000002010-06-10 Sebastien Pouliot * UseCorrectPrefixRule.cs: Make sure types do not start with an I unless acronyms are used 2010-06-07 Sebastien Pouliot * ParameterNamesShouldMatchOverridenMethodRule.cs: Avoid string allocations when comparing strings. Saves more than 400kb on self-test 2010-06-05 Sebastien Pouliot * AvoidDeepNamespaceHierarchyRule.cs: * DetectNonAlphaNumericsInTypeNamesRule.cs: * UseCorrectCasingRule.cs: * UsePreferredTermsRule.cs: Use a unique NamespaceDefinition (not a new one each time) when reporting a defect on a namespace 2010-06-04 Sebastien Pouliot * AvoidRedundancyInMethodNameRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-04-17 Sebastien Pouliot * UseCorrectCasingRule.cs: With newer CSC (e.g. 10.0) we cannot assume the event accessor to be auto-generated by the presence of IsSynchronized. Fix unit test when compiled with CSC 2010-01-30 Sebastien Pouliot * AvoidRedundancyInMethodNameRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule * AvoidRedundancyInTypeNameRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule * AvoidTypeInterfaceInconsistencyRule.cs: Apply AvoidRepetitive CallsToPropertiesRule * DoNotPrefixEventsWithAfterOrBeforeRule.cs: Apply AvoidRepetitive CallsToPropertiesRule * ParameterNamesShouldMatchOverridenMethodRule.cs: Apply Avoid RepetitiveCallsTo: Apply AvoidRepetitiveCallsTo PropertiesRulePropertiesRule * UseCorrectCasingRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule * UseCorrectPrefixRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule * UseCorrectSuffixRule.cs: Apply PreferEmptyInstanceOverNullRule 2010-01-17 Sebastien Pouliot * AvoidTypeInterfaceInconsistencyRule.cs: Avoid boxing when concatenating strings * UseCorrectCasingRule.cs: Avoid boxing when concatenating strings 2010-01-01 Sebastien Pouliot * AvoidRedundancyInMethodNameRule.cs: Use new IsRef rock 2009-08-30 Jesse Jones * DoNotUseReservedInEnumValueNamesRule.cs, AvoidDeepNamespaceHierarchyRule.cs ParameterNamesShouldMatchOverridenMethodRule.cs: Edited the rule descriptions. 2009-07-28 Cedric Vivier UseCorrectSuffixRule.cs: Lower the confidence when the base type itself does not use correct suffix AND current type does not have its own defect (e.g by implementing an suffix-requiring interface). 2009-07-05 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-03-23 Sebastien Pouliot * AvoidTypeInterfaceInconsistencyRule.cs: Document as added in 2.4 * UseCorrectCasingRule.cs: Fix suggestion for uppercased namespaces 2008-12-26 Cedric Vivier * UsePreferredTermsRule.cs: Fix false positives when term is part of a larger word. Improve text. Use CheckIdentifier for namespaces too. 2008-12-24 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesRule.cs: Replace IndexOf("_") with IndexOf('_') since it's faster (self-test) but probably not much in this case since we were already using StringComparison.Ordinal. 2008-12-23 Sebastien Pouliot * AvoidTypeInterfaceInconsistencyRule.cs: New. Rule that checks if typpe Foo implements interface IFoo when both exists in the same namespace of the same assembly. * Makefile.am: Add new rule and tests to the build 2008-11-30 Sebastien Pouliot * AvoidRedundancyInMethodNameRule.cs: Use HasParameters * DetectNonAlphaNumericsInTypeNamesRule.cs: Use HasFields and HasParameters * DoNotPrefixEventsWithAfterOrBeforeRule.cs: Use HasEvents * ParameterNamesShouldMatchOverridenMethodRule.cs: Use HasParameters * UseCorrectCasingRule.cs: Use HasParameters * UseCorrectPrefixRule.cs: Use HasGenericParameters * UseCorrectSuffixRule.cs: Use HasGenericParameters * UsePreferredTermsRule.cs: Use HasFields 2008-11-24 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesRule.cs: Move IsEnum check outside the loop. 2008-11-20 Sebastien Pouliot * AvoidRedundancyInMethodNameRule.cs: Specify StringComparison.Ordinal when calling String.[Start|End]sWith. Use the new Exists method from NamespaceEngine. * AvoidRedundancyInTypeNameRule.cs: Specify StringComparison.Ordinal when calling String.[Start|End]sWith. * DoNotPrefixEventsWithAfterOrBeforeRule.cs: Specify StringComparison.Ordinal when calling String.StartsWith. * DoNotUseReservedInEnumValueNamesRule.cs: Specify StringComparison. Ordinal when calling String.IndexOf. * UseCorrectSuffixRule.cs: Specify StringComparison.Ordinal when calling String.EndsWith. 2008-11-15 Jesse Jones * AvoidDeepNamespaceHierarchyRule.cs: Fixed so unit test works with checked math. 2008-11-08 Cedric Vivier * ParameterNamesShouldMatchOverridenMethodRule.cs: Do not issue false positives on macro-generated boo code. 2008-11-08 Cedric Vivier * ParameterNamesShouldMatchOverridenMethodRule.cs: DoesNotApply if no parameter. 2008-11-08 Cedric Vivier * AvoidRedundancyInMethodNameRule.cs: Change wording to be consistent with AvoidRedundancyInTypeNameRule. 2008-11-08 Cedric Vivier * AvoidRedundancyInTypeNameRule.cs: New. This rule checks if a type is prefixed with the last component of its enclosing namespace, and that removing the prefix would not cause undesirable ambiguity with its base type or a type from a parent namespace. If possible, removing the prefix from the type name usually makes an API less verbose and more autocompletion-friendly. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Naming.mdp: * Gendarme.Rules.Naming.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-03 Sebastien Pouliot * AvoidRedundancyInMethodNameRule.cs: Change IsTypeFromAlienNamespace to static. 2008-11-03 Cedric Vivier * AvoidRedundancyInMethodNameRule.cs: New. This rule checks if a method is named against its first parameter's type. Usually removing that type name from the method name makes an API less verbose, easier to learn, and more future-proof. 2008-10-25 Sebastien Pouliot * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Removed since its logic is now covered inside UseCorrectSuffixRule. * UseCorrectSuffixRule.cs: Now checks if a suffix is misused, not just missing, on a type. * Makefile.am: Remove EnumNotEndsWithEnumOrFlagsSuffixRule rule and tests source from build. 2008-10-25 Sebastien Pouliot * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Add missing XML doc. * UseCorrectPrefixRule.cs: Add prefix check for generic parameter types. 2008-10-25 Sebastien Pouliot * AvoidDeepNamespaceHierarchyRule.cs, DetectNonAlphaNumericsInTypeNamesRule.cs, UseCorrectCasingRule.cs, UsePreferredTermsRule.cs: Rename Namespace to NamespaceDefinition. 2008-10-21 Sebastien Pouliot * ParameterNamesShouldMatchOverridenMethodRule.cs: Avoid specialization of SignatureMatches parameters (self-test). 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Naming.xml, doc/Gendarme.Rules.Naming: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-19 Sebastien Pouliot * AvoidDeepNamespaceHierarchyRule.cs: Use Namespace.IsSpecialized instead of our own list. Throw the right exception message (self-test) 2008-10-17 Sebastien Pouliot * AvoidDeepNamespaceHierarchyRule.cs: New. Rule to check is a namespace hierarchy gets longer than four elements, unless the last one is a well-known specialization. * DetectNonAlphaNumericsInTypeNamesRule.cs: Rule renamed to AvoidNonAlphanumericIdentifierRule. It now applies to assembly names (it implements IAssemblyRule), namespaces (using the NamespaceEngine) and also to fields. Added XML documentation and [FxCopCompatibility] attribute. * DoNotPrefixEventsWithAfterOrBeforeRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use shorter overload for Runner.Report. Ignore enums and delegates. * DoNotPrefixValuesWithEnumNameRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use shorter overload for Runner.Report. * DoNotUseReservedInEnumValueNamesRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use shorter overload for Runner.Report. * ParameterNamesShouldMatchOverridenMethodRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * UseCorrectCasingRule.cs: Change the way namespace are handled by using the new NamespaceEngine. Add XML documentation and [FxCopCompatibility] attribute. * UseCorrectPrefixRule.cs: Add XML documentation and two [FxCopCompatibility] attribute. * UseCorrectSuffixRule.cs: Add XML documentation and two [FxCopCompatibility] attribute. * UsePluralNameInEnumFlagsRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use shorter overload for Runner.Report. * UsePreferredTermsRule.cs: Rule now applies to assembly names (it implements IAssemblyRule), namespaces (using the NamespaceEngine) and also to fields. Updated the list of preferred terms. Added XML documentation and [FxCopCompatibility] attribute. * UseSingularNameInEnumsUnlessAreFlagsRule.cs: Add XML documentation. Use shorter overload for Runner.Report. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-08-28 Sebastien Pouliot * UseCorrectCasingRule.cs: Simplify the rule a bit. Use a constant for MethodSemanticsAttributes (CheckMethod). Remove unneeded check for (now handled elsewhere) and unneeded case (3) for namespaces. 2008-08-05 Peter Johanson * UseCorrectCasingRule.cs: The casing rule does not apply to add_ and remove_ methods generated by the compiler for private events. 2008-07-10 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-08 Sebastien Pouliot * ParameterNamesShouldMatchOverridenMethodRule.cs: Handle the case where Resolve returns null (cannot find the required assemblies) * Makefile.am: Rebuild if the framework has changed. 2008-05-11 Sebastien Pouliot * DoNotPrefixEventsWithAfterOrBeforeRule.cs: New. Rule to check if event names starts with either After of Before prefixes. 2008-05-02 Sebastien Pouliot * UseCorrectSuffixRule.cs: Use TryGetValue to avoid access to the Dictionary. Refactor textual report outside the CheckType (it's larger) and avoid reporting twice the first item. 2008-04-26 Nestor Salceda * ParameterNamesShouldMatchOverridenMethodRule.cs: Remove a duplicated call to ReturnType. 2008-04-26 Jb Evain * UseCorrectCasingRule.cs: check for proper namespace casing. Rules are as follows: if the namespace length is 1, we report an error, if it's 2, we check that all letters are properly cased, if it's 3, we check that all letters are not upper cased, and that we're pascal case otherwise. 2008-04-06 Sebastien Pouliot * UseCorrectSuffixRule.cs: Allow the Set suffix for collections. 2008-03-19 Sebastien Pouliot * UseCorrectSuffixRule.cs: Fix case where generics are used (since it affects the suffix of the type). Fix bug #372250 2008-03-16 Sebastien Pouliot * UseCorrectCasingRule.cs: Ignore generated code. VS SWF designer can generate properties with bad cases (e.g. for resources). 2008-03-15 Sebastien Pouliot * ParameterNamesShouldMatchOverridenMethodRule.cs: CSC anonymous types don't follow this rule so we ignore code generated by the compiler. * DetectNonAlphanumericInTypeNamesRule.cs: Rule does not apply for interfaces used in COM interop. 2008-02-15 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesRule.cs * DoNotPrefixValuesWithEnumNameRule.cs * DoNotUseReservedInEnumValueNamesRule.cs * EnumNotEndsWithEnumOrFlagsSuffixRule.cs * ParameterNamesShouldMatchOverridenMethodRule.cs * UseCorrectCasingRule.cs * UseCorrectPrefixRule.cs * UseCorrectSuffixRule.cs * UsePluralNameInEnumFlagsRule.cs * UsePreferredTermsRule.cs * UseSingularNameInEnumsUnlessAreFlagsRule.cs: Update rules wrt framework changes. 2008-01-18 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesRule.cs: Add checks for generated code (to eliminate a bunch of false-positives). * NamingUtils.cs: Remove - replaced by rocks or changes in rules. * UseCorrectCasingRule.cs: Avoid creating MessageCollection unless needed. Skip an intermediate string while reporting. * UseCorrectSuffixRule.cs: Add checks for generated code (to eliminate a bunch of false-positives). * Makefile.am: Remove NamingUtils.cs from build. 2008-01-18 Sebastien Pouliot * ParameterNamesShouldMatchOverridenMethodRule.cs: Change three methods to static (for better self-test results :) 2008-01-14 Sebastien Pouliot * DoNotPrefixValuesWithEnumNameRule.cs: New. Rule that checks enums to see if it prefix it's values with the it's own name [Andreas Noever] * DoNotUseReservedInEnumValueNamesRule.cs: New. Rule that check enums to see if it has values containing the word "reserved" [Andreas Noever] * ParameterNamesShouldMatchOverridenMethodRule.cs: New. Rule that check if overriden (or interface implementation) methods use the same parameter names as the original. [Andreas Noever] * Gendarme.Rules.Naming.mdp: Updated MonoDevelop project file. * Gendarme.Rules.Naming.xml.in: Updated descriptions. * Makefile.am: Updated Makefile for new rules/tests. 2008-01-11 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesRule.cs: Turn a method to static and use new Location ctors. * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Use new Location ctors. * UseCorrectCasingRule.cs: Use new Location ctors. * UseCorrectPrefixRule.cs: Use new Location ctors. * UseCorrectSuffixRule.cs: Use new Location ctors. * UsePreferredTermsRule.cs: Use new Location ctors. 2008-01-05 Sebastien Pouliot * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Use rocks to reduce code duplication. * UsePluralNameInEnumFlagsRule.cs: Use rocks to reduce code duplication. * UseSingularNameInEnumsUnlessAreFlagsRule.cs: Use rocks to reduce code duplication. * Makefile.am: Add linq to compiler options 2007-12-26 Sebastien Pouliot * AttributeEndsWithAttributeSuffixRule.cs: Deleted. The new rule UseCorrectSuffixTest is a superset of this rule. * Gendarme.Rules.Naming.mdp: Updated MonoDevelop project file. * Gendarme.Rules.Naming.xml.in: Updated descriptions. * Makefile.am: Updated Makefile for new rules/tests. * NamingUtils.cs: New. Common methods for naming rules. * UseCorrectCasingRule.cs: New. Rule to check correct casing. From Daniel Abramov (GHOP). * UseCorrectPrefixRule.cs:New. Rule to check correct prefixes. From Daniel Abramov (GHOP). * UseCorrectSuffixRule.cs:New. Rule to check correct suffixes. From Daniel Abramov (GHOP). * UsePreferredTermsRule.cs:New. Rule to check use of preferred terms. From Daniel Abramov (GHOP). 2007-12-20 Sebastien Pouliot * EnumNotEndsWithEnumOrFlagsSuffixRule.cs, * DetectNonAlphaNumericsInTypeNamesRule.cs, * UseSingularNameInEnumsUnlessAreFlagsRule.cs: Update message strings. Patch from Daniel Abramov 2007-11-30 Nestor Salceda * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Avoid code duplicated violation when running self-test target. 2007-11-22 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesRule.cs: IsPrivate is different than !IsPublic. Fix false positive reports about anonymous methods. 2007-11-22 Sebastien Pouliot * AttributeEndsWithAttributeSuffixRule.cs: Don't create MessageCollection unless we need to report an error/warning. * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Don't create MessageCollection unless we need to report an error/warning. * UsePluralNameInEnumFlagsRule.cs: Don't create MessageCollection unless we need to report an error/warning. * UseSingularNameInEnumsUnlessAreFlagsRule.cs: Don't create MessageCollection unless we need to report an error/warning. 2007-11-03 Nestor Salceda * Gendarme.Rules.Naming.xml.in: Added the Uri for DetectNonAlphaNumericsInTypeNamesRule. 2007-10-08 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesRule.cs: Rework rule to avoid strings, dependency on string/enum position and creating a MessageCollection unless we need one. 2007-10-07 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesRule.cs: New rule (Nidhi Rawal, GSoC 2007) * Gendarme.Rules.Naming.mdp: Update project file. * Gendarme.Rules.Naming.xml.in: Update rule descriptions. * Makefile.am: Add new rules/tests to build. 2007-10-04 Nestor Salceda * Gendarme.Rules.Naming.mdp: New. Created MonoDevelop project file for the naming rules. 2007-09-29 Nestor Salceda * Gendarme.Rules.Naming.xml.in: Added Uri for the rules. 2007-09-29 Nestor Salceda * Gendarme.Rules.Naming.xml.in: Fixed error from copy and paste for the performance xml file. The correct namespace is Gendarme.Rules.Naming. 2007-09-29 Nestor Salceda * UsePluralNameInFlagEnumsRule.cs, UsePluralNameInEnumFlagsRule.cs: Rename UsePluralNameInFlagEnumsRule.cs to UsePluralNameInEnumFlagsRule.cs because this file doesn't follow the coding guidelines. * Makefile.am: Change files to build the renamed rule. 2007-09-21 Nestor Salceda * AttributeEndsWithAttributeSuffixRule.cs: Change cast to as operator for avoid two type tests in method body. 2007-09-21 Nestor Salceda * AttributeEndsWithAttributeSuffixRule.cs: Fixed a NullReferenceException when the current type is System.Object. Change cast to as operator for avoid two type tests. 2007-09-13 Nestor Salceda * Makefile.am: New. Build Gendarme.Rules.Naming rules and tests. * Gendarme.Rules.Naming.xml.in: New. Configuration for Gendarme.Rules.Naming. * EnumNotEndsWithEnumOrFlagsSuffixRule.cs, UsePluralNameInFlagEnumsRule.cs, UseSingularNameInEnumsUnlessAreFlagsRule.cs, AttributeEndsWithAttributeSuffixRule.cs: New. Rules for check the naming conventions. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/UseCorrectCasingRule.cs0000664000175000017500000002103112413742070031025 0ustar00directhexdirecthex00000000000000// // UseCorrectCasingRule class // // Authors: // Daniel Abramov // Sebastien Pouliot // // (C) 2007 Daniel Abramov // 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; using System.Collections.Generic; using System.Globalization; using System.Linq; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule ensures that identifiers are correctly cased. In particular: /// /// namespace names are PascalCased /// type names are PascalCased /// method names are PascalCased /// parameter names are camelCased /// /// /// /// Bad example: /// /// namespace A { /// abstract public class myClass { /// abstract public int thisMethod (int ThatParameter); /// } /// } /// /// /// /// Good example: /// /// namespace Company.Product.Technology { /// abstract public class MyClass { /// abstract public int ThisMethod (int thatParameter); /// } /// } /// /// [Problem ("This identifier (namespace, type, or method) violates the .NET naming conventions.")] [Solution ("Change the namespace, type, or method name to be pascal-cased (like MyClass) and parameter names to be camel-cased (like myParameter).")] [EngineDependency (typeof (NamespaceEngine))] [FxCopCompatibility ("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")] public class UseCorrectCasingRule : Rule, IAssemblyRule, ITypeRule, IMethodRule { // check if name is PascalCased private static bool IsPascalCase (string name) { if (String.IsNullOrEmpty (name)) return true; return Char.IsUpper (name [0]); } // convert name to PascalCase private static string PascalCase (string name) { if (String.IsNullOrEmpty (name)) return String.Empty; if (name.Length == 1) return name.ToUpperInvariant (); int index = IndexOfFirstCorrectChar (name); return Char.ToUpperInvariant (name [index]).ToString (CultureInfo.InvariantCulture) + name.Substring (index + 1); } // check if name is camelCased private static bool IsCamelCase (string name) { if (String.IsNullOrEmpty (name)) return true; return Char.IsLower (name [0]); } // convert name to camelCase private static string CamelCase (string name) { if (String.IsNullOrEmpty (name)) return String.Empty; if (name.Length == 1) return name.ToLowerInvariant (); int index = IndexOfFirstCorrectChar (name); return Char.ToLowerInvariant (name [index]).ToString (CultureInfo.InvariantCulture) + name.Substring (index + 1); } private static int IndexOfFirstCorrectChar (string s) { int index = 0; while ((index < s.Length) && (s [index] == '_')) index++; // it's possible that we won't find one, e.g. something called "_" return (index == s.Length) ? 0 : index; } void ReportCasingError (IMetadataTokenProvider metadata, string message) { Runner.Report (metadata, Severity.Medium, Confidence.High, message); } void CheckNamespace (string nspace) { if (String.IsNullOrEmpty (nspace)) return; NamespaceDefinition nd = NamespaceDefinition.GetDefinition (nspace); foreach (string ns in nspace.Split ('.')) { switch (ns.Length) { case 1: ReportCasingError (nd, String.Format (CultureInfo.InvariantCulture, "Use of single character namespace is discouraged. Rename namespace {0}", ns)); break; case 2: // if the subnamespace is made of 2 chars, each letter have to be uppercase if (ns.Any (c => Char.IsLetter (c) && Char.IsLower (c))) { string msg = String.Format (CultureInfo.InvariantCulture, "In namespaces made of two characters, both characters should uppercase. Rename namespace '{0}' to '{1}'", ns, ns.ToUpperInvariant ()); ReportCasingError (nd, msg); } break; default: // if the sub namespace is made of 3 or more chars, make sure they're not all uppercase if (ns.All (c => Char.IsLetter (c) && Char.IsUpper (c))) { string msg = String.Format (CultureInfo.InvariantCulture, "Namespaces longer than two characters should not be all uppercase. Rename namespace '{0}' to '{1}{2}'", ns, ns [0].ToString (CultureInfo.InvariantCulture), ns.Substring (1).ToLowerInvariant ()); ReportCasingError (nd, msg); } else if (!IsPascalCase (ns)) { string msg = String.Format (CultureInfo.InvariantCulture, "Namespaces longer than two characters should be pascal cased. Rename namespace '{0}' to '{1}'", ns, PascalCase (ns)); ReportCasingError (nd, msg); } break; } } } public RuleResult CheckAssembly (AssemblyDefinition assembly) { foreach (string ns in NamespaceEngine.NamespacesInside (assembly)) { CheckNamespace (ns); } return Runner.CurrentRuleResult; } public RuleResult CheckType (TypeDefinition type) { // rule does not apply to generated code (outside developer's control) if (type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // types should all be PascalCased string name = type.Name; if (!IsPascalCase (name)) { ReportCasingError (type, String.Format (CultureInfo.InvariantCulture, "Type names should all be pascal-cased. Rename '{0}' type to '{1}'.", name, PascalCase (name))); } return Runner.CurrentRuleResult; } static MethodSemanticsAttributes mask = MethodSemanticsAttributes.Getter | MethodSemanticsAttributes.Setter | MethodSemanticsAttributes.AddOn | MethodSemanticsAttributes.RemoveOn; public RuleResult CheckMethod (MethodDefinition method) { // ignore constructors (.ctor or .cctor) and compiler/tool-generated code if (method.IsConstructor || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // don't consider private add / remove on events if ((method.IsAddOn || method.IsRemoveOn) && method.IsPrivate) return RuleResult.DoesNotApply; string name = method.Name; MethodSemanticsAttributes attrs = method.SemanticsAttributes; if ((attrs & mask) != 0) { // it's something special int underscore = name.IndexOf ('_'); if (underscore != -1) name = name.Substring (underscore + 1); } else if (method.IsSpecialName) { return RuleResult.Success; } // like types, methods/props should all be PascalCased, too if (!IsPascalCase (name)) { string errorMessage = String.Format (CultureInfo.InvariantCulture, "By existing naming conventions, all the method and property names should all be pascal-cased (e.g. MyOperation). Rename '{0}' to '{1}'.", name, PascalCase (name)); Runner.Report (method, Severity.Medium, Confidence.High, errorMessage); } // check parameters if (method.HasParameters) { foreach (ParameterDefinition param in method.Parameters) { // params should all be camelCased if (!IsCamelCase (param.Name)) { string errorMessage = String.Format (CultureInfo.InvariantCulture, "By existing naming conventions, the parameter names should all be camel-cased (e.g. myParameter). Rename '{0}' parameter to '{1}'.", param, CamelCase (param.Name)); Runner.Report (method, Severity.Medium, Confidence.High, errorMessage); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs0000664000175000017500000003156712413742070031104 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.UseCorrectSuffixRule class // // Authors: // Néstor Salceda // Daniel Abramov // Sebastien Pouliot // // (C) 2007 Néstor Salceda // (C) 2007 Daniel Abramov // 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; using System.Collections.Generic; using System.Globalization; using System.Text; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule ensure that types that inherit from certain types or implement certain interfaces /// have a specific suffix. It also ensures that no other /// types are using those suffixes without inheriting/implementing the types/interfaces. E.g. /// /// System.Attribute should end with Attribute /// System.EventArgs should end with EventArgs /// System.Exception should end with Exception /// System.Collections.Queue should end with Collection or Queue /// System.Collections.Stack should end with Collection or Stack /// System.Data.DataSet should end with DataSet /// System.Data.DataTable should end with DataTable or Collection /// System.IO.Stream should end with Stream /// System.Security.IPermission should end with Permission /// System.Security.Policy.IMembershipCondition should end with Condition /// System.Collections.IDictionary or System.Collections.Generic.IDictionary should end with Dictionary /// System.Collections.ICollection, System.Collections.Generic.ICollection or System.Collections.IEnumerable should end with Collection /// /// /// /// Bad example: /// /// public sealed class SpecialCode : Attribute { /// // ... /// } /// /// /// /// Good example: /// /// public sealed class SpecialCodeAttribute : Attribute { /// // ... /// } /// /// [Problem ("This type does not end with the correct suffix. That usually happens when you define a custom attribute or exception and forget to append suffixes like 'Attribute' or 'Exception' to the type name.")] [Solution ("Rename the type and append the correct suffix.")] [FxCopCompatibility ("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] [FxCopCompatibility ("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] public class UseCorrectSuffixRule : Rule, ITypeRule { static Dictionary> definedSuffixes = new Dictionary> (); static Dictionary namespaces = new Dictionary (); static SortedDictionary> reservedSuffixes = new SortedDictionary> (); static UseCorrectSuffixRule () { Add ("Attribute", "System", "Attribute", true); Add ("Collection", "System.Collections", "ICollection", false); Add ("Collection", "System.Collections", "IEnumerable", false); Add ("Collection", "System.Collections", "Queue", false); Add ("Collection", "System.Collections", "Stack", false); Add ("Collection", "System.Collections.Generic", "ICollection`1", false); Add ("Collection", "System.Data", "DataSet", false); Add ("Collection", "System.Data", "DataTable", false); Add ("Condition", "System.Security.Policy", "IMembershipCondition", true); Add ("DataSet", "System.Data", "DataSet", true); Add ("DataTable", "System.Data", "DataTable", true); Add ("Dictionary", "System.Collections", "IDictionary", false); Add ("Dictionary", "System.Collections", "IDictionary`2", false); Add ("EventArgs", "System", "EventArgs", true); Add ("Exception", "System", "Exception", true); Add ("Permission", "System.Security", "IPermission", true); Add ("Queue", "System.Collections", "Queue", true); Add ("Stack", "System.Collections", "Stack", true); Add ("Stream", "System.IO", "Stream", true); // special cases reservedSuffixes.Add ("Collection", message => CheckCollection (message)); reservedSuffixes.Add ("Dictionary", message => CheckDictionary (message)); reservedSuffixes.Add ("EventHandler", message => CheckEventHandler (message)); reservedSuffixes.Add ("Delegate", message => "'Delegate' should never be used as a suffix."); reservedSuffixes.Add ("Enum", message => "'Enum' should never be used as a suffix."); reservedSuffixes.Add ("Flags", message => "'Flags' should never be used as a suffix."); reservedSuffixes.Add ("Ex", message => "'Ex' should not be used to create a newer version of an existing type."); reservedSuffixes.Add ("Impl", message => "Use the 'Core' prefix instead of 'Impl'."); } static void Add (string suffix, string nameSpace, string name, bool reserved) { if (reserved) { reservedSuffixes.Add (suffix, message => InheritsOrImplements (message, nameSpace, name)); } HashSet set; if (!definedSuffixes.TryGetValue (name, out set)) { set = new HashSet (); definedSuffixes.Add (name, set); namespaces.Add (name, nameSpace); } set.Add (suffix); } static string InheritsOrImplements (TypeReference type, string nameSpace, string name) { if (type.Inherits (nameSpace, name) || type.Implements (nameSpace, name)) return String.Empty; return String.Format (CultureInfo.InvariantCulture, "'{0}' should only be used for types that inherits or implements '{1}.{2}'.", type.Name, nameSpace, name); } static string CheckCollection (TypeReference type) { if (type.Implements ("System.Collections", "ICollection") || type.Implements ("System.Collections", "IEnumerable") || type.Implements ("System.Collections.Generic", "ICollection`1")) return String.Empty; if (type.Inherits ("System.Collections", "Queue") || type.Inherits ("System.Collections", "Stack") || type.Inherits ("System.Data", "DataSet") || type.Inherits ("System.Data", "DataTable")) return String.Empty; return "'Collection' should only be used for implementing ICollection or IEnumerable or inheriting from Queue, Stack, DataSet and DataTable."; } static string CheckDictionary (TypeReference type) { if (type.Implements ("System.Collections", "IDictionary") || type.Implements ("System.Collections.Generic", "IDictionary`2")) return String.Empty; return "'Dictionary' should only be used for types implementing IDictionary and IDictionary."; } static string CheckEventHandler (TypeReference type) { if (type.IsDelegate ()) return String.Empty; return "'EventHandler' should only be used for event handler delegates."; } static bool TryGetCandidates (TypeReference type, out HashSet candidates) { string name = type.Name; if ((type is GenericInstanceType) || type.HasGenericParameters) { int pos = name.IndexOf ('`'); if (pos != -1) name = name.Substring (0, pos); } if (definedSuffixes.TryGetValue (name, out candidates)) { string nspace; if (namespaces.TryGetValue (name, out nspace)) { if (nspace == type.Namespace) return true; } } candidates = null; return false; } // checks if type name ends with an approriate suffix // returns array of proposed suffixes via out suffixes parameter or empty list (if none) // `currentTypeSuffix' is true if `type' itself does not have an appropriate suffix private static bool HasRequiredSuffix (TypeDefinition type, List suffixes, out bool currentTypeSuffix) { TypeDefinition current = type; currentTypeSuffix = false; while (current != null && current.BaseType != null) { HashSet candidates; if (TryGetCandidates (current.BaseType, out candidates)) { suffixes.AddRangeIfNew (candidates); if (current == type) currentTypeSuffix = true; } else { // if no suffix for base type is found, we start looking through interfaces foreach (TypeReference iface in current.Interfaces) { if (TryGetCandidates (iface, out candidates)) { suffixes.AddRangeIfNew (candidates); if (current == type) currentTypeSuffix = true; } } } if (suffixes.Count > 0) { // if any suffixes found // check whether type name ends with any of these suffixes string tname = type.Name; return suffixes.Exists (delegate (string suffix) { return HasSuffix (tname, suffix); }); } else { // inspect base type current = current.BaseType.Resolve (); } } // found nothing return (suffixes.Count == 0); } private static string ComposeMessage (List candidates) { if (candidates.Count == 1) { return String.Format (CultureInfo.InvariantCulture, "The type name does not end with '{0}' suffix. Append it to the type name.", candidates [0]); } StringBuilder sb = new StringBuilder ("The type name does not end with one of the following suffixes: "); sb.Append (candidates [0]); for (int i = 1; i < candidates.Count; i++) { sb.Append (", "); sb.Append (candidates [i]); } sb.Append (". Append any of them to the type name."); return sb.ToString (); } private List proposedSuffixes = new List (); static bool HasSuffix (string typeName, string suffix) { if (suffix.Length > typeName.Length) return false; // generic aware int gpos = typeName.LastIndexOf ('`'); if (gpos == -1) gpos = typeName.Length; else if (suffix.Length > gpos) return false; return (String.Compare (suffix, 0, typeName, gpos - suffix.Length, suffix.Length, StringComparison.OrdinalIgnoreCase) == 0); } public RuleResult CheckType (TypeDefinition type) { // rule does not apply to generated code (outside developer's control) if (type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // ok, rule applies string tname = type.Name; // first check if the current suffix is correct // e.g. MyAttribute where the type does not inherit from Attribute foreach (string suffix in reservedSuffixes.Keys) { if (HasSuffix (tname, suffix)) { Func f; if (reservedSuffixes.TryGetValue (suffix, out f)) { string msg = f (type); // if this is a valid suffix then there's not need to check for invalid later if (String.IsNullOrEmpty (msg)) return RuleResult.Success; Runner.Report (type, Severity.Medium, Confidence.High, msg); } } } // then check if the type should have a (or one of) specific suffixes // e.g. MyStuff where the type implements ICollection proposedSuffixes.Clear (); bool currentTypeSuffix; if (!HasRequiredSuffix (type, proposedSuffixes, out currentTypeSuffix)) { Confidence confidence = Confidence.High; // if base type itself does not have any of the proposed suffixes, lower the confidence if (!currentTypeSuffix) { TypeDefinition baseType = type.BaseType.Resolve (); if (null != baseType && !HasRequiredSuffix (baseType, proposedSuffixes, out currentTypeSuffix)) confidence = Confidence.Low; } // there must be some suffixes defined, but type name doesn't end with any of them Runner.Report (type, Severity.Medium, confidence, ComposeMessage (proposedSuffixes)); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Makefile.in0000664000175000017500000006702312642235732026531 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Naming ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AvoidDeepNamespaceHierarchyRule.cs \ AvoidRedundancyInMethodNameRule.cs \ AvoidRedundancyInTypeNameRule.cs \ AvoidTypeInterfaceInconsistencyRule.cs \ DetectNonAlphaNumericsInTypeNamesRule.cs \ DoNotPrefixEventsWithAfterOrBeforeRule.cs \ DoNotPrefixValuesWithEnumNameRule.cs \ DoNotUseReservedInEnumValueNamesRule.cs \ ParameterNamesShouldMatchOverridenMethodRule.cs \ UseCorrectCasingRule.cs \ UseCorrectPrefixRule.cs \ UseCorrectSuffixRule.cs \ UsePluralNameInEnumFlagsRule.cs \ UsePreferredTermsRule.cs \ UseSingularNameInEnumsUnlessAreFlagsRule.cs tests_sources = \ AvoidDeepNamespaceHierarchyTest.cs \ AvoidRedundancyInMethodNameTest.cs \ AvoidRedundancyInTypeNameTest.cs \ AvoidTypeInterfaceInconsistencyTest.cs \ DetectNonAlphaNumericsInTypeNamesTest.cs \ DoNotPrefixEventsWithAfterOrBeforeTest.cs \ DoNotPrefixValuesWithEnumNameTest.cs \ DoNotUseReservedInEnumValueNamesTest.cs \ ParameterNamesShouldMatchOverridenMethodTest.cs \ UsePluralNameInEnumFlagsTest.cs \ UseSingularNameInEnumsUnlessAreFlagsTest.cs \ UseCorrectCasingTest.cs \ UseCorrectPrefixTest.cs \ UseCorrectSuffixTest.cs \ UsePreferredTermsTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Naming/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Naming/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/UseSingularNameInEnumsUnlessAreFlagsRule.cs0000664000175000017500000000552012413742070034767 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.UseSingularNameInEnumsUnlessAreFlagsRule class // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// The rule is used for ensure that the name of enumerations are in singular form unless /// the enumeration is used as flags, i.e. decorated with the [Flags] attribute. /// /// /// Bad example: /// /// public enum MyCustomValues { /// Foo, /// Bar /// } /// /// /// /// Good example (singular): /// /// public enum MyCustomValue { /// Foo, /// Bar /// } /// /// /// /// Good example (flags): /// /// [Flags] /// public enum MyCustomValues { /// Foo, /// Bar, /// AllValues = Foo | Bar /// } /// /// [Problem ("This type is an enumeration and by convention it should have a singular name.")] [Solution ("Change the enumeration name from the plural to the singular form.")] public class UseSingularNameInEnumsUnlessAreFlagsRule : Rule, ITypeRule { private static bool IsPlural (string typeName) { return (String.Compare (typeName, typeName.Length - 1, "s", 0, 1, true, CultureInfo.CurrentCulture) == 0); } public RuleResult CheckType (TypeDefinition type) { // rule applies only to enums - but not enums marked with [Flags] attribute if (!type.IsEnum || type.IsFlags ()) return RuleResult.DoesNotApply; // rule applies if (!IsPlural (type.Name)) return RuleResult.Success; Runner.Report (type, Severity.Medium, Confidence.Normal); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/AvoidRedundancyInTypeNameRule.cs0000664000175000017500000001356512413742070032650 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.AvoidRedundancyInTypeNameRule // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; namespace Gendarme.Rules.Naming { /// /// This rule will fire if a type is prefixed with the last component of its namespace. /// Using prefixes like this makes type names more verbose than they need to be /// and makes them harder to use with tools like auto-complete. Note that an /// exception is made if removal of the prefix would cause an ambiguity with another /// type. If this is the case the rule will not report a defect. /// /// /// Bad example: /// /// namespace Foo.Lang.Compiler { /// public class CompilerContext { /// } /// } /// /// /// using Foo.Lang; /// ... /// Compiler.CompilerContext context = new Compiler.CompilerContext (); /// /// /// using Foo.Lang.Compiler; /// ... /// CompilerContext context = new CompilerContext (); /// /// /// /// Good example: /// /// namespace Foo.Lang.Compiler { /// public class Context { /// } /// } /// /// /// using Foo.Lang; /// ... /// Compiler.Context context = new Compiler.Context (); /// /// /// using Foo.Lang.Compiler; /// ... /// Context context = new Context (); /// /// /// /// Another good example (more meaningful term in the context of the namespace): /// /// namespace Foo.Lang.Compiler { /// public class CompilationContext { /// } /// } /// /// [Problem ("This type name is prefixed with the last component of its enclosing namespace. This usually makes an API more verbose and less autocompletion-friendly than necessary.")] [Solution ("Remove the prefix from the type or replace it with a more meaningful term in the context of the namespace.")] [EngineDependency (typeof (NamespaceEngine))] [FxCopCompatibility ("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")] public class AvoidRedundancyInTypeNameRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { string ns = type.Namespace; if (type.IsGeneratedCode () || string.IsNullOrEmpty (ns)) return RuleResult.DoesNotApply; int ifaceOffset = type.IsInterface ? 1 : 0; int lastDot = ns.LastIndexOf ('.'); string name = type.Name; //type name is smaller or equal to namespace it cannot be a defect if (name.Length - ifaceOffset <= (ns.Length - lastDot)) return RuleResult.Success; string lastComponent = ns.Substring (lastDot + 1); if (type.IsInterface) name = name.Substring (1); if (!name.StartsWith (lastComponent, StringComparison.Ordinal)) return RuleResult.Success; //if first char of suggestion does not start with a uppercase, can ignore it //ie. Foo.Bar.Barometer if (!char.IsUpper (name [lastComponent.Length])) return RuleResult.Success; string suggestion = name.Substring (lastComponent.Length); //if base type name is or ends with suggestion, likely not clearer if we rename it. //would bring ambiguity or make suggestion looks like base of basetype if (null != type.BaseType) { string base_name = type.BaseType.Name; if (base_name.EndsWith (suggestion, StringComparison.Ordinal)) return RuleResult.Success; //equally, if base type starts with the prefix, it is likely a wanted pattern if (DoesNameStartWithPascalWord (base_name, lastComponent)) return RuleResult.Success; } if (type.IsInterface) suggestion = string.Concat ("I", suggestion); //we have a really interesting candidate now, let's check that removing prefix //would not cause undesirable ambiguity with a type from a parent namespace while (0 != ns.Length) { foreach (TypeDefinition typ in NamespaceEngine.TypesInside (ns)) { if (null == typ) break; if (suggestion == typ.Name) //ambiguity return RuleResult.Success; } ns = ns.Substring (0, Math.Max (0, ns.LastIndexOf ('.'))); } //main goal is to keep the API as simple as possible so this is more severe for visible types Severity severity = type.IsVisible () ? Severity.Medium : Severity.Low; string msg = String.Format (CultureInfo.InvariantCulture, "Consider renaming type to '{0}'.", suggestion); Runner.Report (type, severity, Confidence.Normal, msg); return RuleResult.Failure; } //FIXME: share this? private static bool DoesNameStartWithPascalWord (string name, string word) { if (!name.StartsWith (word, StringComparison.Ordinal)) return false; return (name.Length > word.Length && char.IsUpper (name [word.Length])); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Gendarme.Rules.Naming.csproj0000775000175000017500000001403512413742070031721 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {C57E2A54-3BBF-49D7-B3E5-688EE1F63250} Library Properties Gendarme.Rules.Naming Gendarme.Rules.Naming v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Naming.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Naming.xml AllRules.ruleset AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework 3.5 False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/AvoidRedundancyInMethodNameRule.cs0000664000175000017500000001723012413742070033140 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.AvoidRedundancyInMethodNameRule // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Engines; namespace Gendarme.Rules.Naming { /// /// This rule will fire if a method name embeds the type name of its first parameter. /// Usually, removing that type name makes the API less /// verbose, easier to learn, and more future-proof. /// /// /// Bad example: /// /// class PostOffice { /// public void SendLetter (Letter letter) { /// } /// public void SendPackage (Package package) { /// } /// } /// /// /// /// Good example: /// /// class PostOffice { /// public void Send (Letter letter) { /// } /// public void Send (Package package) { /// } /// } /// /// /// /// Bad example: /// /// class PostOffice { /// public static bool IsPackageValid (Package package) { /// return package.HasAddress && package.HasStamp; /// } /// } /// /// /// /// Good example: /// /// class Package { /// public bool IsValid { /// get { /// return HasAddress && HasStamp; /// } /// } /// } /// /// [Problem ("This method's name includes the type name of the first parameter. This usually makes an API more verbose and less future-proof than necessary.")] [Solution ("Remove the type from the method name, move the method into the parameter's type, or create an extension method (if using C#).")] [EngineDependency (typeof (NamespaceEngine))] public class AvoidRedundancyInMethodNameRule : Rule, IMethodRule { bool ignoreAlienNamespaces = true; // // Option to ignore parameter whose type's namespace is not defined in the set of analyzed assemblies. // Default is True (ignore parameters from alien namespaces). // // // True to ignore parameter whose type's namespace is not defined in the set of analyzed assemblies, False otherwise public bool IgnoreAlienNamespaces { get { return ignoreAlienNamespaces; } set { ignoreAlienNamespaces = value; } } public RuleResult CheckMethod (MethodDefinition method) { //does not apply if method has no parameter, is a property, or a p/invoke if (!method.HasParameters || method.IsProperty () || method.IsPInvokeImpl) return RuleResult.DoesNotApply; //if this is a constructor or override, the method name is dependent if (method.IsConstructor || method.IsOverride ()) return RuleResult.DoesNotApply; ParameterDefinition p0 = method.Parameters [0]; TypeReference p0type = p0.ParameterType; //param is out/ref, it is already not obvious (there is a rule for that) if (p0.IsOut || p0type.IsByReference) return RuleResult.DoesNotApply; string name = p0type.Name; string method_name = method.Name; if (name.Length == 1 || method_name.Length <= name.Length) return RuleResult.DoesNotApply; if ((method_name.Length - name.Length) < 4 && IsVaguePrefix (method_name)) //suggestion would be too vague anyway (Get/Set/Is) return RuleResult.DoesNotApply; if (!char.IsUpper (name [0])) //non-compliant naming, cannot go further (PascalWords needed) return RuleResult.DoesNotApply; //if the method return the parameter type it is most likely clearer to have it in the name if (method.ReturnType == p0.ParameterType) return RuleResult.Success; //if starting with name it is most likely on purpose if (method_name.StartsWith (name, StringComparison.Ordinal)) return RuleResult.Success; int pos = method_name.LastIndexOf (name, StringComparison.Ordinal); if (-1 == pos) return RuleResult.Success; Confidence confidence = Confidence.Normal; if (pos >= method_name.Length - name.Length) //suffix, most common and most verbose case confidence = Confidence.High; else if (!char.IsUpper (method_name [pos + name.Length])) //not the end of a 'PascalWord' return RuleResult.Success; //if IgnoreAlienNamespaces is True, then check if parameter type is from one of the analyzed namespaces if (IgnoreAlienNamespaces && IsTypeFromAlienNamespace (p0.ParameterType)) return RuleResult.Success; //ignored/out-of-reach, so this is a success //main goal is to keep the API as simple as possible so this is more severe for visible methods Severity severity = method.IsVisible () ? Severity.Medium : Severity.Low; string suggestion = GetSuggestionMethodName (method, name, pos); string msg; if (method.IsStatic) { //we already have a rule that checks if the method should be static string memberKind = GetSuggestionMemberKind (method); msg = String.Format (CultureInfo.InvariantCulture, "Consider renaming method to '{2}', or extracting method to type '{0}' as {1} '{2}', or making an extension method of that type.", p0.ParameterType, memberKind, suggestion); } else { msg = String.Format (CultureInfo.InvariantCulture, "Consider renaming method to '{0}'.", suggestion); } Runner.Report (method, severity, confidence, msg); return RuleResult.Failure; } private static string GetSuggestionMethodName (MemberReference method, string name, int posFound) { string method_name = method.Name; string suggestion = string.Concat (method_name.Substring (0, posFound), method_name.Substring (posFound + name.Length)); if (suggestion.EndsWith ("In", StringComparison.Ordinal)) return suggestion.Substring (0, suggestion.Length - 2); if (suggestion.EndsWith ("For", StringComparison.Ordinal)) return suggestion.Substring (0, suggestion.Length - 3); if (suggestion.EndsWith ("From", StringComparison.Ordinal) || suggestion.EndsWith ("With", StringComparison.Ordinal)) return suggestion.Substring (0, suggestion.Length - 4); return suggestion; } private static string GetSuggestionMemberKind (IMethodSignature method) { if (method.Parameters.Count == 1 && !method.ReturnType.IsNamed ("System", "Void")) return "property"; return "method"; } private static bool IsVaguePrefix (string name) { if (name.StartsWith ("Get", StringComparison.Ordinal)) return true; if (name.StartsWith ("Set", StringComparison.Ordinal)) return true; if (name.StartsWith ("Is", StringComparison.Ordinal)) return true; return false; } static private bool IsTypeFromAlienNamespace (TypeReference type) { return !NamespaceEngine.Exists (type.Namespace); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/AvoidDeepNamespaceHierarchyRule.cs0000664000175000017500000001270012413742070033141 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.AvoidDeepNamespaceHierarchyRule class // // Authors: // Sebastien Pouliot // // 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; using System.ComponentModel; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Naming { /// /// This rule checks for deeply nested namespaces within an assembly. It will /// warn if the depth is greater than four (default value) unless the fifth (or the /// next) part is one of the specialized name that the framework recommends or a /// name like an internal namespace (something not meant to be seen outside the assembly). /// /// DesignNamespace that provides design-time /// support for its base namespace. /// InteropNamespace that provides all interoperability /// code (e.g. p./invokes) for its base namespace. /// PermissionsNamespace that provides all custom /// permissions for its base namespace. /// InternalNamespace that provides non visible (outside /// the assembly) helper code for its base namespace. Impl while allowed by the /// rule is not encouraged. /// /// /// /// /// Bad example: /// /// namespace One.Two.Three.Four.Five { /// internal class Helper { /// } /// } /// /// /// /// Good example: /// /// namespace One.Two.Three.Four { /// internal class FiveHelper { /// } /// } /// /// /// /// Good example (exception for some namespace specialization): /// /// namespace One.Two.Three.Four.Internal { /// internal class Helper { /// } /// } /// /// [Problem ("The depth of the namespace hierarchy is getting out of control.")] [Solution ("Try to keep the depth below 4, with an additional one for specialization (e.g. Design, Interop, Permissions).")] [EngineDependency (typeof (NamespaceEngine))] public class AvoidDeepNamespaceHierarchyRule : Rule, IAssemblyRule { private const int DefaultMaxDepth = 4; private int max_depth = DefaultMaxDepth; /// The depth at which namespaces may be nested without triggering a defect. /// Defaults to 4. [DefaultValue (DefaultMaxDepth)] [Description ("The depth at which namespaces may be nested without triggering a defect.")] public int MaxDepth { get { return max_depth; } set { if (value < 1) throw new ArgumentOutOfRangeException ("MaxDepth", "Minimum: 1"); max_depth = value; } } private static int CountLevels (string ns) { if (ns.Length == 0) return 0; int levels = 0; int index = 0; while (index != -1) { index = ns.IndexOf ('.', index + 1); levels++; } return levels; } public RuleResult CheckAssembly (AssemblyDefinition assembly) { // check every namespaces inside the assembly using the NamespaceEngine foreach (string ns in NamespaceEngine.NamespacesInside (assembly)) { // shortest invalid namespace would be "a.b.c.d.e" // so we can skip anything less than 2 * MaxDepth // note: overflow does not matter if (ns.Length < unchecked (MaxDepth + MaxDepth)) continue; // count the levels (i.e. number of dots + 1) int levels = CountLevels (ns); if (levels <= MaxDepth) continue; // we have some exceptions for namespace specialization // i.e. stuff we often prefer to have in a sub-namespace // and for internal (non-visible) namespaces if (levels == MaxDepth + 1) { if (NamespaceDefinition.IsSpecialized (ns)) { continue; } else if (ns.EndsWith (".Internal", StringComparison.Ordinal) || ns.EndsWith (".Impl", StringComparison.Ordinal)) { continue; } } Severity severity = (levels < MaxDepth * 2) ? Severity.Medium : Severity.High; Runner.Report (NamespaceDefinition.GetDefinition (ns), severity, Confidence.High); } return Runner.CurrentRuleResult; } public override string Solution { get { return string.Format("Try to keep the depth below {0}, with an additional one for specialization (e.g. Design, Interop, Permissions).", MaxDepth); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/DoNotPrefixValuesWithEnumNameRule.cs0000664000175000017500000000520312413742070033470 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.DoNotPrefixValuesWithEnumNameRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule checks for enum values that are prefixed with the enumeration type /// name. This is typical in C/C++ application but unneeded in .NET since the enum /// type name must be specified anyway when used. /// /// /// Bad example: /// /// public enum Answer { /// AnswerYes, /// AnswerNo, /// AnswerMaybe, /// } /// /// /// /// Good example: /// /// public enum Answer { /// Yes, /// No, /// Maybe /// } /// /// [Problem ("This enumeration contains value names that start with the enum's name.")] [Solution ("Change the values so that they do not include the enum's type name.")] [FxCopCompatibility ("Microsoft.Naming", "CA1712:DoNotPrefixEnumValuesWithTypeName")] public class DoNotPrefixValuesWithEnumNameRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (!type.IsEnum) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { // this excludes special "value__" if (!field.IsStatic) continue; if (field.Name.StartsWith (type.Name, StringComparison.OrdinalIgnoreCase)) { Runner.Report (field, Severity.Medium, Confidence.High); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/ParameterNamesShouldMatchOverridenMethodRule.cs0000664000175000017500000001517712413742070035717 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.ParameterNamesShouldMatchOverriddenMethodRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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.Generic; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule warns if an overriden method's parameter names does not match those of the /// base class or those of the implemented interface. This can be confusing because it may /// not always be clear that it is an override or implementation of an interface method. It /// also makes it more difficult to use the method with languages that support named /// parameters (like C# 4.0). /// /// /// Bad example: /// /// public class Base { /// public abstract void Write (string text); /// } /// /// public class SubType : Base { /// public override void Write (string output) /// { /// //... /// } /// } /// /// /// /// Good example: /// /// public class Base { /// public abstract void Write (string text); /// } /// /// class SubType : Base { /// public override void Write (string text) /// { /// //... /// } /// } /// /// [Problem ("This method overrides (or implements) an existing method but does not use the same parameter names as the original.")] [Solution ("Keep parameter names consistent when overriding a class or implementing an interface.")] [FxCopCompatibility ("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")] public class ParameterNamesShouldMatchOverriddenMethodRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); //check if this is a Boo assembly using macros Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { IsBooAssemblyUsingMacro = (e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("Boo.Lang.Compiler.Ast", "MacroStatement"); })); }; } private static bool SignatureMatches (MethodReference method, MethodReference baseMethod, bool explicitInterfaceCheck) { string name = method.Name; string base_name = baseMethod.Name; if (name != base_name) { if (!explicitInterfaceCheck) return false; TypeReference btype = baseMethod.DeclaringType; string bnspace = btype.Namespace; if (!name.StartsWith (bnspace, StringComparison.Ordinal)) return false; if (name [bnspace.Length] != '.') return false; string bname = btype.Name; if (String.CompareOrdinal (bname, 0, name, bnspace.Length + 1, bname.Length) != 0) return false; int dot = bnspace.Length + bname.Length + 1; if (name [dot] != '.') return false; if (name.LastIndexOf (base_name, StringComparison.Ordinal) != dot + 1) return false; } return method.CompareSignature (baseMethod); } private static MethodDefinition GetBaseMethod (MethodDefinition method) { TypeDefinition baseType = method.DeclaringType.Resolve (); if (baseType == null) return null; while ((baseType.BaseType != null) && (baseType != baseType.BaseType)) { baseType = baseType.BaseType.Resolve (); if ((baseType == null) || !baseType.HasMethods) return null; // could not resolve foreach (MethodDefinition baseMethodCandidate in baseType.Methods) { if (SignatureMatches (method, baseMethodCandidate, false)) return baseMethodCandidate; } } return null; } private static MethodDefinition GetInterfaceMethod (MethodDefinition method) { TypeDefinition type = (method.DeclaringType as TypeDefinition); if (!type.HasInterfaces) return null; foreach (TypeReference interfaceReference in type.Interfaces) { TypeDefinition interfaceCandidate = interfaceReference.Resolve (); if ((interfaceCandidate == null) || !interfaceCandidate.HasMethods) continue; foreach (MethodDefinition interfaceMethodCandidate in interfaceCandidate.Methods) { if (SignatureMatches (method, interfaceMethodCandidate, true)) return interfaceMethodCandidate; } } return null; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.IsVirtual || !method.HasParameters || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; MethodDefinition baseMethod = null; if (!method.IsNewSlot) baseMethod = GetBaseMethod (method); if (baseMethod == null) baseMethod = GetInterfaceMethod (method); if (baseMethod == null) return RuleResult.Success; IList base_pdc = baseMethod.Parameters; //do not trigger false positives on Boo macros if (IsBooAssemblyUsingMacro && IsBooMacroParameter (base_pdc [0])) return RuleResult.Success; IList pdc = method.Parameters; for (int i = 0; i < pdc.Count; i++) { if (pdc [i].Name != base_pdc [i].Name) { string s = String.Format (CultureInfo.InvariantCulture, "The name of parameter #{0} ({1}) does not match the name of the parameter in the overriden method ({2}).", i + 1, pdc [i].Name, base_pdc [i].Name); Runner.Report (method, Severity.Medium, Confidence.High, s); } } return Runner.CurrentRuleResult; } private bool IsBooAssemblyUsingMacro { get; set; } private static bool IsBooMacroParameter (ParameterReference p) { return p.Name == "macro" && p.ParameterType.IsNamed ("Boo.Lang.Compiler.Ast", "MacroStatement"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/DoNotUseReservedInEnumValueNamesRule.cs0000664000175000017500000000603012413742070034121 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.DoNotUseReservedInEnumValueNamesRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule checks for enumerations that contain values named reserved. This /// practice, often seen in C/C++ sources, is not needed in .NET since adding new /// values will not normally break binary compatibility. However renaming a reserved  /// enum value can since there is no way to prevent people from using the old value. /// /// /// Bad example: /// /// public enum Answer { /// Yes, /// No, /// Reserved /// // ^ renaming this to 'Maybe' would be a breaking change /// } /// /// /// /// Good example: /// /// public enum Answer { /// Yes, /// No /// // we can add Maybe here without causing a breaking change /// // (but note that we may break code if we change the values of /// // existing enumerations) /// } /// /// [Problem ("This type is an enumeration that contains value(s) named 'reserved'.")] [Solution ("The 'reserved' value should be removed since there is no need to reserve enum values.")] [FxCopCompatibility ("Microsoft.Naming", "CA1700:DoNotNameEnumValuesReserved")] public class DoNotUseReservedInEnumValueNamesRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (!type.IsEnum) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { // this excludes special "value__" if (!field.IsStatic) continue; if (field.Name.IndexOf ("RESERVED", StringComparison.OrdinalIgnoreCase) >= 0) { // High since removing/renaming the field can be a breaking change Runner.Report (field, Severity.High, Confidence.High); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/0000775000175000017500000000000012642235742025374 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/ChangeLog0000664000175000017500000001241712413742070027144 0ustar00directhexdirecthex000000000000002010-06-10 Sebastien Pouliot * UseCorrectPrefixTest.cs: Add test cases for types starting with an I 2009-03-23 Sebastien Pouliot * UseCorrectCasingTest.cs: Add a different test case for a namespace that is not pascal cased. 2008-12-23 Sebastien Pouliot * AvoidTypeInterfaceInconsistencyTest: New. Unit tests for AvoidTypeInterfaceInconsistencyRule 2008-11-07 Alan McGovern * Tests.Rules.Naming.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-25 Sebastien Pouliot * UseCorrectSuffixTest.cs: Convert to new, shorter, syntax. Move test cases from EnumNotEndsWithEnumOrFlagsSuffixTest here. 2008-10-25 Sebastien Pouliot * UseCorrectPrefixTest.cs: Convert to new, shorter, syntax. Add test cases for generic type parameters. 2008-10-19 Sebastien Pouliot * Test.Rules.Naming.mdp: Add AvoidDeepNamespaceHierarchyTest to MD project file. 2008-10-17 Sebastien Pouliot * AvoidDeepNamespaceHierarchyTest.cs: New. Unit tests for AvoidDeepNamespaceHierarchyRule. * DetectNonAlphaNumericsInTypeNamesTest.cs: Add test cases for namespaces. Convert to new, shorter, syntax. * DoNotPrefixEventsWithAfterOrBeforeTest.cs: Add test cases for structures. * UseCorrectCasingTest.cs: Add test cases for namespaces. Convert to new, shorter, syntax. * UsePreferredTermsTest.cs: Add test cases for namespaces. Convert to new, shorter, syntax. 2008-08-28 Sebastien Pouliot * UseCorrectCasingTest.cs: Convert namespace tests (ITypeRule) to the new syntax. Add a few more tests for more coverage. 2008-05-11 Sebastien Pouliot * DoNotPrefixEventsWithAfterOrBeforeTest.cs: New. Unit tests for DoNotPrefixEventsWithAfterOrBeforeRule 2008-05-11 Andres G. Aragoneses * Test.Rules.Naming.mdp: Fix references. 2008-04-26 Jb Evain * UseCorrectCasingTest.cs: add tests for namespace casing checks. 2008-03-19 Sebastien Pouliot * UseCorrectCasingTest.cs: Fix test case for compiler-generated code (anonymous methods) and CSC. * UseCorrectSuffixTest.cs: Add test cases for generics. 2008-03-15 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesTest.cs: Add test case for COM interop. 2008-02-15 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesTest.cs * DoNotPrefixValuesWithEnumNameTest.cs * DoNotUseReservedInEnumValueNamesTest.cs * EnumNotEndsWithEnumOrFlagsSuffixTest.cs * ParameterNamesShouldMatchOverridenMethodTest.cs * UseCorrectCasingTest.cs * UseCorrectPrefixTest.cs * UseCorrectSuffixTest.cs * UsePluralNameInEnumFlagsTest.cs * UsePreferredTermsTest.cs * UseSingularNameInEnumsUnlessAreFlagsTest.cs: Update unit tests wrt framework changes. 2008-01-14 Sebastien Pouliot * DoNotPrefixValuesWithEnumNameTest.cs: New. Unit tests from Andreas Noever * DoNotUseReservedInEnumValueNamesTest.cs: : New. Unit tests from Andreas Noever * ParameterNamesShouldMatchOverridenMethodTest.cs: : New. Unit tests from Andreas Noever * Test.Rules.Naming.mdp: Update MonoDevelop project file. 2007-12-26 Sebastien Pouliot * AttributeEndsWithAttributeSuffixTest.cs: Deleted. The new UseCorrectSuffixTest is a superset of the rule/tests. * Test.Rules.Naming.mdp: Update MonoDevelop project file. * UseCorrectPrefixTest.cs: New. Test cases from Daniel Abramov. * UseCorrectCasingTest.cs: New. Test cases from Daniel Abramov. * UseCorrectSuffixTest.cs: New. Test cases from Daniel Abramov. * UsePreferredTermsTest.cs: New. Test cases from Daniel Abramov. 2007-10-08 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesTest.cs: Add test cases for non-nested types. Add test case with a delegate (2.0). Make sure everything is tested inside loops. * Test.Rules.Naming.mdp: Use 2.0 runtime for tests. 2007-10-07 Sebastien Pouliot * DetectNonAlphaNumericsInTypeNamesTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * Test.Rules.Portability.mdp: Update project file. 2007-10-05 Nestor Salceda * Test.Rules.Naming.mdp: Changed output directory, by convention looking other Test.Rules.* projects. 2007-10-04 Nestor Salceda * Test.Rules.Naming.mdp: Removed empty directory entry in the MonoDevelop project file. 2007-10-04 Nestor Salceda * Test.Rules.Naming.mdp: New. Created MonoDevelop project file for the unit tests for the naming rules. 2007-09-29 Nestor Salceda * UsePluralNameInFlagEnumsTest.cs, UsePluralNameInEnumFlagsTest.cs,: Rename UsePluralNameInFlagEnumsTest.cs, file to UsePluralNameInEnumFlagsTest.cs, because this file doesn't follow the coding guidelines. 2007-09-13 Nestor Salceda * AttributeEndsWithAttributeSuffixTest.cs, EnumNotEndsWithEnumOrFlagsSuffixTest.cs, UsePluralNameInFlagEnumsTest.cs, UseSingularNameInEnumsUnlessAreFlagsTest.cs: New. Unit tests for the rules. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectCasingTest.cs0000664000175000017500000001652712413742070031772 0ustar00directhexdirecthex00000000000000// // Unit Test for UseCorrectCasingRule // // Authors: // Abramov Daniel // // (C) 2007 Abramov Daniel // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Naming; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; // no namespace class Foo { } namespace Test.IO { class Foo {} } namespace Test.Fa { class Foo {} } namespace Test.ASP { class Foo {} class Bar {} } namespace Test.A { class Foo {} } namespace Test.Rules.ROCKS { class Foo { } } namespace Test.aSP { class Zoo { } class Yar { } } namespace Test.Rules.Naming { [TestFixture] public class UseCorrectCasingAssemblyTest : AssemblyRuleTestFixture { [Test] public void Namespaces () { // 1. Test.A // 2. Test.Fa // 3. Test.ASP // 4. Test.Rules.ROCKS // 5. Test.aSP string unit = Assembly.GetExecutingAssembly ().Location; AssertRuleFailure (AssemblyDefinition.ReadAssembly (unit), 5); } } [TestFixture] public class UseCorrectCasingTypeTest : TypeRuleTestFixture { public class CorrectCasing { } public class incorrectCasing { } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.GeneratedType); } [Test] public void Types () { AssertRuleSuccess (); AssertRuleFailure (1); } } public class CasingMethods { public void CorrectCasing (int foo, string bar) { } public void incorrectCasing (int foo, string bar) { } public void CorrectCasingWithTwoIncorrectParameters (int Bar, string Foo) { } public void incorrectCasingWithTwoIncorrectParameters (int Bar, string Foo) { } public void IncorrectParameter (byte B) { } public void x () { } public void _X (short _S) { } } public class MoreComplexCasing { static MoreComplexCasing () { } // .cctor, should be ignored public MoreComplexCasing () { } // .ctor, should be ignored public int GoodProperty { get { return 0; } set { } } public int badProperty { get { return 0; } set { } } public int get_AccessorLike () { return 0; } // should be catched public void set_AccessorLike (int value) { } // should be catched public event EventHandler GoodEvent { add { throw new NotImplementedException (); } remove { throw new NotImplementedException (); } } public event EventHandler badEvent { add { throw new NotImplementedException (); } remove { throw new NotImplementedException (); } } public static int operator + (MoreComplexCasing a, int b) { return 0; } // ignore! } public class PrivateEventCasing { private event EventHandler good_private_event; } [TestFixture] public class UseCorrectCasingTest : MethodRuleTestFixture { [Test] public void TestCorrectCasedMethod () { AssertRuleSuccess ("CorrectCasing"); } [Test] public void TestIncorrectCasedMethod () { AssertRuleFailure ("incorrectCasing", 1); } [Test] public void TestCorrectCasedMethodWithIncorrectCasedParameters () { AssertRuleFailure ("CorrectCasingWithTwoIncorrectParameters", 2); } [Test] public void TestIncorrectCasedMethodWithIncorrectCasedParameters () { AssertRuleFailure ("incorrectCasingWithTwoIncorrectParameters", 3); } [Test] public void MoreCoverage () { // parameter 'B' should be lower case to be CamelCase AssertRuleFailure ("IncorrectParameter", 1); // method name should be uppercase to be PascalCase AssertRuleFailure ("x", 1); // starts with an underscore for name and parameter, fails both Pascal and Camel checks AssertRuleFailure ("_X", 2); } [Test] public void TestIgnoringCtor () { AssertRuleDoesNotApply (".cctor"); AssertRuleDoesNotApply (".ctor"); } [Test] public void TestGoodProperty () { AssertRuleSuccess ("get_GoodProperty"); AssertRuleSuccess ("set_GoodProperty"); } [Test] public void TestBadProperty () { AssertRuleFailure ("get_badProperty", 1); AssertRuleFailure ("set_badProperty", 1); } [Test] public void TestGoodEventHandler () { AssertRuleSuccess ("add_GoodEvent"); AssertRuleSuccess ("remove_GoodEvent"); } [Test] public void TestBadEventHandler () { AssertRuleFailure ("add_badEvent", 1); AssertRuleFailure ("remove_badEvent", 1); } [Test] public void TestGoodPrivateEvent () { AssertRuleDoesNotApply ("add_good_private_event"); AssertRuleDoesNotApply ("remove_good_private_event"); } [Test] public void TestPropertyLikeMethods () { AssertRuleFailure ("get_AccessorLike", 1); AssertRuleFailure ("set_AccessorLike", 1); } [Test] public void TestIgnoringOperator () { AssertRuleSuccess ("op_Addition"); } public class AnonymousMethod { private void MethodWithAnonymousMethod () { string [] values = new string [] { "one", "two", "three" }; if (Array.Exists (values, delegate (string myString) { return myString.Length == 3; })) Console.WriteLine ("Exists strings with length == 3"); } } private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } [Test] public void TestAnonymousMethod () { // compiler generated code is compiler dependant, check for [g]mcs (inner type) TypeDefinition type = assembly.MainModule.GetType ("Test.Rules.Naming.UseCorrectCasingTest/AnonymousMethod/<>c__CompilerGenerated0"); // otherwise try for csc (inside same class) if (type == null) type = assembly.MainModule.GetType ("Test.Rules.Naming.UseCorrectCasingTest/AnonymousMethod"); Assert.IsNotNull (type, "type not found"); foreach (MethodDefinition method in type.Methods) { switch (method.Name) { case "MethodWithAnonymousMethod": // this isn't part of the test (but included with CSC) break; default: AssertRuleDoesNotApply (method); break; } } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/DoNotPrefixEventsWithAfterOrBeforeTest.cs0000664000175000017500000000651412413742070035412 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotPrefixEventsWithAfterOrBeforeTest // // Authors: // Sebastien Pouliot // // 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; using System.Reflection; using Gendarme.Framework; using Gendarme.Rules.Naming; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Naming { #pragma warning disable 67, 169 [TestFixture] public class DoNotPrefixEventsWithAfterOrBeforeTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); } public class ClassicBad { public event EventHandler Before; public event EventHandler After; } public class CustomBad { public event AssemblyLoadEventHandler BeforeLoad; public event UnhandledExceptionEventHandler AfterException; } public class GenericsBad { public event EventHandler BeforeGenerics; public event EventHandler AfterGenerics; } public struct StructBad { public event EventHandler Before; } public interface IBad { event EventHandler After; } [Test] public void Bad () { AssertRuleFailure (2); AssertRuleFailure (2); AssertRuleFailure (2); AssertRuleFailure (1); AssertRuleFailure (1); } public class ClassicOk { // stetching a bit ;-) public event EventHandler JustBefore; public event EventHandler JustAfter; } public class CustomOk { public event ResolveEventHandler Resolving; public event ModuleResolveEventHandler Resolved; } public class GenericOk { public event EventHandler Genericing; public event EventHandler Genericed; } public struct StructOk { public event EventHandler Beforing; } [Test] public void Ok () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void None () { // no events AssertRuleSuccess (SimpleTypes.Class); AssertRuleSuccess (SimpleTypes.Interface); AssertRuleSuccess (SimpleTypes.Structure); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/DoNotUseReservedInEnumValueNamesTest.cs0000664000175000017500000000602112413742070035050 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotUseReservedInEnumValueNamesRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Naming; using Gendarme.Framework.Rocks; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Naming { [TestFixture] public class DoNotUseReservedInEnumValueNamesTest { private DoNotUseReservedInEnumValueNamesRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.Naming.DoNotUseReservedInEnumValueNamesTest"); rule = new DoNotUseReservedInEnumValueNamesRule (); runner = new TestRunner (rule); } private TypeDefinition GetTest (string name) { foreach (TypeDefinition nestedType in type.NestedTypes) { if (nestedType.Name == name) return nestedType; } return null; } struct NonEnum { int Reserved, NonEnum2; } [Test] public void TestNonEnum () { TypeDefinition type = GetTest ("NonEnum"); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } enum FalsePositive { A, B, C } [Test] public void TestFalsePositive () { TypeDefinition type = GetTest ("FalsePositive"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } enum Reserved { A, Reserved, B } [Test] public void TestReserved () { TypeDefinition type = GetTest ("Reserved"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/Makefile.in0000664000175000017500000003142012642235732027440 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Naming/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Naming.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Naming/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Naming/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/UsePluralNameInEnumFlagsTest.cs0000664000175000017500000000511512413742070033364 0ustar00directhexdirecthex00000000000000// // Unit Test for UsePluralNameInEnumFlags Rule. // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Naming; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Naming { [Flags] public enum AppDomainManagerInitializationOptions { None, RegisterWithHost } [Flags] public enum ConsoleModifier { Alt, Control, Shift } [TestFixture] public class UsePluralNameInEnumFlagsTest { private ITypeRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new UsePluralNameInEnumFlagsRule (); runner = new TestRunner (rule); } [Test] public void TestFlagsHasPluralName () { type = assembly.MainModule.GetType ("Test.Rules.Naming.AppDomainManagerInitializationOptions"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestFlagsHasSingularName () { type = assembly.MainModule.GetType ("Test.Rules.Naming.ConsoleModifier"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } } } ParameterNamesShouldMatchOverridenMethodTest.cs0000664000175000017500000001017112413742070036554 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test// // Unit tests for ParameterNamesShouldMatchOverridenMethodTest // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2008 Andreas Noever // 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 Gendarme.Framework.Helpers; using Gendarme.Rules.Naming; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Naming { interface ISomeInterface { bool InterfaceMethod (int im); } interface ISomeInterface2 { bool InterfaceMethod2 (int im); } abstract public class SuperBaseClass { protected virtual void VirtualSuperIncorrect (int vsi1, bool vsi2) { } protected virtual void VirtualSuperIncorrect (int vsi1, int vsi2_) { } } abstract public class BaseClass : SuperBaseClass { protected virtual void VirtualCorrect (int vc1, int vc2) { } protected virtual void VirtualIncorrect (int vi1, int vi2) { } protected abstract void AbstractCorrect (int ac1, int ac2); protected abstract void AbstractIncorrect (int ai1, int ai2); protected virtual void NoOverwrite (int a, int b) { } } [TestFixture] public class ParameterNamesShouldMatchOverridenMethodTest : MethodRuleTestFixture { class TestCase : BaseClass, ISomeInterface, ISomeInterface2, IEquatable { protected override void VirtualCorrect (int vc1, int vc2) { } protected override void VirtualIncorrect (int vi1, int vi2a) { } protected override void VirtualSuperIncorrect (int vsi1, bool vsi2_) { } protected override void AbstractCorrect (int ac1, int ac2) { throw new NotImplementedException (); } protected override void AbstractIncorrect (int ai1, int ai2_) { throw new NotImplementedException (); } protected virtual void NoOverwrite (int a, int bb) { } public bool InterfaceMethod (int im_) { return false; } bool ISomeInterface2.InterfaceMethod2 (int im_) { return false; } void NoParameter () { } public bool Equals (string s) { throw new NotImplementedException (); } } [Test] public void TestVirtual () { AssertRuleSuccess ("VirtualCorrect"); AssertRuleFailure ("VirtualIncorrect", 1); AssertRuleFailure ("VirtualSuperIncorrect", 1); } [Test] public void TestAbstract () { AssertRuleSuccess ("AbstractCorrect"); AssertRuleFailure ("AbstractIncorrect", 1); } [Test] public void TestNoOverwrite () { AssertRuleSuccess ("NoOverwrite"); } [Test] public void TestInterfaceMethod () { AssertRuleFailure ("InterfaceMethod", 1); AssertRuleFailure ("Test.Rules.Naming.ISomeInterface2.InterfaceMethod2", 1); } [Test] public void TestDoesNotApply () { AssertRuleDoesNotApply ("NoParameter"); } [Test] public void GenericInterface () { AssertRuleSuccess ("Equals", new Type [] { typeof (OpCodeBitmask) }); AssertRuleFailure ("Equals", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/Tests.Rules.Naming.csproj0000775000175000017500000001425512413742070032224 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {B4E97DE7-FF30-485E-A2D8-7A0C596E6851} Library Properties Tests.Rules.Naming Tests.Rules.Naming v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {C57E2A54-3BBF-49D7-B3E5-688EE1F63250} Gendarme.Rules.Naming False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/UsePreferredTermsTest.cs0000664000175000017500000001037612413742070032171 0ustar00directhexdirecthex00000000000000// // Unit Test for UsePreferredTermsRule // // Authors: // Abramov Daniel // Sebastien Pouliot // // (C) 2007 Abramov Daniel // 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; using System.Reflection; using Gendarme.Rules.Naming; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Fixtures; // 5 bad terms are used in this namespace // note: ShouldntBe needs to be in one word (no dot) otherwise UseCoorectCasingRule will spot it (same assembly) namespace Cancelled.ComPlus.Indices.ShouldntBe.Writeable { public class WouldntLogOutOrSignOff { public bool WontAllowIt; public bool arentBad; public bool AccessWerentLogged { get { return true; } } internal void HadntThinkOfIt () { } void CantArgueAboutThat () { } } abstract public class CouldntLogInOrSignOn { WouldntLogOutOrSignOff DoesntMatterAnymore; abstract public bool WasntHere { get; } internal void DontTryThisAtHome () { } public event EventHandler HaventVoted; } } namespace Test.Rules.Naming { [TestFixture] public class UsePreferredTermsAssemblyTest : AssemblyRuleTestFixture { AssemblyDefinition assembly; bool parentMatches; [TestFixtureSetUp] public void FixtureSetup () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } [Test] public void AssemblyName () { string name = assembly.Name.Name; try { assembly.Name.Name = "This.Isnt.A.Nice.Assembly.Name"; // bad name and one bad namespace with 5 failures AssertRuleFailure (assembly, 6); } finally { assembly.Name.Name = name; } } [Test] public void Namespace () { // Type_With_Underscore AssertRuleFailure (assembly, 5); } } [TestFixture] public class UsePreferredTermsTypeTest : TypeRuleTestFixture { [Test] public void Bad () { // 3 failures in the type name, 2 in fields (including one event) AssertRuleFailure (5); // 3 failures in the type name, 2 in a field AssertRuleFailure (5); } [Test] public void Good () { // good type name and good fields names AssertRuleSuccess (); } } [TestFixture] public class UsePreferredTermsMethodTest : MethodRuleTestFixture { [Test] public void Bad () { AssertRuleFailure ("get_AccessWerentLogged", 1); AssertRuleFailure ("HadntThinkOfIt", 1); AssertRuleFailure ("CantArgueAboutThat", 1); AssertRuleFailure ("DontTryThisAtHome", 1); } [Test] public void Good () { AssertRuleSuccess ("Bad"); AssertRuleSuccess ("GetParentFoo"); } private void GetParentFoo () { } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectPrefixTest.cs0000664000175000017500000000634112413742070032014 0ustar00directhexdirecthex00000000000000// // Unit Test for UseCorrectPrefixRule // // Authors: // Abramov Daniel // Sebastien Pouliot // // (C) 2007 Daniel Abramov // Copyright (C) 2008, 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 Gendarme.Rules.Naming; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Naming { public class C { } public class CorrectClass { } public class AnotherCorrectClass { } public class CIncorrectClass { } public class INcorrectClass { } public class ILRange { } public class InMemoryDoohicky { } public interface I { } public interface ICorrectInterface { } public interface IncorrectInterface { } public interface AnotherIncorrectInterface { } public class CLSAbbreviation { // ok } public interface ICLSAbbreviation { // ok too } public class GoodSingleGenericType { } public class GoodPrefixGenericType { } public class BadCapsGenericType { } public class BadPrefixGenericType { } [TestFixture] public class UseCorrectPrefixTypeTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.GeneratedType); } [Test] public void Types () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Interfaces () { AssertRuleFailure (1); AssertRuleSuccess (); AssertRuleFailure (1); AssertRuleFailure (1); } [Test] public void Abbreviations () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void GenericParameters () { AssertRuleSuccess> (); AssertRuleSuccess> (); AssertRuleFailure> (2); AssertRuleFailure> (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/AvoidTypeInterfaceInconsistencyTest.cs0000664000175000017500000000431412413742070035054 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidTypeInterfaceInconsistencyRule // // Authors: // Sebastien Pouliot // // 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; using System.Reflection; using Mono.Cecil; using Gendarme.Rules.Naming; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Naming { public interface IFoo { } // misnamed interface public interface JFoo { } // not implementing IFoo public class Foo : JFoo { } public interface IBar { } public class Bar : IBar { } // misnamed interface public interface Box { } // misnamed type public class IBox : Box { } [TestFixture] public class AvoidTypeInterfaceInconsistencyTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // types AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); // misnamed AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } [Test] public void Good () { AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/AvoidRedundancyInMethodNameTest.cs0000664000175000017500000001067112413742070034071 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidRedundancyInMethodNameRule // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Naming; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Naming { class Package { } class PostOffice { public PostOffice () {} public virtual void SendPackage (Package package) {} public static bool IsPackageValid (Package package) { return true; } public static void CheckPackageValid (Package package) { } public static void SendPackageTo (Package package, string address) {} } class DerivedPostOffice : PostOffice { public override void SendPackage (Package package) {} } [TestFixture] public class AvoidRedundancyInMethodNameTest : MethodRuleTestFixture { private void NoParam () { } private bool Property { get { return true; } } private void ByRefParamPackage (ref Package package) { } private void OutParamPackage (out Package package) { package = null; } private void Shorter (Package package) { } private void ParseString (string text) { } private Package GetRealPackage (Package package) { return null; } private void SetPackage (Package package) { } private void PackageSomething (Package package, string something) { } private void Send (Package package) { } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("NoParam"); AssertRuleDoesNotApply ("get_Property"); AssertRuleDoesNotApply ("ByRefParamPackage"); AssertRuleDoesNotApply ("OutParamPackage"); AssertRuleDoesNotApply (".ctor");//constructor AssertRuleDoesNotApply ("SendPackage");//override AssertRuleDoesNotApply ("Shorter");//...than parameter type name AssertRuleDoesNotApply ("SetPackage");//too vague AssertRuleDoesNotApply ("Send"); } [Test] public void Failure1 () { AssertRuleFailure ("SendPackage", 1); Assert.IsTrue (-1 != Runner.Defects [0].Text.IndexOf ("'Send'"), "SendPackage"); } [Test] public void Failure2 () { AssertRuleFailure ("IsPackageValid", 1); Assert.IsTrue (-1 != Runner.Defects [0].Text.IndexOf ("'Test.Rules.Naming.Package' as property 'IsValid'"), "IsPackageValid"); } [Test] public void Failure3 () { AssertRuleFailure ("CheckPackageValid", 1); Assert.IsTrue (-1 != Runner.Defects [0].Text.IndexOf ("'Test.Rules.Naming.Package' as method 'CheckValid'"), "CheckPackageValid"); } [Test] public void Failure4 () { AssertRuleFailure ("SendPackageTo", 1); Assert.IsTrue (-1 != Runner.Defects [0].Text.IndexOf ("'Test.Rules.Naming.Package' as method 'SendTo'"), "SendPackageTo"); } [Test] public void Success () { AssertRuleSuccess ("GetRealPackage");//return type is also parameter type AssertRuleSuccess ("PackageSomething");//starts with parameter type name, most likely on purpose/action naming AssertRuleSuccess ("ParseString");//third-party type } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/UseCorrectSuffixTest.cs0000664000175000017500000002745712413742070032036 0ustar00directhexdirecthex00000000000000// // Unit Test for UseCorrectSuffix Rule // // Authors: // Néstor Salceda // Abramov Daniel // Sebastien Pouliot // // (C) 2007 Néstor Salceda // (C) 2007 Abramov Daniel // 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; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Security; using Gendarme.Framework; using Gendarme.Rules.Naming; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Naming { public class CorrectAttribute : Attribute { } public class IncorrectAttr : Attribute { } public class OtherAttribute : CorrectAttribute { } public class OtherAttr : CorrectAttribute { } public class CorrectContextStaticAttribute : ContextStaticAttribute { } public class OtherClass { } public class YetAnotherClass : Random { } public class InterfaceImplementer : ICollection { public int Count { get { throw new NotImplementedException(); } } public bool IsSynchronized { get { throw new NotImplementedException (); } } public object SyncRoot { get { throw new NotImplementedException (); } } public IEnumerator GetEnumerator () { throw new NotImplementedException(); } public void CopyTo (Array array, int index) { throw new NotImplementedException(); } } public class CorrectICollectionCollection : InterfaceImplementer { } public class IncorrectICollectionCol : InterfaceImplementer { } public class IncorrectICollectionColDerived : IncorrectICollectionCol { } public class MultipleInterfaceImplementer : IEnumerable, IPermission { public IEnumerator GetEnumerator () { throw new NotImplementedException(); } public void FromXml (SecurityElement e) { throw new NotImplementedException(); } public SecurityElement ToXml () { throw new NotImplementedException(); } public IPermission Copy () { throw new NotImplementedException(); } public void Demand () { throw new NotImplementedException(); } public IPermission Intersect (IPermission target) { throw new NotImplementedException(); } public bool IsSubsetOf (IPermission target) { throw new NotImplementedException(); } public IPermission Union (IPermission target) { throw new NotImplementedException(); } } public class CorrectMultipleInterfaceImplementerPermission : MultipleInterfaceImplementer { } public class CorrectMultipleInterfaceImplementerCollection : MultipleInterfaceImplementer { } public class IncorrectMultipleInterfaceImplementer : MultipleInterfaceImplementer { } public class IncorrectICollectionImplementer : IncorrectMultipleInterfaceImplementer, ICollection { public int Count { get { throw new NotImplementedException (); } } public bool IsSynchronized { get { throw new NotImplementedException (); } } public object SyncRoot { get { throw new NotImplementedException (); } } public IEnumerator GetEnumerator () { throw new NotImplementedException (); } public void CopyTo (Array array, int index) { throw new NotImplementedException (); } } public class DerivingClassImplementingInterfaces : EventArgs, IPermission { public void FromXml (SecurityElement e) { throw new NotImplementedException(); } public SecurityElement ToXml () { throw new NotImplementedException(); } public IPermission Copy () { throw new NotImplementedException(); } public void Demand () { throw new NotImplementedException(); } public IPermission Intersect (IPermission target) { throw new NotImplementedException(); } public bool IsSubsetOf (IPermission target) { throw new NotImplementedException(); } public IPermission Union (IPermission target) { throw new NotImplementedException(); } } public class CorrectDerivingClassImplementingInterfacesEventArgs : DerivingClassImplementingInterfaces { } public class IncorrectDerivingClassImplementingInterfacesCollection : DerivingClassImplementingInterfaces { } public class IncorrectDerivingClassImplementingInterfaces : DerivingClassImplementingInterfaces { } public class CorrectCollection : Collection { } public class CollectionIncorrect : Collection { } public class CollectionIncorrectDerived : CollectionIncorrect { } public class CorrectDictionary : Dictionary { } public class DictionaryIncorrect : Dictionary { } public class DictionaryIncorrectDerived : DictionaryIncorrect { } // test case from https://github.com/Iristyle/mono-tools/commit/40bfb2260511cfe4171e9153c3c434fedd8a4d4a.diff public class CorrectCollectionAndDictionary : Dictionary, ICollection { public void Add(V item) { throw new NotImplementedException(); } public bool Contains(V item) { throw new NotImplementedException(); } public void CopyTo(V[] array, int arrayIndex) { throw new NotImplementedException(); } public bool IsReadOnly { get { throw new NotImplementedException(); } } public bool Remove(V item) { throw new NotImplementedException(); } public new IEnumerator GetEnumerator() { throw new NotImplementedException(); } } [TestFixture] public class UseCorrectSuffixTest : TypeRuleTestFixture { void AssertRuleFailureWithHighConfidence (int num) { AssertRuleFailure (num); Assert.AreEqual (Confidence.High, Runner.Defects [0].Confidence, typeof (T).Name); } void AssertRuleFailureWithLowConfidence () { AssertRuleFailure (1); Assert.AreEqual (Confidence.Low, Runner.Defects [0].Confidence, typeof (T).Name); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.GeneratedType); } [Test] public void TestOneLevelInheritanceIncorrectName () { AssertRuleFailureWithHighConfidence (1); } [Test] public void TestOneLevelInheritanceCorrectName () { AssertRuleSuccess (); } [Test] public void TestVariousLevelInheritanceCorrectName () { AssertRuleSuccess (); } [Test] public void TestVariousLevelInheritanceIncorrectName () { AssertRuleFailureWithHighConfidence (1); } [Test] public void NeedToBeResolvedTypes () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void TestInterfaceImplementerCorrectName () { AssertRuleSuccess (); } [Test] public void TestInterfaceImplementerIncorrectName () { AssertRuleFailureWithLowConfidence (); } [Test] public void TestMultipleInterfaceImplementerCorrectName () { AssertRuleSuccess (); } [Test] public void TestMultipleInterfaceImplementerAnotherCorrectName () { AssertRuleSuccess (); } [Test] public void TestMultipleInterfaceImplementerIncorrectName () { AssertRuleFailureWithHighConfidence (1); } [Test] public void TestIncorrectMultipleInterfaceImplementer () { //this type derives from an incorrect base type, *without* introducing its own defect //hence it has low confidence AssertRuleFailureWithLowConfidence (); } [Test] public void TestIncorrectICollectionImplementer () { //this type derives from an incorrect base type, but also introduce its own defect //hence it has high confidence AssertRuleFailureWithHighConfidence (1); } [Test] public void TestDerivingClassImplementingInterfacesCorrectName () { AssertRuleSuccess (); } [Test] public void TestDerivingClassImplementingInterfacesIncorrectName () { AssertRuleFailureWithLowConfidence (); } [Test] public void TestDerivingClassImplementingInterfacesAnotherIncorrectName () { //this type derives from an incorrect base type AssertRuleFailureWithHighConfidence (2); } [Test] public void GenericCollection () { AssertRuleSuccess> (); AssertRuleFailureWithHighConfidence> (1); } [Test] public void GenericDictionary () { AssertRuleSuccess> (); // to be consistent with FxCop, a class implementing IDictionary and ICollection should end in Dictionary AssertRuleSuccess> (); AssertRuleFailureWithHighConfidence> (1); } [Test] public void IncorrectBaseType () { AssertRuleFailureWithLowConfidence (); AssertRuleFailureWithLowConfidence> (); AssertRuleFailureWithLowConfidence> (); } class My { } class MyDelegate { } enum MyEnum { } [Flags] enum MyFlags { } class MyEx { } class MyImpl { } [Test] public void CheckShouldNeverBeUsedSuffixes () { AssertRuleSuccess (); AssertRuleFailureWithHighConfidence (1); AssertRuleFailureWithHighConfidence (1); AssertRuleFailureWithHighConfidence (1); AssertRuleFailureWithHighConfidence (1); AssertRuleFailureWithHighConfidence (1); } class MyCollection : EventArgs { } [Test] public void TwiceBadSuffix () { // 1- "'Collection' should used only for implementing ICollection or IEnumerable or inheriting Queue, Stack, DataSet and DataTable." // 2- "The type name does not end with 'EventArgs' suffix. Append it to the type name." AssertRuleFailure (2); } // from EnumNotEndsWithEnumOrFlagsSuffixTest.cs public enum ReturnValue { Foo, Bar } public enum ReturnValueEnum { Foo, Bar } [Flags] public enum ReturnValues { Foo, Bar } [Flags] public enum ReturnValuesFlags { Foo, Bar } public enum returnvalueenum { Foo, Bar } [Flags] public enum returnvaluesflags { Foo, Bar } [Test] public void EnumName () { AssertRuleSuccess (); AssertRuleFailureWithHighConfidence (1); AssertRuleFailureWithHighConfidence (1); } [Test] public void FlagsName () { AssertRuleSuccess (); AssertRuleFailureWithHighConfidence (1); AssertRuleFailureWithHighConfidence (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/AvoidRedundancyInTypeNameTest.cs0000664000175000017500000000666012413742070033575 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidRedundancyInTypeNameRule // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Naming; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; class OutsideNamespaceType { } namespace FooX { namespace Bar { class Barometer { } class BarClass : Class { } class BarContext { } interface IBarInterface { } interface IBarContext { } } class Class { } interface IInterface { } } namespace Baz { class BazClass : FooX.Class { } class BazSuperClass : BazClass { } interface ISomeInterface { } interface IBazInterface { } enum BazVersion { } enum BazExistingVersion { } enum ExistingVersion { } } namespace Test.Rules.Naming { [TestFixture] public class AvoidRedundancyInTypeNameTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (SimpleTypes.GeneratedType); } [Test] public void Failure1 () { AssertRuleFailure (1); Assert.IsTrue (-1 != Runner.Defects [0].Text.IndexOf ("'Context'"), "BarContext"); } [Test] public void Failure2 () { AssertRuleFailure (1); Assert.IsTrue (-1 != Runner.Defects [0].Text.IndexOf ("'IInterface'"), "IBazInterface"); } [Test] public void Failure3 () { AssertRuleFailure (); Assert.IsTrue (-1 != Runner.Defects [0].Text.IndexOf ("'Version'"), "BazVersion"); } [Test] public void Failure4 () { AssertRuleFailure (); Assert.IsTrue (-1 != Runner.Defects [0].Text.IndexOf ("'IContext'"), "IBarContext"); } [Test] public void Success () { AssertRuleSuccess (); AssertRuleSuccess ();//'ometer' not a good suggestion AssertRuleSuccess (); //ambiguity with parent namespace's type AssertRuleSuccess (); //ambiguity with base type AssertRuleSuccess (); //base class follow prefix pattern already AssertRuleSuccess (); AssertRuleSuccess ();//ExistingVersion already exists AssertRuleSuccess (); //ambiguity with parent namespace's IInterface } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/DetectNonAlphaNumericsInTypeNamesTest.cs0000664000175000017500000001553012413742070035234 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidNonAlphanumericIdentifierRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-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; using System.Reflection; using System.Runtime.InteropServices; using Gendarme.Rules.Naming; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test_Rules_Naming { public class Type_With_Underscore { protected int Field_With_Underscore; public void Method_With_Underscore (string param_with_underscore) { Event_With_Underscore += delegate { Console.WriteLine ("hello"); }; } public event EventHandler Event_With_Underscore; public bool Property_With_Underscore { get { return false; } } } public class TypeWithoutUnderscore { protected int FieldWithoutUnderscore; private int Field_With_Underscore; // non-visible public void MethodWithoutUnderscore (string paramWithoutUnderscore) { EventWithoutUnderscore += delegate { Console.WriteLine ("hello"); }; } protected event EventHandler EventWithoutUnderscore; public bool PropertyWithoutUnderscore { get { return false; } } internal int Property_With_Underscore { get { return 0; } } } } namespace Test.Rules.Naming { internal class InternalClassName_WithUnderscore { } public class PublicClassName_WithUnderscore { } internal interface InternalInterface_WithUnderscore { } public interface PublicInterface_WithUnderscore { } // from Mono.Cecil.Pdb [Guid ("809c652e-7396-11d2-9771-00a0c9b4d50c")] [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)] [ComVisible (true)] public interface IMetaDataDispenser { void DefineScope_Placeholder (); } public enum PublicEnum_WithUnderscore { Value_WithUnderscore, ValueWithoutUnderscore } [TestFixture] public class AvoidNonAlphanumericIdentifierAssemblyTest : AssemblyRuleTestFixture { AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetup () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } [Test] public void AssemblyName () { string name = assembly.Name.Name; try { assembly.Name.Name = "My_Assembly"; // bad name and bad namespace AssertRuleFailure (assembly, 2); } finally { assembly.Name.Name = name; } } [Test] public void Namespace () { // Type_With_Underscore AssertRuleFailure (assembly, 1); } } [TestFixture] public class AvoidNonAlphanumericIdentifierTypeTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.GeneratedType); // because they are NOT visible AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void Enum () { // the enum itself and one of it's two values AssertRuleFailure (2); } [Test] public void Types () { // namespace is not consider at type level, but the field is catched here AssertRuleFailure (2); AssertRuleSuccess (); } [Test] public void InternalClassWithUnderscoreTest () { AssertRuleDoesNotApply (); } [Test] public void PublicClassWithUnderscoreTest () { AssertRuleFailure (1); } [Test] public void InternalInterfaceWithUnderscoreTest () { AssertRuleDoesNotApply (); } [Test] public void PublicInterfaceWithUnderscoreTest () { AssertRuleFailure (1); } [Test] public void ComInterop () { AssertRuleDoesNotApply (); } } [TestFixture] public class AvoidNonAlphanumericIdentifierMethodTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.GeneratedCodeMethod); } [Test] public void Enum () { AssertRuleFailure (1); } [Test] public void MembersWithoutUnderscoreTest () { AssertRuleSuccess ("MethodWithoutUnderscore"); AssertRuleSuccess ("add_EventWithoutUnderscore"); AssertRuleSuccess ("remove_EventWithoutUnderscore"); AssertRuleSuccess ("get_PropertyWithoutUnderscore"); } [Test] public void MembersWithUnderscoreTest () { // method and its parameter name contains an underscore AssertRuleFailure ("Method_With_Underscore", 2); AssertRuleFailure ("add_Event_With_Underscore", 1); AssertRuleFailure ("remove_Event_With_Underscore", 1); AssertRuleFailure ("get_Property_With_Underscore", 1); } public class ClassWithAnonymousDelegate { public bool MethodDefiningDelegate () { byte [] array = null; return !Array.Exists (array, delegate (byte value) { return value.Equals (this); }); } } [Test] public void AnonymousDelegate () { AssertRuleSuccess ("MethodDefiningDelegate"); } [Test] public void ComInterop () { AssertRuleDoesNotApply ("DefineScope_Placeholder"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/AvoidDeepNamespaceHierarchyTest.cs0000664000175000017500000000562312413742070034076 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidDeepNamespaceHierarchyRule // // Authors: // Sebastien Pouliot // // 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; using System.Reflection; using Mono.Cecil; using Gendarme.Rules.Naming; using NUnit.Framework; using Test.Rules.Fixtures; namespace One { public interface I1 { } } namespace One.Two { public interface I2 { } } namespace One.Two.Three { public interface I3 { } } namespace One.Two.Three.Four { public interface I4 { } } // bad namespace One.Two.Three.Four.Five { public interface I5 { } } // exceptions namespace One.Two.Three.Four.Design { public interface IDesign { } } namespace One.Two.Three.Four.Interop { public interface IInterop { } } namespace One.Two.Three.Four.Permissions { public interface IPermissions { } } namespace One.Two.Three.Four.Impl { internal interface IImpl { } } namespace One.Two.Three.Four.Internal { internal interface Internal { } } namespace Test.Rules.Naming { [TestFixture] public class AvoidDeepNamespaceHierarchyTest : AssemblyRuleTestFixture { AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } [Test] public void Namespaces () { // 1. Cancelled.ComPlus.Indices.ShouldntBe.Writeable (from UsePreferredTermsTest) // 2. One.Two.Three.Four.Five (from here) AssertRuleFailure (assembly, 2); } [Test] [ExpectedException (typeof (ArgumentOutOfRangeException))] public void Min () { Rule.MaxDepth = Int32.MinValue; } [Test] public void Max () { int depth = Rule.MaxDepth; try { Rule.MaxDepth = Int32.MaxValue; AssertRuleSuccess (assembly); } finally { Rule.MaxDepth = depth; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/Makefile.am0000664000175000017500000000015212413742070027417 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Naming.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/DoNotPrefixValuesWithEnumNameTest.cs0000664000175000017500000000643412413742070034426 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotPrefixValuesWithEnumNameRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Naming; using Gendarme.Framework.Rocks; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Naming { [TestFixture] public class DoNotPrefixValuesWithEnumNameTest { private DoNotPrefixValuesWithEnumNameRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.Naming.DoNotPrefixValuesWithEnumNameTest"); rule = new DoNotPrefixValuesWithEnumNameRule (); runner = new TestRunner (rule); } private TypeDefinition GetTest (string name) { foreach (TypeDefinition nestedType in type.NestedTypes) { if (nestedType.Name == name) return nestedType; } return null; } struct NonEnum { int NonEnum1, NonEnum2; } [Test] public void TestNonEnum () { TypeDefinition type = GetTest ("NonEnum"); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } enum FalsePositive { A, B, C } [Test] public void TestFalsePositive () { TypeDefinition type = GetTest ("FalsePositive"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } enum SameName { A, B, C, SameName } [Test] public void TestSameName () { TypeDefinition type = GetTest ("SameName"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } enum Prefix { A, PREfiXB, C } [Test] public void TestReserved () { TypeDefinition type = GetTest ("Prefix"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Test/UseSingularNameInEnumsUnlessAreFlagsTest.cs0000664000175000017500000000570712413742070035725 0ustar00directhexdirecthex00000000000000// // Unit Test for UseSingularNameInEnumsUnlessAreFlags Rule. // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Naming; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Naming { public enum DayOfWeek { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday } public enum DateTimeKinds { Local, Unspecified, Utc } [Flags] public enum StringSplitOptions { None, RemoveEmptyEntries } [TestFixture] public class UseSingularNameInEnumsUnlessAreFlagsTest { private ITypeRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new UseSingularNameInEnumsUnlessAreFlagsRule (); runner = new TestRunner (rule); } [Test] public void TestEnumHasSingularName () { type = assembly.MainModule.GetType ("Test.Rules.Naming.DayOfWeek"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } [Test] public void TestEnumHasPluralName () { type = assembly.MainModule.GetType ("Test.Rules.Naming.DateTimeKinds"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "RuleResult"); Assert.AreEqual (1, runner.Defects.Count, "Count"); } [Test] public void TestFlagsAllowedToHavePluralNames () { type = assembly.MainModule.GetType ("Test.Rules.Naming.StringSplitOptions"); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckType (type), "RuleResult"); Assert.AreEqual (0, runner.Defects.Count, "Count"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/UseCorrectPrefixRule.cs0000664000175000017500000001250712413742070031066 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.UseCorrectPrefixRule class // // Authors: // Daniel Abramov // Sebastien Pouliot // // (C) 2007 Daniel Abramov // Copyright (C) 2008, 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; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { // TODO: It would be nice to replace the C check with a more general hungarian name // rule. /// /// This rule ensures that types are prefixed correctly. Interfaces should always be prefixed /// with a I, types should never be prefixed with a C (reminder for MFC folks) /// and generic parameters should be a single, uppercased letter or be prefixed with T. /// /// /// Bad examples: /// /// public interface Phone { /// // ... /// } /// /// public class CPhone : Phone { /// // ... /// } /// /// public class Call<Mechanism> { /// // ... /// } /// /// /// /// Good examples: /// /// public interface IPhone { /// // ... /// } /// /// public class Phone : IPhone { /// // ... /// } /// /// public class Call<TMechanism> { /// // ... /// } /// /// [Problem ("This type starts with an incorrect prefix or does not start with the required one. All interface names should start with the 'I' letter, followed by another capital letter. All other type names should not have any specific prefix.")] [Solution ("Rename the type to have the correct prefix.")] [FxCopCompatibility ("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")] [FxCopCompatibility ("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")] public class UseCorrectPrefixRule : Rule, ITypeRule { private static bool IsCorrectTypeName (string name) { if (name.Length < 3) return true; switch (name [0]) { case 'C': // MFC like CMyClass should fail - but works for CLSCompliant case 'I': // interface-like - Classes beginning with In or Is etc should pass, e.g. InMemoryDoohicky return Char.IsLower (name [1]) ? true : Char.IsUpper (name [2]); default: return true; } } private static bool IsCorrectInterfaceName (string name) { if (name.Length < 3) return false; return ((name [0] == 'I') && Char.IsUpper (name [1])); } private static bool IsCorrectGenericParameterName (string name) { return (((name.Length > 1) && (name [0] != 'T')) || Char.IsLower (name [0])); } public RuleResult CheckType (TypeDefinition type) { if (type.IsGeneratedCode ()) return RuleResult.DoesNotApply; string name = type.Name; if (type.IsInterface) { // interfaces should look like 'ISomething' if (!IsCorrectInterfaceName (name)) { string s = String.Format (CultureInfo.InvariantCulture, "The '{0}' interface name doesn't have the required 'I' prefix. Acoording to existing naming conventions, all interface names should begin with the 'I' letter followed by another capital letter.", name); Runner.Report (type, Severity.Critical, Confidence.High, s); } } else { // class should _not_ look like 'CSomething" or like an interface 'IOops' if (!IsCorrectTypeName (name)) { string s = String.Format (CultureInfo.InvariantCulture, "The '{0}' type name starts with '{1}' prefix but, according to existing naming conventions, type names should not have any specific prefix.", name, name [0]); Runner.Report (type, Severity.Medium, Confidence.High, s); } } if (type.HasGenericParameters) { // check generic parameters. They are commonly a single letter T, V, K (ok) // but if they are longer (than one char) they should start with a 'T' // e.g. EventHandler foreach (GenericParameter parameter in type.GenericParameters) { string param_name = parameter.Name; if (IsCorrectGenericParameterName (param_name)) { string s = String.Format (CultureInfo.InvariantCulture, "The generic parameter '{0}' should be prefixed with 'T' or be a single, uppercased letter.", param_name); Runner.Report (type, Severity.High, Confidence.High, s); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/DetectNonAlphaNumericsInTypeNamesRule.cs0000664000175000017500000001527312413742070034311 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.AvoidNonAlphanumericIdentifierRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { // TODO: This is a confusing rule. It's called "AvoidNonAlphanumericIdentifierRule" and // the summary suggests that it will fire for non-alphanumeric characters, but the // problem/solution text and the code only check for underscores. The code suggests // that it's only neccesary to check for underscores because the compiler will catch the // others which seems to be true for gmcs 2.4. However section 9.4.2 of the standard // clearly states that character classes like Lm should be allowed which seems like something // the rule should fire for (see http://www.fileformat.info/info/unicode/category/Lm/index.htm). // Also other compilers may very well be more lenient about which characters they accept. // // It seems to me that this rule should explain why underscores and unusual letters are // a problem and fire if a character not in [a-zA-Z0-9] is used. And of course the summary // and problem texts should be synced up. /// /// This rule ensures that identifiers like assembly names, namespaces, types and /// members names don't have any non-alphanumerical characters inside them. The rule /// will ignore interfaces used for COM interoperability - i.e. decorated with both /// [InterfaceType] and [Guid] attributes. /// /// /// Bad example: /// /// namespace New_Namespace { /// /// public class My_Custom_Class { /// /// public int My_Field; /// /// public void My_Method (string my_string) /// { /// } /// } /// } /// /// /// /// Good example: /// /// namespace NewNamespace { /// /// public class MyCustomClass { /// /// public int MyField; /// /// public void MyMethod (string myString) /// { /// } /// } /// } /// /// /// Prior to Gendarme 2.2 this rule was named DetectNonAlphanumericInTypeNamesRule [Problem ("This namespace, type or member name contains underscore(s).")] [Solution ("Remove the underscore from the specified name.")] [EngineDependency (typeof (NamespaceEngine))] [FxCopCompatibility ("Microsoft.Naming", "CA1707:IdentifiersShouldNotContainUnderscores")] public class AvoidNonAlphanumericIdentifierRule : Rule, IAssemblyRule, IMethodRule, ITypeRule { // Compiler generates an error for any other non alpha-numerics than underscore ('_'), // so we just need to check the presence of underscore in method names private static bool CheckName (string name, bool special) { int start = special ? name.IndexOf ('_') + 1: 0; return (name.IndexOf ('_', start) == -1); } private static bool UsedForComInterop (TypeDefinition type) { return (type.IsInterface && type.HasAttribute ("System.Runtime.InteropServices", "GuidAttribute") && type.HasAttribute ("System.Runtime.InteropServices", "InterfaceTypeAttribute")); } public RuleResult CheckAssembly (AssemblyDefinition assembly) { if (!CheckName (assembly.Name.Name, false)) Runner.Report (assembly, Severity.Medium, Confidence.High); // check every namespaces inside the assembly using the NamespaceEngine foreach (string ns in NamespaceEngine.NamespacesInside (assembly)) { if (!CheckName (ns, false)) Runner.Report (NamespaceDefinition.GetDefinition (ns), Severity.Medium, Confidence.High); } return Runner.CurrentRuleResult; } public RuleResult CheckType (TypeDefinition type) { // type must be visible and not generated by the compiler (or a tool) if (!type.IsVisible () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // the rule does not apply if the code is an interface to COM objects if (UsedForComInterop (type)) return RuleResult.DoesNotApply; // check the type name if (!CheckName (type.Name, false)) { Runner.Report (type, Severity.Medium, Confidence.High); } // CheckMethod covers methods, properties and events (indirectly) // but we still need to cover fields if (type.HasFields) { bool is_enum = type.IsEnum; foreach (FieldDefinition field in type.Fields) { if (!field.IsVisible ()) continue; // ignore "value__" inside every enumeration if (is_enum && !field.IsStatic) continue; if (!CheckName (field.Name, false)) { Runner.Report (field, Severity.Medium, Confidence.High); } } } return Runner.CurrentRuleResult; } public RuleResult CheckMethod (MethodDefinition method) { // exclude constrcutors, non-visible methods and generated code if (method.IsConstructor || !method.IsVisible () || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // the rule does not apply if the code is an interface to COM objects if (UsedForComInterop (method.DeclaringType as TypeDefinition)) return RuleResult.DoesNotApply; // check the method name if (!CheckName (method.Name, method.IsSpecialName)) Runner.Report (method, Severity.Medium, Confidence.High); if (method.HasParameters) { foreach (ParameterDefinition parameter in method.Parameters) { if (!CheckName (parameter.Name, false)) Runner.Report (parameter, Severity.Medium, Confidence.High); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/UsePreferredTermsRule.cs0000664000175000017500000001752212413742070031242 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.UsePreferredTermsRule class // // Authors: // Daniel Abramov // Sebastien Pouliot // // (C) 2007 Daniel Abramov // 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule ensures that identifiers such as assemblies, namespaces, types, and members, /// use the terms suggested by the .NET framework guidelines so that they are consistent /// with other class libraries. /// /// Arent should be replaced with AreNot; /// Cancelled should be replaced with Canceled; /// Cant should be replaced with Cannot; /// ComPlus should be replaced with EnterpriseServices; /// Couldnt should be replaced with CouldNot; /// Didnt should be replaced with DidNot; /// Doesnt should be replaced with DoesNot; /// Dont should be replaced with DoNot; /// Hadnt should be replaced with HadNot; /// Hasnt should be replaced with HasNot; /// Havent should be replaced with HaveNot; /// Indices should be replaced with Indexes; /// Isnt should be replaced with IsNot; /// LogIn should be replaced with LogOn; /// LogOut should be replaced with LogOff; /// Shouldnt should be replaced with ShouldNot; /// SignOn should be replaced with SignIn; /// SignOff should be replaced with SignOut; /// Wasnt should be replaced with WasNot; /// Werent should be replaced with WereNot; /// Wont should be replaced with WillNot; /// Wouldnt should be replaced with WouldNot; /// Writeable should be replaced with Writable; /// /// /// /// Bad example: /// /// abstract public class ComPlusSecurity { /// abstract public void LogIn (); /// abstract public void LogOut (); /// } /// /// /// /// Good example: /// /// abstract public class EnterpriseServicesSecurity { /// abstract public void LogOn (); /// abstract public void LogOff (); /// } /// /// [Problem ("The identifier contains non-recommended term(s).")] [Solution ("For consistency replace any non-recommended term with the preferred one.")] [EngineDependency (typeof (NamespaceEngine))] [FxCopCompatibility ("Microsoft.Naming", "CA1726:UsePreferredTerms")] public class UsePreferredTermsRule : Rule, IAssemblyRule, ITypeRule, IMethodRule { private const string Message = "Term '{0}' should be replaced with '{1}'."; // keys are obsolete terms, values are preferred ones // list is based on the FxCop naming rule (as the whole rule is inspired by it) // http://msdn.microsoft.com/en-us/library/ms182258.aspx private static Dictionary preferredTerms = new Dictionary () { { "Arent", "AreNot" }, { "Cancelled", "Canceled" }, { "Cant", "Cannot" }, { "ComPlus", "EnterpriseServices" }, { "Couldnt", "CouldNot" }, { "Didnt", "DidNot" }, { "Doesnt", "DoesNot" }, { "Dont", "DoNot" }, { "Hadnt", "HadNot" }, { "Hasnt", "HasNot" }, { "Havent", "HaveNot" }, { "Indices", "Indexes" }, { "Isnt", "IsNot" }, { "LogIn", "LogOn" }, { "LogOut", "LogOff" }, { "Shouldnt", "ShouldNot" }, { "SignOn", "SignIn" }, { "SignOff", "SignOut" }, { "Wasnt", "WasNot" }, { "Werent", "WereNot" }, { "Wont", "WillNot" }, { "Wouldnt", "WouldNot" }, { "Writeable", "Writable" } }; // Reports a defect when 'name' contains a non-recommended term. // * identifier: Metadata token for 'name' or null if it is a namespace. // * name: Name to check. // * severity: Severity for the defect to be reported (if any). private void CheckIdentifier (IMetadataTokenProvider identifier, string name, Severity severity) { // scan for any obsolete terms foreach (KeyValuePair pair in preferredTerms) { int index = name.IndexOf (pair.Key, StringComparison.OrdinalIgnoreCase); if (index == -1) continue; if (index > 0 && char.IsLetter (name, index - 1) && char.IsLower (name, index)) continue; //term is part of a larger word string s = String.Format (CultureInfo.InvariantCulture, Message, pair.Key, pair.Value); Runner.Report (identifier, severity, Confidence.High, s); } } public RuleResult CheckAssembly (AssemblyDefinition assembly) { // assembly names are very visible, severity == high CheckIdentifier (assembly, assembly.Name.Name, Severity.High); // check every namespaces inside the assembly using the NamespaceEngine // note: we don't reuse CheckIdentifier because we want to avoid // creating Namespace instance unless necessary foreach (string ns in NamespaceEngine.NamespacesInside (assembly)) CheckIdentifier (NamespaceDefinition.GetDefinition (ns), ns, Severity.Medium); return Runner.CurrentRuleResult; } public RuleResult CheckType (TypeDefinition type) { CheckIdentifier (type, type.Name, type.IsVisible () ? Severity.Medium : Severity.Low); if (type.HasFields) { // fields should not be visible (in most case) so we always report low foreach (FieldDefinition field in type.Fields) CheckIdentifier (field, field.Name, Severity.Low); } return Runner.CurrentRuleResult; } public RuleResult CheckMethod (MethodDefinition method) { CheckIdentifier (method, method.Name, method.IsVisible () ? Severity.Medium : Severity.Low); // we're not checking parameters return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/Makefile.am0000664000175000017500000000225312413742070026504 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AvoidDeepNamespaceHierarchyRule.cs \ AvoidRedundancyInMethodNameRule.cs \ AvoidRedundancyInTypeNameRule.cs \ AvoidTypeInterfaceInconsistencyRule.cs \ DetectNonAlphaNumericsInTypeNamesRule.cs \ DoNotPrefixEventsWithAfterOrBeforeRule.cs \ DoNotPrefixValuesWithEnumNameRule.cs \ DoNotUseReservedInEnumValueNamesRule.cs \ ParameterNamesShouldMatchOverridenMethodRule.cs \ UseCorrectCasingRule.cs \ UseCorrectPrefixRule.cs \ UseCorrectSuffixRule.cs \ UsePluralNameInEnumFlagsRule.cs \ UsePreferredTermsRule.cs \ UseSingularNameInEnumsUnlessAreFlagsRule.cs tests_sources = \ AvoidDeepNamespaceHierarchyTest.cs \ AvoidRedundancyInMethodNameTest.cs \ AvoidRedundancyInTypeNameTest.cs \ AvoidTypeInterfaceInconsistencyTest.cs \ DetectNonAlphaNumericsInTypeNamesTest.cs \ DoNotPrefixEventsWithAfterOrBeforeTest.cs \ DoNotPrefixValuesWithEnumNameTest.cs \ DoNotUseReservedInEnumValueNamesTest.cs \ ParameterNamesShouldMatchOverridenMethodTest.cs \ UsePluralNameInEnumFlagsTest.cs \ UseSingularNameInEnumsUnlessAreFlagsTest.cs \ UseCorrectCasingTest.cs \ UseCorrectPrefixTest.cs \ UseCorrectSuffixTest.cs \ UsePreferredTermsTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/DoNotPrefixEventsWithAfterOrBeforeRule.cs0000664000175000017500000000575712413742070034473 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.DoNotPrefixEventsWithAfterOrBeforeRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule ensures that event names are not prefixed with After or Before. /// The .NET naming conventions recommend using a verb in the present and in /// the past tense. /// /// /// Bad example: /// /// public class Bad { /// public event ResolveEventHandler BeforeResolve; /// public event ResolveEventHandler AfterResolve; /// } /// /// /// /// Good example: /// /// public class Good { /// public event ResolveEventHandler Resolving; // present /// public event ResolveEventHandler Resolved; // past /// } /// /// [Problem ("This type contains event(s) whose names start with either After or Before.")] [Solution ("Rename the event(s) to have a correct prefix. E.g. replace After with the future tense, and Before with the past tense.")] [FxCopCompatibility ("Microsoft.Naming", "CA1713:EventsShouldNotHaveBeforeOrAfterPrefix")] public class DoNotPrefixEventsWithAfterOrBeforeRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule does not apply to enumerations and delegates if (type.IsEnum || type.IsDelegate ()) return RuleResult.DoesNotApply; // quick out if there are no events if (!type.HasEvents) return RuleResult.Success; foreach (EventDefinition evnt in type.Events) { string name = evnt.Name; if (name.StartsWith ("After", StringComparison.Ordinal) || name.StartsWith ("Before", StringComparison.Ordinal)) { Runner.Report (evnt, Severity.Medium, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/AvoidTypeInterfaceInconsistencyRule.cs0000664000175000017500000000637512413742070034136 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.AvoidTypeInterfaceInconsistencyRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule will fire if an assembly has a namespace which contains an interface IFoo /// and a type Foo, but the type does not implement the interface. If an interface and /// a type name differ only by the I prefix (of the interface) then we can /// logically expect the type to implement this interface. /// /// /// Bad example: /// /// public interface IMember { /// string Name { /// get; /// } /// } /// /// public class Member { /// public string Name { /// get { /// return String.Empty; /// } /// } /// } /// /// /// /// Good example: /// /// public interface IMember { /// string Name { /// get; /// } /// } /// /// public class Member : IMember { /// public string Name { /// get { /// return String.Empty; /// } /// } /// } /// /// /// This rule is available since Gendarme 2.4 [Problem ("This interface is not implemented by the type of the same name (minus the 'I' prefix).")] [Solution ("Rename either the interface or the type to something else or implement the interface for the type.")] public class AvoidTypeInterfaceInconsistencyRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies only to interfaces if (!type.IsInterface) return RuleResult.DoesNotApply; // badly named interface, we let another rule report this string name = type.Name; if (name [0] != 'I') return RuleResult.DoesNotApply; string nspace = type.Namespace; TypeDefinition candidate = type.Module.GetType (nspace, name.Substring (1)); if (candidate != null) { // does Foo implement IFoo ? if (!candidate.Implements (nspace, name)) { Runner.Report (candidate, Severity.High, Confidence.High); } } return RuleResult.Success; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Naming/UsePluralNameInEnumFlagsRule.cs0000664000175000017500000000534212413742070032437 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Naming.UsePluralNameInEnumFlagsRule class // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Naming { /// /// This rule ensures that the name of enumerations decorated with FlagsAttribute are /// in plural form. /// /// /// Bad example: /// /// [Flags] /// public enum MyCustomValue { /// Foo, /// Bar, /// AllValues = Foo | Bar /// } /// /// /// /// Good example: /// /// [Flags] /// public enum MyCustomValues { /// Foo, /// Bar, /// AllValues = Foo | Bar /// } /// /// [Problem ("This type is a flags enumeration and, by convention, should have a plural name.")] [Solution ("Convert this enumeration type name from singular to plural.")] [FxCopCompatibility ("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames")] public class UsePluralNameInEnumFlagsRule : Rule, ITypeRule { private static bool IsPlural (string typeName) { return String.Compare (typeName, typeName.Length - 1, "s", 0, 1, true, CultureInfo.CurrentCulture) == 0; } public RuleResult CheckType (TypeDefinition type) { // rule applies only to enums with [Flags] attribute if (!type.IsFlags ()) return RuleResult.DoesNotApply; // rule applies if (IsPlural (type.Name)) return RuleResult.Success; // Confidence == Normal because valid names may end with 's' Runner.Report (type, Severity.Low, Confidence.Normal); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/0000775000175000017500000000000012642235742026030 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/ChangeLog0000664000175000017500000001107012413742070027572 0ustar00directhexdirecthex000000000000002010-06-14 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeRule.cs: Apply AvoidRepetitiveCalls ToPropertiesRule on GenericParameter.get_FullName 2010-06-10 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeRule.cs: Reduce severity to low if the generic type is used for the return value 2010-06-04 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-05-16 Sebastien Pouliot * AvoidDeclaringCustomDelegatesRule.cs: * DoNotExposeNestedGenericSignaturesRule.cs: * UseGenericEventHandlerRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-01-29 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeRule.cs: Apply AvoidRepetitiveCalls ToPropertiesRule on GenericParameter.get_FullName 2010-01-19 Jb Evain * AvoidMethodWithUnusedGenericTypeRule.cs: Fix the case where the parameter type is a type specification of a generic type, such as an array. 2010-01-01 Sebastien Pouliot * AvoidDeclaringCustomDelegatesRule.cs: New. Rule to check if custom delegates could be replaced with Action/Func for .net 2.0 and later * Makefile.am: Add new rule and tests to the build 2009-07-03 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2008-12-29 Sebastien Pouliot * DoNotExposeNestedGenericSignaturesRule.cs: New. Rule to check if nested generics are being exposed in visible API. * Makefile.am: Add new rule and test to the build. 2008-11-30 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeRule.cs: Use HasParameters. * PreferGenericsOverRefObjectRule.cs: Use HasGenericParameters. * UseGenericEventHandlerRule.cs: Use HasParameters. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Design.Generic.mdp: * Gendarme.Rules.Design.Generic.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-26 Sebastien Pouliot * PreferGenericsOverRefObjectRule.cs: New. Rule that check method parameters to look for reference to System.Object that could be, with 2.0 and later, replaced by generics. * Makefile.am: Add new rule and test to the build. * Gendarme.Rules.Design.Generic.mdp: Update MD project file. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. * Gendarme.Rules.Design.Generic.csproj: Added an empty placeholder file in order to avoid breaking the build process. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Design.Generic.xml, Gendarme.Rules.Design.Generic: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-15 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeRule.cs: Recursively check GenericInstanceType and GenericParameter. * UseGenericEventHandlerRule.cs: Handle System.MulticastDelegate special case (since there's no Invoke). 2008-09-14 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeRule.cs, ImplementGenericCollectionInterfacesRule.cs, UseGenericEventHandlerRule.cs: Add XML documentation for the rules (then converted into media wiki format). 2008-09-10 Sebastien Pouliot * Gendarme.Rules.Design.Generic.mdp: New. Add MD project file. 2008-09-07 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeRule.cs: New. This rule warns if some generic parameters types are not being used by the method parameters. * Makefile.am: Add new files to the build. 2008-08-30 Sebastien Pouliot * UseGenericEventHandlerRule.cs: New. Rule to promote the use of generic based EventHandler instead of using delegates (like fx 1.x required). * Makefile.am: Add new files to the build. 2008-08-26 Sebastien Pouliot * ImplementGenericCollectionInterfacesRule.cs: Moved from Design. Added FxCopCompatibility attribute. * Makefile.am: New. Build file. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/AvoidDeclaringCustomDelegatesRule.cs0000664000175000017500000001375512413742070035077 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.Generic.AvoidDeclaringCustomDelegatesRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// This rule will fire if custom delegates are defined when either pre-defined System.Action, /// Action<T[,...]> or Func<[Tx,...]TResult> could have been used. /// /// /// Bad example (without return value): /// /// delegate void MyCustomDelegate (int a); /// private MyCustomDelegate custom_delegate; /// /// /// /// Good example (without return value): /// /// private Action<int> action_delegate; /// /// /// /// Bad example (with return value): /// /// delegate int MyCustomDelegate (int a, string s); /// private MyCustomDelegate custom_delegate; /// /// /// /// Good example (with return value): /// /// private Func<int,string,int> func_delegate; /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("This delegate could be replaced with an existing framework delegate.")] [Solution ("Prefer the use of Action, Action and Func<...,TResult> types.")] public class AvoidDeclaringCustomDelegatesRule : GenericsBaseRule, ITypeRule { static string[] ActionMessage = { "Replace with Action()", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", // NET_4_0 "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", "Replace with Action", }; static string [] FuncMessage = { "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", // NET_4_0 "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", "Replace with Func", }; public RuleResult CheckType (TypeDefinition type) { // rule only apply to (non generated) delegates if (!type.IsDelegate () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; MethodDefinition invoke = type.GetMethod ("Invoke"); // this happens for System.MulticastDelegate if (invoke == null) return RuleResult.DoesNotApply; int n = 0; Severity severity = Severity.Medium; bool use_structure = false; // check parameters for 'ref', 'out', 'params' if (invoke.HasParameters) { IList pdc = invoke.Parameters; n = pdc.Count; // too many parameters to directly use Action/Func // so we lower severity and suggest grouping them if (n > ((type.Module.Runtime >= TargetRuntime.Net_4_0) ? 16 : 4)) { severity = Severity.Low; n = 1; use_structure = true; } // special cases not directly usable with Action/Func foreach (ParameterDefinition pd in pdc) { if (pd.IsOut || pd.ParameterType.IsByReference || pd.IsParams ()) return RuleResult.Success; } } string msg = invoke.ReturnType.IsNamed ("System", "Void") ? ActionMessage [n] : FuncMessage [n]; if (use_structure) msg += " and use a structure to hold all your parameters into ."; Runner.Report (type, severity, Confidence.High, msg); return Runner.CurrentRuleResult; } } } DoNotDeclareStaticMembersOnGenericTypesRule.cs0000664000175000017500000000554312413742070036735 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic// // Gendarme.Rules.Design.Generic.DoNotDeclareStaticMembersOnGenericTypesRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// This rule checks for generic types that contain static members. Such members requires the type argument /// to be specified when consumed, leading to harder to use or confusing API. /// /// /// Bad example: /// /// public class BadClass<T> { /// public static string Member () { /// } /// } /// /// /// /// Good example: /// /// public class GoodClass<T> { /// public string Member () { /// } /// } /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("An externally visible generic type has a static member.")] [Solution ("Remove the static member or change it to an instance member.")] [FxCopCompatibility ("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")] public class DoNotDeclareStaticMembersOnGenericTypesRule : GenericsBaseRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (!type.IsClass || !type.HasGenericParameters || !type.IsVisible ()) return RuleResult.DoesNotApply; if (type.HasFields) { foreach (var field in type.Fields) { if (field.IsStatic && field.IsVisible ()) Runner.Report (field, Severity.Medium, Confidence.Total); } } if (type.HasMethods) { foreach (var method in type.Methods) { if (method.IsStatic && method.IsVisible ()) Runner.Report (method, Severity.Medium, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/AvoidMethodWithUnusedGenericTypeRule.cs0000664000175000017500000001217212413742070035565 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.Generic.AvoidMethodWithUnusedGenericTypeRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008,2010-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.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// This method will fire if a generic method does not use all of its generic type parameters /// in the formal parameter list. This usually means that either the type parameter is not used at /// all in which case it should be removed or that it's used only for the return type which /// is problematic because that prevents the compiler from inferring the generic type /// when the method is called which is confusing to many developers. /// /// /// Bad example: /// /// public class Bad { /// public string ToString<T> () /// { /// return typeof (T).ToString (); /// } /// /// static void Main () /// { /// // the compiler can't infer int so we need to supply it ourselves /// Console.WriteLine (ToString<int> ()); /// } /// } /// /// /// /// Good example: /// /// public class Good { /// public string ToString<T> (T obj) /// { /// return obj.GetType ().ToString (); /// } /// /// static void Main () /// { /// Console.WriteLine (ToString (2)); /// } /// } /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("One or more generic type parameters are not used in the formal parameter list.")] [Solution ("This prevents the compiler from inferring types when the method is used which results in hard to use API definitions.")] [FxCopCompatibility ("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")] public class AvoidMethodWithUnusedGenericTypeRule : GenericsBaseRule, IMethodRule { static bool FindGenericType (IGenericInstance git, string nameSpace, string name) { foreach (object o in git.GenericArguments) { if (IsGenericParameter (o, nameSpace, name)) return true; GenericInstanceType inner = (o as GenericInstanceType); if ((inner != null) && (FindGenericType (inner, nameSpace, name))) return true; } return false; } static bool IsGenericParameter (object obj, string nameSpace, string name) { return (obj as GenericParameter).IsNamed (nameSpace, name); } static bool IsGenericType (TypeReference type, string nspace, string name) { if (type.IsNamed (nspace, name)) return true; var type_spec = type as TypeSpecification; if (type_spec != null && type_spec.ElementType.IsNamed (nspace, name)) return true; // handle things like ICollection GenericInstanceType git = (type as GenericInstanceType); if (git == null) return false; return FindGenericType (git, nspace, name); } public RuleResult CheckMethod (MethodDefinition method) { // rule applies only if the method has generic type parameters if (!method.HasGenericParameters || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // look if every generic type parameter... foreach (GenericParameter gp in method.GenericParameters) { Severity severity = Severity.Medium; bool found = false; string nspace = gp.Namespace; string name = gp.Name; // ... is being used by the method parameters foreach (ParameterDefinition pd in method.Parameters) { if (IsGenericType (pd.ParameterType, nspace, name)) { found = true; break; } } if (!found) { // it's a defect when used only for the return value - but we reduce its severity if (IsGenericType (method.ReturnType, nspace, name)) severity = Severity.Low; } if (!found) { string msg = String.Format (CultureInfo.InvariantCulture, "Generic parameter '{0}.{1}' is not used by the method parameters.", nspace, name); Runner.Report (method, severity, Confidence.High, msg); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Makefile.in0000664000175000017500000006636312642235731030111 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Design.Generic ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -r:System.Xml.dll \ -r:System.Xml.Linq.dll console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AvoidDeclaringCustomDelegatesRule.cs \ AvoidExcessiveParametersOnGenericTypesRule.cs \ AvoidMethodWithUnusedGenericTypeRule.cs \ DoNotDeclareStaticMembersOnGenericTypesRule.cs \ DoNotExposeGenericListsRule.cs \ DoNotExposeNestedGenericSignaturesRule.cs \ GenericsBaseRule.cs \ ImplementGenericCollectionInterfacesRule.cs \ PreferGenericsOverRefObjectRule.cs \ UseGenericEventHandlerRule.cs tests_sources = \ AvoidDeclaringCustomDelegatesTest.cs \ AvoidExcessiveParametersOnGenericTypesTest.cs \ AvoidMethodWithUnusedGenericTypeTest.cs \ DoNotDeclareStaticMembersOnGenericTypesTest.cs \ DoNotExposeGenericListsTest.cs \ DoNotExposeNestedGenericSignaturesTest.cs \ ImplementGenericCollectionInterfacesTest.cs \ PreferGenericsOverRefObjectTest.cs \ UseGenericEventHandlerTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Design.Generic/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Design.Generic/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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: DoNotExposeNestedGenericSignaturesRule.cs0000664000175000017500000001020412413742070036032 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic// // Gendarme.Rules.Design.Generic.DoNotExposeNestedGenericSignaturesRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// This rule will fire if an externally visible method has a parameter or return type /// whose type is a generic type which contains a generic type. For example, /// List<List<int>>. Such types are hard to construct and should /// be avoided because simpler alternatives generally exist. /// Since some language, like C#, have direct support for nullable types, i.e. /// System.Nullable<T> this specific case is ignored by the rule. /// /// /// Bad example: /// /// public class Generic<T> { /// public void Process (KeyValuePair<T, ICollection<int>> value) /// { /// } /// } /// /// /// /// Good example: /// /// public class Generic<T> { /// public void Process (KeyValuePair<T, int[]> value) /// { /// } /// } /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("This method exposes a nested generic type in its signature.")] [Solution ("Remove the nested generics to keep the visible API simple to use.")] [FxCopCompatibility ("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")] public class DoNotExposeNestedGenericSignaturesRule : GenericsBaseRule, IMethodRule { static Severity? Check (TypeReference type) { GenericInstanceType git = (type as GenericInstanceType); if ((git != null) && git.HasGenericArguments) { foreach (TypeReference tr in git.GenericArguments) { git = (tr as GenericInstanceType); if (git != null) { // nullable are an exception because there is syntaxic sugar (at // least in some language like C#) to make them easier to use // note: FxCop does not ignore them if (git.ElementType.IsNamed ("System", "Nullable`1")) return null; // FIXME: we should look at ignoring LINQ queries too, because it // too pretty much hides the complexity of nested generics return Severity.High; } } } return null; } public RuleResult CheckMethod (MethodDefinition method) { // note: using anonymous methods creates a lot of defects but they are all non-visible if (!method.IsVisible ()) return RuleResult.DoesNotApply; MethodReturnType return_type = method.MethodReturnType; Severity? severity = Check (return_type.ReturnType); if (severity.HasValue) Runner.Report (return_type, severity.Value, Confidence.Total); if (method.HasParameters) { foreach (ParameterDefinition parameter in method.Parameters) { severity = Check (parameter.ParameterType); if (severity.HasValue) Runner.Report (parameter, severity.Value, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Gendarme.Rules.Design.Generic.csproj0000664000175000017500000001347212413742070034650 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {5446570C-A304-418D-B908-91ADA51E4F00} Library Properties Gendarme.Rules.Design.Generic Gendarme.Rules.Design.Generic v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Design.Generic.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Design.Generic.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/GenericsBaseRule.cs0000664000175000017500000000335612413742070031541 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.Generic.GenericBaseRule // // Authors: // Sebastien Pouliot // // 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.Cecil; using Gendarme.Framework; namespace Gendarme.Rules.Design.Generic { public abstract class GenericsBaseRule : Rule { public override void Initialize (IRunner runner) { base.Initialize (runner); // we only want to run Design.Generic.* rules on assemblies that // use 2.0 or later since generics were not available before Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentModule.Runtime >= TargetRuntime.Net_2_0); }; } } } ImplementGenericCollectionInterfacesRule.cs0000664000175000017500000000703112413742070036371 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic// // Gendarme.Rules.Design.Generic.ImplementGenericCollectionInterfacesRule // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// This rule checks for types which implement the non-generic System.IEnumerable interface but /// not the System.IEnumerable<T> interface. Implementing the generic version /// of System.IEnumerable avoids casts, and possibly boxing, when iterating the collection. /// /// /// Bad example: /// /// public class IntEnumerable : IEnumerable { /// public IEnumerator GetEnumerator () /// { /// } /// } /// /// /// /// Good example: /// /// public class IntEnumerable : IEnumerable<int> { /// public IEnumerator<int> GetEnumerator () /// { /// } /// /// IEnumerator IEnumerable.GetEnumerator () /// { /// } /// } /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("This type implements the non-generic IEnumerable interface but not IEnumerable which would make your collection type-safe.")] [Solution ("Implement one of generic collection interfaces such as IEnumerable, ICollection or IList.")] [FxCopCompatibility ("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")] public class ImplementGenericCollectionInterfacesRule : GenericsBaseRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule does not apply to enums, interfaces and generated code if (type.IsEnum || type.IsInterface || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // rule applies only to visible types if (!type.IsVisible ()) return RuleResult.DoesNotApply; // rule only applies if the type implements IEnumerable if (!type.Implements ("System.Collections", "IEnumerable")) return RuleResult.DoesNotApply; // rule does not apply to the types implementing IDictionary if (type.Implements ("System.Collections", "IDictionary")) return RuleResult.DoesNotApply; // the type should implement IEnumerable too if (!type.Implements ("System.Collections.Generic", "IEnumerable`1")) Runner.Report (type, Severity.Medium, Confidence.High); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/PreferGenericsOverRefObjectRule.cs0000664000175000017500000000647712413742070034541 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.Generic.PreferGenericsOverRefObjectRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// This rule fires if a method has a reference argument (ref or /// out in C#) to System.Object. These methods can generally be /// rewritten in .NET 2.0 using generics which provides type safety, eliminates /// casts, and makes the API easier to consume. /// /// /// Bad example: /// /// // common before 2.0 but we can do better now /// public bool TryGetValue (string key, ref object value) /// { /// // ... /// } /// /// /// /// Good example: /// /// public bool TryGetValue<T> (string key, ref T value) /// { /// // ... /// } /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("This method contains a reference parameter to System.Object which is often an indication that the code is not type safe.")] [Solution ("Change the parameter to use a generic type where the caller will provide the type.")] [FxCopCompatibility ("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] public class PreferGenericsOverRefObjectRule : GenericsBaseRule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply to properties, events, without parameters or for generated code if (method.IsSpecialName || !method.HasParameters || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // exclude the "bool Try* (ref)" pattern from the rule if (method.Name.StartsWith ("Try", StringComparison.Ordinal) && method.ReturnType.IsNamed ("System", "Boolean")) return RuleResult.DoesNotApply; foreach (ParameterDefinition parameter in method.Parameters) { if (!parameter.ParameterType.IsNamed ("System", "Object&")) continue; // suggest using generics Runner.Report (parameter, Severity.Medium, Confidence.High); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test/0000775000175000017500000000000012642235742026747 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test/ChangeLog0000664000175000017500000000255312413742070030517 0ustar00directhexdirecthex000000000000002010-06-10 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeTest.cs: Add asserts for severity 2010-01-19 Jb Evain * AvoidMethodWithUnusedGenericTypeTest.cs: add test for the case where the parameter type is an array of a generic parameter. 2010-01-01 Sebastien Pouliot * AvoidDeclaringCustomDelegatesTest.cs: New. Unit tests for AvoidDeclaringCustomDelegatesRule 2008-12-29 Sebastien Pouliot * DoNotExposeNestedGenericSignaturesTest.cs: New. Unit tests for DoNotExposeNestedGenericSignaturesRule 2008-10-25 Sebastien Pouliot * PreferGenericsOverRefObjectTest.cs: New. Unit tests for PreferGenericsOverRefObjectRule. * Test.Rules.Design.Generic.mdp: Update MD project file. 2008-09-10 Sebastien Pouliot * Test.Rules.Design.Generic.mdp: New. Add MD project file. 2008-09-07 Sebastien Pouliot * AvoidMethodWithUnusedGenericTypeTest.cs: New. Unit tests for AvoidMethodWithUnusedGenericTypeRule 2008-08-30 Sebastien Pouliot * UseGenericEventHandlerTest.cs: New. Unit tests for UseGenericEventHandlerRule 2008-08-26 Sebastien Pouliot * ImplementGenericCollectionInterfacesTest.cs: Moved from Design. * Makefile.am: New. Build file. AvoidExcessiveParametersOnGenericTypesTest.cs0000664000175000017500000000432412413742070037637 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test// // Test.Rules.Design.Generic.AvoidExcessiveParametersOnGenericTypesTest // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Design.Generic { public class GenericType1 { } public class GenericType2 { } public class GenericType3 { } [TestFixture] public class AvoidExcessiveParametersOnGenericTypesTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void Good () { AssertRuleSuccess> (); AssertRuleSuccess> (); } [Test] public void Bad () { AssertRuleFailure> (1); } } } DoNotExposeNestedGenericSignaturesTest.cs0000664000175000017500000001132712413742070036770 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test// // Unit Tests for DoNotExposeNestedGenericSignaturesRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design.Generic { [TestFixture] public class DoNotExposeNestedGenericSignaturesTest : MethodRuleTestFixture { public class IntegerCollection : List { } public class Generic { public ICollection NonGenericReturnValue () { return null; } public ICollection GenericReturnValue () { return null; } public ICollection> NestedReturnValue () { return null; } public void NonGenericParameter (ICollection value) { } public void GenericParameter (ICollection value) { } public void NestedParameter (KeyValuePair> value) { } public void UnnestedParameter (KeyValuePair value) { } public void TwoNestedParameters (KeyValuePair> value, int max, int min, ICollection> template) { } protected ICollection> All (KeyValuePair> value, int max, int min, ICollection> template) { return null; } } [Test] public void ReturnValue () { AssertRuleSuccess> ("NonGenericReturnValue"); AssertRuleSuccess> ("GenericReturnValue"); AssertRuleFailure> ("NestedReturnValue", 1); } [Test] public void Parameters () { AssertRuleSuccess> ("NonGenericParameter"); AssertRuleSuccess> ("GenericParameter"); AssertRuleFailure> ("NestedParameter", 1); AssertRuleSuccess> ("UnnestedParameter"); AssertRuleFailure> ("TwoNestedParameters", 2); } [Test] public void Both () { AssertRuleFailure> ("All", 3); } // adapted from XmlResultWriter public XElement CreateDefects () { var query = from n in Runner.Defects group n by n.Rule into a //gmcs bug// orderby a.Key.Name select new { Rule = a.Key, Value = from o in a group o by o.Target into r orderby (r.Key == null ? String.Empty : a.Key.Name) select new { Target = r.Key, Value = r } }; return new XElement ("results", from value in query select new XElement ("rule", CreateRuleDetails (value.Rule), from v2 in value.Value select new XElement ("target", CreateTargetDetails (v2.Target), from Defect defect in v2.Value select CreateDefect (defect)))); } static XObject [] CreateRuleDetails (IRule rule) { return null; } static XObject [] CreateTargetDetails (IMetadataTokenProvider target) { return null; } static XElement CreateDefect (Defect defect) { return null; } [Test] public void Linq () { AssertRuleSuccess ("CreateDefects"); } public IEnumerable NullableReturnValue () { return null; } public void NullableParameter (ICollection value) { } [Test] public void Nullable () { AssertRuleSuccess ("NullableReturnValue"); AssertRuleSuccess ("NullableParameter"); } } } AvoidDeclaringCustomDelegatesTest.cs0000664000175000017500000001102712413742070035735 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test// // Unit tests for AvoidDeclaringCustomDelegatesRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design.Generic { [TestFixture] public class AvoidDeclaringCustomDelegatesTest : TypeRuleTestFixture { [Test] public void NotApplicableBefore2_0 () { // ensure that the rule does not apply for types defined in 1.x assemblies TypeDefinition violator = DefinitionLoader.GetTypeDefinition (); TargetRuntime realRuntime = violator.Module.Runtime; try { // fake assembly runtime version and do the check violator.Module.Runtime = TargetRuntime.Net_1_1; Rule.Active = true; Rule.Initialize (Runner); Assert.IsFalse (Rule.Active, "Active"); } catch { // rollback violator.Module.Runtime = realRuntime; Rule.Active = true; } } [Test] public void NotApplicable () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } delegate void VoidNoParameter (); delegate void VoidOneParameter (int a); delegate void VoidTwoParameters (int a, string b); delegate void VoidThreeParameters (int a, string b, object c); delegate void VoidFourParameters (int a, string b, object c, float d); delegate void Void17Parameters (int a, string b, object c, float d, double e, short f, byte g, long h, int i, string j, object k, float l, double m, short n, byte o, long p, DateTime q); [Test] public void ReplaceWithAction () { AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); // we don't test 5-16 since they will be valid for NET_4_0 // having more than 16 parameters is another issue (unrelated to this rule) AssertRuleFailure (); } delegate int NonVoidNoParameter (); delegate int NonVoidOneParameter (int a); delegate int NonVoidTwoParameters (int a, string b); delegate int NonVoidThreeParameters (int a, string b, object c); delegate int NonVoidFourParameters (int a, string b, object c, float d); delegate long NonVoid17Parameters (int a, string b, object c, float d, double e, short f, byte g, long h, int i, string j, object k, float l, double m, short n, byte o, long p, DateTime q); [Test] public void ReplaceWithFunc () { AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); // we don't test 5-16 since they will be valid for NET_4_0 // having more than 16 parameters is another issue (unrelated to this rule) AssertRuleFailure (); } delegate int RefDelegate (ref int a); delegate void OutDelegate (out int a); delegate void ParamsDelegate (params object[] args); [Test] public void SpecialCases () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test/Makefile.in0000664000175000017500000003145612642235731031023 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Design.Generic/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Design.Generic.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Design.Generic/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Design.Generic/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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: DoNotDeclareStaticMembersOnGenericTypesTest.cs0000664000175000017500000000450312413742070037657 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test// // Test.Rules.Design.Generic.DoNotDeclareStaticMembersOnGenericTypesTest // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Design.Generic { public class GoodGenericClass { public T member; } public class BadGenericClass { public static T member; } public class BadGenericClass2 { public static T member1; public static void member2 () { } } [TestFixture] public class DoNotDeclareStaticMembersOnGenericTypesTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void Good () { AssertRuleSuccess> (); } [Test] public void Bad () { AssertRuleFailure> (1); AssertRuleFailure> (2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test/Tests.Rules.Design.Generic.csproj0000664000175000017500000001312212413742070035137 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {C3BDA065-4C29-48CA-907A-E35CE92F5F87} Library Properties Tests.Rules.Design.Generic Tests.Rules.Design.Generic v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {5446570C-A304-418D-B908-91ADA51E4F00} Gendarme.Rules.Design.Generic False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test/PreferGenericsOverRefObjectTest.cs0000664000175000017500000000754612413742070035466 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferGenericsOverRefObjectRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Design.Generic { [TestFixture] public class PreferGenericsOverRefObjectTest : MethodRuleTestFixture { public int Property { get { return -1; } set { ;} } public event EventHandler Event; [Test] public void DoesNotApply () { // no parameters AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.GeneratedCodeMethod); AssertRuleDoesNotApply ("get_Property"); AssertRuleDoesNotApply ("set_Property"); AssertRuleDoesNotApply ("add_Event"); AssertRuleDoesNotApply ("remove_Event"); } [Test] public void NoRefOrOut () { AssertRuleSuccess (SimpleMethods.ExternalMethod); } public int GetRef (string s, ref object obj) { int iresult; double dresult; if (Int32.TryParse (s, out iresult)) { obj = iresult; } else if (Double.TryParse (s, out dresult)) { obj = dresult; } else { obj = null; } return s.Length; } // 'out' is a special case of 'ref' public int GetOut(string s, out object obj) { int iresult; double dresult; if (Int32.TryParse (s, out iresult)) { obj = iresult; } else if (Double.TryParse (s, out dresult)) { obj = dresult; } else { obj = null; } return s.Length; } [Test] public void Bad () { AssertRuleFailure ("GetRef"); AssertRuleFailure ("GetOut"); } public int GetGenericRef (string s, ref T obj) { if (obj.GetType () == typeof (int)) obj = (T) (object) Int32.Parse (s); else if (obj.GetType () == typeof (double)) obj = (T) (object) Double.Parse (s); else obj = default (T); return s.Length; } public int GetGenericOut (string s, out T obj) { obj = default (T); if (obj.GetType () == typeof (int)) obj = (T) (object) Int32.Parse (s); else if (obj.GetType () == typeof (double)) obj = (T) (object) Double.Parse (s); return s.Length; } [Test] public void Good () { AssertRuleSuccess ("GetGenericRef"); AssertRuleSuccess ("GetGenericOut"); } public bool Try (out object o) { o = this; return true; } [Test] public void SpecialCase () { AssertRuleDoesNotApply ("SpecialCase"); } } } AvoidMethodWithUnusedGenericTypeTest.cs0000664000175000017500000001102712413742070036433 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test// // Unit Tests for AvoidMethodWithUnusedGenericTypeRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008,2010-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.Generic; using Gendarme.Framework; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Design.Generic { [TestFixture] public class AvoidMethodWithUnusedGenericTypeTest : MethodRuleTestFixture { public void NoGenericParameter () { } public class MyList : List { public void NoGenericParameter () { } } public class Tuple { public void NoGenericParameter () { } } [Test] public void DoesNotApply () { // inside a type that does NOT use generics AssertRuleDoesNotApply ("NoGenericParameter"); // inside a type that use generics AssertRuleDoesNotApply ("NoGenericParameter"); AssertRuleDoesNotApply> ("NoGenericParameter"); } public class BadCases { public void Single () { } public void Double () { } public void Triple () { } public void Partial (T value) { } } [Test] public void Bad () { AssertRuleFailure ("Single", 1); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "1"); AssertRuleFailure ("Double", 2); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "2a"); Assert.AreEqual (Severity.Medium, Runner.Defects [1].Severity, "2b"); AssertRuleFailure ("Triple", 3); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "3a"); Assert.AreEqual (Severity.Medium, Runner.Defects [1].Severity, "3b"); Assert.AreEqual (Severity.Medium, Runner.Defects [2].Severity, "3c"); AssertRuleFailure ("Partial", 1); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "4"); } public class GoodCases { public void Single (T value) { } public void Double (T key, K value) { } public void Triple (T a, K b, V c) { } public void Duplicate (T key, K min, K max) { } public void SingleArray (T [] values) { } public void GenericParameter (IEnumerable values) { } } [Test] public void Good () { AssertRuleSuccess ("Single"); AssertRuleSuccess ("Double"); AssertRuleSuccess ("Triple"); AssertRuleSuccess ("Duplicate"); AssertRuleSuccess ("SingleArray"); AssertRuleSuccess ("GenericParameter"); } // from CommonRocks public static void AddRangeIfNew (ICollection self, IEnumerable items) { foreach (T item in items) { if (!self.Contains (item)) self.Add (item); } } [Test] public void Indirect () { AssertRuleSuccess ("AddRangeIfNew"); } public T Parse (string s) { return default (T); } public IEnumerable ParseList (string s) { return null; } [Test] public void ReturnValue () { AssertRuleFailure ("Parse", 1); Assert.AreEqual (Severity.Low, Runner.Defects [0].Severity, "Low"); AssertRuleFailure ("ParseList", 1); Assert.AreEqual (Severity.Low, Runner.Defects [0].Severity, "Low"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test/Makefile.am0000664000175000017500000000016012413742070030771 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Design.Generic.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test/UseGenericEventHandlerTest.cs0000664000175000017500000000635612413742070034472 0ustar00directhexdirecthex00000000000000// // Unit tests for UseGenericEventHandlerRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design.Generic { [TestFixture] public class UseGenericEventHandlerTest : TypeRuleTestFixture { [Test] public void NotApplicable () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); } [Test] public void NotApplicableBefore2_0 () { // ensure that the rule does not apply for types defined in 1.x assemblies TypeDefinition violator = DefinitionLoader.GetTypeDefinition (); TargetRuntime realRuntime = violator.Module.Runtime; try { // fake assembly runtime version and do the check violator.Module.Runtime = TargetRuntime.Net_1_1; Rule.Active = true; Rule.Initialize (Runner); Assert.IsFalse (Rule.Active, "Active"); } catch { // rollback violator.Module.Runtime = realRuntime; Rule.Active = true; } } public delegate void Bad (object sender, EventArgs e); public delegate void BadInherited (object sender, AssemblyLoadEventArgs e); [Test] public void BadDelegates () { AssertRuleFailure (1); AssertRuleFailure (1); } public delegate bool WrongSignatureReturnValue (object sender, EventArgs e); public delegate void WrongSignatureNoObject (string sender, EventArgs e); public delegate void WrongSignatureExtraParameter (object sender, string name, EventArgs e); public delegate void WrongSignatureNoEventArgs (object sender, object e); [Test] public void GenericInterfaceNotImplementedReturnsFailure () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } } } ImplementGenericCollectionInterfacesTest.cs0000664000175000017500000001160012413742070037315 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test// // Unit tests for ImplementGenericCollectionInterfacesRule // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Design.Generic { [TestFixture] public class ImplementGenericCollectionInterfacesTest : TypeRuleTestFixture { public class PublicIDictionary : IDictionary { bool ICollection.IsSynchronized { get { throw new NotImplementedException (); } } object ICollection.SyncRoot { get { throw new NotImplementedException (); } } bool IDictionary.IsFixedSize { get { throw new NotImplementedException (); } } bool IDictionary.IsReadOnly { get { throw new NotImplementedException (); } } object IDictionary.this [object key] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } void IDictionary.Add (object key, object value) { throw new NotImplementedException (); } bool IDictionary.Contains (object key) { throw new NotImplementedException (); } ICollection IDictionary.Keys { get { throw new NotImplementedException (); } } ICollection IDictionary.Values { get { throw new NotImplementedException (); } } IDictionaryEnumerator IDictionary.GetEnumerator () { throw new NotImplementedException (); } void IDictionary.Remove (object key) { throw new NotImplementedException (); } void ICollection.CopyTo (Array dest, int index) { throw new NotImplementedException (); } IEnumerator IEnumerable.GetEnumerator () { throw new NotImplementedException (); } public void Clear () { throw new NotImplementedException (); } public int Count { get { throw new NotImplementedException (); } } } internal class InternalNoUseOfGenerics : IEnumerable { public IEnumerator GetEnumerator () { throw new NotImplementedException (); } } public class NoUseOfGenerics : IEnumerable { public IEnumerator GetEnumerator () { throw new NotImplementedException (); } } public class GenericsAreUsed : IEnumerable { public IEnumerator GetEnumerator () { throw new NotImplementedException (); } IEnumerator IEnumerable.GetEnumerator () { throw new NotImplementedException (); } } [Test] public void NotApplicable () { // the rule does not apply to: // * interfaces and enums AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); // TODO: add SimpleType for compiler-generated code and corresponding check? // * classes not implementing IEnumerable AssertRuleDoesNotApply (); // * classes implementing IDictionary AssertRuleDoesNotApply (); // * non-public types AssertRuleDoesNotApply (); } [Test] public void NotApplicableBefore2_0 () { // ensure that the rule does not apply for types defined in 1.x assemblies TypeDefinition violator = DefinitionLoader.GetTypeDefinition (); TargetRuntime realRuntime = violator.Module.Runtime; try { // fake assembly runtime version and do the check violator.Module.Runtime = TargetRuntime.Net_1_1; Rule.Active = true; Rule.Initialize (Runner); Assert.IsFalse (Rule.Active, "Active"); } catch { // rollback violator.Module.Runtime = realRuntime; Rule.Active = true; } } [Test] public void GenericInterfaceImplementedReturnsSuccess () { AssertRuleSuccess (); } [Test] public void GenericInterfaceNotImplementedReturnsFailure () { AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Test/DoNotExposeGenericListsTest.cs0000664000175000017500000000444312413742070034657 0ustar00directhexdirecthex00000000000000// // Test.Rules.Design.Generic.DoNotExposeGenericListsTest // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Rules.Design.Generic; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Design.Generic { public class BadField { public List field; } public class BadProperty { public List property { get; set; } } public class BadMethods { public List method () { return null; } public void method (List a, List b) { } } [TestFixture] public class DoNotExposeGenericListsTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void Good () { AssertRuleSuccess (SimpleTypes.Class); AssertRuleSuccess (SimpleTypes.Structure); } [Test] public void Bad () { AssertRuleFailure (1); AssertRuleFailure (3); AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/Makefile.am0000664000175000017500000000161012413742070030053 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AvoidDeclaringCustomDelegatesRule.cs \ AvoidExcessiveParametersOnGenericTypesRule.cs \ AvoidMethodWithUnusedGenericTypeRule.cs \ DoNotDeclareStaticMembersOnGenericTypesRule.cs \ DoNotExposeGenericListsRule.cs \ DoNotExposeNestedGenericSignaturesRule.cs \ GenericsBaseRule.cs \ ImplementGenericCollectionInterfacesRule.cs \ PreferGenericsOverRefObjectRule.cs \ UseGenericEventHandlerRule.cs EXTRA_TESTS_OPTIONS += -r:System.Xml.dll -r:System.Xml.Linq.dll tests_sources = \ AvoidDeclaringCustomDelegatesTest.cs \ AvoidExcessiveParametersOnGenericTypesTest.cs \ AvoidMethodWithUnusedGenericTypeTest.cs \ DoNotDeclareStaticMembersOnGenericTypesTest.cs \ DoNotExposeGenericListsTest.cs \ DoNotExposeNestedGenericSignaturesTest.cs \ ImplementGenericCollectionInterfacesTest.cs \ PreferGenericsOverRefObjectTest.cs \ UseGenericEventHandlerTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/DoNotExposeGenericListsRule.cs0000664000175000017500000000765612413742070033741 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.Generic.DoNotExposeGenericListsRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// A type has an externally visible member that is, returns or has a signature containing a /// System.Collections.Generic.List<T>. /// /// /// Bad example: /// /// public class BadClass { /// public List<string> member { get; set; }; /// } /// /// /// /// Good example: /// /// public class GoodClass { /// public Collection<string> member { get; set; }; /// } /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("The type exposes System.Collections.Generic.List.")] [Solution ("Use a type such as System.Collections.ObjectModel.Collection instead.")] [FxCopCompatibility ("Microsoft.Design", "CA1002:DoNotExposeGenericLists")] public class DoNotExposeGenericListsRule : GenericsBaseRule, ITypeRule { private const string List = "List`1"; private static bool IsList (TypeReference type) { return type.Namespace == "System.Collections.Generic" && type.Name.StartsWith (List, StringComparison.Ordinal); } private void CheckField (FieldReference field) { if (field.IsVisible () && IsList (field.FieldType)) Runner.Report (field, Severity.Medium, Confidence.Total); } private void CheckProperty (PropertyDefinition property) { if (!IsList (property.PropertyType)) return; if (property.GetMethod.IsVisible () || property.SetMethod.IsVisible ()) Runner.Report (property, Severity.Medium, Confidence.Total); } private void CheckMethod (MethodDefinition method) { // Getters/setters handled by CheckProperty. if (method.IsGetter || method.IsSetter || !method.IsVisible ()) return; if (IsList (method.ReturnType)) Runner.Report (method, Severity.Medium, Confidence.Total); if (!method.HasParameters) return; foreach (var param in method.Parameters) { if (IsList (param.ParameterType)) Runner.Report (param, Severity.Medium, Confidence.Total); } } public RuleResult CheckType (TypeDefinition type) { if (!type.IsClass || type.IsEnum || type.IsInterface || type.IsDelegate ()) return RuleResult.DoesNotApply; if (type.HasFields) { foreach (var field in type.Fields) CheckField (field); } if (type.HasProperties) { foreach (var property in type.Properties) CheckProperty (property); } if (type.HasMethods) { foreach (var method in type.Methods) CheckMethod (method); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic/UseGenericEventHandlerRule.cs0000664000175000017500000000662212413742070033537 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Design.Generic.UseGenericEventHandlerRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// This rule fires if an assembly defines a delegate which can be /// replaced by System.EventHandler<TEventArgs>. /// /// /// Bad example: /// /// public delegate void AuthenticityHandler (object sender, AuthenticityEventArgs e); /// /// public event AuthenticityHandler CheckingAuthenticity; /// public event AuthenticityHandler CheckedAuthenticity; /// /// /// /// Good example: /// /// public event EventHandler<AuthenticityEventArgs> CheckingAuthenticity; /// public event EventHandler<AuthenticityEventArgs> CheckedAuthenticity; /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("This delegate definition is not needed with .NET 2.0 and later runtimes.")] [Solution ("Replace the delegate with System.EventHandler.")] [FxCopCompatibility ("Microsoft.Design", "CA1003:UseGenericEventHandlerInstances")] public class UseGenericEventHandlerRule : GenericsBaseRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule only apply to (non generated) delegates if (!type.IsDelegate () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; MethodDefinition invoke = type.GetMethod ("Invoke"); // this happens for System.MulticastDelegate if (invoke == null) return RuleResult.DoesNotApply; if (!invoke.ReturnType.IsNamed ("System", "Void")) return RuleResult.Success; if (!invoke.HasParameters) return RuleResult.Success; IList pdc = invoke.Parameters; if (pdc.Count != 2) return RuleResult.Success; if (!pdc [0].ParameterType.IsNamed ("System", "Object")) return RuleResult.Success; if (!pdc [1].ParameterType.Inherits ("System", "EventArgs")) return RuleResult.Success; Runner.Report (type, Severity.Medium, Confidence.High); return RuleResult.Failure; } } } AvoidExcessiveParametersOnGenericTypesRule.cs0000664000175000017500000000511312413742070036705 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Design.Generic// // Gendarme.Rules.Design.Generic.AvoidExcessiveParametersOnGenericTypesRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Design.Generic { /// /// A visible type should not have more than two generic parameters. This makes it /// hard for consumers to remember what each parameter is required for. /// /// /// Bad example: /// /// public class BadClass<A, B, C> { /// } /// /// /// /// Good example: /// /// public class GoodClass<A, B> { /// } /// /// /// This rule applies only to assemblies targeting .NET 2.0 and later. [Problem ("A visible type has more than two generic parameters.")] [Solution ("Redesign the type so it doesn't take more than two generic parameters.")] [FxCopCompatibility ("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] public class AvoidExcessiveParametersOnGenericTypesRule : GenericsBaseRule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (!type.IsClass || !type.HasGenericParameters || !type.IsVisible ()) return RuleResult.DoesNotApply; if (type.GenericParameters.Count > 2) Runner.Report (type, Severity.Medium, Confidence.Total); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/0000775000175000017500000000000012642235742026362 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/ChangeLog0000664000175000017500000004127112413742070030132 0ustar00directhexdirecthex000000000000002010-06-20 Sebastien Pouliot * ConsiderUsingStopwatchRule.cs: * PreferStringIsNullOrEmptyRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-20 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Fix sparse (non consecutive) switch/cases. Use a fast version of CC if no switch is present (based on OpCodeEngine). Handle both xMCS and CSC 2010-06-15 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: * RemoveDependenceOnObsoleteCodeRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-15 Sebastien Pouliot * AvoidAlwaysNullFieldRule.cs: * AvoidUnnecessarySpecializationRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-09 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Split signature gathering from UpdateParameterLeastType (fixing some self-test defects wrt size). Only compute signatures when we need them - saves 149kb while executing self-test 2010-06-07 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Fix potential false positives when overriding a base method. Fix potential false positives when analyzing methods assigned to events. 2010-06-07 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Avoid using temporary List (reduce allocations) and avoid re-checking known parameters. 2010-06-04 Sebastien Pouliot * RemoveDependenceOnObsoleteCodeRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-05-16 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Apply AvoidRepetitive CallsToPropertiesRule. Remove condition check that can never occur at this stage since it is checked earlier by the rule. 2010-05-08 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Fix when "ldarg 0" is used instead of the, much more common, "ldarg_0" 2010-04-22 Sebastien Pouliot * RemoveDependenceOnObsoleteCodeRule.cs: Fix case where a property setter or getter does not exists (on obsoleted property). 2010-02-15 Sebastien Pouliot * AvoidAlwaysNullFieldRule.cs: The rules was ignoring "components" member for windows forms but not for usercontrol and more generally controls. Patch provided by Antoine V. 2010-01-31 Sebastien Pouliot * Makefile.am: Add new rule and tests to the build * RemoveDependenceOnObsoleteCodeRule.cs: New. Rule to warn you if your code depends on code decorated with the [Obsolete] attribute 2010-01-27 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Use shorter, unambiguous .ctor to create MethodSignature 2010-01-26 Sebastien Pouliot * PreferStringIsNullOrEmptyRule.cs: Fix regression on code compiled using CSC. 2009-08-13 Jesse Jones * AvoidLackOfCohesionOfMethodsRule.cs, ConsiderUsingStopwatchRule.cs, AvoidDeepInheritanceTreeRule.cs, AvoidComplexMethodsRule.cs: Edited the rule descriptions. 2009-07-04 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-01-28 Jb Evain * AvoidUnnecessarySpecializationRule.cs: in GetBaseImplementor: handle types with a null BaseType. 2008-12-30 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Move some checks before calling (expensive) Resolve on the interface. Check that resolved interface is non-null before continuing. Based on patch from Tamara Roberson. [partial fix for #462925] 2008-13-10 Jesse Jones * AvoidAlwaysNullFieldRule.cs: Use the correct namespace. 2008-12-10 Jesse Jones * AvoidAlwaysNullFieldTest.cs: Also report fields explicitly set to null but not used. 2008-12-10 Jesse Jones * AvoidAlwaysNullFieldRule.cs: Improved winforms check slightly. 2008-12-09 Jesse Jones * AvoidAlwaysNullFieldRule.cs, Makefile.am: Added new rule. 2008-12-06 Sebastien Pouliot * AvoidLackOfCohesionOfMethodsRule.cs: CSC dislike (CS1570) mixing // comment, on a new line, inside a block of /// 2008-12-05 Sebastien Pouliot * AvoidLackOfCohesionOfMethodsRule.cs: Use HasMethods and HasFields to avoid computing cohesion if the minimums are not met. Reuse the same (cleared) collections to reuse memory. * AvoidUnnecessarySpecializationRule.cs: Use Has{x} to avoid creating empty collections. Moved checks in CheckMethod to start with the lighter ones (properties) then the more heavy ones (rocks). 2008-12-03 Sebastien Pouliot * AvoidLackOfCohesionOfMethodsRule.cs: Fix documentation (wrong rule) * AvoidDeepInheritanceTreeRule.cs: Fix documentation (wrong rule) 2008-11-26 Sebastien Pouliot * ConsiderUsingStopwatchRule.cs: Use TraceBack rock instead of the Previous property to ensure we get over things like unbox. 2008-11-19 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Specify StringComparison.Ordinal when calling String.StartsWith. * AvoidUnnecessarySpecializationRule.cs: Specify StringComparison. Ordinal when calling String.StartsWith. Simplify namespace matching method. 2008-11-10 Cedric Vivier * AvoidUnnecessarySpecializationRule.cs: Prettify the suggestion by showing generic parameters as SomeType instead of SomeType`2. 2008-11-10 Cedric Vivier * AvoidUnnecessarySpecializationRule.cs: Ignore non-generic collection types suggestions as we do not check if the suggestion would be possible to apply or not (wrt casts etc). 2008-11-10 Cedric Vivier * AvoidLackOfCohesionOfMethodsRule.cs: Count LCOM correctly wrt static and visible fields. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Maintainability.mdp: * Gendarme.Rules.Maintainability.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-02 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Fix double cast (self-test) 2008-11-03 Cedric Vivier * AvoidUnnecessarySpecializationRule.cs: Use generic parameter owner instead of genericity of current method (GetConstructedGenericType). 2008-11-03 Cedric Vivier * AvoidUnnecessarySpecializationRule.cs: Handle correctly generic arguments and/or non-generic arguments used as a generic argument of a generic method. Fixes false positives on such cases and makes the rule suggests a proper type instead of the infamous !!0 on real positive cases (such as SpecializedClass.GenericMethodArgument testcase). 2008-11-03 Cedric Vivier * AvoidUnnecessarySpecializationRule.cs: Fix NRE when gp.Owner is not a TypeReference. Regression tests pending, this needs more investigation. 2008-10-31 Jesse Jones * AvoidComplexMethodsTest.cs: No longer relies on CustomAttributeCollection returning attributes in the order they were declared in. 2008-10-24 Sebastien Pouliot * AvoidLackOfCohesionOfMethodsRule.cs: Revert visibility change for GetCohesivenessForType since it's used in the unit test. Add a null check inside that method (self-test) 2008-10-24 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Add null check in method GetCyclomaticComplexityForMethod (self-test) * AvoidLackOfCohesionOfMethodsRule.cs: Change visibility of GetCohesivenessForType and GetCohesivenessSeverity to private. 2008-10-22 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Handle 'ref' parameters correctly. Ignore generic constraints if there's more than one (since we don't consider them properly). Fix reporting to avoid stuff like "could be of '!0'." 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Maintainability.xml, doc/Gendarme.Rules.Maintainability: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-16 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Remove dead code/line. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-10-15 Cedric Vivier * AvoidUnnecessarySpecializationRule.cs: Fix style issues. Remove unnecessary .ToArray()s. 2008-10-15 Cedric Vivier * AvoidUnnecessarySpecializationRule.cs: Do something sensible if a resolution fails during the navigation of the depth inheritance. This also fixes GenericAddBar test failure happening since rev.115089. 2008-10-15 Cedric Vivier * AvoidUnnecessarySpecializationRule.cs: Refactoring to fix FalsePositive test and another cases such as in the new SuggestMethodReferenceInsteadOfIMethodSignature test when a parameter is used through different interfaces. 2008-10-08 Sebastien Pouliot * PreferStringIsNullOrEmptyRule.cs: Fix a false positive that can happen when checking if a string is stricly empty - which generates very similar IL to IsNullOrEmpty. 2008-10-07 Sebastien Pouliot * PreferStringIsNullOrEmptyRule.cs: Fix typo in [Solution] attribute and downgrade the confidence to High (test case show it's not Total). Both found by Andy Hume. 2008-09-30 Sebastien Pouliot * AvoidLackOfCohesionOfMethodsRule.cs: Change field visibility to private. * ConsiderUsingStopwatchRule.cs: More explicit solution text. 2008-09-29 Sebastien Pouliot * AvoidLackOfCohesionOfMethodsRule.cs: Be consistent when reporting Cohesiveness factor (all checks for >=). 2008-09-28 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Add XML documentation. * AvoidDeepInheritanceTreeRule.cs: Add XML documentation. * AvoidLackOfCohesionOfMethodsRule.cs: Add XML documentation. * AvoidUnnecessarySpecializationRule.cs: Add XML documentation. * ConsiderUsingStopwatchRule.cs: Add XML documentation. * PreferStringIsNullOrEmptyRule.cs: Add XML documentation. 2008-09-06 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Add [FxCopCompatibility] attribute. * AvoidLackOfCohesionOfMethodsRule.cs: Don't apply to delegates. Do not ignore properties (SpecialName). Add a few FIXME. * ConsiderUsingStopwatchRule.cs: Use OpCodeEngine to ensure methods contains call[virt] instructions. * PreferStringIsNullOrEmptyRule.cs: : Use OpCodeEngine to ensure methods contains call[virt] instructions. 2008-08-29 Sebastien Pouliot * AvoidDeepInheritanceTreeRule.cs: Return DoesNotApply on delegates. Modulate the severity based on inheritance depth. Add [FxCopCompatibility] attribute. 2008-08-29 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Allocate arrays for 64 parameters and re-adjust if needed. This makes it possible to allocate arrays once (well it's true for mono 2.0 class libs) and not for each method. 2008-08-26 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Avoid computing the method's CC if the number of IL instructions is lower than the success threshold. 2008-08-11 Sebastien Pouliot * AvoidDeepInheritanceTreeRule.cs: Fix case where we can't resolve a base type. * AvoidUnnecessarySpecializationRule.cs: Fix case where we can't resolve the least type. 2008-08-07 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: Small fixes for self-test 2008-08-04 Sebastien Pouliot * ConsiderUsingStopwatchRule.cs: Remove unneeded parameter on IsGetNow method (self-test). * AvoidUnnecessarySpecializationRule.cs: Ignore methods where the parameters are dictated by an interface that the type implements. Also use new rocks to simplify rule and apply rule to itself ;-) 2008-08-03 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Use automatic properties for all Threadhold properties. Reuse (i.e. Clear) 'targets' between rule executions (to reduce memory requirements). * ConsiderUsingStopwatchRule.cs: Use new rocks to simplify code. Rework parameter checks to consider Ref and Out parameters. 2008-07-13 Sebastien Pouliot * ConsiderUsingStopwatchRule.cs: New. Rule to check if the use of DateTime could not be replaced with the use of a Stopwatch to increase the code clarity. [committed for Cedric Vivier] * Gendarme.Rules.Maintainability.mdp: Update MD project files. * Makefile.am: Add the rule and the test to the build. 2008-07-13 Sebastien Pouliot * AvoidUnnecessarySpecializationRule.cs: New. Rule to check if some method parameters could use a type lower in the hierarchy than the one being used. [committed for Cedric Vivier] * Gendarme.Rules.Maintainability.mdp: Update MD project files. * Makefile.am: Add the rule and the test to the build. 2008-07-11 Sebastien Pouliot * AvoidDeepInheritanceTreeRule.cs: Change the default rule behaviour to check only inheritance inside the set of assemblies being analyzed (instead of the whole resolvable class libraries). This can be changed back using the configuration file. Patch by Cedric Vivier. 2008-07-10 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Always report the calculated CC since it is useful to the end user (to see how much complexity there is ;-) * AvoidLackOfCohesionOfMethodsRule.cs: Always report the calculated cohesion (for the same reasons). * Makefile.am: Start using ../common.make 2008-05-18 Sebastien Pouliot * PreferStringIsNullOrEmptyRule.cs: New. Rule to suggest using String.IsNullOrEmpty over a null and length check on the same string [Fix bug/request #362867] * Makefile.am: Add the rule and the test to the build. 2008-05-11 Sebastien Pouliot * AvoidLackOfCohesionOfMethodsRule.cs: Refactor against AvoidLongMethodsRule (GetCohesivenessForType) and AvoidLargeClassesRule (common prefixes). Fix exception arguments ordering. 2008-05-10 Sebastien Pouliot * AvoidDeepInheritanceTreeRule.cs: New. Rule to check if the inheritance tree of types gets deeper than 4 levels. 2008-05-10 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Change default threshold to 25 (to match results from fxcop) and make all threshold configurable using rules.xml. 2008-05-01 Sebastien Pouliot * AvoidComplexMethodsRule.cs: Remove empty static ctor. 2008-05-01 Sebastien Pouliot * Gendarme.Rules.Maintainability.csproj: New. VS.NET project file. * Makefile.am: Add project files to dist 2008-04-27 Andres G. Aragoneses * Gendarme.Rules.Maintainability.mdp: new project. 2008-04-27 Nestor Salceda * AvoidComplexMethodsRule.cs: I forget change the header. 2008-04-27 Nestor Salceda * AvoidComplexMethodsRule.cs: Move to Gendarme.Rules.Maintainability namespace. * Test/AvoidComplexMethodsTest.cs: Move to Test.Rules.Maintainability namespace. 2008-04-27 Nestor Salceda * AvoidLackOfCohesionOfMethodsRule.cs: Improved the linq query. It avoids a .Where call, and it doesn't need the ToIEnumerable call. 2008-04-27 Nestor Salceda * AvoidLackOfCohesionOfMethodsRule.cs: Skip the empty methods whithout body and move the accessors to the linq query. Fixes the break in the self-test target. 2008-04-27 Nestor Salceda * AvoidLackOfCohesionOfMethodsRule.cs: New. Rule for check the cohesion in the methods. Thanks Cedric ! * Makefile.am: Add the rule and the test to the build. 2008-04-27 Nestor Salceda * Makefile.am: Build Gendarme.Rules.Maintainability rules. * AvoidComplexMethodsRule.cs: New. Rule for check the method cyclomatic complexity. Thanks Cedric ! mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/PreferStringIsNullOrEmptyRule.cs0000664000175000017500000001523112413742070034615 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.PreferStringIsNullOrEmptyRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Maintainability { /// /// This rule checks methods for cases where String.IsNullOrEmpty could be /// used instead of doing separate null and length checks. This does not affect /// execution nor performance (much) but it does improve source code readability. /// This rule only applies to assemblies compiled with .NET 2.0 (or later). /// /// /// Bad example: /// /// public bool SendMessage (string message) /// { /// if ((message == null) || (message.Length == 0)) { /// return false; /// } /// return SendMessage (Encode (message)); /// } /// /// /// /// Good example: /// /// public bool SendMessage (string message) /// { /// if (String.IsNullOrEmpty (message)) { /// return false; /// } /// return SendMessage (Encode (message)); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method does both string null and length checks which can be harder on code readability/maintainability.")] [Solution ("Replace both checks with a single call to String.IsNullOrEmpty(string).")] [EngineDependency (typeof (OpCodeEngine))] public class PreferStringIsNullOrEmptyRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // we only want to run this on assemblies that use 2.0 or later // since String.IsNullOrEmpty did not exist before that Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentModule.Runtime >= TargetRuntime.Net_2_0); }; } private static string GetName (MethodDefinition method, Instruction ins) { switch (ins.OpCode.Code) { case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: int index = ins.OpCode.Code - Code.Ldarg_0; if (!method.IsStatic) { index--; if (index < 0) return "this"; } return method.Parameters [index].Name; case Code.Ldarg: case Code.Ldarg_S: case Code.Ldarga: case Code.Ldarga_S: return (ins.Operand as ParameterDefinition).Name; case Code.Ldfld: case Code.Ldsfld: return (ins.Operand as FieldReference).Name; case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: int vindex = ins.OpCode.Code - Code.Ldloc_0; return method.Body.Variables [vindex].Name; case Code.Ldloc: case Code.Ldloc_S: return (ins.Operand as VariableDefinition).Name; default: object o = ins.Operand; MemberReference mr = (o as MemberReference); if (mr != null) return mr.GetFullName (); else if (o != null) return o.ToString (); else return String.Empty; } } // if a valid check is found then return the instruction where it branch private static Instruction PreLengthCheck (MethodDefinition method, Instruction ins) { string name_length = GetName (method, ins); while (ins.Previous != null) { ins = ins.Previous; switch (ins.OpCode.Code) { case Code.Brfalse: case Code.Brfalse_S: if (name_length == GetName (method, ins.Previous)) return (ins.Operand as Instruction); return null; } } return null; } private static bool PostLengthCheck (Instruction ins, Instruction branch) { switch (ins.OpCode.Code) { // e.g. if case Code.Brtrue: case Code.Brtrue_S: return ((ins.Operand as Instruction).OpCode.Code != branch.OpCode.Code); // e.g. return default: if (!IsOperandZero (ins)) return false; break; } ins = ins.Next; switch (ins.OpCode.Code) { case Code.Ceq: return true; case Code.Cgt: return IsOperandZero (ins.Next); default: return false; } } private static bool IsOperandZero (Instruction ins) { switch (ins.OpCode.Code) { case Code.Ldc_I4: return ((int) ins.Operand == 0); case Code.Ldc_I4_S: return ((int) (sbyte) ins.Operand == 0); case Code.Ldc_I4_0: return true; default: return false; } } public RuleResult CheckMethod (MethodDefinition method) { // rule doesn't not apply to methods without code (e.g. p/invokes) if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Call or Callvirt instructions in the method OpCodeBitmask calls = OpCodeBitmask.Calls; if (!calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // go! // we look for a call to String.Length property (since it's much easier // than checking a string being compared to null) foreach (Instruction current in method.Body.Instructions) { if (!calls.Get (current.OpCode.Code)) continue; MethodReference mr = (current.Operand as MethodReference); if (mr.IsNamed ("System", "String", "get_Length")) { // now that we found it we check that // 1 - we previously did a check null on the same value (that we already know is a string) Instruction branch = PreLengthCheck (method, current.Previous); if (branch == null) continue; // 2 - we compare the return value (length) with 0 if (PostLengthCheck (current.Next, branch)) { Runner.Report (method, current, Severity.Medium, Confidence.High); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/AvoidUnnecessarySpecializationRule.cs0000664000175000017500000004334512413742070035724 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.AvoidUnnecessarySpecializationRule class // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; using System.Collections.Generic; namespace Gendarme.Rules.Maintainability { /// /// This rule checks methods for over specialized parameters - i.e. parameter types /// that are unnecessarily specialized with respect to what the method needs to /// perform its job. This often impairs the reusability of the method. If a problem /// is found the rule will suggest the most general type, or interface, required for the /// method to work. /// /// /// Bad example: /// /// public class DefaultEqualityComparer : IEqualityComparer { /// public int GetHashCode (object obj) /// { /// return o.GetHashCode (); /// } /// } /// /// public int Bad (DefaultEqualityComparer ec, object o) /// { /// return ec.GetHashCode (o); /// } /// /// /// /// Good example: /// /// public class DefaultEqualityComparer : IEqualityComparer { /// public int GetHashCode (object obj) /// { /// return o.GetHashCode (); /// } /// } /// /// public int Good (IEqualityComparer ec, object o) /// { /// return ec.GetHashCode (o); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method has a parameter whose type is more specialized than necessary. This can make it difficult to reuse the method in other contexts.")] [Solution ("Replace the parameter type with the most general type which will work or make use of the specifics of the formal parameter type.")] [FxCopCompatibility ("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] public class AvoidUnnecessarySpecializationRule : Rule, IMethodRule { private StackEntryAnalysis sea; private TypeReference [] types_least = new TypeReference [64]; private int [] depths_least = new int [64]; // FIXME: handle more than one constraint private static TypeReference GetActualType (TypeReference type) { GenericParameter gp = (type as GenericParameter); if (gp != null) { IList cc = gp.Constraints; if (cc.Count == 1) type = cc [0]; } return type; } private static int GetActualTypeDepth (TypeReference type) { return GetTypeDepth (GetActualType (type)); } private static int GetTypeDepth (TypeReference type) { TypeDefinition typeDef = GetActualType (type).Resolve (); //if we cannot resolve then return depth as 1 by default as it will //be eventually be sorted out by signature matching. return (null == typeDef) ? 1 : GetTypeDepth (typeDef); } private static int GetTypeDepth (TypeDefinition type) { int depth = 0; while (null != type && type.BaseType != null) { depth++; type = type.BaseType.Resolve (); } return depth; } private static bool DoesAllSignaturesMatchType (TypeReference type, IEnumerable signatures) { bool match = true; foreach (MethodSignature signature in signatures) { match &= (null != type.GetMethod (signature)); } return match; } private static TypeDefinition GetBaseImplementor (TypeReference type, IEnumerable signatures) { return GetBaseImplementor (type.Resolve (), signatures); } private static TypeDefinition GetBaseImplementor (TypeDefinition type, IEnumerable signatures) { TypeDefinition implementor = type; while (null != type && type.IsVisible ()) { //search for matching interface TypeDefinition ifaceDef = GetInterfaceImplementor (type, signatures); if (null != ifaceDef) implementor = ifaceDef; else if (DoesAllSignaturesMatchType (type, signatures)) implementor = type; type = type.BaseType != null ? type.BaseType.Resolve () : null; } return implementor; } private static TypeDefinition GetInterfaceImplementor (TypeDefinition type, IEnumerable signatures) { TypeDefinition ifaceDef = null; foreach (TypeReference iface in type.Interfaces) { // ignore non-cls-compliant interfaces if (iface.Name.StartsWith ("_", StringComparison.Ordinal)) continue; TypeDefinition candidate = iface.Resolve (); if ((candidate == null) || !candidate.IsVisible ()) continue; if (!DoesAllSignaturesMatchType (candidate, signatures)) continue; if (null == ifaceDef) { ifaceDef = candidate; } else if (ifaceDef.GenericParameters.Count < candidate.GenericParameters.Count) { //prefer the most generic interface ifaceDef = candidate; } else if (ifaceDef.Interfaces.Count < candidate.Interfaces.Count) { //prefer the most specific interface ifaceDef = candidate; } else if (ifaceDef.Interfaces.Count >= candidate.Interfaces.Count || ifaceDef.GenericParameters.Count >= candidate.GenericParameters.Count) { continue; //we already have a better match } else { //ambiguous/explicit, ignore ifaceDef = null; break; } } return ifaceDef; } static string [] Empty = new string [0]; private static MethodSignature GetSignature (MethodReference method) { string name = method.Name; string rtype = GetReturnTypeSignature (method); if (!method.HasParameters) return new MethodSignature (name, rtype, Empty); IList pdc = method.Parameters; int count = pdc.Count; string [] parameters = new string [count]; for (int i = 0; i < count; ++i) { TypeReference pType = pdc [i].ParameterType; // handle reference type (ref in C#) ByReferenceType ref_type = (pType as ByReferenceType); if (ref_type != null) pType = ref_type.ElementType; if (pType is GenericParameter) parameters [i] = null; //TODO: constructed mapping? else parameters [i] = pType.GetFullName (); } return new MethodSignature (name, rtype, parameters); } private static string GetReturnTypeSignature (MethodReference method) { //special exception if (!method.HasParameters && (method.Name == "GetEnumerator")) return null; return method.ReturnType.GetFullName (); } private static bool IsSystemObjectMethod (MethodReference method) { string name = method.Name; if (name.Length < 6 /*Equals*/ || name.Length > 16 /*EqualityOperator*/) return false; //no need to do the string comparisons switch (name) { case "Finalize" : case "GetHashCode" : case "GetType" : case "MemberwiseClone" : case "ToString" : return !method.HasParameters; case "Equals" : IList pdc = method.Parameters; return (method.HasParameters && (pdc.Count == 1 || pdc.Count == 2)); case "ReferenceEquals" : return (method.HasParameters && (method.Parameters.Count == 2)); //HACK: BOO: case "EqualityOperator" : return (method.HasParameters && (method.Parameters.Count == 2) && (method.DeclaringType.IsNamed ("Boo.Lang.Runtime", "RuntimeServices"))); } return false; } private static bool IsFromNonGenericCollectionNamespace (string nameSpace) { return ((nameSpace == "System.Collections") || (nameSpace == "System.Collections.Specialized")); } private static bool IsIgnoredSuggestionType (TypeReference type) { return (type.IsNamed ("System", "Object") || IsFromNonGenericCollectionNamespace (type.Namespace)); } private static List GetSignatures (IEnumerable usageResults) { List signatures = new List (); foreach (var usage in usageResults) { switch (usage.Instruction.OpCode.Code) { case Code.Newobj: case Code.Call: case Code.Callvirt: MethodReference method = (MethodReference) usage.Instruction.Operand; if (IsSystemObjectMethod (method) || IsFromNonGenericCollectionNamespace (method.DeclaringType.Namespace)) continue; signatures.Add (GetSignature (method)); break; } } return signatures; } private void UpdateParameterLeastType (ParameterReference parameter, IEnumerable usageResults) { int pIndex = parameter.Index; int parameterDepth = GetActualTypeDepth (parameter.ParameterType); int currentLeastDepth = 0; TypeReference currentLeastType = null; List signatures = null; //update the result array as in if (needUpdate) block below foreach (var usage in usageResults) { bool needUpdate = false; switch (usage.Instruction.OpCode.Code) { case Code.Newobj : case Code.Call : case Code.Callvirt : MethodReference method = (MethodReference) usage.Instruction.Operand; //potential generalization to object does not really make sense //from a readability/maintainability point of view if (IsSystemObjectMethod (method)) continue; //we cannot really know if suggestion would work since the collection //is non-generic thus we ignore it TypeReference type = method.DeclaringType; if (IsFromNonGenericCollectionNamespace (type.Namespace)) continue; int pcount = method.HasParameters ? method.Parameters.Count : 0; if (usage.StackOffset == pcount) { //argument is used as `this` in the call if (signatures == null) signatures = GetSignatures (usageResults); currentLeastType = GetBaseImplementor (GetActualType (type), signatures); } else { //argument is also used as an argument in the call currentLeastType = method.Parameters [pcount - usage.StackOffset - 1].ParameterType; //if parameter type is a generic, find the 'real' constructed type GenericParameter gp = (currentLeastType as GenericParameter); if (gp != null) currentLeastType = GetConstructedGenericType (method, gp); } //if the best we could find is object or non-generic collection, ignore this round if (currentLeastType == null || IsIgnoredSuggestionType (currentLeastType)) continue; needUpdate = true; break; case Code.Stfld : case Code.Stsfld : FieldReference field = (FieldReference) usage.Instruction.Operand; currentLeastType = field.FieldType; needUpdate = true; break; } if (needUpdate) { currentLeastDepth = GetActualTypeDepth (currentLeastType); if (null == types_least [pIndex] || currentLeastDepth > depths_least [pIndex]) { types_least [pIndex] = currentLeastType; depths_least [pIndex] = currentLeastDepth; } if (currentLeastDepth == parameterDepth) //no need to check further return; } } } private void CheckParameters (MethodDefinition method) { Dictionary> usages = new Dictionary> (); foreach (Instruction ins in method.Body.Instructions) { if (!ins.IsLoadArgument ()) continue; ParameterDefinition parameter = ins.GetParameter (method); // this is `this`, we do not care if ((parameter == null) || (parameter.Index == -1)) continue; // is parameter already known ? if (!usages.ContainsKey (parameter)) { if (parameter.IsOut || parameter.IsOptional || parameter.ParameterType.IsValueType) continue; if (parameter.ParameterType.IsArray || parameter.ParameterType.IsDelegate ()) continue; //TODO: these are more complex to handle, not supported for now if (null == sea || sea.Method != method) sea = new StackEntryAnalysis (method); usages [parameter] = new List (); } usages [parameter].AddRange (sea.GetStackEntryUsage (ins)); } foreach (var usage in usages) UpdateParameterLeastType (usage.Key, usage.Value); } static bool IsSignatureDictated (MethodDefinition method) { TypeDefinition type = method.DeclaringType; MethodSignature signature = null; if (type.HasInterfaces) { signature = GetSignature (method); if (IsSignatureDictatedByInterface (method, signature)) return true; } if (!method.IsVirtual) return false; // e.g. System.Object if (type.BaseType == null) return false; return IsSignatureDictatedByOverride (method, signature ?? GetSignature (method)); } static bool IsSignatureDictatedByOverride (IMemberDefinition method, MethodSignature sig) { TypeDefinition baseType = method.DeclaringType.BaseType.Resolve (); while (baseType != null) { if (baseType.HasMethods) { foreach (MethodDefinition md in baseType.Methods) { if (!md.IsConstructor && sig.Matches (md)) return true; } } TypeReference tr = baseType.BaseType; baseType = tr == null ? null : tr.Resolve (); } return false; } static bool IsSignatureDictatedByInterface (IMemberDefinition method, MethodSignature sig) { foreach (TypeReference intf_ref in method.DeclaringType.Interfaces) { TypeDefinition intr = intf_ref.Resolve (); if (intr == null) continue; foreach (MethodDefinition md in intr.Methods) { if (sig.Matches (md)) return true; } } return false; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody || !method.HasParameters || method.IsCompilerControlled) return RuleResult.DoesNotApply; if (method.IsProperty () || method.IsGeneratedCode () || method.IsEventCallback ()) return RuleResult.DoesNotApply; // we cannot change parameter types if: // - we're overriding a base virtual method; or // - they were specified by an interface if (IsSignatureDictated (method)) return RuleResult.DoesNotApply; int pcount = method.Parameters.Count; if (pcount > types_least.Length) { // that should be quite rare (does not happen for mono 2.0 class libs) types_least = new TypeReference [pcount]; depths_least = new int [pcount]; } CheckParameters (method); CheckParametersSpecializationDelta (method); Array.Clear (types_least, 0, types_least.Length); Array.Clear (depths_least, 0, depths_least.Length); return Runner.CurrentRuleResult; } private void CheckParametersSpecializationDelta (MethodReference method) { foreach (ParameterDefinition parameter in method.Parameters){ int i = parameter.Index; if (null == types_least [i]) continue; //argument is not used // the rule currently does not handle more than one generic constraint // so we prefer skipping them than reporting a bunch of false positives GenericParameter gp = (parameter.ParameterType as GenericParameter); if (gp != null) { if (gp.Constraints.Count > 1) continue; } int delta = GetActualTypeDepth (parameter.ParameterType) - depths_least [i]; if (delta > 0) { string message = GetSuggestionMessage (parameter); Severity sev = (delta < 3) ? Severity.Medium : Severity.High; Runner.Report (method, sev, Confidence.High, message); } } } private string GetSuggestionMessage (ParameterReference parameter) { StringBuilder sb = new StringBuilder (); sb.Append ("Parameter '"); sb.Append (parameter.Name); if (parameter.ParameterType is GenericParameter) sb.Append ("' could be constrained to type '"); else sb.Append ("' could be of type '"); TypeReference type = types_least [parameter.Index]; AppendPrettyTypeName (sb, type); sb.Append ("'."); return sb.ToString (); } private static TypeReference GetConstructedGenericType (MemberReference method, GenericParameter parameter) { int position = parameter.Position; if (parameter.Owner is MethodReference) { GenericInstanceMethod gim = (method as GenericInstanceMethod); // 'gim' can be null in special cases, e.g. a generated Set method on a multidim array if (gim != null) return gim.GenericArguments [position]; } if (parameter.Owner is TypeReference) { GenericInstanceType git = (method.DeclaringType as GenericInstanceType); if (git != null) return git.GenericArguments [position]; } return parameter.Owner.GenericParameters [position]; } private static void AppendPrettyTypeName (StringBuilder sb, TypeReference type) { int nRemoveTrail; IList gpc = type.GenericParameters; int count = gpc.Count; if (count == 0) nRemoveTrail = 0; else if (count < 10) nRemoveTrail = 2; else nRemoveTrail = 3; string fullname = type.GetFullName (); sb.Append (fullname.Substring (0, fullname.Length - nRemoveTrail)); if (count > 0) { int n = 0; sb.Append ("<"); foreach (GenericParameter gp in gpc) { if (n > 0) sb.Append (","); AppendPrettyTypeName (sb, gp); n++; } sb.Append (">"); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/AvoidLackOfCohesionOfMethodsRule.cs0000664000175000017500000002070212413742070035156 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.AvoidLackOfCohesionOfMethodsRule class // // Authors: // Cedric Vivier // Sebastien Pouliot // // (C) 2008 Cedric Vivier // 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.Generic; using System.ComponentModel; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Maintainability { /// /// This rule checks every type for lack of cohesion between the fields and the methods. Low cohesion is often /// a sign that a type is doing too many, different and unrelated things. The cohesion score is given for each defect /// (higher is better). /// Automatic properties (e.g. available in C# 3) are considered as fields since their 'backing field' cannot be /// directly used and the getter/setter is only used to update a single field. /// /// This rule is available since Gendarme 2.0 [Problem ("The methods in this class lack cohesion (a higher score is better). This leads to code which is harder to understand and maintain.")] [Solution ("You can apply the Extract Class or Extract Subclass refactoring.")] public class AvoidLackOfCohesionOfMethodsRule : Rule, ITypeRule { private const double DefaultSuccessCoh = 0.5; private const double DefaultLowCoh = 0.4; private const double DefaultMediumCoh = 0.2; private const int DefaultMethodMinimumCount = 2; // set at 2 to remove 'uninteresting' types private const int DefaultFieldMinimumCount = 1; // set at 1 to remove 'uninteresting' types (this shouldn't be set to a value other than MinimumMethodCount/2) private double successCoh = DefaultSuccessCoh; private double lowCoh = DefaultLowCoh; private double medCoh = DefaultMediumCoh; private int method_minimum_count = DefaultMethodMinimumCount; private int field_minimum_count = DefaultFieldMinimumCount; private Dictionary F = new Dictionary (); private List Fset = new List (); public RuleResult CheckType (TypeDefinition type) { //does rule apply? if (type.IsEnum || type.IsInterface || type.IsAbstract || type.IsDelegate () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; if (!type.HasFields || (type.Fields.Count < MinimumFieldCount)) return RuleResult.DoesNotApply; if (!type.HasMethods || (type.Methods.Count < MinimumMethodCount)) return RuleResult.DoesNotApply; //yay! rule do apply! double coh = GetCohesivenessForType (type); if (coh >= SuccessLowerLimit) return RuleResult.Success; if (0 == coh) return RuleResult.DoesNotApply; //how's severity? Severity sev = GetCohesivenessSeverity(coh); string msg = String.Format (CultureInfo.CurrentCulture, "Type cohesiveness : {0}%", (int) (coh * 100)); Runner.Report (type, sev, Confidence.Normal, msg); return RuleResult.Failure; } // works with "field-like" automatic properties private bool SetField (MemberReference field, TypeReference type) { if ((field.DeclaringType != type) || Fset.Contains (field)) return false; if (F.ContainsKey (field)) { F [field]++; } else { F.Add (field, 1); } Fset.Add (field); return true; } public double GetCohesivenessForType (TypeDefinition type) { if (type == null) return 0.0; int M = 0;//M is the number of methods in the type //F keeps the count of distinct-method accesses to the field F.Clear (); foreach (MethodDefinition method in type.Methods) { if (!method.HasBody || method.IsStatic) continue; //Mset is true if the method has already incremented M bool Mset = false; //Fset keeps the fields already addressed in the current method Fset.Clear (); foreach (Instruction inst in method.Body.Instructions) { MemberReference mr = null; switch (inst.OpCode.OperandType) { case OperandType.InlineField: FieldDefinition fd = inst.Operand as FieldDefinition; if (null == fd || !fd.IsPrivate || fd.IsStatic || fd.IsGeneratedCode ()) continue; //does not make sense for LCOM calculation mr = fd; break; case OperandType.InlineMethod: // special case for automatic properties since the 'backing' fields won't be used MethodDefinition md = inst.Operand as MethodDefinition; if (md == null || md.IsPrivate || md.IsStatic || !md.IsProperty () || !md.IsGeneratedCode ()) continue; mr = md.GetPropertyByAccessor (); break; } if (mr != null) { bool result = SetField (mr, type); if (result && !Mset) { M++; Mset = true; } } } } if (M > MinimumMethodCount && F.Count > MinimumFieldCount) { double r = 0; foreach (KeyValuePair f in F) { r += f.Value; } double rm = r / F.Count; double coh = Math.Round(1 - ((M - rm) / M), 2); return coh; } return 0; } private Severity GetCohesivenessSeverity (double coh) { if (coh >= LowSeverityLowerLimit) return Severity.Low; if (coh >= MediumSeverityLowerLimit) return Severity.Medium; return Severity.High;//cohCohesion values lower than this will result in a defect. /// Defaults to 0.5. [DefaultValue (DefaultSuccessCoh)] [Description ("Cohesion values lower than this will result in a defect.")] public double SuccessLowerLimit { get { return successCoh; } set { successCoh = value; } } /// Defects with cohesion values greater than this will be reported at low severity. /// Defaults to 0.4. [DefaultValue (DefaultLowCoh)] [Description ("Defects with cohesion values greater than this will be reported at low severity.")] public double LowSeverityLowerLimit { get { return lowCoh; } set { lowCoh = value; } } /// Defects with cohesion values greater than (but less than LowSeverityLowerLimit) this will be reported at medium severity. /// Defaults to 0.2. [DefaultValue (DefaultMediumCoh)] [Description ("Defects with cohesion values greater than (but less than LowSeverityLowerLimit) this will be reported at medium severity.")] public double MediumSeverityLowerLimit { get { return medCoh; } set { medCoh = value; } } /// The minimum number of methods a class must have to be checked. /// Defaults to 2. [DefaultValue (DefaultMethodMinimumCount)] [Description ("The minimum number of methods a class must have to be checked.")] public int MinimumMethodCount { get { return method_minimum_count; } set { if (value < 1) throw new ArgumentException ("MinimumMethodCount cannot be lesser than 1", "MinimumMethodCount"); method_minimum_count = value; } } /// The minimum number of fields a class must have to be checked. /// Defaults to 1. [DefaultValue (DefaultFieldMinimumCount)] [Description ("The minimum number of fields a class must have to be checked.")] public int MinimumFieldCount { get { return field_minimum_count; } set { if (value < 0) throw new ArgumentException ("MinimumFieldCount cannot be lesser than 0", "MinimumFieldCount"); field_minimum_count = value; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/AvoidAlwaysNullFieldRule.cs0000664000175000017500000001672012413742070033562 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.AvoidAlwaysNullFieldRule // // Authors: // Jesse Jones // Sebastien Pouliot // // Copyright (C) 2008 Jesse Jones // 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.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Maintainability { /// /// A type has a private field whose value is always null. /// /// /// Bad example: /// /// internal sealed class Bad { /// private List<int> values; /// /// public List<int> Values { /// get { /// return values; /// } /// } /// } /// /// /// /// Good example: /// /// internal sealed class Good { /// private List<int> values = new List<int>(); /// /// public List<int> Values { /// get { /// return values; /// } /// } /// } /// /// /// This rule is available since Gendarme 2.4 [Problem ("This type has a private field whose value is always null.")] [Solution ("Either remove the field or properly initialize it.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class AvoidAlwaysNullFieldRule : Rule, ITypeRule { private HashSet nullFields = new HashSet (); private HashSet setFields = new HashSet (); private HashSet usedFields = new HashSet (); private bool usesWinForms; private static OpCodeBitmask LoadStoreFields = new OpCodeBitmask (0x0, 0x3F00000000000000, 0x0, 0x0); static bool CheckForNullAssignment (Instruction ins) { Instruction previous = ins.Previous; if (!previous.Is (Code.Ldnull)) return false; // handling "ternary if" is always a bit more complex previous = previous.Previous; if ((previous == null) || (previous.OpCode.FlowControl != FlowControl.Branch)) return true; return (previous.Offset == ins.Offset); } private void CheckMethod (MethodDefinition method) { Log.WriteLine (this, method); FieldDefinition field; if (method.HasBody && OpCodeEngine.GetBitmask (method).Intersect (LoadStoreFields)) { foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Stfld: case Code.Stsfld: field = ins.GetField (); // if non-resolved then it will not be a field of this type if (field == null) continue; // FIXME: we'd catch more cases (and avoid some false positives) // if we used a null value tracker. if (CheckForNullAssignment (ins)) { setFields.Add (field); Log.WriteLine (this, "{0} is set to null at {1:X4}", field.Name, ins.Offset); } else { nullFields.Remove (field); Log.WriteLine (this, "{0} is set at {1:X4}", field.Name, ins.Offset); } break; case Code.Ldflda: // if the field address is taken we have to assume the field has been set case Code.Ldsflda: field = ins.GetField (); // if non-resolved then it will not be a field of this type if (field == null) continue; nullFields.Remove (field); Log.WriteLine (this, "{0} is set at {1:X4}", field.Name, ins.Offset); break; case Code.Ldfld: case Code.Ldsfld: field = ins.GetField (); // if non-resolved then it will not be a field of this type if (field == null) continue; usedFields.Add (field); Log.WriteLine (this, "{0} is used at {1:X4}", field.Name, ins.Offset); break; } } } Log.WriteLine (this); } public override void Initialize (IRunner runner) { base.Initialize (runner); // If the module does not reference SWF we can skip the type.Inherits // check below. Runner.AnalyzeModule += (o, e) => { usesWinForms = false; foreach (AssemblyNameReference name in e.CurrentModule.AssemblyReferences) { if (name.Name == "System.Windows.Forms") usesWinForms = true; } }; } void CheckMethods (TypeDefinition type) { if (!type.HasMethods) return; IList mc = type.Methods; for (int i = 0; i < mc.Count && nullFields.Count > 0; ++i) CheckMethod (mc [i]); } public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || type.IsInterface || !type.HasFields) return RuleResult.DoesNotApply; Log.WriteLine (this); Log.WriteLine (this, "----------------------------------"); bool isWinFormControl = usesWinForms && type.Inherits ("System.Windows.Forms", "Control"); // All fields start out as always null and unused. foreach (FieldDefinition field in type.Fields) { if (field.IsPrivate && !field.FieldType.IsValueType) if (!isWinFormControl || field.Name != "components") // the winforms designer seems to like to leave this null nullFields.Add (field); } CheckMethods (type); if (type.HasNestedTypes) { foreach (TypeDefinition nested in type.NestedTypes) CheckMethods (nested); } // Report a defect if: // 1) The field is explicitly set to null and not used (if // if is implicitly set to null and not used AvoidUnusedPrivateFieldsRule // will catch it). setFields.IntersectWith (nullFields); setFields.ExceptWith (usedFields); if (setFields.Count > 0) { foreach (FieldDefinition field in setFields) { Log.WriteLine (this, "{0} is always null", field.Name); Runner.Report (field, Severity.Medium, Confidence.High); } } // 2) The field is always null and used somewhere. nullFields.IntersectWith (usedFields); if (nullFields.Count > 0) { foreach (FieldDefinition field in nullFields) { Log.WriteLine (this, "{0} is always null", field.Name); Runner.Report (field, Severity.Medium, Confidence.High); } } nullFields.Clear (); setFields.Clear (); usedFields.Clear (); return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask fields = new OpCodeBitmask (); fields.Set (Code.Ldfld); fields.Set (Code.Ldflda); fields.Set (Code.Ldsfld); fields.Set (Code.Ldsflda); fields.Set (Code.Stfld); fields.Set (Code.Stsfld); Console.WriteLine (fields); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Makefile.in0000664000175000017500000006631212642235731030435 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Maintainability ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) \ -r:System.Runtime.Serialization.dll console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AvoidAlwaysNullFieldRule.cs \ AvoidComplexMethodsRule.cs \ AvoidDeepInheritanceTreeRule.cs \ AvoidLackOfCohesionOfMethodsRule.cs \ AvoidUnnecessarySpecializationRule.cs \ ConsiderUsingStopwatchRule.cs \ PreferStringIsNullOrEmptyRule.cs \ RemoveDependenceOnObsoleteCodeRule.cs \ ReviewMisleadingFieldNamesRule.cs \ VariableNamesShouldNotMatchFieldNamesRule.cs tests_sources = \ AvoidAlwaysNullFieldTest.cs \ AvoidComplexMethodsTest.cs \ AvoidDeepInheritanceTreeTest.cs \ AvoidLackOfCohesionOfMethodsTest.cs \ AvoidUnnecessarySpecializationTest.cs \ ConsiderUsingStopwatchTest.cs \ PreferStringIsNullOrEmptyTest.cs \ RemoveDependenceOnObsoleteCodeTest.cs \ ReviewMisleadingFieldNamesTest.cs \ VariableNamesShouldNotMatchFieldNamesTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Maintainability/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Maintainability/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/ConsiderUsingStopwatchRule.cs0000664000175000017500000001412612413742070034207 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.ConsiderUsingStopwatchRule // // Authors: // Cedric Vivier // Sebastien Pouliot // // Copyright (C) 2008 Cedric Vivier // 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; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.Maintainability { /// /// This rule checks methods for cases where a System.Diagnostics.Stopwatch could be /// used instead of using System.DateTime to compute the time required for an action. /// Stopwatch is preferred because it better expresses the intent of the code and because (on /// some platforms at least) StopWatch is accurate to roughly the microsecond whereas /// DateTime.Now is only accurate to 16 milliseconds or so. This rule only applies to assemblies /// compiled with the .NET framework version 2.0 (or later). /// /// /// Bad example: /// /// public TimeSpan DoLongOperation () /// { /// DateTime start = DateTime.Now; /// DownloadNewOpenSuseDvdIso (); /// return DateTime.Now - start; /// } /// /// /// /// Good example: /// /// public TimeSpan DoLongOperation () /// { /// Stopwatch watch = Stopwatch.StartNew (); /// DownloadNewOpenSuseDvdIso (); /// return watch.Elapsed; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method uses the difference between two DateTime.Now calls to retrieve processing time. The developer's intent may not be very clear.")] [Solution ("Use the System.Diagnostics.Stopwatch type to improve code readability.")] [EngineDependency (typeof (OpCodeEngine))] public class ConsiderUsingStopwatchRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference (sealed) System.DateTime // then no code inside the module will use it. // also we do not want to run this on <2.0 assemblies since Stopwatch // did not exist back then. Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentModule.Runtime >= TargetRuntime.Net_2_0 && (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System", "DateTime"); } ))); }; } private static bool AreMirrorInstructions (Instruction ld, Instruction st, MethodDefinition method) { return (ld.GetVariable (method).Index == st.GetVariable (method).Index); } private static bool IsGetNow (Instruction ins) { if (ins.OpCode.Code != Code.Call) return false; MethodReference calledMethod = (MethodReference) ins.Operand; return calledMethod.IsNamed ("System", "DateTime", "get_Now"); } private static bool CheckParameters (MethodDefinition method, Instruction ins) { Instruction prev; if (ins.IsLoadLocal ()) { prev = ins.Previous; while (null != prev) { // look for a STLOC* instruction and compare the variable indexes if (prev.IsStoreLocal () && AreMirrorInstructions (ins, prev, method)) return IsGetNow (prev.Previous); prev = prev.Previous; } } else if (ins.OpCode.Code == Code.Ldobj) { prev = ins.TraceBack (method); ParameterDefinition p = prev.GetParameter (method); if (p == null) return false; int arg = p.Index; prev = prev.Previous; while (null != prev) { // look for a STOBJ instruction and compare the objects if (prev.OpCode.Code == Code.Stobj) { prev = prev.TraceBack (method); p = prev.GetParameter (method); return (p == null) ? false : (arg == p.Index); } prev = prev.Previous; } } else { return IsGetNow (ins); } return false; } private static bool CheckUsage (MethodDefinition method, Instruction ins) { // track the two parameters given to DateTime.op_Substraction Instruction param1 = ins.TraceBack (method, -1); Instruction param2 = ins.TraceBack (method); return CheckParameters (method, param1) && CheckParameters (method, param2); } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // is there any Call or Callvirt instructions in the method OpCodeBitmask calls = OpCodeBitmask.Calls; if (!calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { MethodReference calledMethod = ins.GetMethod (); if (calledMethod == null) continue; if (!calledMethod.DeclaringType.IsNamed ("System", "DateTime")) continue; if (!MethodSignatures.op_Subtraction.Matches (calledMethod)) continue; if (CheckUsage (method, ins)) Runner.Report (method, ins, Severity.Low, Confidence.High); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/AvoidComplexMethodsRule.cs0000664000175000017500000002651712413742070033463 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.AvoidComplexMethodsRule class // // Authors: // Cedric Vivier // Sebastien Pouliot // // (C) 2008 Cedric Vivier // 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; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Maintainability { /// /// This rule computes the cyclomatic complexity (CC) for every method and reports any method /// with a CC over 25 (this limit is configurable). Large CC value often indicate complex /// code that is hard to understand and maintain. It's likely that breaking the /// method into several methods will help readability. This rule won't report any defects /// on code generated by the compiler or by tools. /// /// This rule is available since Gendarme 2.0 [Problem ("Methods with a large cyclomatic complexity are hard to understand and maintain.")] [Solution ("Simplify the method using refactors like Extract Method.")] [FxCopCompatibility ("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidComplexMethodsRule : Rule, IMethodRule { // defaults match fxcop rule http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1575061&SiteID=1 // so people using both tools should not see conflicting results private const int DefaultSuccessThreshold = 25; static OpCodeBitmask ld = new OpCodeBitmask (0xFFFF6C3FC, 0x1B0300000000FFE0, 0x400100FFF800, 0xDE0); public AvoidComplexMethodsRule () { SuccessThreshold = DefaultSuccessThreshold; } public override void Initialize (IRunner runner) { base.Initialize (runner); // works if only SuccessThreshold is configured in rules.xml if (LowThreshold == 0) LowThreshold = SuccessThreshold * 2; if (MediumThreshold == 0) MediumThreshold = SuccessThreshold * 3; if (HighThreshold == 0) HighThreshold = SuccessThreshold * 4; } /// The cyclomatic complexity at which defects begin to be reported. /// This defaults to 25 and larger values will mean fewer reported defects. [DefaultValue (DefaultSuccessThreshold)] [Description ("The cyclomatic complexity at which defects are reported.")] public int SuccessThreshold { get; set; } /// Methods with cyclomatic complexity less than this will be reported as low severity. /// If left as zero then the rule will initialize it to 2*SuccessThreshold. [DefaultValue (0)] [Description ("Methods with cyclomatic complexity less than this will be reported as low severity.")] public int LowThreshold { get; set; } /// Methods with cyclomatic complexity less than this (but higher than LowThreshold) will be reported as medium severity. /// If left as zero then the rule will initialize it to 3*SuccessThreshold. [DefaultValue (0)] [Description ("Methods with cyclomatic complexity less than this will be reported as medium severity.")] public int MediumThreshold { get; set; } /// Methods with cyclomatic complexity less than this (but higher than MediumThreshold) will be reported as high severity. /// Methods with cyclomatic complexity greater than this will be reported as critical severity. /// If left as zero then the rule will initialize it to 4*SuccessThreshold. [DefaultValue (0)] [Description ("Methods with cyclomatic complexity less than this will be reported as high severity.")] public int HighThreshold { get; set; } public RuleResult CheckMethod (MethodDefinition method) { //does rule apply? if (!method.HasBody || method.IsGeneratedCode () || method.IsCompilerControlled) return RuleResult.DoesNotApply; //yay! rule do apply! // quick optimization: if the number of instructions is lower // than our SuccessThreshold then it cannot be too complex if (method.Body.Instructions.Count < SuccessThreshold) return RuleResult.Success; int cc = GetCyclomaticComplexity (method); if (cc < SuccessThreshold) return RuleResult.Success; //how's severity? Severity sev = GetCyclomaticComplexitySeverity(cc); string msg = String.Format (CultureInfo.CurrentCulture, "Method's cyclomatic complexity : {0}.", cc); Runner.Report (method, sev, Confidence.High, msg); return RuleResult.Failure; } public Severity GetCyclomaticComplexitySeverity(int cc) { // 25 <= CC < 50 is not good but not catastrophic either if (cc < LowThreshold) return Severity.Low; // 50 <= CC < 75 this should be refactored asap if (cc < MediumThreshold) return Severity.Medium; // 75 <= CC < 100 this SHOULD be refactored asap if (cc < HighThreshold) return Severity.High; // CC > 100, don't touch it since it may become a classic in textbooks // anyway probably no one can understand it ;-) return Severity.Critical; } static public int GetCyclomaticComplexity (MethodDefinition method) { if ((method == null) || !method.HasBody) return 1; if (OpCodeEngine.GetBitmask (method).Get (Code.Switch)) return GetSwitchCyclomaticComplexity (method); else return GetFastCyclomaticComplexity (method); } // the use of 'switch' requires a bit more code so we avoid it unless there are swicth instructions static private int GetFastCyclomaticComplexity (MethodDefinition method) { int cc = 1; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.FlowControl) { case FlowControl.Branch: // detect ternary pattern Instruction previous = ins.Previous; if ((previous != null) && ld.Get (previous.OpCode.Code)) cc++; break; case FlowControl.Cond_Branch: cc++; break; } } return cc; } static private int GetSwitchCyclomaticComplexity (MethodDefinition method) { Instruction previous = null; Instruction branch = null; int cc = 1; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.FlowControl) { case FlowControl.Branch: if (previous == null) continue; // detect ternary pattern previous = ins.Previous; if (ld.Get (previous.OpCode.Code)) cc++; // or 'default' (xmcs) if (previous.OpCode.FlowControl == FlowControl.Cond_Branch) { branch = (previous.Operand as Instruction); // branch can be null (e.g. switch -> Instruction[]) if ((branch != null) && targets.Contains (branch)) targets.AddIfNew (ins); } break; case FlowControl.Cond_Branch: // note: a single switch (C#) with sparse values can be broken into several swicth (IL) // that will use the same 'targets' and must be counted only once if (ins.OpCode.Code == Code.Switch) { AccumulateSwitchTargets (ins); } else { // some conditional branch can be related to the sparse switch branch = (ins.Operand as Instruction); previous = branch.Previous; if ((previous != null) && !previous.Previous.Is (Code.Switch)) { if (!targets.Contains (branch)) cc++; } } break; } } // count all unique targets (and default if more than one C# switch is used) cc += targets.Count; targets.Clear (); return cc; } static List targets = new List (); static private void AccumulateSwitchTargets (Instruction ins) { Instruction[] cases = (Instruction[]) ins.Operand; foreach (Instruction target in cases) { // ignore targets that are the next instructions (xmcs) if (target != ins.Next) targets.AddIfNew (target); } // add 'default' branch (if one exists) Instruction next = ins.Next; if (next.OpCode.FlowControl == FlowControl.Branch) { Instruction unc = FindFirstUnconditionalBranchTarget (cases [0]); if (unc != next.Operand) targets.AddIfNew (next.Operand as Instruction); } } static private Instruction FindFirstUnconditionalBranchTarget (Instruction ins) { while (ins != null) { if (FlowControl.Branch == ins.OpCode.FlowControl) return ((Instruction) ins.Operand); ins = ins.Next; } return null; } #if false public void Bitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Ldarg); mask.Set (Code.Ldarg_0); mask.Set (Code.Ldarg_1); mask.Set (Code.Ldarg_2); mask.Set (Code.Ldarg_3); mask.Set (Code.Ldarg_S); mask.Set (Code.Ldarga); mask.Set (Code.Ldarga_S); mask.Set (Code.Ldc_I4); mask.Set (Code.Ldc_I4_0); mask.Set (Code.Ldc_I4_1); mask.Set (Code.Ldc_I4_2); mask.Set (Code.Ldc_I4_3); mask.Set (Code.Ldc_I4_4); mask.Set (Code.Ldc_I4_5); mask.Set (Code.Ldc_I4_6); mask.Set (Code.Ldc_I4_7); mask.Set (Code.Ldc_I4_8); mask.Set (Code.Ldc_I4_M1); mask.Set (Code.Ldc_I4_S); mask.Set (Code.Ldc_I8); mask.Set (Code.Ldc_R4); mask.Set (Code.Ldc_R8); mask.Set (Code.Ldelem_Any); mask.Set (Code.Ldelem_I); mask.Set (Code.Ldelem_I1); mask.Set (Code.Ldelem_I2); mask.Set (Code.Ldelem_I4); mask.Set (Code.Ldelem_I8); mask.Set (Code.Ldelem_R4); mask.Set (Code.Ldelem_R8); mask.Set (Code.Ldelem_Ref); mask.Set (Code.Ldelem_U1); mask.Set (Code.Ldelem_U2); mask.Set (Code.Ldelem_U4); mask.Set (Code.Ldelema); mask.Set (Code.Ldfld); mask.Set (Code.Ldflda); mask.Set (Code.Ldftn); mask.Set (Code.Ldind_I); mask.Set (Code.Ldind_I1); mask.Set (Code.Ldind_I2); mask.Set (Code.Ldind_I4); mask.Set (Code.Ldind_I8); mask.Set (Code.Ldind_R4); mask.Set (Code.Ldind_R8); mask.Set (Code.Ldind_Ref); mask.Set (Code.Ldind_U1); mask.Set (Code.Ldind_U2); mask.Set (Code.Ldind_U4); mask.Set (Code.Ldlen); mask.Set (Code.Ldloc); mask.Set (Code.Ldloc_0); mask.Set (Code.Ldloc_1); mask.Set (Code.Ldloc_2); mask.Set (Code.Ldloc_3); mask.Set (Code.Ldloc_S); mask.Set (Code.Ldloca); mask.Set (Code.Ldloca_S); mask.Set (Code.Ldnull); mask.Set (Code.Ldobj); mask.Set (Code.Ldsfld); mask.Set (Code.Ldsflda); mask.Set (Code.Ldstr); mask.Set (Code.Ldtoken); mask.Set (Code.Ldvirtftn); Console.WriteLine (mask); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/ReviewMisleadingFieldNamesRule.cs0000664000175000017500000000516112413742070034723 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.ReviewMisleadingFieldNamesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; namespace Gendarme.Rules.Maintainability { /// /// This rule checks for fields which have misleading names, e.g. instance fields beginning with "s_" /// or static fields beginning with "m_", since they can be confusing when reading source code. /// /// /// Bad example: /// /// public class Bad { /// int s_value; /// static int m_other_value; /// } /// /// /// /// Good example: /// /// public class Good { /// int value; /// static int other_value; /// } /// /// [Problem ("Fields have misleading names, e.g. instance fields beginning with \"s_\" or static fields beginning with \"m_\"")] [Solution ("Rename the fields so that their names follow convention.")] [FxCopCompatibility ("Microsoft.Maintainability", "CA1504:ReviewMisleadingFieldNames")] public class ReviewMisleadingFieldNamesRule : Rule, ITypeRule { public RuleResult CheckType(TypeDefinition type) { // We need fields to test. if (!type.HasFields) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { string name = field.Name; string prefix = field.IsStatic ? "m_" : "s_"; if (name.StartsWith (prefix, StringComparison.Ordinal)) Runner.Report (field, Severity.Low, Confidence.Total); } return Runner.CurrentRuleResult; } } } VariableNamesShouldNotMatchFieldNamesRule.cs0000664000175000017500000000772112413742070036740 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability// // Gendarme.Rules.Maintainability.VariableNamesShouldNotMatchFieldNamesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Maintainability { /// /// This rule checks for local variables or parameters whose names match (case sensitive) an instance field name. /// Note that variable names can only be verified when debugging symbols (pdb or mdb) are available. /// /// /// Bad example: /// /// public class Bad { /// public int value; /// /// public void DoSomething (int value) /// { /// // without 'this.' the field will never be set /// this.value = value; /// } /// } /// /// /// /// Good example: /// /// public class Good { /// public int value; /// /// public void DoSomething (int integralValue) /// { /// value = integralValue; /// } /// } /// /// [Problem ("An instance method declares a parameter or a local variable whose name matches an instance field of the declaring type.")] [Solution ("Rename the variable/parameter or the field.")] [FxCopCompatibility ("Microsoft.Maintainability", "CA1500:VariableNamesShouldNotMatchFieldNames")] public class VariableNamesShouldNotMatchFieldNamesRule : Rule, ITypeRule { // Storing all field names in a hashset provides quicker .Contains(), and saves time // in the long run. HashSet fields; public VariableNamesShouldNotMatchFieldNamesRule () { fields = new HashSet (); } public RuleResult CheckType (TypeDefinition type) { // We only like types with fields AND methods. if (!type.HasFields || !type.HasMethods || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; fields.Clear (); foreach (FieldDefinition field in type.Fields) fields.Add (field.Name); // Iterate through all the methods. Check parameter names then method bodies. foreach (MethodDefinition method in type.Methods) { if (method.HasParameters) { foreach (ParameterDefinition param in method.Parameters) { if (fields.Contains (param.Name)) Runner.Report (param, Severity.Medium, Confidence.Total); } } // Method bodies w/o variables don't interest me. if (!method.HasBody) continue; MethodBody body = method.Body; if (body.HasVariables) { // Iterate through all variables in the method body. foreach (VariableDefinition var in body.Variables) { // if the name is compiler generated or if we do not have debugging symbols... if (var.IsGeneratedName ()) continue; if (fields.Contains (var.Name)) Runner.Report (method, Severity.Medium, Confidence.Normal, var.Name); } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/RemoveDependenceOnObsoleteCodeRule.cs0000664000175000017500000003041012413742070035525 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.RemoveDependenceOnObsoleteCodeRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Maintainability { /// /// This rule will warn you if your code depends on (e.g. inherit, implement, call...) /// code that is decorated with the [Obsolete] attribute. /// Note that the rule does not report [Obsolete] types, methods... /// but only their use by your code. /// /// /// Bad example: /// /// [Obsolete ("Limited to In32.MaxValue, use new Int64 ReportAll method")] /// abstract int Report (IList list); /// /// abstract long ReportAll (IList list); /// /// public int GetCount () /// { /// // this method is not ok since it use an obsolete method /// return Report (list); /// } /// /// /// /// Good example (dependency removed): /// /// [Obsolete ("Limited to In32.MaxValue, use new Int64 ReportAll method")] /// abstract int Report (IList list); /// /// abstract long ReportAll (IList list); /// /// // this method is correct but this changed the public API /// public long GetCount () /// { /// return ReportAll (list); /// } /// /// /// /// Good example (decorated as [Obsolete]): /// /// [Obsolete ("Limited to In32.MaxValue, use new Int64 ReportAll method")] /// abstract int Report (IList list); /// /// abstract long ReportAll (IList list); /// /// [Obsolete ("Limited to In32.MaxValue, use new Int64 GetLongCount method")] /// public int GetCount () /// { /// // this method is now correct since it is decorated with [Obsolete] /// return Report (list); /// } /// /// public long GetLongCount () /// { /// return ReportAll (list); /// } /// /// /// This rule is available since Gendarme 2.8 [Problem ("This type or method is not obsolete but depends on code decorated with [Obsolete] attribute.")] [Solution ("Remove the dependence on obsolete code or decorate this code with the [Obsolete] attribute.")] [EngineDependency (typeof (OpCodeEngine))] public class RemoveDependenceOnObsoleteCodeRule : Rule, ITypeRule, IMethodRule { static Dictionary types = new Dictionary (); static Dictionary methods = new Dictionary (); static Dictionary fields = new Dictionary (); static bool IsObsolete (TypeReference type) { if (type == null) return false; bool obsolete = false; if (!types.TryGetValue (type, out obsolete)) { TypeDefinition t = type.Resolve (); obsolete = t.HasAttribute ("System", "ObsoleteAttribute"); types.Add (type, obsolete); } return obsolete; } static bool IsObsolete (MethodReference method) { if (method == null) return false; bool obsolete = false; if (!methods.TryGetValue (method, out obsolete)) { MethodDefinition md = method.Resolve (); obsolete = md.HasAttribute ("System", "ObsoleteAttribute"); methods.Add (method, obsolete); } return obsolete; } static bool IsObsolete (FieldReference field) { if (field == null) return false; bool obsolete = false; if (!fields.TryGetValue (field, out obsolete)) { FieldDefinition fd = field.Resolve (); obsolete = fd.HasAttribute ("System", "ObsoleteAttribute"); fields.Add (field, obsolete); } return obsolete; } void CheckBaseType (TypeDefinition type) { if (!IsObsolete (type.BaseType)) return; string msg = String.Format (CultureInfo.InvariantCulture, "Inherit from obsolete type '{0}'.", type.BaseType); Runner.Report (type, type.IsVisible () ? Severity.High : Severity.Medium, Confidence.Total, msg); } void CheckInterfaces (TypeDefinition type) { foreach (TypeReference intf in type.Interfaces) { if (IsObsolete (intf)) { string msg = String.Format (CultureInfo.InvariantCulture, "Implement obsolete interface '{0}'.", intf); Runner.Report (type, type.IsVisible () ? Severity.Medium : Severity.Low, Confidence.Total, msg); } } } void CheckFields (TypeDefinition type) { foreach (FieldDefinition field in type.Fields) { if (IsObsolete (field.FieldType)) { string msg = String.Format (CultureInfo.InvariantCulture, "Field type '{0}' is obsolete.", field.FieldType); Runner.Report (field, field.IsVisible () ? Severity.Medium : Severity.Low, Confidence.Total, msg); } } } // check the properties (not the individual getter/setters) void CheckProperties (TypeDefinition type) { foreach (PropertyDefinition property in type.Properties) { if (IsObsolete (property.PropertyType)) { string msg = String.Format (CultureInfo.InvariantCulture, "Property type '{0}' is obsolete.", property.PropertyType); bool visible = (IsVisible (property.GetMethod) || IsVisible (property.SetMethod)); Runner.Report (property, visible ? Severity.High : Severity.Medium, Confidence.Total, msg); } } } void CheckEvents (TypeDefinition type) { foreach (EventDefinition evnt in type.Events) { if (IsObsolete (evnt.EventType)) { string msg = String.Format (CultureInfo.InvariantCulture, "Event type '{0}' is obsolete.", evnt.EventType); bool visible = (IsVisible (evnt.AddMethod) || IsVisible (evnt.RemoveMethod) || IsVisible (evnt.InvokeMethod)); Runner.Report (evnt, visible ? Severity.High : Severity.Medium, Confidence.Total, msg); } } } // helper method to avoid calling the same (large) properties more than once -> AvoidRepetitiveCallsToPropertiesRule static bool IsVisible (MethodReference method) { return ((method != null) && method.IsVisible ()); } // Type Visible Non-Visible // ------------------------------------------------ // BaseType* High Medium // Interfaces* Medium Low // Fields Medium Low // Properties High Medium // Events High Medium // * type visibility public RuleResult CheckType (TypeDefinition type) { // we're not interested in the details of [Obsolete] types if (type.HasAttribute ("System", "ObsoleteAttribute")) return RuleResult.DoesNotApply; // check if we inherit from an [Obsolete] class / struct / enum CheckBaseType (type); // check if we implement an [Obsolete] interface if (type.HasInterfaces) CheckInterfaces (type); // check fields types if (type.HasFields) CheckFields (type); // check properties (not the getter / setter) if (type.HasProperties) CheckProperties (type); // check events (not add / remove / invoke) if (type.HasEvents) CheckEvents (type); return Runner.CurrentRuleResult; } void CheckParameters (MethodReference method) { foreach (ParameterDefinition p in method.Parameters) { if (IsObsolete (p.ParameterType)) { string msg = String.Format (CultureInfo.InvariantCulture, "Parameter type '{0}' is obsolete.", p.ParameterType); Runner.Report (p, method.IsVisible () ? Severity.High : Severity.Medium, Confidence.Total, msg); } } } void CheckReturnType (MethodReference method) { TypeReference rt = method.ReturnType; if (!IsObsolete (rt)) return; string msg = String.Format (CultureInfo.InvariantCulture, "Return type '{0}' is obsolete.", rt); Runner.Report (method, method.IsVisible () ? Severity.High : Severity.Medium, Confidence.Total, msg); } void CheckVariables (MethodDefinition method) { foreach (VariableDefinition v in method.Body.Variables) { if (IsObsolete (v.VariableType)) { string msg = String.Format (CultureInfo.InvariantCulture, "Variable type '{0}' is obsolete.", v.VariableType); Runner.Report (method, Severity.Low, Confidence.High, msg); } } } void CheckTypeCreation (MethodDefinition method, Instruction ins, TypeReference type) { if (!IsObsolete (type)) return; string msg = String.Format (CultureInfo.InvariantCulture, "Type '{0}' is obsolete.", type); Severity severity = type.IsVisible () ? Severity.Medium : Severity.Low; Runner.Report (method, ins, severity, Confidence.High, msg); } void CheckMethodCall (MethodDefinition method, Instruction ins, MethodReference call) { if (call == null) return; string msg = null; if (IsObsolete (call)) { msg = String.Format (CultureInfo.InvariantCulture, "Method '{0}' is obsolete.", call); } else { TypeReference type = call.DeclaringType; if (IsObsolete (type)) msg = String.Format (CultureInfo.InvariantCulture, "Type '{0}' is obsolete.", type); } if (msg != null) { Severity severity = call.IsVisible () ? Severity.Medium : Severity.Low; Runner.Report (method, ins, severity, Confidence.High, msg); } } void CheckFieldAccess (MethodDefinition method, Instruction ins, FieldReference field) { if (field == null) return; string msg = null; if (IsObsolete (field)) { msg = String.Format (CultureInfo.InvariantCulture, "Field '{0}' is obsolete.", field.Name); } else if (IsObsolete (field.DeclaringType)) { msg = String.Format (CultureInfo.InvariantCulture, "Field type '{0}' is obsolete.", field.FieldType); } else { return; } Severity severity = field.IsVisible () ? Severity.Medium : Severity.Low; Runner.Report (method, ins, severity, Confidence.High, msg); } // Method Visible Non-Visible // ------------------------------------------------ // Parameters High Medium // ReturnType High Medium // Variables Low Low // Method calls Medium* Low* // Fields access Medium* Low* // * target visibility public RuleResult CheckMethod (MethodDefinition method) { // [Obsolete] cannot be applied to property or event accessors if (method.IsProperty () || method.IsAddOn || method.IsRemoveOn || method.IsFire) return RuleResult.DoesNotApply; // if the method is obsolete (directly or because it's type is) if (method.HasAttribute ("System", "ObsoleteAttribute") || method.DeclaringType.HasAttribute ("System", "ObsoleteAttribute")) return RuleResult.DoesNotApply; // check method signature (parameters, return value) if (method.HasParameters) CheckParameters (method); CheckReturnType (method); // then check what the IL calls/access if (method.HasBody) { MethodBody body = method.Body; if (body.HasVariables) CheckVariables (method); foreach (Instruction ins in body.Instructions) { switch (ins.OpCode.Code) { case Code.Newarr: case Code.Newobj: case Code.Call: case Code.Callvirt: CheckMethodCall (method, ins, (ins.Operand as MethodReference)); break; case Code.Initobj: CheckTypeCreation (method, ins, (ins.Operand as TypeReference)); break; case Code.Ldfld: case Code.Ldflda: case Code.Ldsfld: case Code.Ldsflda: case Code.Stfld: case Code.Stsfld: CheckFieldAccess (method, ins, (ins.Operand as FieldReference)); break; } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/0000775000175000017500000000000012642235742027301 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/ChangeLog0000664000175000017500000001354212413742070031051 0ustar00directhexdirecthex000000000000002010-06-20 Sebastien Pouliot * AvoidComplexMethodsTest.cs: Add test case with a switch that has non consecutive cases entries. 2010-06-07 Sebastien Pouliot * AvoidUnnecessarySpecializationTest.cs: Merge both event-related test cases together and mark them as DoesNotApply. 2010-06-07 Sebastien Pouliot * AvoidUnnecessarySpecializationTest.cs: Add [Ignore]d test case with two conflicting interfaces. Add test case for overriding and event handlers. 2010-06-06 Sebastien Pouliot * AvoidUnnecessarySpecializationTest.cs: Remove [Ignore] on a test since it seems to work properly now 2010-01-31 Sebastien Pouliot * RemoveDependenceOnObsoleteCodeTest.cs: New. Unit tests for RemoveDependenceOnObsoleteCodeRule 2010-01-26 Sebastien Pouliot * PreferStringIsNullOrEmptyTest.cs: Run Argument_InvertedCondition only if not compiled by *MCS (i.e. works with CSC). Ignore StrictlyEmpty since it cannot be reliably detected. 2009-02-15 Sebastien Pouliot * AvoidAlwaysNullFieldTest.cs: TestFixture must be public 2008-13-10 Jesse Jones * AvoidAlwaysNullFieldTest.cs: Use the correct namespace. 2008-12-10 Jesse Jones * AvoidAlwaysNullFieldTest.cs: Also report fields explicitly set to null but not used. 2008-12-09 Jesse Jones * AvoidAlwaysNullFieldTest.cs: Added. 2008-11-26 Sebastien Pouliot * ConsiderUsingStopwatchTest.cs: Add test case where the values are boxed (which can cause, using gmcs, an NRE in the rule). 2008-11-07 Alan McGovern * Tests.Rules.Maintainability.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-03 Cedric Vivier * AvoidUnnecessarySpecializationTest.cs: Remove [Ignore] from CollectionKey test as it passes now. 2008-10-22 Sebastien Pouliot * AvoidUnnecessarySpecializationTest.cs: Remove [Ignore] from GenericParameters test case. Add two new, ignored, test cases. * ConsiderUsingStopwatchTest.cs: Add more coverage. 2008-10-08 Sebastien Pouliot * PreferStringIsNullOrEmptyTest.cs: Add more test cases to get better coverage. Add a second test case for the inverted condition, but ignored since it won't work with [g]mcs compiled code. Remove ignore on the false positive StrictlyEmpty test since this is fixed. * Test.Rules.Maintainability.mdp: Add reference to System.Core so MD will compile the project. 2008-10-07 Sebastien Pouliot * PreferStringIsNullOrEmptyTest.cs: Add new test cases from Andy Hume. This returns a defects where none exists since the IL is too similar for the current rule logic. 2008-10-03 Sebastien Pouliot * AvoidLackOfCohesionOfMethodsTest.cs: Adjust test case with the comparison change I made earlier in the rule. 2008-09-28 Sebastien Pouliot * AvoidUnnecessarySpecializationTest.cs: Add a test cases for a false positive we get when more than one generic constraint exist. 2008-08-29 Sebastien Pouliot * AvoidDeepInheritanceTreeTest.cs: Use SimpleTests for DoesNotApply and add one for delegates. 2008-08-07 Sebastien Pouliot * AvoidUnnecessarySpecializationTest.cs: Add a few test cases for better coverage and one, ignored, for a false positive we have. 2008-08-04 Sebastien Pouliot * AvoidUnnecessarySpecializationTest.cs: Add test cases where methods parameters are dictated from the interface definition. 2008-08-03 Sebastien Pouliot * AvoidComplexMethodsTest.cs: Add test cases for better coverage. Use Cecil (instead of reflection) to read ExpectedCC. * ConsiderUsingStopwatchTest.cs: Complete coverage by adding test cases for Initialize and an external method (DoesNotApply). Added test cases to check for Ref/Out DateTime parameters. 2008-07-13 Sebastien Pouliot * ConsiderUsingStopwatchTest.cs: Test cases for ConsiderUsingStopwatchRule [committed for Cedric Vivier] * Test.Rules.Maintainability.mdp: Update MD project files. 2008-07-13 Sebastien Pouliot * AvoidUnnecessarySpecializationTest.cs: Test cases for AvoidUnnecessarySpecializationRule [committed for Cedric Vivier] * Test.Rules.Maintainability.mdp: Update MD project files. 2008-07-11 Sebastien Pouliot * AvoidDeepInheritanceTreeTest.cs: A second set of test cases for the (new) default rule behaviour, working on the set of assemblies only (not the whole resolvable framework). Patch by Cedric Vivier. 2008-05-18 Sebastien Pouliot * PreferStringIsNullOrEmptyTest.cs: New. Unit tests for PreferStringIsNullOrEmptyRule. 2008-05-10 Sebastien Pouliot * AvoidDeepInheritanceTreeTest.cs: New. Unit tests for AvoidDeepInheritanceTreeRule. 2008-05-10 Sebastien Pouliot * AvoidComplexMethodsTest.cs: Adapt unit tests with new threshold. 2008-05-01 Sebastien Pouliot * Tests.Rules.Maintainability.csproj: New. VS.NET project file. * Makefile.am: Add project files to dist 2008-04-27 Andres G. Aragoneses * Test.Rules.Maintainability.mdp: New project. 2008-04-27 Nestor Salceda * AvoidLackOfCohesionOfMethodsTest.cs: New. Unit tests for the rule. Thanks Cedric ! 2008-04-27 Nestor Salceda * Makefile.am: Build Gendarme.Rules.Maintainability tests. * AvoidComplexMethodsTest.cs: New. Unit tests for the rule. Thanks Cedric ! RemoveDependenceOnObsoleteCodeTest.cs0000664000175000017500000001727412413742070036412 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test// // Unit tests for RemoveDependenceOnObsoleteCodeRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Maintainability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Tests.Rules.Maintainability { [Obsolete] class ObsoleteType { public void Show () { } } [Obsolete] struct ObsoleteStruct { public int Field; } [Obsolete] struct ObsoleteEnum { } [Obsolete] interface IObsolete { } class TypeInheritObsoleteType : ObsoleteType { } class TypeImplementObsoleteInterface : IObsolete { } interface InterfaceImplementObsoleteInterface : IObsolete { } enum EnumWithObsoleteValues { One, [Obsolete] Two, Three, [Obsolete] Four } class TypeWithEnumFields { private ObsoleteEnum a; private ObsoleteEnum b; private EnumWithObsoleteValues c; // ok, the enum is not obsolete public void SetEnum (ObsoleteEnum oe) { // parameter is not used so we detect it on the signature only } public void UseEnum () { c = EnumWithObsoleteValues.Two; // obsolete } } struct StructWithStuctFields { ObsoleteStruct a; DateTime b; public void SetStruct (ObsoleteStruct os) { // parameter is not used so we detect it on the signature only } public void UseStruct () { a = new ObsoleteStruct (); } } class TypeWithObsoleteProperties { [Obsolete] int Integer { get; set; } [Obsolete] public string String { get; set; } } class TypeWithObsoletePropertiesType { ObsoleteEnum Enum { get; set; } ObsoleteStruct Struct { get; set; } ObsoleteType Type { get; set; } } struct StructWithObsoleteEvents { [Obsolete] event EventHandler WayTooLate; [Obsolete] public event EventHandler TooLate; } [Obsolete] public class ObsoleteEventArgs : EventArgs { } [Obsolete] public delegate void ObsoleteEventHandler (object sender, ObsoleteEventArgs e); struct StructWithObsoleteEventsType { event ObsoleteEventHandler WayTooLate; public event EventHandler TooLate; } [TestFixture] public class RemoveDependenceOnObsoleteCodeTypeTest : TypeRuleTestFixture { [Test] public void NonObsolete () { AssertRuleSuccess (SimpleTypes.Class); AssertRuleSuccess (SimpleTypes.Delegate); AssertRuleSuccess (SimpleTypes.Enum); AssertRuleSuccess (SimpleTypes.GeneratedType); AssertRuleSuccess (SimpleTypes.Interface); AssertRuleSuccess (SimpleTypes.Structure); } [Test] public void Obsolete () { // having obsolete types / interfaces ... is not an issue AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); // but using them is not AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } [Test] public void ObsoleteMembers () { // having obsolete fields is not an issue AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); // unless they are used (obsolete type as field) AssertRuleFailure (2); AssertRuleFailure (1); AssertRuleFailure (6); // 3 properties + 3 backing fields AssertRuleFailure (2); } } class TypeWithObsoleteFields { [Obsolete] public static int Field; void Structure () { ObsoleteStruct s = new ObsoleteStruct (); s.Field = 0; } } class TypeWithObsoleteMethods { [Obsolete] public TypeWithObsoleteMethods () { } [Obsolete] public void Show () { Console.WriteLine (); } public void ShowData (object o) { // variable (and use) of an obsolete type ObsoleteType t = (o as ObsoleteType); Console.WriteLine (t); } public void ShowType (object o) { (o as ObsoleteType).Show (); } ObsoleteType GetObsolete () { return null; } void SetObsoleteField (int x) { TypeWithObsoleteFields.Field = x; } static void Main () { new TypeWithObsoleteMethods ().Show (); } } [TestFixture] public class RemoveDependenceOnObsoleteCodeMethodTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // we can define [Obsolete] if we don't use them (backward compatibility) AssertRuleDoesNotApply ("Show"); AssertRuleDoesNotApply (".ctor"); } [Test] public void ObsoleteMethods () { // call .ctor and Show AssertRuleFailure ("Main", 2); // variable (type and it's use) AssertRuleFailure ("ShowData", 1); // call a non-obsolete method from an obsolete type AssertRuleFailure ("ShowType", 1); // obsolete return value (+ implied local variable for csc, but not gmcs) AssertRuleFailure ("GetObsolete"); } [Test] public void ObsoleteFields () { // the number of defects can vary between compiler (gmcs versus csc) AssertRuleFailure ("UseStruct"); AssertRuleFailure ("Structure", 3); // variable + initobj + field AssertRuleFailure ("SetObsoleteField", 1); } [Test] [Ignore ("Enums")] public void ObsoleteEnums () { // enums are special since they are compiled as integers (or their base type) // and we "lose" the real, named, value. We need to track every case back to the type AssertRuleFailure ("UseEnum", 1); } [Test] public void ObsoleteParameterTypes () { AssertRuleFailure ("SetEnum", 1); AssertRuleFailure ("SetStruct", 1); } [Test] public void ObsoleteProperty () { // property is [Obsolete] - not the getter/setter AssertRuleDoesNotApply ("get_Integer"); AssertRuleDoesNotApply ("set_Integer"); } [Test] public void ObsoleteEvents () { // event is [Obsolete] - not the getter/setter AssertRuleDoesNotApply ("add_TooLate"); AssertRuleDoesNotApply ("remove_TooLate"); } [Test] public void InsideObsoleteType () { // method in obsolete type calls some obsolete code AssertRuleDoesNotApply ("Show"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/PreferStringIsNullOrEmptyTest.cs0000664000175000017500000001604612413742070035551 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferStringIsNullOrEmptyRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Maintainability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Maintainability { [TestFixture] public class PreferStringIsNullOrEmptyTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL[VIRT] inside IL AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public bool ArgumentNullAndLengthCheck (string s) { return ((s == null) || (s.Length == 0)); } public static bool MuchoArgumentNullAndLengthCheck (int a, byte b, char c, double d, string s) { return ((s == null) || (s.Length == 0)); } public bool ArgumentIsNullOrEmpty (string s) { return String.IsNullOrEmpty (s); } [Test] public void Arguments () { AssertRuleFailure ("ArgumentNullAndLengthCheck"); AssertRuleFailure ("MuchoArgumentNullAndLengthCheck"); AssertRuleSuccess ("ArgumentIsNullOrEmpty"); } private string str; public bool FieldNullAndLengthCheck () { return ((str == null) || (str.Length == 0)); } public bool FieldIsNullOrEmpty () { return String.IsNullOrEmpty (str); } [Test] public void Fields () { AssertRuleFailure ("FieldNullAndLengthCheck"); AssertRuleSuccess ("FieldIsNullOrEmpty"); } static public bool ArgumentIsNotNullAndNotEmpty (string str) { return !((str != null) && (str.Length > 0)); } public bool FieldIsNotNullAndNotEmpty () { return !((str != null) && (str.Length > 0)); } [Test] #if __MonoCS__ [Ignore ("is not always detected, e.g. code generated by [g]mcs")] #endif public void Argument_InvertedCondition () { Assert.IsTrue (ArgumentIsNotNullAndNotEmpty (null), "null"); Assert.IsTrue (ArgumentIsNotNullAndNotEmpty (String.Empty), "empty"); AssertRuleFailure ("ArgumentIsNotNullAndNotEmpty"); AssertRuleFailure ("FieldIsNotNullAndNotEmpty"); } static bool ArgumentVariationForCoverage (string str) { return !((str != null) && (str.Length < 0)); } [Test] public void VariationForCoverage () { AssertRuleSuccess ("ArgumentVariationForCoverage"); } private static string static_str; public void StaticFieldNullAndLengthCheck () { if ((static_str == null) || (static_str.Length == 0)) Console.WriteLine ("Empty"); } public void StaticFieldIsNullOrEmpty () { if (String.IsNullOrEmpty (static_str)) Console.WriteLine ("Empty"); } [Test] public void StaticFields () { AssertRuleFailure ("StaticFieldNullAndLengthCheck"); AssertRuleSuccess ("StaticFieldIsNullOrEmpty"); } public bool LocalNullAndLengthCheck () { string s = String.Format ("{0}", 1); return ((s == null) || (s.Length == 0)); } public bool MuchoLocalNullAndLengthCheck () { string s1 = String.Format ("{0}", 1); if ((s1 == null) || (s1.Length == 0)) return true; string s2 = String.Format ("{0}", 1); if ((s2 == null) || (s2.Length == 0)) return true; string s3 = String.Format ("{0}", 1); if ((s3 == null) || (s3.Length == 0)) return true; string s4 = String.Format ("{0}", 1); if ((s4 == null) || (s4.Length == 0)) return true; string s5 = String.Format ("{0}", 1); return ((s5 == null) || (s5.Length == 0)); } public bool LocalIsNullOrEmpty () { string s = String.Format ("{0}", 1); return String.IsNullOrEmpty (s); } [Test] public void Locals () { AssertRuleFailure ("LocalNullAndLengthCheck", 1); AssertRuleFailure ("MuchoLocalNullAndLengthCheck", 5); AssertRuleSuccess ("LocalIsNullOrEmpty"); } public static void StaticLocalNullAndLengthCheck () { string s = String.Format ("{0}", 1); if ((s == null) || (s.Length == 0)) Console.WriteLine ("Empty"); } public static void StaticLocalIsNullOrEmpty () { string s = String.Format ("{0}", 1); if (String.IsNullOrEmpty (s)) Console.WriteLine ("Empty"); } [Test] public void StaticLocals () { AssertRuleFailure ("StaticLocalNullAndLengthCheck"); AssertRuleSuccess ("StaticLocalIsNullOrEmpty"); } // two different checks are ok if we're doing different stuff, like throwing exceptions, based on each one public void CommonExceptionPattern (string s) { if (s == null) throw new ArgumentNullException ("s"); if (s.Length == 0) throw new ArgumentException ("empty"); } public void ConfusingStringInstance (string s1, string s2) { // this is bad code but it's not what the rule looks for if ((s1 == null) || (s2.Length == 0)) throw new InvalidOperationException ("confusing s1 and s2!"); } [Test] public void Others () { AssertRuleSuccess ("CommonExceptionPattern"); AssertRuleSuccess ("ConfusingStringInstance"); } public static bool StringIsStrictlyEmpty (string value) { return value != null && value.Length == 0; } public void ThereShouldBeNoStringIsNullOrEmptySuggestionHere (string realm) { if (realm != null && realm.Length == 0) throw new ArgumentException (); Console.WriteLine (realm); } [Test] [Ignore ("FIXME: false positive")] public void StrictlyEmpty () { AssertRuleSuccess ("StringIsStrictlyEmpty"); AssertRuleSuccess ("ThereShouldBeNoStringIsNullOrEmptySuggestionHere"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/Makefile.in0000664000175000017500000003146212642235732031353 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Maintainability/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Maintainability.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Maintainability/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Maintainability/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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: VariableNamesShouldNotMatchFieldNamesTest.cs0000664000175000017500000000620512413742070037663 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test// // Unit Tests for VariableNamesShouldNotMatchFieldNamesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using System.Text; using Gendarme.Rules.Maintainability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Mono.Cecil; using Test.Rules.Helpers; namespace Test.Rules.Maintainability { [TestFixture] public class VariableNamesShouldNotMatchFieldNamesTest : TypeRuleTestFixture { private class GoodClass { int Value; void DoSomething(int OtherValue) { int VeryOtherValue = 0; VeryOtherValue = OtherValue++; } } private class BadClass { int Value; void DoSomething(int Value) { } } // We ignore this, as we need .pdb access to resolve local variable names. private class BadIgnore { int Value = 0, Value1 = 1; void DoSomething(int Value) { int Value1; Value1 = Value + this.Value; } } private class DoesNotApplyClass1 { int Value; } private class DoesNotApplyClass2 { void DoSomething() { } } private TypeDefinition DoesNotApplyClassSpecial; [TestFixtureSetUp] public void SetUp() { // A type always has a method (implicit constructor) so we have to hack our own // methodless class. DoesNotApplyClassSpecial = DefinitionLoader.GetTypeDefinition (); DoesNotApplyClassSpecial.Methods.Clear (); } [Test] public void Good () { AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (1); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (DoesNotApplyClassSpecial); AssertRuleDoesNotApply (); } [Test] public void Ignores () { AssemblyDefinition assembly = DefinitionLoader.GetAssemblyDefinition (); int expected = assembly.MainModule.HasSymbols ? 2 : 1; AssertRuleFailure (expected); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/ReviewMisleadingFieldNamesTest.cs0000664000175000017500000000407212413742070035652 0ustar00directhexdirecthex00000000000000// // Unit Tests for ReviewMisleadingFieldNamesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using System.Text; using Gendarme.Rules.Maintainability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Maintainability { [TestFixture] public class ReviewMisleadingFieldNamesTest : TypeRuleTestFixture { private class GoodClass { int m_SomeValue; static int s_SomeValue; } private class Bad1 { int s_SomeValue; static int s_SomeOtherValue; } private class Bad2 { int s_SomeValue; static int m_SomeValue; } [Test] public void Good () { AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (1); AssertRuleFailure (2); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Class); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/AvoidDeepInheritanceTreeTest.cs0000664000175000017500000000640412413742070035317 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidDeepInheritanceTreeRule // // Authors: // Sebastien Pouliot // // 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; using System.Security.Cryptography; using Gendarme.Rules.Maintainability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Maintainability { public class Internal : HMACSHA1 { } public class InternalOne : Internal { } public class InternalTwo : InternalOne { } public class InternalThree : InternalTwo { } public class InternalFour : InternalThree { } public class InternalFive : InternalFour { } [TestFixture] public class AvoidDeepInheritanceTreeTestWithCountExternalDepth : TypeRuleTestFixture { [SetUp] public void SetUp () { Rule.CountExternalDepth = true; } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Structure); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Delegate); } [Test] public void Zero () { AssertRuleSuccess (); } [Test] public void One () { // inherits from System.Object AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Two () { AssertRuleSuccess (); } [Test] public void Three () { AssertRuleSuccess (); } [Test] public void Four () { AssertRuleSuccess (); } class MyHMACSHA1 : HMACSHA1 { } [Test] public void More () { AssertRuleFailure (); } [Test] public void InternalOneWithCountExternalDepth () { AssertRuleFailure (); } } [TestFixture] public class AvoidDeepInheritanceTreeTest : TypeRuleTestFixture { [Test] public void InternalZero () { AssertRuleSuccess (); } [Test] public void InternalOne () { AssertRuleSuccess (); } [Test] public void InternalFour () { AssertRuleSuccess (); } [Test] public void InternalFive () { AssertRuleFailure (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/Tests.Rules.Maintainability.csproj0000775000175000017500000001424712413742070036037 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {A2F3E904-8D4E-4C18-A0B9-B2BCBD3A0537} Library Properties Tests.Rules.Maintainability Tests.Rules.Maintainability v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 3.0 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {8DB890C9-F9B7-4BEA-9ADE-EF32391363C2} Gendarme.Rules.Maintainability False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/AvoidComplexMethodsTest.cs0000664000175000017500000002773612413742070034416 0ustar00directhexdirecthex00000000000000// // Unit Test for AvoidComplexMethods Rule. // // Authors: // Sebastien Pouliot // // (C) 2008 Cedric Vivier // 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; using System.Runtime.InteropServices; using System.Text; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Maintainability; using Mono.Cecil; using Mono.Cecil.Cil; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Maintainability { [AttributeUsage(AttributeTargets.Method)] public sealed class ExpectedCCAttribute : Attribute { public ExpectedCCAttribute(int cc) { _cc = cc; } public int Value { get { return _cc; } } private int _cc = 0; } public class MethodsWithExpectedCC { [ExpectedCC (1)] [DllImport ("libc.so")] private static extern void strncpy (StringBuilder dest, string src, uint n); [ExpectedCC(1)] public void Test1() { Console.Write("1"); } [ExpectedCC(1)] public void TestLong1(int x, int y) { Console.Write("{0} {1} {2} {3}", x, x+0, (x+0>y), y); Console.Write("{3} {2} {1} {0}", x, x+1, (x+1>y), y); Console.Write("{3} {2} {1} {0}", x, x+2, (x+2>y), y); Console.Write("{0} {2} {1} {3}", x, x+3, (x+3>y), y); Console.Write("{0} {1} {3} {2}", x, x+4, (x+4>y), y); Console.Write("{3} {1} {2} {0}", x, x+5, (x+5>y), y); Console.Write("{3} {1} {2} {0}", x*x, (x+5)*x, (((x+5)*x)>y), y*y); } [ExpectedCC(2)] public object Test2(object x) { return x ?? new object()/*2*/; } [ExpectedCC(3)] public int TestTernary3(int x) { return (x == 0) ? -1/*2*/ : 1/*3*/; } [ExpectedCC(5)] public void TestSwitch5(int x) { switch (x) { case 1: case 2: case 3: Console.Write("abc"); break; case 4: Console.Write("d"); break; case 5: Console.Write("e"); break; default: Console.Write("default"); break; } Console.Write("oob"); } [ExpectedCC(6)] public void TestSwitch6(int x) { Console.Write("oob"); switch (x) { case 1: Console.Write("a"); break; case 2: Console.Write("b"); break; case 3: Console.Write("c"); break; case 4: Console.Write("d"); break; case 5: Console.Write("e"); break; } Console.Write("oob"); } [ExpectedCC(7)] public void TestSwitch7(int x) { switch (x) { case 1: Console.Write("a"); break; case 2: Console.Write("b"); break; case 3: Console.Write("c"); break; case 4: Console.Write("d"); break; case 5: Console.Write("e"); break; default: Console.Write("default"); break; } Console.Write("oob"); } [ExpectedCC(6)] public object Test6(object val) { if (val != null) {/*2*/ return (val == this) ? 1/*3*/ : 2/*4*/; } else if (val.GetType() == typeof(string))/*5*/ { string sRef = val.GetType().FullName; return sRef ?? "foo"/*6*/; } throw new InvalidOperationException(); } [ExpectedCC(14)] public void Test14(int x) { switch (x) { case 1: Console.Write("a"); break; case 2: Console.Write("b"); break; case 3: Console.Write("c"); break; case 4: Console.Write("d"); break; case 5: Console.Write("e"); break; default:/*7*/ Console.Write("default"); break; } int y = this.GetHashCode(); if (Math.Min(x, y) > 0/*8*/ && Math.Min(x,y) < 42/*9*/) { y = (x == 32) ? x/*10*/ : y/*11*/; } else if (x == 3000/*12*/ || y > 3000/*13*/ || y == 500/*14*/) { y = 200; } Console.Write("oob"); } [ExpectedCC(27)] public object Test27(object val) { if (val == null) {/*2*/ return null; } else if (val.GetType() == typeof(string))/*3*/ { string sRef = "eateat"; return sRef; } else if (val.GetType () == typeof (int)/*4*/ || val.GetType () == typeof (uint)/*5*/ || val.GetType () == typeof (float)/*6*/ || val.GetType () == typeof (double)/*7*/ || val.GetType () == typeof (byte)/*8*/ || val.GetType () == typeof (sbyte)/*9*/ || val.GetType () == typeof (short)/*10*/ || val.GetType () == typeof (ushort)/*11*/ || val.GetType () == typeof (long)/*12*/ || val.GetType () == typeof (ulong)/*13*/ || val.GetType () == typeof (void)/*14*/ || val.GetType () == typeof (IntPtr)/*15*/ || val.GetType () == typeof (UIntPtr)/*16*/ || val.GetType () == typeof (char))/*17*/ { return 50; } else if (val.GetType() == typeof(bool))/*19*/ { return (val.GetType().FullName == "foo") ? true/*19*/ : false/*20*/; } else if (val.GetType() == typeof(object))/*21*/ { return val; } int i = val.GetHashCode(); if (i > 0/*22*/ && i < 42/*23*/) { return null; } else if (i == 42/*24*/ || i == 69/*25*/) { return (i == 42) ? true/*26*/ : false/*27*/; } throw new InvalidOperationException(); } [ExpectedCC (53)] public void TooManyIf (char c) { if ((c == 'a') || (c == 'b') || (c == 'c') || (c == 'd') || (c == 'e') || (c == 'f') || (c == 'g') || (c == 'h') || (c == 'i') || (c == 'j') || (c == 'k') || (c == 'l') || (c == 'm') || (c == 'n') || (c == 'o') || (c == 'p') || (c == 'q') || (c == 'r') || (c == 's') || (c == 't') || (c == 'u') || (c == 'v') || (c == 'w') || (c == 'x') || (c == 'y') || (c == 'z') || (c == 'A') || (c == 'B') || (c == 'C') || (c == 'D') || (c == 'E') || (c == 'F') || (c == 'G') || (c == 'H') || (c == 'I') || (c == 'J') || (c == 'K') || (c == 'L') || (c == 'M') || (c == 'N') || (c == 'O') || (c == 'P') || (c == 'Q') || (c == 'R') || (c == 'S') || (c == 'T') || (c == 'U') || (c == 'V') || (c == 'W') || (c == 'X') || (c == 'Y') || (c == 'Z')) Console.WriteLine ("52!"); } [ExpectedCC(15)] [System.Runtime.CompilerServices.CompilerGenerated] public object Generated15(object val) { if (val == null) {/*2*/ return null; } else if (val.GetType () == typeof (string))/*3*/ { string sRef = "eateat"; return sRef; } else if (val.GetType () == typeof (int)/*4*/ || val.GetType () == typeof (uint)/*5*/ || val.GetType () == typeof (float)/*6*/ || val.GetType () == typeof (double)/*7*/ || val.GetType () == typeof (byte)/*8*/ || val.GetType () == typeof (long)/*9*/ || val.GetType () == typeof (ulong)/*10*/ || val.GetType () == typeof (char))/*11*/ { return 50; } else if (val.GetType () == typeof (bool))/*12*/ { return (val.GetType ().FullName == "foo") ? true/*13*/ : false/*14*/; } else if (val.GetType () == typeof (object))/*15*/ { return val; } throw new InvalidOperationException (); } // adapted from InstructionRocks.GetOperandType [ExpectedCC (8)] public static int GetOperandType (Instruction self, MethodDefinition method) { int i = 0; switch (self.OpCode.Code) { case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: case Code.Ldarg: case Code.Ldarg_S: case Code.Ldarga: case Code.Ldarga_S: case Code.Starg: case Code.Starg_S: i = 1; Console.WriteLine ("arguments"); break; case Code.Conv_R4: case Code.Ldc_R4: case Code.Ldelem_R4: case Code.Ldind_R4: case Code.Stelem_R4: case Code.Stind_R4: i = 2; Console.WriteLine ("singles"); break; case Code.Conv_R8: case Code.Ldc_R8: case Code.Ldelem_R8: case Code.Ldind_R8: case Code.Stelem_R8: i = 3; Console.WriteLine ("doubles"); break; case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: case Code.Ldloc: case Code.Ldloc_S: case Code.Ldloca: case Code.Ldloca_S: case Code.Stloc_0: case Code.Stloc_1: case Code.Stloc_2: case Code.Stloc_3: case Code.Stloc: case Code.Stloc_S: i = 4; Console.WriteLine ("locals"); break; case Code.Ldfld: case Code.Ldflda: case Code.Ldsfld: case Code.Ldsflda: case Code.Stfld: case Code.Stsfld: i = 5; Console.WriteLine ("fields"); break; case Code.Call: case Code.Callvirt: case Code.Newobj: i = 6; Console.WriteLine ("calls"); break; default: i = 7; Console.WriteLine ("default"); break; } Console.WriteLine ("end"); return i; } } [TestFixture] public class AvoidComplexMethodsTest : MethodRuleTestFixture { [Test] public void CyclomaticComplexityMeasurementTest () { TypeDefinition type = DefinitionLoader.GetTypeDefinition (); int actual_cc; int expected_cc; foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) continue; actual_cc = AvoidComplexMethodsRule.GetCyclomaticComplexity (method); expected_cc = GetExpectedComplexity (method); Assert.AreEqual (expected_cc, actual_cc, "CC for method '{0}' is {1} but should have been {2}.", method.Name, actual_cc, expected_cc); } } private int GetExpectedComplexity(MethodDefinition method) { foreach (CustomAttribute attr in method.CustomAttributes) { if (attr.AttributeType.Name == "ExpectedCCAttribute") return (int) attr.ConstructorArguments [0].Value; } throw new ArgumentException (method + " does not have ExpectedCCAttribute"); } [Test] public void SimpleMethodsTest () { AssertRuleSuccess ("Test1"); AssertRuleSuccess ("TestLong1"); AssertRuleSuccess ("Test2"); AssertRuleSuccess ("TestTernary3"); AssertRuleSuccess ("TestSwitch5"); AssertRuleSuccess ("TestSwitch6"); AssertRuleSuccess ("TestSwitch7"); AssertRuleSuccess ("Test6"); AssertRuleSuccess ("Test14"); } [Test] public void ComplexMethodTest () { AssertRuleFailure ("Test27"); } [Test] public void MoreComplexMethodTest () { AssertRuleFailure ("TooManyIf"); } [Test] public void MethodDoesNotApplyTest () { AssertRuleDoesNotApply ("Generated15"); } [Test] public void Custom () { try { Rule.SuccessThreshold = 10; Rule.LowThreshold = 15; Rule.MediumThreshold = 25; AssertRuleFailure ("Test27", 1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "Test27-Severity"); Rule.HighThreshold = 50; AssertRuleFailure ("TooManyIf", 1); Assert.AreEqual (Severity.Critical, Runner.Defects [0].Severity, "TooManyIf-Severity"); } finally { Rule.SuccessThreshold = 25; Rule.LowThreshold = 50; Rule.MediumThreshold = 75; Rule.HighThreshold = 100; } } [Test] public void HighLevelSwitchBrokenIntoSeveralIlSwitch () { AssertRuleSuccess ("GetOperandType"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/AvoidAlwaysNullFieldTest.cs0000664000175000017500000001311412413742070034503 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidAlwaysNullFieldRule // // Authors: // Jesse Jones // Sebastien Pouliot // // Copyright (C) 2008 Jesse Jones // 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.Generic; using System.Linq; using System.Threading; using Gendarme.Rules.Maintainability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Maintainability { [TestFixture] public sealed class AvoidAlwaysNullFieldTest : TypeRuleTestFixture { private sealed class Good1 { private string name = "hey"; // initialized public void Write () { Console.WriteLine (name); } } private class Good2 { protected string name; // not private public void Write () { if (name != null) Console.WriteLine (name); } } private sealed class Good3 { private string name; // not used (AvoidUnusedPrivateField will handle this case) public void Write () { Console.WriteLine ("hey"); } } private sealed class Good4 { private IntPtr zero; // not a reference type public void Write () { Console.WriteLine (zero); } } private sealed class Good5 { private static string name = "hey"; // initialized public void Write () { Console.WriteLine (name); } } private sealed class Good6 { private string name; public Good6 () { IndirectSet (ref name); // address taken } public void Write () { Console.WriteLine (name); } public void IndirectSet (ref string n) { n = "hey"; } } private class Bad1 { private string name; public void Write () { if (name != null) Console.WriteLine (name); } } private class Bad2 { private string name; public Bad2 () { name = null; } public void Write () { if (name != null) Console.WriteLine (name); } } private class Bad3 { private static string name; public Bad3 () { name = null; } public void Write () { if (name != null) Console.WriteLine (name); } } private class Bad4 { private string name1; private string name2; public Bad4 () { name1 = null; // explictly set to null, but not used name2 = "hey"; } public void Write () { Console.WriteLine (name2); } } private class TernaryIf { private string name; public TernaryIf (bool flag) { name = flag ? "hmm" : null; // we don't handle this properly } public void Write () { if (name != null) Console.WriteLine (name); } } [Test] public void Simple () { AssertRuleDoesNotApply (SimpleTypes.Class); // no fields AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleSuccess (SimpleTypes.Structure); // a few public fields } [Test] public void Cases () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); } class Bug667692a { private string [] bar = null; public void SetBar (IEnumerable boo) { bar = boo == null ? null : boo.ToArray (); } } class Bug667692b { private string [] bar = null; public void SetBar (IEnumerable boo) { bar = boo != null ? boo.ToArray () : null; } } [Test] public void MultipleAssignment () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } // this will create an anonymous method class AnonymousDelegatesAllFields { string file; void Parse () { ThreadPool.QueueUserWorkItem (delegate { file = ""; }); } void Show () { Console.WriteLine (file); } } // this will create a nested type with the anonymous method class AnonymousDelegatesFieldsAndLocals { string file; void Parse () { string local; ThreadPool.QueueUserWorkItem (delegate { file = ""; local = file; }); } void Show () { Console.WriteLine (file); } } [Test] public void AnonymousDelegates () { AssertRuleSuccess (); AssertRuleSuccess (); } } } AvoidUnnecessarySpecializationTest.cs0000664000175000017500000004034412413742070036570 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test// // Unit tests for AvoidUnnecessarySpecializationRule // // Authors: // Cedric Vivier // // Copyright (C) 2008 Cedric Vivier // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Linq; using System.Reflection; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Maintainability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Maintainability { public class Base { public virtual void Foo() { } } public class Derived : Base { public override void Foo() { } public void Bar(int x, string y) { } } public class DerivedDerived : Derived { public DerivedDerived (Base parent) { } public override void Foo() { } public new void Bar(int x, string y) { } public void DerivedDerivedSpecific() { } } public class GeneralizedClass { public void FooCouldBeBase (Base foo) { foo.Foo (); } public void DerivedDerivedSpecificCouldNotBeGeneralized (DerivedDerived specific) { specific.Bar (999, "bar"); specific.DerivedDerivedSpecific (); specific.Foo (); } public void DerivedBarCouldNotBeGeneralized (Derived bar) { bar.Bar (0, string.Empty); } public int BarAndFooCouldNotBeGeneralized (string foo, Derived bar) { bar.Bar (foo.Length, foo); return 0; } public void BarAsGeneralizedArgument (string hash, Derived dbar) { dbar.Foo (); //if bar wasn't used as a Derived argument below it would be eligible DerivedBarCouldNotBeGeneralized(dbar); } public void Interface (IDisposable stream, int number) { stream.Dispose (); } public bool CollectionInterface (IEnumerable list, int number) { foreach (int i in list) if (number == i) return true; return false; } public bool GenericInterface (IEnumerable list, int number) { foreach (int i in list) if (number == i) return true; return false; } public int Property { get { return prop; } set { prop = value; } } int prop; public void ParameterLessMethod () { } public void GenericAddBar (Base bar) { List l = new List(); l.Add(bar); } public DerivedDerived Constructor (Base bar) { return new DerivedDerived (bar); } public Derived derived; public void Stfld (Derived bar) { derived = bar; } public void Stfld2 (DerivedDerived bar) { derived = bar;//no warn since we use specific below bar.DerivedDerivedSpecific (); } public static Derived sderived; public void Stsfld (Derived bar) { sderived = bar; } public void Stsfld2 (DerivedDerived bar) { sderived = bar;//no warn since we use specific below bar.DerivedDerivedSpecific (); } public void GenericMethod (T x) where T : System.Exception { Console.WriteLine (x.Message); } public int GenericMethodArgument (Type type) { Type [] types = new Type [0]; return Array.IndexOf (types, type); } public FieldInfo [] OverloadNotSupportedByInterface (Type type) { return type.GetFields (); } } public class SpecializedClass { public void FooCouldBeBase (Derived foo) { foo.Foo (); } public void DerivedDerivedFooCouldBeBase (int dummy, DerivedDerived foo) { foo.Foo (); } public void DerivedDerivedBarCouldBeDerived (DerivedDerived bar) { bar.Bar (0, null); } public void BarAndFooCouldBeGeneralized (Derived foo, DerivedDerived bar) { bar.Bar (42, "hash"); foo.Foo (); } public int BarCouldBeGeneralizedButNotFoo (string foo, DerivedDerived bar) { bar.Bar (42, "hash"); return foo.Length; } public int BarAsSpecializedArgument (string hash, DerivedDerived bar) { FooCouldBeBase(bar); return 0; } //`stream` could be an IDisposable public void Interface (System.IO.Stream stream, int number) { stream.Dispose (); } //`list` could be a IEnumerable, but we ignore the suggestion public bool CollectionInterface (ArrayList list, int number) { foreach (int i in list) if (number == i) return true; return false; } //`list` could be a IEnumerable (or int* ;) public bool GenericInterface (List list, int number) { foreach (int i in list) if (number == i) return true; return false; } //`bar` could be Base public void GenericAddBar (Derived bar) { List l = new List(); l.Add(bar); } //`bar` could be Base public DerivedDerived Constructor (Derived bar) { return new DerivedDerived (bar); } public Derived derived; public void Stfld (DerivedDerived bar) { derived = bar; } public static Derived sderived; public void Stsfld (DerivedDerived bar) { sderived = bar; } public void GenericMethod (T x) where T : System.ArgumentException { Console.WriteLine (x.Message); } //`type` could be MemberInfo public int GenericMethodArgument (Type type) { MemberInfo [] types = new MemberInfo [0]; return Array.IndexOf (types, type); } public FieldInfo [] OverloadNotSupportedByInterface (Type type) { //IReflect support this GetFields overload return type.GetFields (BindingFlags.Public); } } // resolve won't work when running unit test from makefiles interface ITestTypeRule { RuleResult CheckType (TypeDefinition type); } interface ITestMethodRule { RuleResult CheckMethod (MethodDefinition method); } class TestRule : Rule, ITestTypeRule, ITestMethodRule { public RuleResult CheckType (TypeDefinition type) { Console.WriteLine (type.Name); return RuleResult.DoesNotApply; } public RuleResult CheckMethod (MethodDefinition method) { Console.WriteLine (method.Name); return RuleResult.Success; } } [TestFixture] public class AvoidUnnecessarySpecializationTest : MethodRuleTestFixture { [Test] public void NotApplicable () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } [Test] public void FooCouldBeBase () { AssertRuleFailure ("FooCouldBeBase"); AssertRuleSuccess ("FooCouldBeBase"); } [Test] public void DerivedDerivedFooCouldBeBase () { AssertRuleFailure ("DerivedDerivedFooCouldBeBase"); AssertRuleSuccess ("DerivedDerivedSpecificCouldNotBeGeneralized"); } [Test] public void DerivedDerivedBarCouldBeDerived () { AssertRuleFailure ("DerivedDerivedBarCouldBeDerived"); AssertRuleSuccess ("DerivedBarCouldNotBeGeneralized"); } [Test] public void BarAndFooCouldBeGeneralized () { AssertRuleFailure ("BarAndFooCouldBeGeneralized", 2); AssertRuleFailure ("BarCouldBeGeneralizedButNotFoo", 1); AssertRuleSuccess ("BarAndFooCouldNotBeGeneralized"); } [Test] public void BarUsedAsArgument () { AssertRuleFailure ("BarAsSpecializedArgument"); AssertRuleSuccess ("BarAsGeneralizedArgument"); } [Test] public void Interface () { AssertRuleSuccess ("Interface"); AssertRuleFailure ("Interface"); Assert.IsTrue (Runner.Defects [0].Text.IndexOf ("'System.IDisposable'") > 0); } [Test] public void CollectionInterface () { //we ignore non-generic collection interface suggestions since //we cannot know if the suggestion would work wrt casts etc... AssertRuleSuccess ("CollectionInterface"); AssertRuleSuccess ("CollectionInterface"); } [Test] public void GenericInterface () { AssertRuleSuccess ("GenericInterface"); AssertRuleFailure ("GenericInterface"); Assert.IsTrue (Runner.Defects [0].Text.IndexOf ("'System.Collections.Generic.IEnumerable'") > 0); } [Test] public void GenericAddBar () { AssertRuleFailure ("GenericAddBar"); AssertRuleSuccess ("GenericAddBar"); } [Test] public void Constructor () { AssertRuleFailure ("Constructor"); AssertRuleSuccess ("Constructor"); } [Test] public void Field () { AssertRuleFailure ("Stfld"); AssertRuleSuccess ("Stfld"); AssertRuleSuccess ("Stfld2"); } [Test] public void StaticField () { AssertRuleFailure ("Stsfld"); AssertRuleSuccess ("Stsfld"); AssertRuleSuccess ("Stsfld2"); } [Test] public void GenericMethod () { AssertRuleSuccess ("GenericMethod"); AssertRuleFailure ("GenericMethod"); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("ParameterLessMethod"); AssertRuleDoesNotApply ("get_Property"); AssertRuleDoesNotApply ("set_Property"); } [Test] public void SatisfyInterface () { AssertRuleDoesNotApply ("CheckType"); AssertRuleDoesNotApply ("CheckMethod"); } // based on System.Boolean Gendarme.Rules.Smells.AvoidLongMethodsRule::IsAutogeneratedByTools(Mono.Cecil.MethodDefinition) // original recommandation is IMethodSignature - which does not supply a DeclaringType property private static bool IsAutogeneratedByTools (MethodDefinition method) { if (method.Parameters.Count != 0) return false; return (method.DeclaringType.Resolve () == null); } [Test] public void FalsePositive () { AssertRuleSuccess ("IsAutogeneratedByTools"); } private static bool Compare (MethodDefinition method) { return (method == null); } private static bool Unused (MethodDefinition method) { return false; } [Test] public void NoInformation () { AssertRuleSuccess ("Compare"); AssertRuleSuccess ("Unused"); } private bool CheckValueType (byte b) { return (b == 0); } private bool CheckArray (object [] array) { foreach (object o in array) { if (o == null) return true; } return false; } [Test] public void Ignored () { AssertRuleSuccess ("CheckValueType"); AssertRuleSuccess ("CheckArray"); } [Test] public void GenericParameters () { // rule suggest IConvertible which is (one of) the constraint on AssertRuleSuccess> ("Get"); AssertRuleSuccess> ("Set"); } // from AvoidUncalledPrivateCodeRule static Dictionary> cache; private static HashSet GetCache (TypeDefinition type) { HashSet methods; if (!cache.TryGetValue (type, out methods)) { methods = new HashSet (); cache.Add (type, methods); foreach (MethodDefinition md in type.Methods) { if (!md.HasBody) continue; } } return methods; } [Test] public void CollectionKey () { AssertRuleSuccess ("GetCache"); } // from gendarme/rules/Gendarme.Rules.Portability/MonoCompatibilityReviewRule.cs public event EventHandler BuildingCustomAttributes; private void BuildCustomAttributes (Mono.Cecil.ICustomAttributeProvider custom, EngineEventArgs e) { if ((BuildingCustomAttributes != null) && (custom.CustomAttributes.Count > 0)) { BuildingCustomAttributes (custom, e); } } [Test] public void GenericMethodArgument () { AssertRuleSuccess ("GenericMethodArgument"); AssertRuleFailure ("GenericMethodArgument"); Assert.IsTrue(Runner.Defects [0].Text.IndexOf ("'System.Reflection.MemberInfo'") > 0); } private bool HasMoreParametersThanAllowed (IMethodSignature method) { return (method.HasParameters ? method.Parameters.Count : 0) >= 1; } // extracted from AvoidLongParameterListsRule where IMethodSignature was suggested // but could not be cast (when compiled) into Mono.Cecil.IMetadataTokenProvider private void CheckConstructor (IMethodSignature constructor) { if (HasMoreParametersThanAllowed (constructor)) Runner.Report (constructor, Severity.Medium, Confidence.Normal, "This constructor contains a long parameter list."); } [Test] public void UncompilableSuggestion () { AssertRuleSuccess ("CheckConstructor"); } // test case based on false positive found on: // System.Void Gendarme.Rules.Concurrency.DoNotLockOnWeakIdentityObjectsRule::Analyze(Mono.Cecil.MethodDefinition,Mono.Cecil.MethodReference,Mono.Cecil.Cil.Instruction) class Base { public virtual void Show (MethodDefinition method) { Console.WriteLine (method.Body.CodeSize); } } class Override : Base { // without checking the override the rule would suggest: // Parameter 'method' could be of type 'Mono.Cecil.MemberReference'. // but this would not compile public override void Show (MethodDefinition method) { Console.WriteLine (method.Name); } } [Test] public void OverrideTypeCannotBeChanged () { AssertRuleDoesNotApply ("Show"); } public sealed class DecorateThreadsRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); runner.AnalyzeAssembly += this.OnAssembly; } // rule suggest HierarchicalEventArgs but we can't change the event definition public void OnAssembly (object sender, RunnerEventArgs e) { Console.WriteLine (e.CurrentAssembly); } public RuleResult CheckMethod (MethodDefinition method) { throw new NotImplementedException (); } } [Test] public void EventsCannotBeChanged () { AssertRuleDoesNotApply ("OnAssembly"); AssertRuleDoesNotApply ("BuildCustomAttributes"); } // this will generate code like: // call instance void !!T[0...,0...]::Set(int32, int32, !!0) // which does not really exists (e.g. can't be resolve into a MethodDefinition) private void Fill (T [,] source, T value) { for (int i = 0; i < source.GetLength (0); i++) { for (int j = 0; j < source.GetLength (1); j++) source [i, j] = value; } } [Test] public void MultiDimSet () { AssertRuleSuccess ("Fill"); } [Test] public void OverloadNotSupportedByInterface () { AssertRuleSuccess ("OverloadNotSupportedByInterface"); AssertRuleFailure ("OverloadNotSupportedByInterface", 1); } class TestCase690057 { public class nauczyciel { public Guid Oid; public List NoweGrupies = new List (); } public List nauczyciele = new List (); public void WyslijMaile (List ListIdJ, Guid idRok) { var cmd = from c in nauczyciele where ListIdJ.Contains (c.Oid) select c; foreach (var s in cmd) { try { foreach (var grp in s.NoweGrupies) ; } catch (Exception ex) { } } } } [Test] public void Bug690057 () { AssertRuleSuccess ("WyslijMaile"); } } } AvoidLackOfCohesionOfMethodsTest.cs0000664000175000017500000002220712413742070036030 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test// // Unit Test for AvoidLackOfCohesionOfMethods Rule. // // Authors: // Cedric Vivier // Sebastien Pouliot // // (C) 2008 Cedric Vivier // 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.Reflection; using System.Runtime.Serialization; using Gendarme.Framework; using Gendarme.Rules.Maintainability; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Maintainability { [AttributeUsage(AttributeTargets.Class)] public sealed class ExpectedCohesivenessAttribute : Attribute { public ExpectedCohesivenessAttribute(double c) { _c = c; _d = Double.Epsilon; } public ExpectedCohesivenessAttribute (double c, double delta) { _c = c; _d = delta; } public double Value { get { return _c; } } public double Delta { get { return _d; } } private double _c; private double _d; } #pragma warning disable 414, 169 interface Interface { void DoFoo(); } public class ClassWithNoField { public void DoFoo() { } } public class ClassWithUnusedField { int x; public void DoFoo() { } } [ExpectedCohesiveness(1)] public class PerfectCohesion { int x; int y; public int DoFooXY() { return (x = y); } public int DoFooYX() { return (y = x); } public void DoBarYX() { x = 1; y = 2; } } [ExpectedCohesiveness(0.67)] public class GoodCohesion { int x; int y; public void DoFooX() { x = 2; } public void DoFooY() { y = 4; } public void DoBarXY() { x = y; } } [ExpectedCohesiveness(0)]//0 because does not apply public class AverageCohesionNotBadBecauseOfLowNumberOfMethods { int x; int y; public void DoSomething() { x = 2; } public void DoSomethingElse() { y = 2; } } [ExpectedCohesiveness(0.5)] public class AverageCohesionLimitBecauseOfHighNumberOfMethods { int x; int y; public void DoSomething() { x = 2; } public void DoSomethingElse() { y = 2; } public void DoSomethingCrazy() { y = 4; } public void DoSomethingSmart() { x = 4; } } [ExpectedCohesiveness(0.33)] public class BadCohesion { int x; int y; int z; public void DoSomething() { x = 2; } public void DoSomethingElse() { y = 2; } public void DoSomethingDifferent() { z = 2; } } // CSC 9.x result varies if /o (optimize) is ON or OFF and we want the test to pass in both cases [ExpectedCohesiveness (0.17, 0.2)] public class VeryBadCohesion { int x; int y; int z = 0; int u; int v = 23; int w; public int DoSomethingX() { x = 2; return x; } public int DoSomethingY() { y = 2; return y; } public void DoSomethingZ() { z = 2; } public void DoSomethingU() { u = 2; } public void DoSomethingV() { v = 4; } public int DoSomethingW() { return w.GetHashCode(); } } [ExpectedCohesiveness(0.33)] public class BadCohesionNotVeryBadBecauseOfInheritance : BadCohesion { int u; int v; int w; public void DoSomethingU() { u = 2; } public void DoSomethingV() { v = 2; } public void DoSomethingW() { w = 2; } } [ExpectedCohesiveness (0)] public class ClassWithProtectedField { protected int x; public void TouchField () { x = 1; } } [ExpectedCohesiveness (0)] public class ClassWithStaticMethod { int x; public static void Foo () { } } [ExpectedCohesiveness (0)] public class ClassWithMethodUsingStaticField { static int x; public static void TouchStaticField () { x = 1; } } [DataContract] [ExpectedCohesiveness (0)] // all fields and geteter/setters are marked as generated code public class Address { [DataMember] public string StreetNumber { get; set; } [DataMember] public string StreetName { get; set; } [DataMember] public string City { get; set; } [DataMember] public string State { get; set; } [DataMember] public string ZipCode { get; set; } [DataMember] public string Country { get; set; } } [DataContract] [ExpectedCohesiveness (0.78)] public class Address_WithExtraMethods_High { [DataMember] public string StreetNumber { get; set; } [DataMember] public string StreetName { get; set; } [DataMember] public string City { get; set; } [DataMember] public string State { get; set; } [DataMember] public string ZipCode { get; set; } [DataMember] public string Country { get; set; } public void Validate () { if (StreetNumber.Length == 0) throw new InvalidDataContractException (); if (StreetName.Length == 0) throw new InvalidDataContractException (); if (City.Length == 0) throw new InvalidDataContractException (); if (State.Length == 0) throw new InvalidDataContractException (); if (ZipCode.Length == 0) throw new InvalidDataContractException (); if (Country.Length == 0) throw new InvalidDataContractException (); } public void Reset () { StreetNumber = String.Empty; StreetName = String.Empty; City = String.Empty; State = String.Empty; ZipCode = String.Empty; Country = String.Empty; } public void AutoComplete () { if (State == "QC") Country = "Canada"; } } [DataContract] [ExpectedCohesiveness (0.42)] public class Address_WithExtraMethods_Low { [DataMember] public string StreetNumber { get; set; } [DataMember] public string StreetName { get; set; } [DataMember] public string City { get; set; } [DataMember] public string State { get; set; } [DataMember] public string ZipCode { get; set; } [DataMember] public string Country { get; set; } public void Validate () { if (StreetNumber.Length == 0) throw new InvalidDataContractException (); } public void Reset () { StreetNumber = String.Empty; StreetName = String.Empty; } public void AutoComplete () { if (State == "QC") Country = "Canada"; } } #pragma warning restore 414, 169 [TestFixture] public class AvoidLackOfCohesionOfMethodsTest : TypeRuleTestFixture { [Test] public void CohesivenessMeasurementTest () { Type[] types = Assembly.GetExecutingAssembly ().GetTypes (); ExpectedCohesivenessAttribute expectedCoh; double coh; foreach (Type type in types) { if (0 == type.GetCustomAttributes (typeof(ExpectedCohesivenessAttribute), false).Length) continue; expectedCoh = (ExpectedCohesivenessAttribute) type.GetCustomAttributes ( typeof(ExpectedCohesivenessAttribute), false)[0]; AvoidLackOfCohesionOfMethodsRule rule = new AvoidLackOfCohesionOfMethodsRule(); coh = rule.GetCohesivenessForType ( DefinitionLoader.GetTypeDefinition (type)); Assert.IsTrue ( Math.Abs (coh - expectedCoh.Value) <= expectedCoh.Delta, "Cohesiveness for type '{0}' is {1} but should have been {2} +/- {3}.", type, coh, expectedCoh.Value, expectedCoh.Delta); } } [Test] public void GoodCohesionsTest () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); // automatic properties - with "real" methods, high cohesion AssertRuleSuccess (); } [Test] public void BadCohesionsTest () { AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleFailure (1); // automatic properties - with "real" methods, low cohesion AssertRuleFailure (1); } [Test] public void MethodsDoNotApplyTest () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); // automatic properties - no "real" methods AssertRuleDoesNotApply
(); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/Makefile.am0000664000175000017500000000016112413742070031324 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Maintainability.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Test/ConsiderUsingStopwatchTest.cs0000664000175000017500000001501412413742070035133 0ustar00directhexdirecthex00000000000000// // Unit Test for ConsiderUsingStopwatchRule. // // Authors: // Cedric Vivier // Sebastien Pouliot // // (C) 2008 Cedric Vivier // 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; using System.Diagnostics; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Maintainability; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Maintainability { #pragma warning disable 219 public class TestClass { public void ProcessingTime1 () { DateTime start = DateTime.Now; //stuff TimeSpan end = DateTime.Now - start; } public void ProcessingTime2 () { DateTime start = DateTime.Now; //stuff DateTime end = DateTime.Now; TimeSpan duration = end - start; } public void ProcessingTime3 () { DateTime start = DateTime.Now; Console.WriteLine("started at {0}", start); //stuff DateTime end = DateTime.Now; Console.WriteLine("ended at {0}", end); Console.WriteLine("duration : {0}", end - start); } public TimeSpan ProcessingTime4 () { DateTime start = DateTime.Now; //stuff return DateTime.Now - start; } public void DateDiff1 () { DateTime baseTime = new DateTime(2000, 12, 1); //stuff TimeSpan diff = DateTime.Now - baseTime; } public void DateDiff2 () { DateTime baseTime = new DateTime(2000, 12, 1); //stuff DateTime now = DateTime.Now; TimeSpan diff = now - baseTime; } public void DateDiff3 () { TimeSpan diff = DateTime.Now - new DateTime(2000, 12, 1); } public TimeSpan DateDiff4 () { return new DateTime(2008, 1, 1) - new DateTime(2000, 12, 1); } public TimeSpan DateDiff5 (DateTime origin) { return DateTime.Now - origin; } public TimeSpan Mixed1 (DateTime origin) { DateTime start = DateTime.Now; //stuff TimeSpan end = DateTime.Now - start; return DateTime.Now - origin; } public TimeSpan Double () { DateTime start = DateTime.Now; //stuff TimeSpan end = DateTime.Now - start; start = DateTime.Now; //stuff return DateTime.Now - start; } public TimeSpan Triple () { DateTime start = DateTime.Now; //stuff TimeSpan end = DateTime.Now - start; start = DateTime.Now; //stuff end = DateTime.Now - start; start = DateTime.Now; //stuff return DateTime.Now - start; } public void ManyLocals () { DateTime baseTime = DateTime.Now; DateTime dummy1 = new DateTime(2001, 12, 1); DateTime dummy2 = new DateTime(2002, 12, 1); DateTime dummy3 = new DateTime(2003, 12, 1); DateTime dummy4 = new DateTime(2004, 12, 1); DateTime now = DateTime.Now; TimeSpan diff = now - baseTime; } public TimeSpan Return () { DateTime start = DateTime.Now; //stuff return DateTime.Now - start; } public TimeSpan Ref (ref DateTime start) { start = DateTime.Now; //stuff return DateTime.Now - start; } public TimeSpan Out (out DateTime end) { DateTime start = DateTime.Now; //stuff end = DateTime.Now; return end - start; } public TimeSpan UsingStopwatch () { Stopwatch watch = new Stopwatch (); // stuff return watch.Elapsed; } private object boxed; private bool Box (object a, object b) { return ((DateTime) a - (DateTime) b < (TimeSpan) boxed); } } #pragma warning restore 169 [TestFixture] public class ConsiderUsingStopwatchTest : MethodRuleTestFixture { [Test] public void Initialize () { // ensure that the rule does not apply for types defined in 1.x assemblies TypeDefinition violator = DefinitionLoader.GetTypeDefinition (); TargetRuntime realRuntime = violator.Module.Runtime; try { // fake assembly runtime version and do the check violator.Module.Runtime = TargetRuntime.Net_1_1; Rule.Active = true; Rule.Initialize (Runner); Assert.IsFalse (Rule.Active, "Active"); } catch { // rollback violator.Module.Runtime = realRuntime; Rule.Active = true; } } [Test] public void NotApplicable () { // no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no call[virt] instruction AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void Success () { AssertRuleSuccess ("DateDiff1"); AssertRuleSuccess ("DateDiff2"); AssertRuleSuccess ("DateDiff3"); AssertRuleSuccess ("DateDiff4"); AssertRuleSuccess ("DateDiff5"); AssertRuleSuccess ("UsingStopwatch"); } [Test] public void Failure () { AssertRuleFailure ("ProcessingTime1"); AssertRuleFailure ("ProcessingTime2"); AssertRuleFailure ("ProcessingTime3"); AssertRuleFailure ("ProcessingTime4"); } [Test] public void Mixed () { AssertRuleFailure ("Mixed1", 1); } [Test] public void Double () { AssertRuleFailure ("Double", 2); } [Test] public void Triple () { AssertRuleFailure ("Triple", 3); } [Test] public void ManyLocals () { AssertRuleFailure ("ManyLocals", 1); } [Test] public void SpecialCases () { AssertRuleFailure ("Return", 1); AssertRuleFailure ("Ref", 1); AssertRuleFailure ("Out", 1); // boxed substraction without the use of Now AssertRuleSuccess ("Box"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Gendarme.Rules.Maintainability.csproj0000775000175000017500000001340412413742070035532 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {8DB890C9-F9B7-4BEA-9ADE-EF32391363C2} Library Properties Gendarme.Rules.Maintainability Gendarme.Rules.Maintainability v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 1591 1570 ..\..\console\bin\Debug\Gendarme.Rules.Maintainability.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Maintainability.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/Makefile.am0000664000175000017500000000153412413742070030412 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AvoidAlwaysNullFieldRule.cs \ AvoidComplexMethodsRule.cs \ AvoidDeepInheritanceTreeRule.cs \ AvoidLackOfCohesionOfMethodsRule.cs \ AvoidUnnecessarySpecializationRule.cs \ ConsiderUsingStopwatchRule.cs \ PreferStringIsNullOrEmptyRule.cs \ RemoveDependenceOnObsoleteCodeRule.cs \ ReviewMisleadingFieldNamesRule.cs \ VariableNamesShouldNotMatchFieldNamesRule.cs EXTRA_TESTS_OPTIONS += -r:System.Runtime.Serialization.dll tests_sources = \ AvoidAlwaysNullFieldTest.cs \ AvoidComplexMethodsTest.cs \ AvoidDeepInheritanceTreeTest.cs \ AvoidLackOfCohesionOfMethodsTest.cs \ AvoidUnnecessarySpecializationTest.cs \ ConsiderUsingStopwatchTest.cs \ PreferStringIsNullOrEmptyTest.cs \ RemoveDependenceOnObsoleteCodeTest.cs \ ReviewMisleadingFieldNamesTest.cs \ VariableNamesShouldNotMatchFieldNamesTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Maintainability/AvoidDeepInheritanceTreeRule.cs0000664000175000017500000001022412413742070034363 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Maintainability.AvoidDeepInheritanceTreeRule // // Authors: // Sebastien Pouliot // // 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; using System.ComponentModel; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Maintainability { /// /// This rule will fire if a type has (by default) more than four base classes defined /// within the assembly set being analyzed. Optionally it will also count base /// classes defined outside the assembly set being analyzed. /// /// This rule is available since Gendarme 2.0 [Problem ("This type has more than four base classes.")] [Solution ("Refactor your class hierarchy to reduce its depth. Consider using extension methods to extend existing types.")] [FxCopCompatibility ("Microsoft.Maintainability", "CA1501:AvoidExcessiveInheritance")] public class AvoidDeepInheritanceTreeRule : Rule, ITypeRule { /// Classes with more base classes than this will result in a defect. /// Defaults to 4. [DefaultValue (DefaultMaximumDepth)] [Description ("Classes with more base classes than this will result in a defect.")] public int MaximumDepth { get { return maximumDepth; } set { maximumDepth = value; } } private const int DefaultMaximumDepth = 4; private int maximumDepth = DefaultMaximumDepth; /// If true the rule will count base classes defined outside the assemblies being analyzed. /// Defaults to false. [DefaultValue (DefaultCountExternalDepth)] [Description ("If true the rule will count base classes defined outside the assemblies being analyzed.")] public bool CountExternalDepth { get { return countExternalDepth; } set { countExternalDepth = value; } } private const bool DefaultCountExternalDepth = false; private bool countExternalDepth = DefaultCountExternalDepth; private Severity GetSeverity (int depth) { if (depth < 2 * MaximumDepth) return Severity.Medium; return (depth < 4 * MaximumDepth) ? Severity.High : Severity.Critical; } public RuleResult CheckType (TypeDefinition type) { if (type.IsInterface || type.IsValueType || type.IsDelegate ()) return RuleResult.DoesNotApply; int depth = 0; TypeDefinition temp = type; while (temp.BaseType != null) { temp = temp.BaseType.Resolve(); if (temp == null) break; if (countExternalDepth || Runner.Assemblies.Contains(temp.Module.Assembly)) depth++; } if (depth <= MaximumDepth) return RuleResult.Success; // Confidence is total unless we count outside the current assembly, // where it's possible we can't resolve up to System.Object Confidence confidence = countExternalDepth ? Confidence.High : Confidence.Total; // Severity is based on the depth string msg = String.Format (CultureInfo.CurrentCulture, "Inheritance tree depth : {0}.", depth); Runner.Report (type, GetSeverity (depth), confidence, msg); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/0000775000175000017500000000000012642235742026571 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/ChangeLog0000664000175000017500000002615012413742070030340 0ustar00directhexdirecthex000000000000002010-08-27 Rolf Bjarne Kvinge * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs: Mark leave.s as safe (just as leave is safe too). 2010-08-27 Rolf Bjarne Kvinge * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs: Make the example code more extensive and explain the rule a bit better. Initialize member variables in the the ctor to avoid null checks all the time. Use HashSet instead of List when we only check for existence. Use bitmasks to exclude methods to process, and generate the bitmasks statically. Change rule logic to mark all code in a method that is covered by a catch-all exception clause as safe - and the remaining code must be included in a list of safe instructions for the rule to accept it. Fix other minor issues as noted by either self-test or peer-review. 2010-06-15 Sebastien Pouliot * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs: * DoNotCastIntPtrToInt32Rule.cs: * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: * MarshalBooleansInPInvokeDeclarationsRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-04 Sebastien Pouliot * CentralizePInvokesIntoNativeMethodsTypeRule.cs: * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-04-28 Sebastien Pouliot * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs: Don't assume a FieldDefinition instance after resolving. Fix analysis against Muinshee.exe 2010-04-23 Sebastien Pouliot * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs: Check method.HasBody before doing any memory allocation. Check HasExceptionHandlers before iterating the ExceptionHandlers. Check called_method.HasParameters before iterating them. Don't call GetDelegatePointers, nor access 'stack' if stack_count is 0. The later solve the exception thrown while analyzing the jts-1.10.dll assembly. 2010-04-14 Sebastien Pouliot * CentralizePInvokesIntoNativeMethodsTypeRule.cs: Static-ify CanInstantiateType (make self-test) * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs: Skip if we hit a negative 'stack_count' (workaround for #582823). Fix some "make self-test" defects like: Seal ILRange. Remove some unused parameters. Add #if DEBUG around debugging code. Do not throw Exception (changed to ArgumentException). * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Don't assume a MethodReference for FlowControl.Call. Calli, while uncommon, would provide a CallSite. * MarshalStringsInPInvokeDeclarationsRule.cs: Check if PInvokeInfo is null even if IsPInvokeImpl is true since some badly encoded assemblies just do that (flag PInvokeImpl, but has no record in the ImplMapTable) 2010-01-16 Sebastien Pouliot * CentralizePInvokesIntoNativeMethodsTypeRule.cs: New. Rule to ensure the fx convention on where to define p/invoke declarations 2009-07-31 Jesse Jones * MarshalBooleansInPInvokeDeclarationsRule.csm MarshalStringsInPInvokeDeclarationsRule.cs: Edited the descriptions. 2009-07-04 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-02-24 Jesse Jones * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs: Fix for ldloca instructions. 2008-11-30 Sebastien Pouliot * MarshalBooleansInPInvokeDeclarationsRule.cs: Use HasParameters * MarshalStringsInPInvokeDeclarationsRule.cs: Use HasParameters 2008-11-22 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Fix the case where we can't resolve the method (leading to a NRE). 2008-11-18 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Avoid calling ToString on Method[Reference|Definition] since they are rebuilt each time. Accept UIntPtr [in]equality operators. * MarshalBooleansInPInvokeDeclarationsRule.cs: Specify StringComparison.Ordinal when calling StartsWith. * UseManagedAlternativesToPInvokeRule.cs: Remove PInvokeCall struct since it required an allocation (of a new struct) in order to search alternatives. This is now replaced by using strings and a second check later for the module and runtime version. 2008-11-15 Jesse Jones * DoNotCastIntPtrToInt32Rule.cs: Checks for overflow convert instructions. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Interoperability.mdp: * Gendarme.Rules.Interoperability.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-01 Sebastien Pouliot * MarshalBooleansInPInvokeDeclarationsRule.cs: New. Rule to warn if no marshalling information is given for boolean parameters and return values. * Gendarme.Rules.Interoperability.mdp: Add rule to MD project file. * Makefile.am: Add rule and test to build. 2008-11-01 Sebastien Pouliot * DoNotCastIntPtrToInt32Rule.cs: Now cover the case where Marshal. ReadInt[32|64] is used to read pointers (i.e. casted into IntPtr). Renamed rule to (more general) DoNotAssumeIntPtrSizeRule 2008-10-30 Jesse Jones * Makefile.am: Inherit EXTRA_TESTS_OPTIONS from common.make. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Interoperability.xml, doc/Gendarme.Rules.Interoperability: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-17 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Make Branch implement IEquatable (self-test). * UseManagedAlternativesToPInvokeRule.cs: Make PInvokeCall implement IEquatable (self-test). 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-14 Sebastien Pouliot * DoNotCastIntPtrToInt32Rule.cs: Add XML documentation, the [FxCopCompatibility] attribute and use the OpCodeEngine. * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Add XML documentation, [FxCopCompatibility] attribute and use the OpCodeEngine. * MarshalStringsInPInvokeDeclarationsRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * PInvokeShouldNotBeVisibleRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * UseManagedAlternativesToPInvokeRule.cs: Add XML documentation and [FxCopCompatibility] attribute. 2008-08-10 Sebastien Pouliot * PInvokeShouldNotBeVisibleRule.cs: Add check for non-static p/invokes. * Makefile.am: Include all unit tests (typo) 2008-07-12 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Remove unused field (self-test) 2008-07-10 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-08 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Simplify logic a bit. Handle the case where Resolve returns null (cannot find the required assemblies) * Makefile.am: Rebuild if the framework has changed. 2008-05-24 Sebastien Pouliot * DoNotCastIntPtrToInt32Rule.cs: Don't apply rule to GetHashCode methods since it's unlikely that the downcast will cause problem and this reduce the main source of false-positives. 2008-05-16 Sebastien Pouliot * DoNotCastIntPtrToInt32Rule.cs: Change Convert method to static (self-test). 2008-05-09 Sebastien Pouliot * DoNotCastIntPtrToInt32Rule.cs: New. Rule to ensure we're not generating code limiting IntPtr to work on 32bits architectures. * Makefile.am: Add rule and test to the build. 2008-04-06 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Add Equals, GetHashCode and ==,!= operators on Branch to satisfy OverrideValueTypeDefaultsRule. * UseManagedAlternativesToPInvokeRule.cs: Add Equals(PInvokeCall) method to satisfy ImplementEqualsTypeRule. 2008-02-17 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Change to static and initialize it directly. 2008-02-16 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Fix the case where the p/invoke is inside another assembly using the AssemblyResolver. 2008-02-15 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs * MarshalStringsInPInvokeDeclarationsRule.cs * PInvokeShouldNotBeVisibleRule.cs * UseManagedAlternativesToPInvokeRule.cs: Update rules wrt framework changes. 2008-01-30 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Changed to use the new shared StackEntryAnalysis by Andreas Noever. Refactored (split) by me to reduce self-test complaints ;-) 2008-01-29 Sebastien Pouliot * MarshalStringsInPInvokeDeclarationsRule.cs: New. Rule to ensure all string and StringBuilder have marshalling information [Daniel Abramov] * Gendarme.Rules.Interoperability.xml.in: Add rule description and update Uri for all of them. * Makefile.am: Add rule and test to the build. 2008-01-28 Sebastien Pouliot * UseManagedAlternativesToPInvokeRule.cs: Override operators == and != since the struct PInvokeCall overrides Equals (Gendarme rule). 2008-01-21 Sebastien Pouliot * UseManagedAlternativesToPInvokeRule.cs: New. Rule to check if p/invoke calls can be replaced with managed alternatives [Daniel Abramov]. Removed dead code and simplified GetHashCode (sp) * Makefile.am: Add rule and test to the build. * Gendarme.Rules.Interoperability.xml.in: Add rule description. 2008-01-11 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Use new Location ctors. 2008-01-02 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: Change two methods to static (self-test) * Gendarme.Rules.Interoperability.mdp: New. MonoDevelop project file. 2007-12-30 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeRule.cs: New. Rule to ensure GetLastError is called soon enough after a p.invoke call. Rule by Andreas Noever * PInvokeShouldNotBeVisibleRule.cs: New. Rule to check that all p/invoke declaration aren't directly visible from assemblies. * Gendarme.Rules.Interoperability.xml.in: Rules descritions. * Makefile.am: New. Build file for rules and tests. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/UseManagedAlternativesToPInvokeRule.cs0000664000175000017500000001236612413742070036143 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Interoperability.UseManagedAlternativesToPInvokeRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.Collections.Generic; using System.Globalization; using System.Linq; using Gendarme.Framework; using Mono.Cecil; namespace Gendarme.Rules.Interoperability { // TODO: QueryPerformanceFrequency can be replaced with StopWatch /// /// This rule will fire if an external (P/Invoke) method is called but a managed /// alternative is provided by the .NET framework. /// /// /// Bad example: /// /// [DllImport ("kernel32.dll")] /// static extern void Sleep (uint dwMilliseconds); /// /// public void WaitTwoSeconds () /// { /// Sleep (2000); /// } /// /// /// /// Good example: /// /// public void WaitTwoSeconds () /// { /// System.Threading.Thread.Sleep (2000); /// } /// /// [Problem ("There is a managed API which can be used instead of the p/invoke call.")] [Solution ("Use the suggested managed alternative to replace your p/invoke call and remove its declaration.")] [FxCopCompatibility ("Microsoft.Usage", "CA2205:UseManagedEquivalentsOfWin32Api")] public class UseManagedAlternativesToPInvokeRule : Rule, IMethodRule { private sealed class ManagedAlternatives { public ManagedAlternatives (string module, string alternatives) : this (module, alternatives, TargetRuntime.Net_1_1) { } public ManagedAlternatives (string module, string alternatives, TargetRuntime runtime) { Module = module; Alternatives = alternatives; Runtime = runtime; } public string Alternatives { get; set; } public string Module { get; set; } public TargetRuntime Runtime { get; set; } } private static Dictionary managedAlternatives = new Dictionary () { { "Sleep", new ManagedAlternatives ("kernel32.dll", "System.Threading.Thread::Sleep()") }, { "FindFirstFile", new ManagedAlternatives ("kernel32.dll", "System.IO.Directory::GetDirectories(), System.IO.Directory::GetFiles(), System.IO.Directory::GetFileSystemEntries()") }, { "ReadFile", new ManagedAlternatives ("kernel32.dll", "System.IO.FileStream") }, { "WaitForMultipleObjects", new ManagedAlternatives ("kernel32.dll", "System.Threading.WaitHandle::WaitAny(), System.Threading.WaitHandle::WaitAll()") }, { "GetLastError", new ManagedAlternatives ("kernel32.dll", "System.Runtime.InteropServices.Marshal::GetLastWin32Error()") }, { "MessageBox", new ManagedAlternatives ("user32.dll", "System.Windows.Forms.MessageBox::Show()") }, { "Beep", new ManagedAlternatives ("kernel32.dll", "System.Console::Beep()", TargetRuntime.Net_2_0) }, { "PlaySound", new ManagedAlternatives ("winmm.dll", "System.Media.SoundPlayer", TargetRuntime.Net_2_0) } }; private static ManagedAlternatives GetManagedAlternatives (MethodDefinition method) { ManagedAlternatives alts; if (managedAlternatives.TryGetValue (method.Name, out alts)) { // can we apply this alternative to the framework being used ? if (method.DeclaringType.Module.Runtime < alts.Runtime) return null; // make sure we're talking about the exact same (module-wise) p/invoke declaration if (alts.Module.StartsWith (method.PInvokeInfo.Module.Name, StringComparison.OrdinalIgnoreCase)) return alts; } return null; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply to non-pinvoke methods if (!method.IsPInvokeImpl) return RuleResult.DoesNotApply; // rule apply, looks for alternatives ManagedAlternatives alternatives = GetManagedAlternatives (method); if (alternatives == null) return RuleResult.Success; string message = String.Format (CultureInfo.InvariantCulture, "Try to replace the platform-dependent call '{0}' by (one of) the following alternative(s): {1}.", method.Name, alternatives.Alternatives); Runner.Report (method, Severity.Low, Confidence.High, message); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/DoNotCastIntPtrToInt32Rule.cs0000664000175000017500000001613112413742070034065 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Interoperability.DoNotAssumeIntPtrSizeRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability { /// /// This rule checks for code which casts an IntPtr or UIntPtr into a /// 32-bit (or smaller) value. It will also check if memory read with the Marshal.ReadInt32 /// and Marshal.ReadInt64 methods is being cast into an IntPtr or /// UIntPtr. IntPtr is generally used to reference a memory /// location and downcasting them to 32-bits will make the code fail on 64-bit CPUs. /// /// /// Bad example (cast): /// /// int ptr = dest.ToInt32 (); /// for (int i = 0; i < 16; i++) { /// Marshal.StructureToPtr (this, (IntPtr)ptr, false); /// ptr += 4; /// } /// /// /// /// Bad example (Marshal.Read*): /// /// // that won't work on 64 bits platforms /// IntPtr p = (IntPtr) Marshal.ReadInt32 (p); /// /// /// /// Good example (cast): /// /// long ptr = dest.ToInt64 (); /// for (int i = 0; i < 16; i++) { /// Marshal.StructureToPtr (this, (IntPtr) ptr, false); /// ptr += IntPtr.Size; /// } /// /// /// /// Good example (Marshal.Read*): /// /// IntPtr p = (IntPtr) Marshal.ReadIntPtr (p); /// /// /// This rule is available since Gendarme 2.0 but was named DoNotCastIntPtrToInt32Rule before 2.2 [Problem ("This method casts a [U]IntPtr to a 32-bit value which won't work on 64-bit architectures.")] [Solution ("You should always use 64 bits integers, signed or unsigned, when doing pointer math.")] [EngineDependency (typeof (OpCodeEngine))] public class DoNotAssumeIntPtrSizeRule : Rule, IMethodRule { private void Report (MethodDefinition method, Instruction ins, string typeName) { string msg = String.Format (CultureInfo.InvariantCulture, "Type cast to '{0}'.", typeName); Runner.Report (method, ins, Severity.High, Confidence.Normal, msg); } private static string Convert (Instruction ins) { if (ins == null) return String.Empty; switch (ins.OpCode.Code) { case Code.Conv_I1: case Code.Conv_Ovf_I1: return "System.SByte"; case Code.Conv_U1: case Code.Conv_Ovf_U1: return "System.Byte"; case Code.Conv_I2: case Code.Conv_Ovf_I2: return "System.Int16"; case Code.Conv_U2: case Code.Conv_Ovf_U2: return "System.UInt16"; case Code.Conv_I4: case Code.Conv_Ovf_I4: return "System.Int32"; case Code.Conv_U4: case Code.Conv_Ovf_U4_Un: return "System.UInt32"; default: return String.Empty; } } private void CheckCastOnIntPtr (MethodDefinition method, Instruction ins, MethodReference mr, bool intptr, bool uintptr) { // check for calls to IntPtr.ToInt32, UIntPtr.ToUInt32 or // cast to anything other than [U]IntPtr, [U]Int64 or Void* string name = mr.Name; if (intptr && (name == "ToInt32")) { Runner.Report (method, ins, Severity.High, Confidence.Normal, "Call to 'IntPtr.ToInt32()'."); } else if (uintptr && (name == "ToUInt32")) { Runner.Report (method, ins, Severity.High, Confidence.Normal, "Call to 'UIntPtr.ToUInt32()'."); } else if (name == "op_Explicit") { string rtfullname = mr.ReturnType.GetFullName (); switch (rtfullname) { case "System.Int64": case "System.UInt64": // valid cases unless (like [g]mcs does) it's followed by a convertion string msg = Convert (ins.Next); if (msg.Length > 0) Report (method, ins, msg); break; case "System.IntPtr": // used to cast void* case "System.UIntPtr": // used to cast void* case "System.Void*": // used to cast void* // valid cases break; default: // problematic cases Report (method, ins, rtfullname); break; } } } private void CheckCastOnMarshal (MethodDefinition method, Instruction ins, MethodReference mr) { // if we're reading an int32 or an int64 then we should not be assigning it to an IntPtr string method_name = mr.Name; if ((method_name == "ReadInt32") || (method_name == "ReadInt64")) { Instruction next = ins.Next; if (next.OpCode.Code != Code.Call) return; MethodReference m = (next.Operand as MethodReference); if (m.Name != "op_Explicit") return; string msg = String.Format (CultureInfo.InvariantCulture, "A '{0}' value is casted into an '{1}' when reading marshalled memory.", mr.ReturnType.GetFullName (), m.Parameters [0].ParameterType.GetFullName ()); Runner.Report (method, ins, Severity.High, Confidence.Normal, msg); } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // it's a safe bet that the downsizing of the [U]IntPtr is not a problem inside GetHashCode if (MethodSignatures.GetHashCode.Matches (method)) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { MethodReference mr = ins.GetMethod (); if (mr == null) continue; // look for both IntPtr and the (less known) UIntPtr TypeReference type = mr.DeclaringType; if (type.Namespace == "System") { string name = type.Name; bool intptr = (name == "IntPtr"); bool uintptr = (name == "UIntPtr"); if (intptr || uintptr) CheckCastOnIntPtr (method, ins, mr, intptr, uintptr); } else if (type.IsNamed ("System.Runtime.InteropServices", "Marshal")) { CheckCastOnMarshal (method, ins, mr); } } return Runner.CurrentRuleResult; } } } MarshalBooleansInPInvokeDeclarationsRule.cs0000664000175000017500000001000212413742070037041 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability// // Gendarme.Rules.Design.MarshalBooleansInPInvokeDeclarationsRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability { /// /// This rule warns the developer if a [MarshalAs] attribute has not been /// specified for boolean parameters of a P/Invoke method. The size of boolean types varies /// across language (e.g. the C++ bool type is four bytes on some platforms and /// one byte on others). By default the CLR will marshal System.Boolean as a 32 bit value /// (UnmanagedType.Bool) like the Win32 API BOOL uses. But, for clarity, /// you should always specify the correct value. /// /// /// Bad example: /// /// // bad assuming the last parameter is a single byte being mapped to a bool /// [DllImport ("liberty")] /// private static extern bool Bad (bool b1, ref bool b2); /// /// /// /// Good example: /// /// [DllImport ("liberty")] /// [return: MarshalAs (UnmanagedType.Bool)] /// private static extern bool Good ([MarshalAs (UnmanagedType.Bool)] bool b1, [MarshalAs (UnmanagedType.U1)] ref bool b2); /// /// [Problem ("No marshaling information is supplied for boolean parameters(s) on this p/invoke declaration.")] [Solution ("Specify, even if just for clarity, the size of the unmanaged boolean representation.")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1414:MarkBooleanPInvokeArgumentsWithMarshalAs")] public class MarshalBooleansInPInvokeDeclarationsRule : Rule, IMethodRule { static bool CheckBooleanMarshalling (IMarshalInfoProvider spec, TypeReference type) { // is marshalling information provided if (spec.MarshalInfo != null) return true; // using StartsWith to catch references (ref) return !(type.Namespace == "System" && type.Name.StartsWith ("Boolean", StringComparison.Ordinal)); } public RuleResult CheckMethod (MethodDefinition method) { // rule applies only to p/invoke methods if (!method.IsPInvokeImpl) return RuleResult.DoesNotApply; // check all parameters if (method.HasParameters) { foreach (ParameterDefinition parameter in method.Parameters) { if (!CheckBooleanMarshalling (parameter, parameter.ParameterType)) { // we can't be sure (confidence) that the MarshalAs is needed // since most of the time the default (4 bytes) is ok - but // the severity is high because this mess up the stack Runner.Report (parameter, Severity.High, Confidence.Normal); } } } // and check return value MethodReturnType mrt = method.MethodReturnType; if (!CheckBooleanMarshalling (mrt, mrt.ReturnType)) { Runner.Report (mrt, Severity.High, Confidence.Normal); } return Runner.CurrentRuleResult; } } } MarshalStringsInPInvokeDeclarationsRule.cs0000664000175000017500000001016112413742070036736 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability// // Gendarme.Rules.Interoperability.MarshalStringsInPInvokeDeclarationsRule // // Authors: // Daniel Abramov // // (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability { /// /// This rule will fire if a P/Invoke method has System.String or System.Text.StringBuilder /// arguments, and the DllImportAttribute does not specify the CharSet, /// and the string arguments are not decorated with [MarshalAs]. /// /// This is important because the defaults are different on the various platforms. /// On Mono the default is to always use utf-8. On .NET the default is to use the ANSI /// CharSet which is the native encoding and will typically be some variant of ASCII or /// something like Shift-JIS. On Compact .NET the default is utf-16. /// /// /// Bad example: /// /// [DllImport ("coredll")] /// static extern int SHCreateShortcut (StringBuilder szShortcut, StringBuilder szTarget); /// /// /// /// Good examples: /// /// [DllImport ("coredll", CharSet = CharSet.Auto)] /// static extern int SHCreateShortcut (StringBuilder szShortcut, StringBuilder szTarget); /// /// [DllImport ("coredll")] /// static extern int SHCreateShortcut ([MarshalAs (UnmanagedType.LPTStr)] StringBuilder szShortcut, /// [MarshalAs (UnmanagedType.LPTStr)] StringBuilder szTarget); /// /// [Problem ("Marshaling information for string types is missing and what is required may be different from what you expected the default to be.")] [Solution ("Add [DllImport CharSet=] to the method or [MarshalAs] on the parameter(s)")] [FxCopCompatibility ("Microsoft.Globalization", "CA2101:SpecifyMarshalingForPInvokeStringArguments")] public class MarshalStringsInPInvokeDeclarationsRule : Rule, IMethodRule { private static bool IsStringOrSBuilder (TypeReference reference) { TypeReference type = reference.GetElementType (); return (type.IsNamed ("System", "String") || type.IsNamed ("System.Text", "StringBuilder")); } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply to non-pinvoke methods if (!method.IsPInvokeImpl) return RuleResult.DoesNotApply; PInvokeInfo info = method.PInvokeInfo; if (info == null) return RuleResult.DoesNotApply; if (!info.IsCharSetNotSpec || !method.HasParameters) return RuleResult.Success; foreach (ParameterDefinition parameter in method.Parameters) { if (IsStringOrSBuilder (parameter.ParameterType) && (parameter.MarshalInfo == null)) { string text = String.Format (CultureInfo.InvariantCulture, "Parameter '{0}', of type '{1}', does not have [MarshalAs] attribute, yet no [DllImport CharSet=] is set for the method '{2}'.", parameter.Name, parameter.ParameterType.Name, method.Name); Runner.Report (parameter, Severity.High, Confidence.Total, text); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Makefile.in0000664000175000017500000006626012642235731030646 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Interoperability ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -unsafe console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ CentralizePInvokesIntoNativeMethodsTypeRule.cs \ DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs \ DoNotCastIntPtrToInt32Rule.cs \ GetLastErrorMustBeCalledRightAfterPInvokeRule.cs \ MarshalBooleansInPInvokeDeclarationsRule.cs \ MarshalStringsInPInvokeDeclarationsRule.cs \ PInvokeShouldNotBeVisibleRule.cs \ UseManagedAlternativesToPInvokeRule.cs tests_sources = \ CentralizePInvokesIntoNativeMethodsTypeTest.cs \ DoNotCastIntPtrToInt32Test.cs \ GetLastErrorMustBeCalledRightAfterPInvokeTest.cs \ MarshalBooleansInPInvokeDeclarationsTest.cs \ MarshalStringsInPInvokeDeclarationsTest.cs \ PInvokeShouldNotBeVisibleTest.cs \ UseManagedAlternativesToPInvokeTest.cs \ DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Interoperability/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Interoperability/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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: GetLastErrorMustBeCalledRightAfterPInvokeRule.cs0000664000175000017500000001570012413742070037743 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability// // Gendarme.Rules.Interoperability.GetLastErrorMustBeCalledRightAfterPInvokeRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2007-2008 Andreas Noever // 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability { /// /// This rule will fire if Marshal.GetLastWin32Error() is called, but is /// not called immediately after a P/Invoke. This is a problem because other methods, /// even managed methods, may overwrite the error code. /// /// /// Bad example: /// /// public void DestroyError () /// { /// MessageBeep (2); /// Console.WriteLine ("Beep"); /// int error = Marshal.GetLastWin32Error (); /// } /// /// /// /// Good example: /// /// public void GetError () /// { /// MessageBeep (2); /// int error = Marshal.GetLastWin32Error (); /// Console.WriteLine ("Beep"); /// } /// /// public void DontUseGetLastError () /// { /// MessageBeep (2); /// Console.WriteLine ("Beep"); /// } /// /// [Problem ("GetLastError() should be called immediately after the P/Invoke call.")] [Solution ("Move the call to GetLastError just after the P/Invoke call.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Interoperability", "CA1404:CallGetLastErrorImmediatelyAfterPInvoke")] public class GetLastErrorMustBeCalledRightAfterPInvokeRule : Rule, IMethodRule { struct Branch : IEquatable { public readonly Instruction Instruction; public readonly bool DirtyMethodCalled; public Branch (Instruction ins, bool dirty) { this.Instruction = ins; this.DirtyMethodCalled = dirty; } public override bool Equals (object obj) { if (obj is Branch) return Equals ((Branch) obj); return false; } public bool Equals (Branch other) { return (Instruction == other.Instruction) && (DirtyMethodCalled == other.DirtyMethodCalled); } public override int GetHashCode () { return Instruction.GetHashCode () ^ DirtyMethodCalled.GetHashCode (); } public static bool operator == (Branch left, Branch right) { return left.Equals (right); } public static bool operator != (Branch left, Branch right) { return !left.Equals (right); } } List branches = new List (); private bool CheckPInvoke (Instruction startInstruction) { branches.Clear (); branches.Add (new Branch (startInstruction.Next, false)); for (int i = 0; i < branches.Count; i++) { //follow all branches Instruction ins = branches [i].Instruction; bool dirty = branches [i].DirtyMethodCalled; bool getLastErrorFound = false; while (true) { //follow the branch //check if a method is called if (ins.OpCode.FlowControl == FlowControl.Call) { MethodReference mRef = ins.Operand as MethodReference; if (mRef == null) { continue; } MethodDefinition mDef = mRef.Resolve(); if (mDef != null && mDef.IsPInvokeImpl) { //check if another pinvoke method is called, this counts as "GetLastError not called" break; } string s = (mDef == null) ? String.Empty : mDef.DeclaringType.GetFullName (); switch (s) { case "System.Runtime.InteropServices.Marshal": getLastErrorFound = (mDef.Name == "GetLastWin32Error"); break; //found case "System.Runtime.InteropServices.SafeHandle": dirty = (mDef.Name != "get_IsInvalid"); break; case "System.IntPtr": case "System.UIntPtr": string name = mDef.Name; dirty = ((name != "op_Inequality") && (name != "op_Equality")); break; default: dirty = true; break; } if (getLastErrorFound) break; } //fetch the next instruction object alternatives; ins = StackEntryAnalysis.GetNextInstruction (ins, out alternatives); if (ins == null) break; if (alternatives != null) { Instruction alt_ins = (alternatives as Instruction); if (alt_ins != null) { branches.AddIfNew (new Branch (alt_ins, dirty)); } else { Instruction [] alts = (Instruction []) alternatives; foreach (Instruction altIns in alts) branches.AddIfNew (new Branch (altIns, dirty)); } } //avoid infinity loop if (ins.OpCode.FlowControl == FlowControl.Branch) { branches.AddIfNew (new Branch (ins, dirty)); break; } } //report error if (getLastErrorFound && dirty) return false; } return true; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if the method has no IL if (!method.HasBody) return RuleResult.DoesNotApply; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.FlowControl != FlowControl.Call) continue; // nothing do check if there's no more instructions if (ins.Next == null) break; MethodReference mr = ins.GetMethod (); if (mr == null) break; MethodDefinition pinvoke = mr.Resolve (); if ((pinvoke == null) || !pinvoke.IsPInvokeImpl) break; // check if GetLastError is called near enough this pinvoke call if (CheckPInvoke (ins)) break; // code might not work if an error occurs Runner.Report (method, ins, Severity.High, Confidence.High); } return Runner.CurrentRuleResult; } } } CentralizePInvokesIntoNativeMethodsTypeRule.cs0000664000175000017500000001574412413742070037643 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability// // Gendarme.Rules.Interoperability.CentralizePInvokesIntoNativeMethodsTypeRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability { /// /// This rule will warn you if p/invoke declarations are found outside some /// specially named types. The convention makes it easier to know which type /// of security checks are done (at runtime) and how critical is a security /// audit for them. In all cases the type should not be visible (i.e. internal /// in C#) outside the assembly. /// /// Note that the type naming itself has no influence on security (either with /// Code Access Security or with CoreCLR for Silverlight). The naming convention /// includes the presence or absence of the [SuppressUnmanagedCodeSecurity] /// security attribute based on the type name. /// /// NativeMethods should not be decorated with a /// [SuppressUnmanagedCodeSecurity]. This will let CAS do a stackwalk to /// ensure the code can be... /// SafeNativeMethods should be decorated with a /// [SuppressUnmanagedCodeSecurity] attribute. The attribute means that no /// stackwalk will occurs. /// UnsafeNativeMethods should be decorated with a /// [SuppressUnmanagedCodeSecurity] attribute. The attribute means that no /// stackwalk will occurs. However since the p/invoke methods are named unsafe then /// the rule will warn an audit-level defect to review the code. /// /// /// This rule is available since Gendarme 2.8 [Problem ("A p/invoke declaration was found outside a *NativeMethods type.")] [Solution ("Move all p/invokes declarations into the right *NativeMethods type.")] [FxCopCompatibility ("Microsoft.Design", "CA1060:MovePInvokesToNativeMethodsClass")] public class CentralizePInvokesIntoNativeMethodsTypeRule : Rule, ITypeRule, IMethodRule { // Note: you either like the rule or not (disable it). If you // follow it then it is important to follow it 100% since other // people will expect specific behaviors from specific names const string Audit = "Unsafe p/invoke decorated with [SuppressUnmanagedCodeSecurity] needs a security review."; static bool CanInstantiateType (TypeDefinition type) { // type is static (>= 2.0) if (type.IsStatic ()) return false; if (type.IsSealed && type.HasMethods) { foreach (MethodDefinition ctor in type.Methods) { if (ctor.IsConstructor && ctor.IsVisible ()) return true; } return false; } return true; } private void CheckTypeVisibility (TypeDefinition type) { // *NativeMethods types should never be visible outside the assembly if (type.IsVisible ()) { string msg = String.Format (CultureInfo.InvariantCulture, "'{0}' should not be visible outside the assembly.", type.GetFullName ()); Runner.Report (type, Severity.High, Confidence.Total, msg); } if (CanInstantiateType (type)) { string msg = String.Format (CultureInfo.InvariantCulture, "'{0}' should not be static or sealed with no visible constructor.", type.GetFullName ()); Runner.Report (type, Severity.High, Confidence.Total, msg); } } private void CheckSuppressUnmanagedCodeSecurity (ICustomAttributeProvider type, bool required) { string msg = null; if (type.HasAttribute ("System.Security", "SuppressUnmanagedCodeSecurityAttribute")) { if (!required) msg = "Remove [SuppressUnmanagedCodeSecurity] attribute on the type declaration."; } else { // no [SuppressUnmanagedCodeSecurity] attribute if (required) msg = "Add missing [SuppressUnmanagedCodeSecurity] attribute on the type declaration."; } if (msg != null) Runner.Report (type, Severity.Critical, Confidence.Total, msg); } // if the "right" type names is used then it's very important to follow 100% of the convention public RuleResult CheckType (TypeDefinition type) { switch (type.Name) { case "NativeMethods": // type must NOT be visible... CheckTypeVisibility (type); // and NOT decorated with [SuppressUnmanagedCodeSecurity] CheckSuppressUnmanagedCodeSecurity (type, false); break; case "SafeNativeMethods": // type must NOT be visible... CheckTypeVisibility (type); // and decorated with [SuppressUnmanagedCodeSecurity] CheckSuppressUnmanagedCodeSecurity (type, true); break; case "UnsafeNativeMethods": // type must NOT be visible... CheckTypeVisibility (type); // and decorated with [SuppressUnmanagedCodeSecurity] CheckSuppressUnmanagedCodeSecurity (type, true); // always report an audit-level defects for UnsafeNativeMethods Runner.Report (type, Severity.Audit, Confidence.Total, Audit); return RuleResult.Failure; default: // if p/invokes exists in this type then CheckMethod will spot them return RuleResult.DoesNotApply; } return Runner.CurrentRuleResult; } // note: all p/invokes methods should not be visible - but // this is already checked by PInvokeShouldNotBeVisibleRule, // which is important as a standalone rule for people that // do not follow this, more complete, convention public RuleResult CheckMethod (MethodDefinition method) { if (!method.IsPInvokeImpl) return RuleResult.DoesNotApply; // are the p/invoke declaration in a "well-named" type ? switch (method.DeclaringType.Name) { case "NativeMethods": case "SafeNativeMethods": case "UnsafeNativeMethods": return RuleResult.Success; default: // method does not follow the type-naming convention Runner.Report (method, Severity.Medium, Confidence.Total); return RuleResult.Failure; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/PInvokeShouldNotBeVisibleRule.cs0000664000175000017500000000603312413742070034743 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Interoperability.PInvokeShouldNotBeVisibleRule // // Authors: // Andreas Noever // Sebastien Pouliot // // (C) 2007 Andreas Noever // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability { /// /// This rule checks for PInvoke declaration methods that are visible outside their assembly. /// /// /// Bad example: /// /// [DllImport ("user32.dll")] /// public static extern bool MessageBeep (UInt32 beepType); /// /// /// /// Good example: /// /// [DllImport ("user32.dll")] /// internal static extern bool MessageBeep (UInt32 beepType); /// /// [Problem ("P/Invoke declarations should not be visible outside of their assembly.")] [Solution ("Reduce the visibility of the p/invoke method and make sure it is declared as static.")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1401:PInvokesShouldNotBeVisible")] public class PInvokeShouldNotBeVisibleRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply to non-p/invoke if (!method.IsPInvokeImpl) return RuleResult.DoesNotApply; // rule applies // code is very unlikely to work (because of the extra this parameter) // note: existing C# compilers won't compile instance p/invoke, e.g. // error CS0601: The DllImport attribute must be specified on a method marked `static' and `extern' if (!method.IsStatic) Runner.Report (method, Severity.Critical, Confidence.Total); // code will work (low) but it's bad design (non-fx-like validations) and makes // it easier to expose security vulnerabilities if (method.IsVisible ()) Runner.Report (method, Severity.Low, Confidence.Total); return Runner.CurrentRuleResult; } } } DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs0000664000175000017500000006250112413742070042671 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability// // Gendarme.Rules.Interoperability.DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule // // Authors: // Rolf Bjarne Kvinge // // 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. // //#define DEBUG //#define LOG using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability { /// /// This rule checks for delegates which are created for methods which don't /// have exception handling and then passed to native code. /// Every delegate which is passed to native code must include an exception /// block which spans the entire method and has a catch all block. /// /// /// Bad example: /// /// delegate void Callback (); /// [DllImport ("mylibrary.dll")] /// static extern void RegisterCallback (Callback callback); /// public void RegisterManagedCallback () /// { /// RegisterCallback (ManagedCallback); /// } /// public void ManagedCallback () /// { /// // This will cause the process to crash if native code calls this method. /// throw new NotImplementedException (); /// } /// /// /// /// Good example: /// /// delegate void Callback (); /// [DllImport ("mylibrary.dll")] /// static extern void RegisterCallback (Callback callback); /// public void RegisterManagedCallback () /// { /// RegisterCallback (ManagedCallback); /// } /// public void ManagedCallback () /// { /// try { /// throw new NotImplementedException (); /// } /// catch { /// // This way the exception won't "leak" to native code /// } /// try { /// throw new NotImplementedException (); /// } /// catch (System.Exception ex) { /// // This is also safe - the runtime will process this catch clause, /// // even if it is technically possible (by writing assemblies in managed /// // C++ or IL) to throw an exception that doesn't inherit from /// // System.Exception. /// } /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("Every delegate passed to native code must include an exception block which spans the entire method and has a catch all block.")] [Solution ("Surround the entire method body with a try/catch block.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule : Rule, IMethodRule { // A list of methods which have been verified to be safe to call from native code. Dictionary verified_methods = new Dictionary (); // A list of methods which have been reported to be unsafe (to not report the same method twice). HashSet reported_methods = new HashSet (); // A list of all the fields which have been passed to pinvokes (as a delegate parameter). // We report an error if a ld[s]fld stores an unsafe function pointer into any of these fields. List loaded_fields = new List (); // A list of all the fields which have been assigned function pointers. // We report an error if a pinvoke loads any of these fields. Dictionary> stored_fields = new Dictionary> (); // A list of all the locals in a method. // Have one class-level instance which is emptied before checking a method. // Avoids creating a new list instance for each method to check. List> locals = new List> (); // A list of ilranges a stack position corresponds to. // Avoids creating a new list instance for each method to check. List stack = new List (); // A list of one bool per instruction in a method indicating whether that instruction is safe in a method. // Avoids creating a new list instance for each method to check. List is_safe = new List(); // A bitmask of safe instructions. static OpCodeBitmask safe_instructions = new OpCodeBitmask (0x22F7FFE7FFD, 0x48000000007F0000, 0x3C00000000000000, 0x45C80); // A bitmask of opcodes a method must have to be checked in CheckMethod. static OpCodeBitmask applicable_method_bitmask = new OpCodeBitmask (0x8000000000, 0x2400400000000000, 0x0, 0x0); #if LOG static class Log { public static bool IsEnabled (object o) { return true; } public static void WriteLine (object o, string msg, params object [] args) { Console.WriteLine (msg, args); } public static void WriteLine (object o, MethodDefinition m) { Console.WriteLine (new MethodPrinter (m).ToString ()); } } #endif #if false static DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule () { GenerateBitmasks (); } public static void GenerateBitmasks () { OpCodeBitmask bitmask; bitmask = new OpCodeBitmask (); bitmask.Set (Code.Stfld); bitmask.Set (Code.Stsfld); bitmask.Set (Code.Call); bitmask.Set (Code.Callvirt); applicable_method_bitmask = bitmask; Console.WriteLine ("applicable_method_bitmask: {0}", bitmask); bitmask = new OpCodeBitmask (); // a list of safe instructions, which under no circumstances // (for verifiable code) can cause an exception to be raised. bitmask = new OpCodeBitmask (); bitmask.Set (Code.Nop); bitmask.Set (Code.Ret); bitmask.Set (Code.Ldloc); bitmask.Set (Code.Ldloc_0); bitmask.Set (Code.Ldloc_1); bitmask.Set (Code.Ldloc_2); bitmask.Set (Code.Ldloc_3); bitmask.Set (Code.Ldloc_S); bitmask.Set (Code.Ldloca); bitmask.Set (Code.Ldloca_S); // This one is needed to load static fields for return values // a method which returns IntPtr should be able to ldsfld IntPtr.Zero bitmask.Set (Code.Ldsfld); // bitmask.Set (Code.Ldsflda); // Not quite sure about this one, leaving it out for now. bitmask.Set (Code.Leave); bitmask.Set (Code.Leave_S); bitmask.Set (Code.Endfilter); bitmask.Set (Code.Endfinally); bitmask.Set (Code.Ldc_I4); bitmask.Set (Code.Ldc_I4_0); bitmask.Set (Code.Ldc_I4_1); bitmask.Set (Code.Ldc_I4_2); bitmask.Set (Code.Ldc_I4_3); bitmask.Set (Code.Ldc_I4_4); bitmask.Set (Code.Ldc_I4_5); bitmask.Set (Code.Ldc_I4_6); bitmask.Set (Code.Ldc_I4_7); bitmask.Set (Code.Ldc_I4_8); bitmask.Set (Code.Ldc_I4_M1); bitmask.Set (Code.Ldc_I8); bitmask.Set (Code.Ldc_R4); bitmask.Set (Code.Ldc_R8); bitmask.Set (Code.Ldarg); bitmask.Set (Code.Ldarg_0); bitmask.Set (Code.Ldarg_1); bitmask.Set (Code.Ldarg_2); bitmask.Set (Code.Ldarg_3); bitmask.Set (Code.Ldarg_S); bitmask.Set (Code.Stloc); bitmask.Set (Code.Stloc_0); bitmask.Set (Code.Stloc_1); bitmask.Set (Code.Stloc_2); bitmask.Set (Code.Stloc_3); bitmask.Set (Code.Stloc_S); bitmask.Set (Code.Stobj); /* Can throw TypeLoadException. This is required to properly initialize out parameters which are ValueTypes */ bitmask.Set (Code.Ldnull); bitmask.Set (Code.Initobj); bitmask.Set (Code.Pop); // The stind* instructions can raise an exception: // "NullReferenceException is thrown if addr is not naturally aligned for the argument type implied by the instruction suffix." // Not sure how we can verify that the alignment is correct, and this instruction is emitted by the compiler for byref/out parameters. // Not marking this instructions as safe would mean that it would be impossible to fix a delegate that takes // a byref/out parameter. bitmask.Set (Code.Stind_I); bitmask.Set (Code.Stind_I1); bitmask.Set (Code.Stind_I2); bitmask.Set (Code.Stind_I4); bitmask.Set (Code.Stind_I8); bitmask.Set (Code.Stind_R4); bitmask.Set (Code.Stind_R8); bitmask.Set (Code.Stind_Ref); safe_instructions = bitmask; Console.WriteLine ("safe_instructions: {0}", bitmask); } #endif public RuleResult CheckMethod (MethodDefinition method) { // Rule does not apply if the method has no IL if (!method.HasBody) return RuleResult.DoesNotApply; // // We need to check all methods which has any of the following opcodes: call, stfld or stsfld. // OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); if (!applicable_method_bitmask.Intersect (bitmask)) return RuleResult.DoesNotApply; /* Unfortunately it's possible to generate IL this rule will choke on, especially when * using non-standard compilers or obfuscators. */ try { return CheckMethodUnsafe (method); } catch (Exception ex) { // FIXME: This problem should be reported some other way, it's not really a failure. // Pending implementation of "analysis warnings", as mentioned here (post #21): // http://groups.google.com/group/gendarme/browse_frm/thread/c37d157ae0c9682/57f89f3abf14f2fd?tvc=1&q=Gendarme+2.6+Preview+1+is+ready+for+download#57f89f3abf14f2fd Runner.Report (method, Severity.Low, Confidence.Low, String.Format (CultureInfo.CurrentCulture, "An exception occurred while verifying this method. " + "This failure can probably be ignored, it's most likely due to an " + "uncommon code sequence in the method the rule didn't understand. {0}", ex.Message)); return RuleResult.Failure; } } private RuleResult CheckMethodUnsafe (MethodDefinition method) { locals.Clear (); stack.Clear (); Log.WriteLine (this, "\n\nChecking method: {0} on type: {1}", method.Name, method.DeclaringType.GetFullName ()); Log.WriteLine (this, method); MethodBody body = method.Body; #if DEBUG foreach (ExceptionHandler e in body.ExceptionHandlers) Log.WriteLine (this, " HandlerType: {6}, TryStart: {3:X}, TryEnd: {4:X}, HandlerStart: {0:X}, HandlerEnd: {1:X}, FilterStart: {2:X}, CatchType: {5}", e.HandlerStart.GetOffset (), e.HandlerEnd.GetOffset (), e.FilterStart.GetOffset (), e.TryStart.GetOffset (), e.TryEnd.GetOffset (), e.CatchType, e.HandlerType); #endif // // We check the following code patterns: // - All delegate expressions created and passed directly to the pinvoke // - All delegate expressions created and stored in fields or local variables and then passed to the pinvoke. // // To do the second item, we keep track of all reads from fields to pinvoke and stores to fields (with delegates) // and report an error if the delegate is unsafe in either case (i.e. we read from a field which has been // assigned an unsafe delegate, or we store an unsafe delegate in a field which have been used in a pinvoke). // This way only one pass over the code is required. // // No other static analysis is done, which means that for things like this we'll report false positives: // delegate v = SafeMethod; // PInvoke (v); // v = UnsafeMethod; // // // There are several ways to get around this: // - Create a delegate, store it in a array/list and then pass it to a pinvoke. // - Create a delegate, return it from a function and use the return value directly in a call to a pinvoke. // - ... // int stack_count = 0; foreach (Instruction ins in body.Instructions) { int pop = ins.GetPopCount (method); if (pop == -1) { // leave or leave.s, they leave the stack empty. stack_count = 0; stack.Clear (); continue; // No need to do anything else here. } if ((stack_count == 0) && body.HasExceptionHandlers) { foreach (ExceptionHandler eh in body.ExceptionHandlers) { if (eh.HandlerStart != null && eh.HandlerStart.Offset == ins.Offset) { // upon entry to a catch handler there is an implicit object on the stack already (the thrown object) stack_count = 1; stack.Add (null); break; } } } int push = ins.GetPushCount (); Log.WriteLine (this, " {0:X} {5} prev stack: {1}, pop: {2}, push: {3}, post stack: {4}", ins.Offset, stack_count, pop, push, stack_count + push - pop, ins.OpCode.Name); if (stack_count == 1 && stack [stack_count - 1] == null) { // Don't do anything, this is the implicit exception object passed to a catch handler. } else if (ins.OpCode.Code == Code.Call) { VerifyCallInstruction (ins); } else if (ins.OpCode.Code == Code.Stfld || ins.OpCode.Code == Code.Stsfld) { VerifyStoreFieldInstruction (ins, stack_count); } else if (ins.IsStoreLocal ()) { VerifyStoreLocalInstruction (ins, stack_count); } stack_count += push - pop; while (stack_count > stack.Count) stack.Add (new ILRange (ins)); while (stack_count < stack.Count) stack.RemoveAt (stack.Count - 1); if (stack_count > 0 && stack [stack_count - 1] != null) stack [stack_count - 1].Last = ins; } Log.WriteLine (this, "Checking method: {0} [Done], result: {1}", method.Name, Runner.CurrentRuleResult); return Runner.CurrentRuleResult; } private void VerifyStoreLocalInstruction (Instruction ins, int stack_count) { List pointers; int index = ins.GetStoreIndex (); pointers = (stack_count <= 0) ? null : GetDelegatePointers (stack [stack_count - 1]); Log.WriteLine (this, " Reached a local variable store at offset {2:X}. index {0}, there are {1} pointers here.", index, pointers == null ? 0 : pointers.Count, ins.Offset); if (pointers != null && pointers.Count > 0) { while (locals.Count <= index) locals.Add (null); if (locals [index] == null) locals [index] = new List (); locals [index].AddRange (pointers); } } private void VerifyStoreFieldInstruction (Instruction ins, int stack_count) { List pointers; FieldReference field = (ins.Operand as FieldReference); pointers = (stack_count <= 0) ? null : GetDelegatePointers (stack [stack_count - 1]); Log.WriteLine (this, " Reached a field variable store to the field {0}, there are {1} unsafe pointers here.", field.Name, pointers == null ? 0 : pointers.Count); #if DEBUG stack [stack_count - 1].DumpAll (" "); #endif if (pointers != null && pointers.Count > 0) { List tmp; if (!stored_fields.TryGetValue (field, out tmp)) { tmp = new List (); stored_fields.Add (field, tmp); } tmp.AddRange (pointers); } // If this field has been loaded into a pinvoke, // check the list for unsafe pointers. if (loaded_fields.Contains (field)) VerifyMethods (pointers); } private void VerifyCallInstruction (Instruction ins) { MethodDefinition called_method; IList parameters; called_method = (ins.Operand as MethodReference).Resolve (); if (called_method != null && called_method.IsPInvokeImpl && called_method.HasParameters) { Log.WriteLine (this, " Reached a call instruction to a pinvoke method: {0}", called_method.Name); parameters = called_method.Parameters; for (int i = 0; i < parameters.Count; i++) { if (stack [i] == null) continue; if (!parameters [i].ParameterType.IsDelegate ()) continue; Log.WriteLine (this, " Parameter #{0} takes a delegate, stack expression:", i); #if DEBUG stack [i].DumpAll (" "); #endif // if we load a field, store the field so that any subsequent unsafe writes to that field can be reported. Instruction last = stack [i].Last; if (last.OpCode.Code == Code.Ldfld || last.OpCode.Code == Code.Ldsfld) { FieldReference field = (last.Operand as FieldReference); loaded_fields.AddIfNew (field); } // Get and check the pointers VerifyMethods (GetDelegatePointers (stack [i])); } } } // Verifies that the method is safe to call as a callback from native code. private bool VerifyCallbackSafety (MethodDefinition callback) { bool result; bool valid_ex_handler; MethodBody body; IList instructions; if (callback == null) return true; Log.WriteLine (this, " Verifying: {0} with code size: {1} instruction count: {2}", callback.Name, callback.Body.CodeSize, callback.Body.Instructions.Count); if (!callback.HasBody) return true; if (verified_methods.TryGetValue (callback, out result)) return result; body = callback.Body; instructions = body.Instructions; int icount = instructions.Count; is_safe.Clear (); is_safe.Capacity = icount; // // We assume that the method is verifiable. // // Mark all instructions corresponding to a safe opcode as safe, others are unsafe for now. for (int i = 0; i < icount; i++) { bool safe = safe_instructions.Get (instructions [i].OpCode.Code); Log.WriteLine (this, " {0} {1}: {2}", i, instructions [i].OpCode.Code, safe); is_safe.Add (safe); } // // Mark code handled by a catch all block as safe. // // Catch all block is any of the following: // a) A try block which does not specify an exception type // b) A try block which specifies System.Exception as the exception type. // // The second case will break if both of the following happens: // 1) An exception is thrown which does not inherit from System.Exception (not valid in C# nor VB, but it is valid in C++/CIL and IL) // 2) The assembly where the exception handler resides has the System.Runtime.CompilerServices.RuntimeCompatibility attribute set with WrapNonExceptionThrows = true. // // If 2) is not true, the runtime will wrap the exception in a RuntimeWrappedException object, which is handled by case b) above. // Given that this is the normal case (otherwise you'd have to put the attribute in the assembly), we accept 2) as safe too. // if (body.HasExceptionHandlers) { foreach (ExceptionHandler eh in body.ExceptionHandlers) { // We only care about catch clauses. if (eh.HandlerType != ExceptionHandlerType.Catch) continue; // no 'Catch ... When ' clause. C# doesn't support it, VB does if (eh.FilterStart != null) continue; // check for catch all clauses TypeReference ctype = eh.CatchType; if (!(ctype == null || ctype.IsNamed ("System", "Object") || ctype.IsNamed ("System", "Exception"))) continue; // Mark the code this exception handler handles as safe. int start_index = instructions.IndexOf (eh.TryStart); int end_index = instructions.IndexOf (eh.TryEnd); Log.WriteLine (this, " Catch all block found, marking instruction at index {0} to index {1} (included) as safe.", start_index, end_index - 1); for (int j = start_index; j < end_index; j++) is_safe [j] = true; } } // Check that all instructions have been marked as safe, otherwise mark the method as unsafe. valid_ex_handler = !is_safe.Contains (false); #if DEBUG Log.WriteLine (this, " Method {0} verified: {1}.", callback.Name, valid_ex_handler); for (int i = 0; i < is_safe.Count; i++) { // Console.ForegroundColor = safe [i] ? ConsoleColor.DarkGreen : ConsoleColor.Red; Log.WriteLine (this, " {1} {0}", instructions [i].ToPrettyString (), is_safe [i] ? "Y" : "N"); // Console.ResetColor (); } foreach (ExceptionHandler e in body.ExceptionHandlers) Log.WriteLine (this, " HandlerType: {6}, TryStart: {3}, TryEnd: {4}, HandlerStart: {0}, HandlerEnd: {1}, FilterStart: {2}, CatchType: {5}", e.HandlerStart.GetOffset (), e.HandlerEnd.GetOffset (), e.FilterStart.GetOffset (), e.TryStart.GetOffset (), e.TryEnd.GetOffset (), e.CatchType, e.HandlerType); #endif verified_methods.Add (callback, valid_ex_handler); return valid_ex_handler; } private sealed class ILRange { public Instruction First; public Instruction Last; public ILRange (Instruction first) { First = first; } #if DEBUG public void DumpAll (string prefix) { if (!Log.IsEnabled (this.GetType ().Name)) return; Instruction instr = First; do { Log.WriteLine (this, "{0}{1}", prefix, instr.ToPrettyString ()); if (instr == Last) break; instr = instr.Next; } while (true); } #endif } // Parses the ILRange and return all delegate pointers that could end up on the stack as a result of executing that code. private List GetDelegatePointers (ILRange range) { List result = null; MethodReference ldftn; MethodDefinition ldftn_definition; // Check if the code does any ldftn. if (range.First != range.Last && range.Last.OpCode.Code == Code.Newobj && range.Last.Previous.OpCode.Code == Code.Ldftn) { ldftn = range.Last.Previous.Operand as MethodReference; if (ldftn != null) { ldftn_definition = ldftn.Resolve (); if (ldftn_definition != null) { if (result == null) result = new List (); result.Add (ldftn_definition); } } } // Check if the code loads any local variables which can be delegates. if (locals != null && range.Last.IsLoadLocal ()) { int index = range.Last.GetLoadIndex (); if (locals.Count > index) { List pointers = locals [index]; if (pointers != null && pointers.Count != 0) { if (result == null) result = new List (); result.AddRange (pointers); } } } // If the last opcode is a field load, check if any pointers have been stored in that field. if (stored_fields.Count > 0 && range.Last.OpCode.Code == Code.Ldfld || range.Last.OpCode.Code == Code.Ldsfld) { FieldReference field = range.Last.Operand as FieldReference; List pointers; if (field != null) { if (stored_fields.TryGetValue (field, out pointers)) { if (result == null) result = new List (); result.AddRange (pointers); } } } return result; } // Verifies that all methods in the list are safe to call from native code, // otherwise reports the corresponding result. private void VerifyMethods (List pointers) { Log.WriteLine (this, " Verifying {0} method pointers.", pointers == null ? 0 : pointers.Count); if (pointers == null) return; for (int i = 0; i < pointers.Count; i++) ReportVerifiedMethod (pointers [i], VerifyCallbackSafety (pointers [i])); } // Reports the result from verifying the method. private void ReportVerifiedMethod (MethodDefinition pointer, bool safe) { if (!safe) { if (reported_methods.Contains (pointer)) return; reported_methods.Add (pointer); Log.WriteLine (this, " Reporting: {0}", pointer.Name); Runner.Report (pointer, Severity.High, Confidence.High); } else { Log.WriteLine (this, " Safe: {0}", pointer.Name); } } } internal static class DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRuleHelper { #if DEBUG public static string ToPrettyString (this Instruction instr) { if (instr == null) return ""; return string.Format ("IL_{0} {1} {2}", instr.Offset, instr.OpCode.Name, instr.Operand); } public static int GetOffset (this Instruction instr) { if (instr != null) return instr.Offset; return -1; } #endif // Return the index of the load opcode. // This could probably go into InstructionRocks. public static int GetLoadIndex (this Instruction ins) { switch (ins.OpCode.Code) { case Code.Ldloc_0: return 0; case Code.Ldloc_1: return 1; case Code.Ldloc_2: return 2; case Code.Ldloc_3: return 3; case Code.Ldloc: // Untested case Code.Ldloca: // Untested case Code.Ldloca_S: case Code.Ldloc_S: return ((VariableDefinition) ins.Operand).Index; default: string msg = String.Format (CultureInfo.InvariantCulture, "Invalid opcode: {0}", ins.OpCode.Name); throw new ArgumentException (msg); } } // Return the index of the store opcode. // This could probably go into InstructionRocks. public static int GetStoreIndex (this Instruction ins) { switch (ins.OpCode.Code) { case Code.Stloc_0: return 0; case Code.Stloc_1: return 1; case Code.Stloc_2: return 2; case Code.Stloc_3: return 3; case Code.Stloc: // Untested for stloc case Code.Stloc_S: return ((VariableDefinition) ins.Operand).Index; default: string msg = String.Format (CultureInfo.InvariantCulture, "Invalid opcode: {0}", ins.OpCode.Name); throw new ArgumentException (msg); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test/0000775000175000017500000000000012642235742027510 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test/ChangeLog0000664000175000017500000000742212413742070031260 0ustar00directhexdirecthex000000000000002010-08-27 Rolf Bjarne Kvinge * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.cs: Remove CWL's from catch blocks in methods that are safe, and add CWL's to methods that should not be safe. In general update to make the tests work with the more correct version of the rule. 2010-04-20 Sebastien Pouliot * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.cs: Make sure the delegates content cannot be optimized away (e.g. CSC) because they have no side effects (i.e. dead code). Fix unit tests under Windows (CSC) 2010-01-16 Sebastien Pouliot * CentralizePInvokesIntoNativeMethodsTypeTest.cs: New. Unit tests for CentralizePInvokesIntoNativeMethodsTypeRule 2009-02-24 Jesse Jones * DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.cs: Rename a bunch of methods so the test doesn't die with old versions of nunit. 2008-11-07 Alan McGovern * Tests.Rules.Interoperability.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-01 Sebastien Pouliot * MarshalBooleansInPInvokeDeclarationsTest.cs: New. Unit tests for MarshalBooleansInPInvokeDeclarationsRule * Test.Rules.Interoperability.mdp: Add new test to MD project file 2008-11-01 Sebastien Pouliot * DoNotCastIntPtrToInt32Test.cs: Add test case for Marshal. ReadInt[32|64] methods casted into IntPtr. Rename fixture to DoNotAssumeIntPtrSizeTest. 2008-09-14 Sebastien Pouliot * DoNotCastIntPtrToInt32Test.cs: Change some results from Success to DoesNotApply since the use of the OpCodeEngine is able to short circuit more cases. 2008-08-10 Sebastien Pouliot * PInvokeShouldNotBeVisibleTest.cs: Convert tests to new syntax. Add test case for instance-based (non static) p/invoke. 2008-05-24 Sebastien Pouliot * DoNotCastIntPtrToInt32Test.cs: Add test case for methods without IL and for GetHashCode (does not apply in both cases) 2008-05-16 Sebastien Pouliot * DoNotCastIntPtrToInt32Test.cs: Re-enable test case since Marek fixed bug #389073 2008-05-11 Andres G. Aragoneses * Test.Rules.Interoperability.mdp: Fix references. 2008-05-09 Sebastien Pouliot * DoNotCastIntPtrToInt32Test.cs: New. Test cases for DoNotCastIntPtrToInt32Rule. 2008-02-15 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeTest.cs * MarshalStringsInPInvokeDeclarationsTest.cs * PInvokeShouldNotBeVisibleTest.cs * UseManagedAlternativesToPInvokeTest.cs: Update unit tests wrt framework changes. 2008-01-30 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeTest.cs: More unit tests by Andreas Noever to reduce false-positives. 2008-01-29 Sebastien Pouliot * MarshalStringsInPInvokeDeclarationsTest.cs: New. Unit tests from Daniel Abramov. 2008-01-21 Sebastien Pouliot * UseManagedAlternativesToPInvokeTest.cs: New. Unit tests from Daniel Abramov (with a bit more coverage by myself). 2008-01-02 Sebastien Pouliot * Makefile.am: Include new file in dist * Test.Rules.Interoperability.mdp: New. MonoDevelop project file. 2007-12-30 Sebastien Pouliot * GetLastErrorMustBeCalledRightAfterPInvokeTest.cs: New. Unit tests for GetLastErrorMustBeCalledRightAfterPInvokeRule by Andreas Noever * PInvokeShouldNotBeVisibleTest.cs: New. Unit tests for PInvokeShouldNotBeVisibleRule by Andreas Noever * Makefile.am: New. Makefile for tests MarshalStringsInPInvokeDeclarationsTest.cs0000664000175000017500000001753512413742070037701 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test// // Unit tests for MarshalStringsInPInvokeDeclarationsRule // // Authors: // Daniel Abramov // // (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using System.Text; using Gendarme.Framework; using Gendarme.Rules.Interoperability; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Interoperability { [TestFixture] public class MarshalStringsInPInvokeDeclarationsTest { private MarshalStringsInPInvokeDeclarationsRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; // checks for CharSet property [DllImport ("kernel32")] static extern void Sleep (uint time); // good (no strings) [DllImport ("kernel32.dll", CharSet = CharSet.Auto)] static extern IntPtr FindFirstFile (string lpFileName, out object lpFindFileData); // good (string) [DllImport ("secur32.dll", CharSet = CharSet.Ansi)] static extern int GetUserNameEx (int nameFormat, StringBuilder userName, ref uint userNameSize); // good (StringBuilder) [DllImport ("winmm.dll", SetLastError = true)] static extern bool PlaySound (string pszSound, UIntPtr hmod, uint fdwSound); // bad (string, no charset!) [DllImport ("user32.dll")] static extern int MessageBox (IntPtr hWnd, StringBuilder text, StringBuilder caption, object style); // bad (StringBuilder, no charset) // checks for MarshalAs // have marshalas's but no charset => ok [DllImport ("kernel32.dll", SetLastError = true)] static extern uint GetShortPathNameGood ( [MarshalAs (UnmanagedType.LPTStr)] string lpszLongPath, [MarshalAs (UnmanagedType.LPTStr)] StringBuilder lpszShortPath, uint cchBuffer); // have charset, no marshalas's => ok [DllImport ("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] static extern uint GetShortPathNameBadParametersCharsetSpec ( string lpszLongPath, StringBuilder lpszShortPath, uint cchBuffer); // have neither => not ok [DllImport ("kernel32.dll", SetLastError = true)] static extern uint GetShortPathNameBadParametersCharsetNotSpec ( string lpszLongPath, StringBuilder lpszShortPath, uint cchBuffer); #region Commented out because structure handling is disabled but this code can be reused somewhere //// structure tests //[StructLayout (LayoutKind.Sequential, CharSet = CharSet.Auto)] // have charset => ok //public struct SHFILEINFOWithCharset //{ // public IntPtr hIcon; // public int iIcon; // public uint dwAttributes; // [MarshalAs (UnmanagedType.ByValTStr, SizeConst = 260)] // public string szDisplayName; // [MarshalAs (UnmanagedType.ByValTStr, SizeConst = 80)] // public string szTypeName; //}; //[DllImport ("shell32.dll")] // no charset but we have one in struct => ok //public static extern IntPtr SHGetFileInfoWithStructureCharset ([MarshalAs (UnmanagedType.LPStr)] string pszPath, uint dwFileAttributes, ref SHFILEINFOWithCharset psfi, uint cbFileInfo, uint uFlags); //[StructLayout (LayoutKind.Sequential)] // no charset but all marsalas's => ok //public struct SHFILEINFOAllMarshalled //{ // public IntPtr hIcon; // public int iIcon; // public uint dwAttributes; // [MarshalAs (UnmanagedType.ByValTStr, SizeConst = 260)] // public string szDisplayName; // [MarshalAs (UnmanagedType.ByValTStr, SizeConst = 80)] // public string szTypeName; //}; //[DllImport ("shell32.dll")] // no charset but all struct strings have marshalas's => ok //public static extern IntPtr SHGetFileInfoAllMarshalled ([MarshalAs (UnmanagedType.LPStr)] string pszPath, uint dwFileAttributes, ref SHFILEINFOAllMarshalled psfi, uint cbFileInfo, uint uFlags); //[StructLayout (LayoutKind.Sequential)] // no charset, two marshalas's missing => bad //public struct SHFILEINFOTwoNotMarshalled //{ // public IntPtr hIcon; // public int iIcon; // public uint dwAttributes; // public string szDisplayName; // public string szTypeName; //}; //[DllImport ("shell32.dll")] // no charset, two struct strings don't have marshalas's => bad //public static extern IntPtr SHGetFileInfoTwoNotMarshalled ([MarshalAs (UnmanagedType.LPStr)] string pszPath, uint dwFileAttributes, ref SHFILEINFOTwoNotMarshalled psfi, uint cbFileInfo, uint uFlags); #endregion void EmptyMethod () { } // FIXME: replace with PerfectMethods.EmptyMethod when porting to new tests model [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.Interoperability.MarshalStringsInPInvokeDeclarationsTest"); rule = new MarshalStringsInPInvokeDeclarationsRule (); runner = new TestRunner (rule); } private MethodDefinition GetTest (string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } return null; } [Test] public void TestEmptyMethod () { MethodDefinition method = GetTest ("EmptyMethod"); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckMethod (method)); } [Test] public void TestNoStringsMethod () { MethodDefinition method = GetTest ("Sleep"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestStringWithCharsetMethod () { MethodDefinition method = GetTest ("FindFirstFile"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestStringBuilderWithCharsetMethod () { MethodDefinition method = GetTest ("GetUserNameEx"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestStringWithoutCharsetMethod () { MethodDefinition method = GetTest ("PlaySound"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestStringBuilderWithoutCharsetMethod () { MethodDefinition method = GetTest ("MessageBox"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestDeclarationWithMarshalAs () { MethodDefinition method = GetTest ("GetShortPathNameGood"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestDeclarationWithoutMarshalAsCharsetSpec () { MethodDefinition method = GetTest ("GetShortPathNameBadParametersCharsetSpec"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestDeclarationWithoutMarshalAsCharsetNotSpec () { MethodDefinition method = GetTest ("GetShortPathNameBadParametersCharsetNotSpec"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test/Makefile.in0000664000175000017500000003146712642235731031566 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Interoperability/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Interoperability.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Interoperability/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Interoperability/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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: GetLastErrorMustBeCalledRightAfterPInvokeTest.cs0000664000175000017500000001601712413742070040674 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test// // Unit tests for GetLastErrorMustBeCalledRightAfterPInvokeRule // // Authors: // Andreas Noever // // (C) 2007 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using System.Text; using Gendarme.Framework; using Gendarme.Rules.Interoperability; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Interoperability { [TestFixture] public class GetLastErrorMustBeCalledRightAfterPInvokeTest { private GetLastErrorMustBeCalledRightAfterPInvokeRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; [DllImport ("User32.dll")] static extern Boolean MessageBeep (UInt32 beepType); public void CallNothing () { new object ().ToString (); } public void CallNothingNotExternal () { this.CallPInvoke (); Console.WriteLine (); Marshal.GetLastWin32Error (); } public void CallPInvoke () { MessageBeep (5); } public void CallPInvoke_GetError () { MessageBeep (5); Marshal.GetLastWin32Error (); } public void CallPInvoke_GetError_valid () { SafeHandle handle = new Microsoft.Win32.SafeHandles.SafeFileHandle ((IntPtr)0, true); MessageBeep (5); IntPtr a = IntPtr.Zero; IntPtr b = IntPtr.Zero; if (a == b) return; if (handle.IsInvalid) return; Marshal.GetLastWin32Error (); } public void CallPInvoke_GetError_valid_struct () { MessageBeep (5); new System.DateTime (); //valid: initobj System.DateTime Marshal.GetLastWin32Error (); } public void CallPInvoke_GetError_invalid () { MessageBeep (5); Console.WriteLine ("FAIL"); Marshal.GetLastWin32Error (); } public void CallPInvoke_GetError_invalid_newobj () { MessageBeep (5); new object (); Marshal.GetLastWin32Error (); } public void CallPInvoke_GetError_invalid_struct () { MessageBeep (5); new System.DateTime (10); //invalid: call System.Void System.DateTime::.ctor(System.Int64) Marshal.GetLastWin32Error (); } public void CallGetError () { new object().ToString (); Marshal.GetLastWin32Error (); } [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.Interoperability.GetLastErrorMustBeCalledRightAfterPInvokeTest"); rule = new GetLastErrorMustBeCalledRightAfterPInvokeRule (); runner = new TestRunner (rule); } private MethodDefinition GetTest (string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } return null; } [Test] public void TestNothing () { MethodDefinition method = GetTest ("CallNothing"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestNothingNotExternal () { MethodDefinition method = GetTest ("CallNothingNotExternal"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestPInvoke () { MethodDefinition method = GetTest ("CallPInvoke"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestPInvoke_GetError () { MethodDefinition method = GetTest ("CallPInvoke_GetError"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestPInvoke_GetError_valid () { MethodDefinition method = GetTest ("CallPInvoke_GetError_valid"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestPInvoke_GetError_invalid () { MethodDefinition method = GetTest ("CallPInvoke_GetError_invalid"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestPInvoke_GetError_invalid_newobj () { MethodDefinition method = GetTest ("CallPInvoke_GetError_invalid_newobj"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestPInvoke_GetError_invalid_struct () { MethodDefinition method = GetTest ("CallPInvoke_GetError_invalid_struct"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestPInvoke_GetError_valid_struct () { MethodDefinition method = GetTest ("CallPInvoke_GetError_valid_struct"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } [Test] public void TestGetError () { MethodDefinition method = GetTest ("CallGetError"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } public void CallPInvoke_Branch () { bool a = MessageBeep (5); if (a) { Console.WriteLine (); } else { Marshal.GetLastWin32Error (); } } [Test] public void TestPInvoke_Branch () { MethodDefinition method = GetTest ("CallPInvoke_Branch"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } public void CallPInvoke_Switch () { bool a = MessageBeep (5); switch (a) { case true: Console.WriteLine (); break; case false: Marshal.GetLastWin32Error (); break; } return; } [Test] public void TestPInvoke_Switch () { MethodDefinition method = GetTest ("CallPInvoke_Switch"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } public void CallPInvoke_Endless () { bool a = MessageBeep (5); loop: Console.WriteLine (); goto loop; } [Test] public void TestPInvoke_Endless () { MethodDefinition method = GetTest ("CallPInvoke_Endless"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } public void TwoPInvokes () { MessageBeep (5); MessageBeep (5); Marshal.GetLastWin32Error (); } [Test] public void TestTwoPInvokes () { MethodDefinition method = GetTest ("TwoPInvokes"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } } } CentralizePInvokesIntoNativeMethodsTypeTest.cs0000664000175000017500000001536512413742070040571 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test// // Unit Tests for CentralizePInvokesIntoNativeMethodsTypeRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.InteropServices; using System.Security; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Interoperability; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; // [SuppressUnmanagedCodeSecurity] attributes are reversed namespace Bad.Attributes { [SuppressUnmanagedCodeSecurity] internal sealed class NativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } internal sealed class SafeNativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } internal sealed class UnsafeNativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } } namespace Bad.Instantiate { internal class NativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } [SuppressUnmanagedCodeSecurity] internal class SafeNativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } [SuppressUnmanagedCodeSecurity] internal class UnsafeNativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } } namespace Bad.Visibility { public sealed class NativeMethods { private NativeMethods () { } [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } [SuppressUnmanagedCodeSecurity] public sealed class SafeNativeMethods { private SafeNativeMethods () { } [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } [SuppressUnmanagedCodeSecurity] public sealed class UnsafeNativeMethods { private UnsafeNativeMethods () { } [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } } namespace Test.Rules.Interoperability { internal sealed class NativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } [SuppressUnmanagedCodeSecurity] internal sealed class SafeNativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } [SuppressUnmanagedCodeSecurity] internal sealed class UnsafeNativeMethods { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } // type name does not follow convention internal sealed class NativeCode { [DllImport ("User32.dll")] internal static extern Boolean MessageBeep (UInt32 beepType); } [TestFixture] public class CentralizePInvokesIntoNativeMethodsTypeTypeTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // not a good type name AssertRuleDoesNotApply (SimpleTypes.Class); } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); // it's good but we'll report an Audit defect since this needs reviewing AssertRuleFailure (1); Assert.AreEqual (Severity.Audit, Runner.Defects [0].Severity); } [Test] public void BadAttributes () { AssertRuleFailure (1); Assert.AreEqual (Severity.Critical, Runner.Defects [0].Severity, "NativeMethods"); AssertRuleFailure (1); Assert.AreEqual (Severity.Critical, Runner.Defects [0].Severity, "SafeNativeMethods"); // bad attribute + audit AssertRuleFailure (2); Assert.AreEqual (Severity.Critical, Runner.Defects [0].Severity, "UnsafeNativeMethods"); Assert.AreEqual (Severity.Audit, Runner.Defects [1].Severity, "UnsafeNativeMethods-audit"); } [Test] public void BadInstantiate () { AssertRuleFailure (1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "NativeMethods"); AssertRuleFailure (1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "SafeNativeMethods"); // bad attribute + audit AssertRuleFailure (2); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "UnsafeNativeMethods"); Assert.AreEqual (Severity.Audit, Runner.Defects [1].Severity, "UnsafeNativeMethods-audit"); } [Test] public void BadVisibility () { AssertRuleFailure (1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "NativeMethods"); AssertRuleFailure (1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "SafeNativeMethods"); // bad attribute + audit AssertRuleFailure (2); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "UnsafeNativeMethods"); Assert.AreEqual (Severity.Audit, Runner.Defects [1].Severity, "UnsafeNativeMethods-audit"); } } [TestFixture] public class CentralizePInvokesIntoNativeMethodsTypeMethodTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no pinvoke (not a good type name either) AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void Good () { AssertRuleSuccess ("MessageBeep"); AssertRuleSuccess ("MessageBeep"); AssertRuleSuccess ("MessageBeep"); } [Test] public void Bad () { AssertRuleFailure ("MessageBeep", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test/PInvokeShouldNotBeVisibleTest.cs0000664000175000017500000001026712413742070035676 0ustar00directhexdirecthex00000000000000// // Unit tests for PInvokeShouldNotBeVisibleRule // // Authors: // Sebastien Pouliot // // (C) 2007 Andreas Noever // 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; using System.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Rules.Interoperability; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Interoperability { internal class PInvokeInternal { [DllImport ("User32.dll")] internal static extern Boolean MessageBeepInternal (UInt32 beepType); //ok [DllImport ("User32.dll")] public static extern Boolean MessageBeepPublic (UInt32 beepType); //ok public class Public { [DllImport ("User32.dll")] public static extern Boolean MessageBeepPublic (UInt32 beepType); //ok } } public class PInvokePublic { [DllImport ("User32.dll")] internal static extern Boolean MessageBeepInternal (UInt32 beepType); //ok [DllImport ("User32.dll")] public static extern Boolean MessageBeepPublic (UInt32 beepType); //warn public class Public { [DllImport ("User32.dll")] public static extern Boolean MessageBeepPublic (UInt32 beepType); //warn } internal class Internal { [DllImport ("User32.dll")] public static extern Boolean MessageBeepPublic (UInt32 beepType); //ok } // special cases - we'll be modified (static removed) before their use [DllImport ("User32.dll")] internal static extern Boolean InstanceInternal (UInt32 beepType); //bad1 [DllImport ("User32.dll")] public static extern Boolean InstancePublic (UInt32 beepType); //bad2 } [TestFixture] public class PInvokeShouldNotBeVisibleTest : MethodRuleTestFixture { [TestFixtureSetUp] public void SetUp () { // since C# compiler won't compile an instance p/invoke we'll need to hack our own AssemblyDefinition assembly = DefinitionLoader.GetAssemblyDefinition (); foreach (MethodDefinition method in assembly.MainModule.GetType ("Test.Rules.Interoperability.PInvokePublic").Methods) { if (method.Name.StartsWith ("Instance")) method.IsStatic = false; } } [Test] public void NonVisibleType_NonVisibleMethod () { AssertRuleSuccess ("MessageBeepInternal"); } [Test] public void NonVisibleType_VisibleMethod () { AssertRuleSuccess ("MessageBeepPublic"); } [Test] public void NonVisibleNestedType_VisibleMethod () { AssertRuleSuccess ("MessageBeepPublic"); AssertRuleSuccess ("MessageBeepPublic"); } [Test] public void VisibleType_NonVisibleMethod () { AssertRuleSuccess ("MessageBeepInternal"); } [Test] public void VisibleType_VisibleMethod () { AssertRuleFailure ("MessageBeepPublic", 1); } [Test] public void VisibleNestedType_VisibleMethod () { AssertRuleFailure ("MessageBeepPublic", 1); } [Test] public void Instance () { AssertRuleFailure ("InstanceInternal", 1); AssertRuleFailure ("InstancePublic", 2); } } } UseManagedAlternativesToPInvokeTest.cs0000664000175000017500000000670612413742070037014 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test// // Unit tests for UseManagedAlternativesToPInvokeRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) 2008 Daniel Abramov // 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; using System.Reflection; using System.Runtime.InteropServices; using Gendarme.Framework; using Gendarme.Rules.Interoperability; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Interoperability { [TestFixture] public class UseManagedAlternativesToPInvokeTest { private UseManagedAlternativesToPInvokeRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; [DllImport ("kernel32")] static extern void Sleep (uint time); // bad because we have Thread.Sleep () [DllImport ("user32.dll")] static extern Boolean MessageBeep (UInt32 beepType); // ok [DllImport ("kernel32.dll")] static extern Boolean FindFirstFile (); // wrong definition, but this occurs frequently in real life :| public void EmptyMethod () { } // FIXME: replace with PerfectMethods.EmptyMethod when porting to new tests model [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.Interoperability.UseManagedAlternativesToPInvokeTest"); rule = new UseManagedAlternativesToPInvokeRule (); runner = new TestRunner (rule); } private MethodDefinition GetTest (string name) { foreach (MethodDefinition method in type.Methods) { if (method.Name == name) return method; } return null; } [Test] public void TestEmptyMethod () { MethodDefinition method = GetTest ("EmptyMethod"); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckMethod (method)); } [Test] public void TestBadMethod () { MethodDefinition method = GetTest ("Sleep"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestBadMethodMultipleSolutions () { MethodDefinition method = GetTest ("FindFirstFile"); Assert.AreEqual (RuleResult.Failure, runner.CheckMethod (method)); } [Test] public void TestOkMethod () { MethodDefinition method = GetTest ("MessageBeep"); Assert.AreEqual (RuleResult.Success, runner.CheckMethod (method)); } } } DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.cs0000664000175000017500000005655712413742070043636 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test// // Unit tests for DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest // // Authors: // Rolf Bjarne Kvinge // // 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.Reflection; using System.Runtime.InteropServices; using System.Text; using Gendarme.Framework; using Gendarme.Rules.Interoperability; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; using Test.Rules.Fixtures; namespace Test.Rules.Interoperability { [TestFixture] public class DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest { private DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule rule; private AssemblyDefinition assembly; private TypeDefinition type; public delegate void CallbackDelegate (); public delegate byte CallbackDelegateByte (); public delegate void CallbackDelegateOut (out int a); public delegate System.DateTime CallbackDelegateNonVoidStruct (); [DllImport ("library.dll")] static extern void PInvokeNormal (); [DllImport ("library.dll")] static extern void PInvokeDelegate1 (CallbackDelegate d); [DllImport ("library.dll")] static extern void PInvokeDelegate2 (object obj, CallbackDelegate d); [DllImport ("library.dll")] static extern void PInvokeDelegate3 (CallbackDelegate d1, object obj, CallbackDelegate d3); [DllImport ("library.dll")] static extern void PInvokeDelegate4 (CallbackDelegateByte d); [DllImport ("library.dll")] static extern void PInvokeDelegate5 (CallbackDelegateOut d); [DllImport ("library.dll")] static extern void PInvokeDelegate6 (CallbackDelegateNonVoidStruct d); #region Callback methods private CallbackDelegate CallbackOK1_Field; private CallbackDelegate CallbackOK1_StaticField; private void CallbackOK1 () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } } private byte CallbackOK_NonVoid () { try { Console.WriteLine ("try"); return 1; } catch { return 2; } } private CallbackDelegate CallbackOKStatic_Field; private CallbackDelegate CallbackOKStatic_StaticField; private static void CallbackOKStatic () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } } private void CallbackOKEmpty () { // Nothing is done here, so this method is ok. } private CallbackDelegate CallbackFailEmpty_Field; private CallbackDelegate CallbackFailEmpty_StaticField; private void CallbackFailEmpty () { Console.WriteLine (); } private byte CallbackFailEmpty_NonVoid () { Console.WriteLine (); return 1; } private CallbackDelegate CallbackFailEmptyStatic_Field; private CallbackDelegate CallbackFailEmptyStatic_StaticField; private static void CallbackFailEmptyStatic () { Console.WriteLine (); } private void CallbackFailNoCatch () { try { Console.WriteLine (); } finally { } } private void CallbackFailNoEmptyCatch () { try { Console.WriteLine (); } catch (StackOverflowException ex) { } } private void CallbackFailNotEntireMethod1 () { Console.WriteLine (); try { } catch { } } private void CallbackFailNotEntireMethod2 () { try { } catch { } Console.WriteLine (); } private void CallbackFailNoEmptyCatchEntireMethod () { try { Console.WriteLine (); try { Console.WriteLine (); } catch { Console.WriteLine (); } } catch (StackOverflowException ex) { Console.WriteLine (); } } #endregion [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); type = assembly.MainModule.GetType ("Test.Rules.Interoperability.DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest"); } private void CheckMethod_OK1 () { CallbackDelegate c = CallbackFailEmpty; // Create a bad delegate but not pass it to a pinvoke. PInvokeNormal (); } private void CheckMethod_AnonymousOK1 () { CallbackDelegate c = delegate () {}; // Create a bad delegate but not pass it to a pinvoke. PInvokeNormal (); } private void CheckMethod_OK2 () { CallbackDelegate a = CallbackFailEmpty; CallbackDelegate b = CallbackOK1; // Create a bad delegate and a good delegate, pass the good delegate. PInvokeDelegate1 (b); } private void CheckMethod_AnonymousOK2 () { CallbackDelegate a = delegate () { }; CallbackDelegate b = delegate () { try { Console.WriteLine ("try"); } catch { } }; // Create a bad delegate and a good delegate, pass the good delegate. PInvokeDelegate1 (b); } private void CheckMethod_CallbackOK1 () { CallbackDelegate c = CallbackOK1; CallbackOK1_Field = CallbackOK1; CallbackOK1_StaticField = CallbackOK1; PInvokeDelegate1 (CallbackOK1); PInvokeDelegate1 (new CallbackDelegate (CallbackOK1)); PInvokeDelegate1 (c); PInvokeDelegate1 (CallbackOK1_Field); PInvokeDelegate1 (CallbackOK1_StaticField); PInvokeDelegate2 (null, CallbackOK1); PInvokeDelegate2 (new CallbackDelegate (CallbackOK1), null); PInvokeDelegate3 (CallbackOK1_Field, null, CallbackOK1_StaticField); } private void CheckMethod_CallbackOKStatic () { CallbackDelegate c = CallbackOKStatic; CallbackOKStatic_Field = CallbackOKStatic; CallbackOKStatic_StaticField = CallbackOKStatic; PInvokeDelegate1 (CallbackOKStatic); PInvokeDelegate1 (new CallbackDelegate (CallbackOKStatic)); PInvokeDelegate1 (c); PInvokeDelegate1 (CallbackOKStatic_Field); PInvokeDelegate1 (CallbackOKStatic_StaticField); PInvokeDelegate2 (null, CallbackOKStatic); PInvokeDelegate2 (new CallbackDelegate (CallbackOKStatic), null); PInvokeDelegate3 (CallbackOKStatic_Field, null, CallbackOKStatic_StaticField); } private void CheckMethod_AnonymousCallbackOK1 () { // These anonymous delegates will turn out non-static since they access a method variable in outer scope. int o = 7; CallbackDelegate c = delegate () { int a, b; try { a = o; Console.WriteLine (a); } catch { } }; CallbackOKStatic_Field = delegate () { int a, b; try { a = o; Console.WriteLine (a); } catch { } }; CallbackOKStatic_StaticField = delegate () { int a, b; try { a = o; Console.WriteLine (a); } catch { } }; PInvokeDelegate1 (delegate () { int a, b; try { a = o; Console.WriteLine (a); } catch { } }); PInvokeDelegate1 (new CallbackDelegate (delegate () { int a, b; try { a = o; Console.WriteLine (a); } catch { } })); PInvokeDelegate1 (c); PInvokeDelegate1 (CallbackOKStatic_Field); PInvokeDelegate1 (CallbackOKStatic_StaticField); PInvokeDelegate2 (null, delegate () { int a, b; try { a = o; Console.WriteLine (a); } catch { } }); PInvokeDelegate2 (new CallbackDelegate (delegate () { int a, b; try { a = o; Console.WriteLine (a); } catch { } }), null); PInvokeDelegate3 (CallbackOKStatic_Field, null, CallbackOKStatic_StaticField); } private void CheckMethod_AnonymousCallbackOKStatic () { // These anonymous delegates will turn out static given that they don't access any class/method variables in outer scope. CallbackDelegate c = delegate () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } }; CallbackOK1_Field = delegate () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } }; CallbackOK1_StaticField = delegate () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } }; PInvokeDelegate1 (delegate () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } }); PInvokeDelegate1 (new CallbackDelegate (delegate () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } })); PInvokeDelegate1 (c); PInvokeDelegate1 (CallbackOK1_Field); PInvokeDelegate1 (CallbackOK1_StaticField); PInvokeDelegate2 (null, delegate () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } }); PInvokeDelegate2 (new CallbackDelegate (delegate () { int a, b; try { a = 1; Console.WriteLine (a); } catch { b = 2; } }), null); PInvokeDelegate3 (CallbackOK1_Field, null, CallbackOK1_StaticField); } private void CheckMethod_CallbackFailEmpty_a () { PInvokeDelegate1 (CallbackFailEmpty); } private void CheckMethod_AnonymousCallbackFailEmpty_a () { PInvokeDelegate1 (delegate () { Console.WriteLine (); }); } private void CheckMethod_CallbackFailEmpty_b () { PInvokeDelegate1 (new CallbackDelegate (CallbackFailEmpty)); } private void CheckMethod_AnonymousCallbackFailEmpty_b () { PInvokeDelegate1 (new CallbackDelegate (delegate () { Console.WriteLine (); })); } private void CheckMethod_CallbackFailEmpty_c () { CallbackDelegate c = CallbackFailEmpty; PInvokeDelegate1 (c); } private void CheckMethod_AnonymousCallbackFailEmpty_c () { CallbackDelegate c = delegate () { Console.WriteLine (); }; PInvokeDelegate1 (c); } private void CheckMethod_CallbackFailEmpty_d () { CallbackFailEmptyStatic_Field = CallbackFailEmpty; PInvokeDelegate1 (CallbackFailEmptyStatic_Field); } private void CheckMethod_AnonymousCallbackFailEmpty_d () { CallbackFailEmptyStatic_Field = delegate () { Console.WriteLine (); }; PInvokeDelegate1 (CallbackFailEmptyStatic_Field); } private void CheckMethod_CallbackFailEmpty_e () { CallbackFailEmptyStatic_StaticField = CallbackFailEmpty; PInvokeDelegate1 (CallbackFailEmptyStatic_StaticField); } private void CheckMethod_AnonymousCallbackFailEmpty_e () { CallbackFailEmptyStatic_StaticField = delegate () { Console.WriteLine (); }; PInvokeDelegate1 (CallbackFailEmptyStatic_StaticField); } private void CheckMethod_CallbackFailEmpty_f () { PInvokeDelegate2 (null, CallbackFailEmpty); } private void CheckMethod_AnonymousCallbackFailEmpty_f () { PInvokeDelegate2 (null, delegate () { Console.WriteLine (); }); } private void CheckMethod_CallbackOKEmpty_g () { PInvokeDelegate2 (new CallbackDelegate (CallbackFailEmpty), null); } private void CheckMethod_AnonymousCallbackOKEmpty_g () { PInvokeDelegate2 (new CallbackDelegate (delegate () { Console.WriteLine (); }), null); } private void CheckMethod_CallbackFailEmpty_h () { CallbackFailEmptyStatic_Field = CallbackFailEmpty; CallbackFailEmptyStatic_StaticField = CallbackFailEmpty; PInvokeDelegate3 (CallbackFailEmptyStatic_Field, null, CallbackFailEmptyStatic_StaticField); } private void CheckMethod_AnonymousCallbackFailEmpty_h () { CallbackFailEmptyStatic_Field = delegate () { Console.WriteLine (); }; CallbackFailEmptyStatic_StaticField = delegate () { Console.WriteLine (); }; PInvokeDelegate3 (CallbackFailEmptyStatic_Field, null, CallbackFailEmptyStatic_StaticField); } class CheckClass_InstanceFieldFail { private CallbackDelegate field; public void DoBadA () { DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.PInvokeDelegate1 (field); } public void Set () { // Note that we set the field (textually) after using the pinvoke above. field = DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.CallbackFailEmptyStatic; } } class CheckClass_StaticFieldFail { private static CallbackDelegate field; public void Set () { // Reverse textual order from instance field test above. field = DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.CallbackFailEmptyStatic; } public void DoBadA () { DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.PInvokeDelegate1 (field); } } class CheckClass_AnonymousInstanceFieldFail { private CallbackDelegate field; public void DoBadA () { DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.PInvokeDelegate1 (field); } public void Set () { // Note that we set the field (textually) after using the pinvoke above. field = delegate () { Console.WriteLine (); }; } } class CheckClass_AnonymousStaticFieldFail { private static CallbackDelegate field; public void Set () { // Reverse textual order from instance field test above. field = delegate () { Console.WriteLine (); }; } public void DoBadA () { DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.PInvokeDelegate1 (field); } } private void CheckMethod_CallbackFailEmptyStatic () { PInvokeDelegate1 (CallbackFailEmptyStatic); } private void CheckMethod_AnonymousCallbackFailEmptyStatic () { PInvokeDelegate1 (delegate () { Console.WriteLine (); }); } private void CheckMethod_CallbackFailNoCatch () { PInvokeDelegate1 (CallbackFailNoCatch); } private void CheckMethod_AnonymousCallbackFailNoCatch () { PInvokeDelegate1 (delegate () { try { Console.WriteLine (); } finally {} }); } private void CheckMethod_CallbackFailNoEmptyCatch () { PInvokeDelegate1 (CallbackFailNoEmptyCatch); } private void CheckMethod_AnonymousCallbackFailNoEmptyCatch () { PInvokeDelegate1 (delegate () { try { Console.WriteLine (); } catch (StackOverflowException ex) { } }); } private void CheckMethod_CallbackFailNotEntireMethod1 () { PInvokeDelegate1 (CallbackFailNotEntireMethod1); } private void CheckMethod_AnonymousCallbackFailNotEntireMethod1 () { PInvokeDelegate1 (delegate () { Console.WriteLine (); try { } catch { } }); } private void CheckMethod_CallbackFailNotEntireMethod2 () { PInvokeDelegate1 (CallbackFailNotEntireMethod2); } private void CheckMethod_AnonymousCallbackFailNotEntireMethod2 () { PInvokeDelegate1 (delegate () { try { } catch { } Console.WriteLine (); } ); } private void CheckMethod_CallbackFailNoEmptyCatchEntireMethod () { PInvokeDelegate1 (CallbackFailNoEmptyCatchEntireMethod); } private void CheckMethod_AnonymousCallbackFailNoEmptyCatchEntireMethod () { PInvokeDelegate1 (delegate () { try { Console.WriteLine (); try { Console.WriteLine (); } catch { Console.WriteLine (); } } catch (Exception ex) { Console.WriteLine (); } }); } private void CheckMethod_NonVoidOK () { PInvokeDelegate4 (CallbackOK_NonVoid); } private void CheckMethod_NonVoidFail () { PInvokeDelegate4 (CallbackFailEmpty_NonVoid); } private void CheckMethod_TwoFailures_a () { PInvokeDelegate1 (delegate () { Console.WriteLine (); }); PInvokeDelegate1 (delegate () { Console.WriteLine (); }); } private void CheckMethod_TwoFailures_b () { PInvokeDelegate3 (delegate () { Console.WriteLine (); }, null, delegate () { Console.WriteLine (); }); } private void CheckMethod_OKOutParams () { PInvokeDelegate5 ( delegate (out int a) { a = 0; } ); } private void CheckMethod_FailOutParams () { PInvokeDelegate5 ( delegate (out int a) { Console.WriteLine (); a = 2; } ); } private void CheckMethod_OKNonVoidStruct () { PInvokeDelegate6 ( delegate () { return new DateTime (); } ); } private void CheckMethod_OKNonVoidStruct2 () { PInvokeDelegate6 ( delegate () { return DateTime.MinValue; } ); } private void AssertTest (string name) { AssertTest (name, 1); } private void AssertTest (string name, int expectedCount) { TestRunner runner; MethodDefinition method; RuleResult result; RuleResult expected = name.Contains ("OK") ? RuleResult.Success : RuleResult.Failure; if (expected == RuleResult.Success) expectedCount = 0; // Since the rule only reports errors once for each method, and these tests reuse methods, // we need a new test runner for each test. runner = new TestRunner (new DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule ()); runner.Rules.Clear (); method = DefinitionLoader.GetMethodDefinition (name); result = runner.CheckMethod (method); Assert.AreEqual (expected, result); Assert.AreEqual (expectedCount, runner.Defects.Count, "DefectCount"); } private void AssertClass () { TestRunner runner; bool failed = false; RuleResult result; // // We assert that exactly 1 error is raised among all the methods in the class // runner = new TestRunner (new DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule ()); foreach (MethodDefinition method in DefinitionLoader.GetTypeDefinition ().Methods) { result = runner.CheckMethod (method); if (result == RuleResult.Failure) { Assert.IsFalse (failed); Assert.AreEqual (1, runner.Defects.Count); failed = true; } } Assert.IsTrue (failed); } [Test] public void Test_NonVoidStruct () { AssertTest ("CheckMethod_OKNonVoidStruct"); AssertTest ("CheckMethod_OKNonVoidStruct2"); } [Test] public void Test_OutParams () { AssertTest ("CheckMethod_OKOutParams"); AssertTest ("CheckMethod_FailOutParams", 1); } [Test] public void Test_TwoFailures () { AssertTest ("CheckMethod_TwoFailures_a", 2); AssertTest ("CheckMethod_TwoFailures_b", 2); } [Test] public void Test_NonVoid () { AssertTest ("CheckMethod_NonVoidOK"); AssertTest ("CheckMethod_NonVoidFail"); } [Test] public void Test_OK1 () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_OK2 () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackOK1 () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackOKStatic () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailEmpty_a () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailEmpty_b () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailEmpty_c () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailEmpty_d () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailEmpty_e () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailEmpty_f () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackOKEmpty_g () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailEmpty_h () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous"), 2); } [Test] public void Test_StaticFieldFail () { AssertClass (); AssertClass (); } [Test] public void Test_InstanceFieldFail () { AssertClass (); AssertClass (); } [Test] public void Test_CallbackFailEmptyStatic () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailNoCatch () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailNoEmptyCatch () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailNotEntireMethod1 () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailNotEntireMethod2 () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } [Test] public void Test_CallbackFailNoEmptyCatchEntireMethod () { AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_")); AssertTest (MethodInfo.GetCurrentMethod ().Name.Replace ("Test_", "CheckMethod_Anonymous")); } } } MarshalBooleansInPInvokeDeclarationsTest.cs0000664000175000017500000000603612413742070040004 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test// // Unit tests for MarshalBooleansInPInvokeDeclarationsRule. // // Authors: // Sebastien Pouliot // // 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.Runtime.InteropServices; using Gendarme.Rules.Interoperability; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Interoperability { [TestFixture] public class MarshalBooleansInPInvokeDeclarationsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // not pinvokes AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); AssertRuleDoesNotApply (SimpleMethods.GeneratedCodeMethod); } [DllImport ("liberty.so")] [return: MarshalAs (UnmanagedType.Bool)] private static extern bool GoodBoolReturn (); [DllImport ("liberty.so")] private static extern void GoodOutBool ([MarshalAs (UnmanagedType.U1)] out bool b); [DllImport ("liberty.so")] private static extern void GoodBoolTwo ([MarshalAs (UnmanagedType.Bool)] bool b1, [MarshalAs (UnmanagedType.U1)] ref bool b2); [Test] public void Ok () { // no boolean parameters AssertRuleSuccess (SimpleMethods.ExternalMethod); AssertRuleSuccess ("GoodBoolReturn"); AssertRuleSuccess ("GoodOutBool"); AssertRuleSuccess ("GoodBoolTwo"); } [DllImport ("liberty.so")] private static extern bool BadBoolReturn (); [DllImport ("liberty.so")] private static extern void BadOutBool (out bool b); [DllImport ("liberty.so")] private static extern void BadBoolTwo (bool b1, ref bool b2); [Test] public void Bad () { AssertRuleFailure ("BadBoolReturn", 1); AssertRuleFailure ("BadOutBool", 1); AssertRuleFailure ("BadBoolTwo", 2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test/Makefile.am0000664000175000017500000000016312413742070031535 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Interoperability.csproj DISTCLEANFILES = Makefile.in all: Tests.Rules.Interoperability.csproj0000775000175000017500000001411212413742070036365 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test Debug AnyCPU 9.0.30729 2.0 {5F87F782-0D2B-48B0-9B44-373DB67D9321} Library Properties Tests.Rules.Interoperability Tests.Rules.Interoperability v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full true bin\Debug\ DEBUG;TRACE prompt 4 true AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 true AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {C0E9997F-EA91-4C7A-9702-5F8215574BCA} Gendarme.Rules.Interoperability False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Test/DoNotCastIntPtrToInt32Test.cs0000664000175000017500000001357112413742070035021 0ustar00directhexdirecthex00000000000000// // Unit Tests for DoNotAssumeIntPtrSizeRule. // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Interoperability; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; #pragma warning disable 169 namespace Test.Rules.Interoperability { [TestFixture] public unsafe class DoNotAssumeIntPtrSizeTest : MethodRuleTestFixture { private int CastIntPtrToInt32 (IntPtr ptr) { return (int) ptr; } private uint CastIntPtrToUInt32 (IntPtr ptr) { return (uint) ptr; } private long CastIntPtrToInt64 (IntPtr ptr) { return (long) ptr; } private ulong CastIntPtrToUInt64 (IntPtr ptr) { return (ulong) ptr; } private IntPtr CastIntPtrToIntPtr (IntPtr ptr) { return (IntPtr) ptr; } private void* CastIntPtrToVoidPointer (IntPtr ptr) { return (void*) ptr; } [Test] public void TypeCastIntPtr () { AssertRuleFailure ("CastIntPtrToInt32", 1); AssertRuleFailure ("CastIntPtrToUInt32", 1); AssertRuleSuccess ("CastIntPtrToInt64"); AssertRuleSuccess ("CastIntPtrToUInt64"); AssertRuleDoesNotApply ("CastIntPtrToIntPtr"); AssertRuleSuccess ("CastIntPtrToVoidPointer"); } private int CastUIntPtrToInt32 (UIntPtr ptr) { return (int) ptr; } private uint CastUIntPtrToUInt32 (UIntPtr ptr) { return (uint) ptr; } private long CastUIntPtrToInt64 (UIntPtr ptr) { return (long) ptr; } private ulong CastUIntPtrToUInt64 (UIntPtr ptr) { return (ulong) ptr; } private UIntPtr CastUIntPtrToIntPtr (UIntPtr ptr) { return (UIntPtr) ptr; } private void* CastUIntPtrToVoidPointer (UIntPtr ptr) { return (void*) ptr; } [Test] public void TypeCastUIntPtr () { AssertRuleFailure ("CastUIntPtrToInt32", 1); AssertRuleFailure ("CastUIntPtrToUInt32", 1); AssertRuleSuccess ("CastUIntPtrToInt64"); AssertRuleSuccess ("CastUIntPtrToUInt64"); AssertRuleDoesNotApply ("CastUIntPtrToIntPtr"); AssertRuleSuccess ("CastUIntPtrToVoidPointer"); } private void BadLoop (IntPtr dest) { int ptr = dest.ToInt32 (); for (int i = 0; i < 16; i++) { Marshal.StructureToPtr (this, (IntPtr)ptr, false); ptr += 4; } } private void GoodLoop (IntPtr dest) { long ptr = dest.ToInt64 (); for (int i = 0; i < 16; i++) { Marshal.StructureToPtr (this, (IntPtr) ptr, false); ptr += 4; } } [Test] public void Convert () { AssertRuleFailure ("BadLoop", 1); AssertRuleSuccess ("GoodLoop"); } public override bool Equals (object obj) { return base.Equals (obj); } public override int GetHashCode () { return base.GetHashCode(); } [Test] public void DoesNotApply () { // no IL for p/invokes AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // rule does not apply to GetHashCode AssertRuleDoesNotApply ("GetHashCode"); } // adapted from System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs public void ReadInt32 (IntPtr p) { for (int i = 0; i < 1000; i++) { // that won't work on 64 bits platforms p = (IntPtr) Marshal.ReadInt32 (p); } } public void ReadInt64 (IntPtr p) { for (int i = 0; i < 1000; i++) { // that won't work on 32 bits platforms p = (IntPtr) Marshal.ReadInt64 (p); } } public void ReadIntPtr (IntPtr p) { for (int i = 0; i < 1000; i++) { p = (IntPtr) Marshal.ReadIntPtr (p); } } [Test] public void MarshalRead () { AssertRuleFailure ("ReadInt32", 1); AssertRuleFailure ("ReadInt64", 1); AssertRuleSuccess ("ReadIntPtr"); } public void WriteInt32 (IntPtr p) { for (int i = 0; i < 1000; i++) { // that won't work on 64 bits platforms Marshal.WriteInt32 (p, (int) p); } } public void WriteInt64 (IntPtr p) { // that will work on both 32/64 platform (even if its not the preferred way) Marshal.WriteInt64 (p, (long) p); } public void WriteIntPtr (IntPtr p) { Marshal.WriteIntPtr (p, p); } [Test] public void MarshalWrite () { AssertRuleFailure ("WriteInt32", 1); AssertRuleSuccess ("WriteInt64"); AssertRuleSuccess ("WriteIntPtr"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Gendarme.Rules.Interoperability.csproj0000775000175000017500000001333712413742070036155 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {C0E9997F-EA91-4C7A-9702-5F8215574BCA} Library Properties Gendarme.Rules.Interoperability Gendarme.Rules.Interoperability v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 1591 1570 ..\..\console\bin\Debug\Gendarme.Rules.Interoperability.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Interoperability.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability/Makefile.am0000664000175000017500000000150212413742070030614 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ CentralizePInvokesIntoNativeMethodsTypeRule.cs \ DelegatesPassedToNativeCodeMustIncludeExceptionHandlingRule.cs \ DoNotCastIntPtrToInt32Rule.cs \ GetLastErrorMustBeCalledRightAfterPInvokeRule.cs \ MarshalBooleansInPInvokeDeclarationsRule.cs \ MarshalStringsInPInvokeDeclarationsRule.cs \ PInvokeShouldNotBeVisibleRule.cs \ UseManagedAlternativesToPInvokeRule.cs EXTRA_TESTS_OPTIONS += -unsafe tests_sources = \ CentralizePInvokesIntoNativeMethodsTypeTest.cs \ DoNotCastIntPtrToInt32Test.cs \ GetLastErrorMustBeCalledRightAfterPInvokeTest.cs \ MarshalBooleansInPInvokeDeclarationsTest.cs \ MarshalStringsInPInvokeDeclarationsTest.cs \ PInvokeShouldNotBeVisibleTest.cs \ UseManagedAlternativesToPInvokeTest.cs \ DelegatesPassedToNativeCodeMustIncludeExceptionHandlingTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/0000775000175000017500000000000012642235742027306 5ustar00directhexdirecthex00000000000000AvoidOverloadsInComVisibleInterfacesRule.cs0000664000175000017500000000611412413742070037572 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // Gendarme.Rules.Interoperability.Com.AvoidOverloadsInComVisibleInterfacesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// This rule checks for ComVisible interface which contains overloaded methods. /// /// /// Bad example: /// /// [ComVisible(true)] /// public interface Bad { /// void SomeMethod(); /// void SomeMethod(int SomeValue); /// } /// /// /// /// Good example: /// /// [ComVisible(true)] /// public interface Good { /// void SomeMethod(); /// void SomeMethodWithValue(int SomeValue); /// } /// /// [Problem ("ComVisible interfaces which contain overloaded methods cannot be implemented by all COM clients.")] [Solution ("Rename the overloaded methods so the names are unique, change visiblity of the interface to internal, or change the ComVisibleAttribute value to false.")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1402:AvoidOverloadsInComVisibleInterfaces")] public class AvoidOverloadsInComVisibleInterfacesRule : Rule, ITypeRule { private HashSet methods; public AvoidOverloadsInComVisibleInterfacesRule() { methods = new HashSet (); } public RuleResult CheckType(TypeDefinition type) { // This rule only applies to public interfaces with methods and explicit ComVisible. if (!type.IsInterface || !type.IsPublic || !type.HasMethods) return RuleResult.DoesNotApply; if (!type.IsTypeComVisible ()) return RuleResult.DoesNotApply; methods.Clear (); foreach (MethodDefinition method in type.Methods) { var name = method.Name; if (methods.Contains (name) && (method.IsComVisible () ?? true)) Runner.Report (method, Severity.Critical, Confidence.Total); else methods.Add (name); } return Runner.CurrentRuleResult; } } } AutoLayoutTypesShouldNotBeComVisibleRule.cs0000664000175000017500000000656512413742070037632 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // AutoLayoutTypesShouldNotBeComVisibleRule.cs // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// This rule checks for [System.Runtime.InteropServices.ComVisible] decorated value /// types which have [System.Runtime.InteropServices.StructLayout] attribute set to /// System.Runtime.InteropServices.LayoutKind.Auto because auto layout can /// change between Mono and .NET or even between releases of the .NET/Mono frameworks. /// Note that this does not affect System.Enum-based types. /// /// /// Bad example: /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// [StructLayout (LayoutKind.Auto)] /// public struct Good { /// ushort a; /// ushort b; /// } /// } /// /// /// /// Good example /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// [StructLayout (LayoutKind.Sequential)] /// public struct Good { /// ushort a; /// ushort b; /// } /// } /// /// /// /// Rule applies only when the containing assembly has ComVisible attribute explicitly set to false /// and the type has ComVisible attribute explicitly set to true. /// [Problem ("Value types with StructLayout attribute set to LayoutKind.Auto should not be COM visible")] [Solution ("Change StructLayout attribute for this type or make it invisible for COM")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1403:AutoLayoutTypesShouldNotBeComVisible")] public class AutoLayoutTypesShouldNotBeComVisibleRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || !type.IsValueType || !type.HasCustomAttributes || (!type.IsPublic && !type.IsNestedPublic) || type.HasGenericParameters) return RuleResult.DoesNotApply; if (!type.IsTypeComVisible ()) return RuleResult.DoesNotApply; if (type.IsAutoLayout) Runner.Report (type, Severity.High, Confidence.High); return Runner.CurrentRuleResult; } } } ComVisibleShouldInheritFromComVisibleRule.cs0000664000175000017500000000675612413742070037754 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // ComVisibleShouldInheritFromComVisibleRule.cs // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// This rule checks that the base type of COM visible types is also /// visible from COM. This is needed reduce the chance of breaking /// COM clients as COM invisible types do not have to follow COM versioning rules. /// /// /// Bad example: /// /// [assemply: ComVisible(false)] /// namespace InteropLibrary { /// [ComVisible (false)] /// public class Base { /// } /// /// [ComVisible (true)] /// public class Derived : Base { /// } /// } /// /// /// /// Good example: /// /// [assemply: ComVisible(false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// public class Base { /// } /// /// [ComVisible (true)] /// public class Derived : Base { /// } /// } /// /// /// /// Good example (both types are invisible because of the assembly attribute): /// /// [assemply: ComVisible(false)] /// namespace InteropLibrary { /// public class Base { /// } /// /// public class Derived : Base { /// } /// } /// /// [Problem ("COM visible class is derived from COM invisible class")] [Solution ("Make derived type invisible from COM or make base type visible")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1405:ComVisibleTypeBaseTypesShouldBeComVisible")] public class ComVisibleShouldInheritFromComVisibleRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.BaseType == null) return RuleResult.DoesNotApply; // Checks whether specific type is COM visible or not // considering nested types, assemblies attributes and default values if (!type.IsTypeComVisible ()) return RuleResult.DoesNotApply; TypeDefinition baseType = type.BaseType.Resolve (); if ((baseType != null) && !baseType.IsTypeComVisible ()) { string msg = String.Format (CultureInfo.InvariantCulture, "Type is derived from invisible from COM type {0}", baseType.GetFullName ()); Runner.Report (type, Severity.High, Confidence.Total, msg); } return Runner.CurrentRuleResult; } } } AvoidInt64ArgumentsInComVisibleMethodsRule.cs0000664000175000017500000000724712413742070037756 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // AvoidInt64ArgumentsInComVisibleMethodsRule.cs // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// This rule checks that ComVisible methods do not take System.Int64 arguments /// because Visual Basic 6 clients do not support it. /// /// /// Bad example: /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// public class Bad { /// public void DoBadThings (long a) /// { /// // doing bad things /// } /// } /// } /// /// /// /// Good example (type changed): /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// public class Good { /// public void DoGoodThings (int a) /// { /// // doing good things /// } /// } /// } /// /// /// /// Good example (method is not visible from COM): /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// public class Good { /// [ComVisible (false)] /// public void DoGoodThings (long a) /// { /// // doing good things /// } /// } /// } /// /// /// /// Rule applies only when the containing assembly has ComVisible attribute explicitly set to false /// and the type has ComVisible attribute explicitly set to true. /// [Problem ("ComVisible method takes Int64 argument which is not usable from VB6 clients")] [Solution ("Change argument type (e.g. to the System.Int32 or System.Decimal), or mark the method with [ComVisible (false)]")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1406:AvoidInt64ArgumentsForVB6Clients")] public class AvoidInt64ArgumentsInComVisibleMethodsRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasParameters) return RuleResult.DoesNotApply; // check that class is explicitly ComVisible, assembly is explicitly not ComVisible // and method does not have [ComVisible (false)] if (!method.DeclaringType.IsTypeComVisible () || !(method.IsComVisible () ?? true)) return RuleResult.DoesNotApply; foreach (ParameterDefinition parameter in method.Parameters) { if (parameter.ParameterType.IsNamed ("System", "Int64")) Runner.Report (parameter, Severity.Medium, Confidence.Total); } return Runner.CurrentRuleResult; } } } AvoidNonPublicFieldsInComVisibleValueTypesRule.cs0000664000175000017500000000620212413742070040670 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // Gendarme.Rules.Interoperability.Com.AvoidNonPublicFieldsInComVisibleValueTypesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// This rule checks for ComVisible value types which contain fields that are non-public. /// /// /// Bad example: /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// public struct BadStruct { /// internal int SomeValue; /// } /// } /// /// /// /// Good example: /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// public struct BadStruct { /// public int SomeValue; /// } /// } /// /// [Problem ("ComVisible value types which contain non-public fields will have such fields exposed to COM clients.")] [Solution ("Review fields for sensitive information, and either make the type a reference type, or remove the ComVisibleAttribute from the type")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1413:AvoidNonpublicFieldsInComVisibleValueTypes")] public class AvoidNonPublicFieldsInComVisibleValueTypesRule : Rule, ITypeRule { private const string ComVisible = "System.Runtime.InteropServices.ComVisibleAttribute"; public RuleResult CheckType (TypeDefinition type) { // Only check for value types and types with fields. // But also for types with attributes, since FXCop only issues a warning if ComVisible is explicitly defined. if (!type.IsValueType || !type.HasCustomAttributes || !type.HasFields) return RuleResult.DoesNotApply; if (!type.IsTypeComVisible ()) return RuleResult.DoesNotApply; // If we find any, low severity as the code works, but it's bad practice. foreach (FieldDefinition field in type.Fields) if (!field.IsPublic) Runner.Report (field, Severity.Low, Confidence.Total); return Runner.CurrentRuleResult; } } } AvoidStaticMembersInComVisibleTypesRule.cs0000664000175000017500000001043312413742070037416 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // Gendarme.Rules.Interoperability.Com.AvoidStaticMembersInComVisibleTypesRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// COM visible types should not contain static methods because they are /// not supported by COM /// /// /// Bad example: /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// public class Bad { /// public static void BadMethod () /// { /// // do something /// } /// } /// } /// /// /// /// Good example: /// /// [assembly: ComVisible (false)] /// namespace InteropLibrary { /// [ComVisible (true)] /// public class Good { /// [ComVisiblte (false)] /// public static void GoodMethod () /// { /// // do something /// } /// } /// } /// /// /// /// This rule ignores methods marked with ComRegisterFunctionAttribute or ComUnregisterFunctionAttribute attributes. /// Rule applies only when the containing assembly has ComVisible attribute explicitly set to false /// and the type has ComVisible attribute explicitly set to true. [Problem ("Static method is visible to COM, while COM does not support statics.")] [Solution ("Add [ComVisible (false)] attribute to the method, or make static method an instance method.")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1407:AvoidStaticMembersInComVisibleTypes")] public class AvoidStaticMembersInComVisibleTypesRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!IsApplicableMethod (method)) return RuleResult.DoesNotApply; // check if assembly has [ComVisible (false)] // and type has [ComVisible (true)] if (!method.DeclaringType.IsTypeComVisible ()) return RuleResult.DoesNotApply; bool comVisibleValue = true; if (method.HasCustomAttributes) { foreach (CustomAttribute attribute in method.CustomAttributes) { TypeReference type = attribute.AttributeType; if (type.Namespace != "System.Runtime.InteropServices") continue; switch (type.Name) { case "ComUnregisterFunctionAttribute": case "ComRegisterFunctionAttribute": return RuleResult.DoesNotApply; case "ComVisibleAttribute": comVisibleValue = (bool)attribute.ConstructorArguments [0].Value; break; } } } if (comVisibleValue) Runner.Report (method, Severity.Medium, Confidence.High); return Runner.CurrentRuleResult; } private static bool IsApplicableMethod (MethodDefinition method) { return !(!method.IsStatic || !method.IsPublic || method.HasGenericParameters || method.IsAddOn || method.IsRemoveOn || method.IsGetter || method.IsSetter || ((method.Attributes & MethodAttributes.SpecialName) != 0 && method.Name.StartsWith ("op_", StringComparison.Ordinal)) || method.DeclaringType.HasGenericParameters || method.DeclaringType.IsEnum || method.DeclaringType.IsInterface); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Makefile.in0000664000175000017500000006660012642235731031361 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Interoperability.Com ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AutoLayoutTypesShouldNotBeComVisibleRule.cs \ AvoidInt64ArgumentsInComVisibleMethodsRule.cs \ AvoidNonPublicFieldsInComVisibleValueTypesRule.cs \ AvoidOverloadsInComVisibleInterfacesRule.cs \ AvoidStaticMembersInComVisibleTypesRule.cs \ ComVisibleShouldInheritFromComVisibleRule.cs \ ComVisibleTypesShouldBeCreatableRule.cs \ DoNotUseAutoDualClassInterfaceTypeRule.cs \ MarkComSourceInterfacesAsIDispatchRule.cs \ ReviewComRegistrationMethodsRule.cs \ ComRocks.cs tests_sources = \ AutoLayoutTypesShouldNotBeComVisibleTest.cs \ AvoidInt64ArgumentsInComVisibleMethodsTest.cs \ AvoidNonPublicFieldsInComVisibleValueTypesTest.cs \ AvoidOverloadsInComVisibleInterfacesTest.cs \ AvoidStaticMembersInComVisibleTypesTest.cs \ ComVisibleShouldInheritFromComVisibleTest.cs \ ComVisibleTypesShouldBeCreatableTest.cs \ DoNotUseAutoDualClassInterfaceTypeTest.cs \ MarkComSourceInterfacesAsIDispatchTest.cs \ ReviewComRegistrationMethodsTest.cs \ ComRocksTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Interoperability.Com/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Interoperability.Com/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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: ReviewComRegistrationMethodsRule.cs0000664000175000017500000001126712413742070036225 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // Gendarme.Rules.Interoperability.Com.ReviewComRegistrationMethodsRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// This rule checks the correctness of COM register and unregister methods, /// i.e. they should not be externally visible and they should be matched /// (both or none of them should exist ). /// /// /// Bad example (public methods): /// /// [ComVisible (true) /// class Bad { /// [ComRegisterFunction] /// public void Register () /// { /// } /// /// [ComUnregisterFunction] /// public void Unregister () /// { /// } /// } /// /// /// /// Bad example (only one of the methods exist) /// /// [ComVisible (true)] /// class Bad { /// [ComRegisterFunction] /// public void Register () /// { /// } /// } /// /// /// /// Good example: /// /// [ComVisible (true)] /// class Good { /// [ComRegisterFunction] /// private void Register () /// { /// } /// /// [ComUnregisterFunction] /// private void Unregister () /// { /// } /// } /// /// [Problem ("COM registration methods should be matched (i.e. both or none of them should exist) and should not be externally visible.")] [Solution ("Add a missing method or change methods visibility to private or internal.")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1410:ComRegistrationMethodsShouldBeMatched")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1411:ComRegistrationMethodsShouldNotBeVisible")] public class ReviewComRegistrationMethodsRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.HasGenericParameters || !type.IsVisible () || !type.IsTypeComVisible ()) return RuleResult.DoesNotApply; bool foundRegister = false; // type level variables bool foundUnregister = false; foreach (MethodDefinition method in type.Methods) { if (!method.HasCustomAttributes) continue; bool foundRegisterUnregisterMethod = false; // method level variable foreach (CustomAttribute attribute in method.CustomAttributes) { TypeReference atype = attribute.AttributeType; if (!foundRegister && atype.IsNamed ("System.Runtime.InteropServices", "ComRegisterFunctionAttribute")) { foundRegister = true; foundRegisterUnregisterMethod = true; } if (!foundUnregister && atype.IsNamed ("System.Runtime.InteropServices", "ComUnregisterFunctionAttribute")) { foundUnregister = true; foundRegisterUnregisterMethod = true; } } if (foundRegisterUnregisterMethod && method.IsVisible ()) { Runner.Report (method, Severity.High, Confidence.High, "Method is marked with the ComRegisterFunctionAttribute or with the ComUnregisterFunctionAttribute and is externally visible"); } } if (foundRegister ^ foundUnregister) { // only one of them is true if (foundRegister) Runner.Report (type, Severity.High, Confidence.High, "Type contains has a method with ComRegisterFunctionAttribute but it doesn't contain a method with ComUnregisterFunctionAttribute"); if (foundUnregister) Runner.Report (type, Severity.High, Confidence.High, "Type contains has a method with ComUnregisterFunctionAttribute but it doesn't contain a method with ComRegisterFunctionAttribute"); } return Runner.CurrentRuleResult; } } } ComVisibleTypesShouldBeCreatableRule.cs0000664000175000017500000000631212413742070036713 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // Gendarme.Rules.Interoperability.Com.ComVisibleTypesShouldBeCreatableRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// This rule checks for ComVisible reference types which have a public parameterized constructor, /// but lack a default public constructor. /// /// /// Bad example: /// /// [ComVisible (true)] /// public class BadClass { /// public BadClass (int param) { /// /// } /// } /// /// /// /// Good example: /// /// [ComVisible (true)] /// public class GoodClass { /// public GoodClass () { /// /// } /// public GoodClass (int param) { /// /// } /// } /// /// [Problem ("ComVisible reference types should declare a default public constructor.")] [Solution ("Either add a default public constructor, or remove the ComVisibleAttribute from the type.")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1409:ComVisibleTypesShouldBeCreatable")] public class ComVisibleTypesShouldBeCreatableRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // Check only for reference types with attributes. if (!type.IsClass || type.IsValueType || !type.HasCustomAttributes) return RuleResult.DoesNotApply; // Ensure class is explicitly ComVisible. if (!type.IsTypeComVisible ()) return RuleResult.DoesNotApply; // Report success if a default public constructor is found or no parameterized constructor is found. bool hasParameterizedCtor = false; bool hasDefaultCtor = false; foreach (var ctor in type.Methods) { if (!ctor.IsConstructor) continue; if (ctor.IsPublic && ctor.HasParameters) { hasParameterizedCtor = true; continue; } if (ctor.IsPublic) hasDefaultCtor = true; } if (!hasParameterizedCtor || hasDefaultCtor) return RuleResult.Success; Runner.Report (type, Severity.Medium, Confidence.Total); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/ComRocks.cs0000664000175000017500000000652612413742070031357 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Interoperability.Com.ComRocks // // Authors: // N Lum // Yuri Stuken // Sebastien Pouliot // // Copyright (C) 2010 N Lum // Copyright (C) 2010 Yuri Stuken // 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 Mono.Cecil; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// ComRocks contains extensions methods for COM-related methods. /// public static class ComRocks { /// /// Check if the type is explicitly declared to be ComVisible. /// /// The ICustomAttributeProvider (e.g. AssemblyDefinition, TypeReference, MethodReference, /// FieldReference...) on which the extension method can be called. /// null no ComVisible attribute is present, true if ComVisible is set to true, false otherwise. public static bool? IsComVisible (this ICustomAttributeProvider self) { if (self == null) return null; if (self.HasCustomAttributes) { foreach (CustomAttribute attribute in self.CustomAttributes) { // ComVisibleAttribute has a single ctor taking a boolean value // http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.comvisibleattribute.comvisibleattribute.aspx // any attribute without arguments can be skipped if (!attribute.HasConstructorArguments) continue; if (!attribute.Constructor.DeclaringType.IsNamed ("System.Runtime.InteropServices", "ComVisibleAttribute")) continue; return (bool) attribute.ConstructorArguments[0].Value; } } // special case for types, check if this is a nested type inside a [ComVisible] type TypeDefinition type = (self as TypeDefinition); if (type == null) return null; return type.DeclaringType.IsComVisible (); } // Checks whether specific type is COM visible or not // considering nested types, assemblies attributes and default values public static bool IsTypeComVisible (this TypeDefinition self) { // [ComVisible] attribute will be ignored on non-visible types if (!self.IsVisible ()) return false; return (self.IsComVisible () ?? self.Module.Assembly.IsComVisible () ?? true); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/0000775000175000017500000000000012642235742030225 5ustar00directhexdirecthex00000000000000MarkComSourceInterfacesAsIDispatchTest.cs0000664000175000017500000001027512413742070040126 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // Test.Rules.Interoperability.Com.MarkComSourceInterfacesAsIDispatchTest // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Interoperability.Com { [InterfaceType (ComInterfaceType.InterfaceIsIDispatch)] public interface IInterfaceIsIDispatch { } [InterfaceType (ComInterfaceType.InterfaceIsDual)] public interface IInterfaceIsDual { } [InterfaceType (2)] public interface IInterfaceIsIDispatchShort { } [InterfaceType (1)] public interface IInterfaceIsIUnknownShort { } [InterfaceType ((short) 0)] public interface IInterfaceIsDualShort { } public interface IBlankInterface { } [ComSourceInterfaces ("Test.Rules.Interoperability.Com.IInterfaceIsIDispatch")] public class GoodStringOverloadClass { } [ComSourceInterfaces (typeof (IInterfaceIsIDispatch))] public class GoodTypeOverloadClass { } [ComSourceInterfaces ("Test.Rules.Interoperability.Com.IInterfaceIsIDispatchShort")] public class GoodStringOverloadShortClass { } [ComSourceInterfaces (typeof (IInterfaceIsIDispatchShort))] public class GoodTypeOverloadShortClass { } [ComSourceInterfaces (typeof (IInterfaceIsDual))] public class BadWrongTypeClass { } [ComSourceInterfaces (typeof (IBlankInterface))] public class BadNoTypeClass { } [ComSourceInterfaces (typeof (IInterfaceIsDual), typeof(IBlankInterface))] public class BadTwoInterfacesClass { } [ComSourceInterfaces (typeof (IInterfaceIsDualShort))] public class BadWrongTypeShortClass { } [ComSourceInterfaces (typeof (IInterfaceIsIUnknownShort), typeof (IBlankInterface))] public class BadTwoInterfacesShortClass { } [TestFixture] public class MarkComSourceInterfacesAsIDispatchTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // No ComSourceInterfaces attribute. AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (SimpleTypes.Structure); // Applies only to types. AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void GoodShort () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { // The specified interface is marked with the wrong ComInterfaceType AssertRuleFailure (1); // The specified interface isn't marked with an InterfaceTypeAttribute. AssertRuleFailure (1); // Both of the above AssertRuleFailure (2); } [Test] public void BadShort () { // variants using the 'short' based attribute AssertRuleFailure (1); AssertRuleFailure (2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/ComRocksTest.cs0000664000175000017500000000376212413742070033135 0ustar00directhexdirecthex00000000000000// // Unit tests for CustomAttributeRocks // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Rules.Interoperability.Com; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Helpers; namespace Test.Rules.Interoperability.Com { [System.Runtime.InteropServices.ComVisible (true)] public class ExplicitComVisibleClass { } [System.Runtime.InteropServices.ComVisible (false)] public class ExplicitComInvisibleClass { } [TestFixture] public class ComRocksTest { [Test] public void IsComVisible() { TypeDefinition type = DefinitionLoader.GetTypeDefinition (); Assert.IsTrue (type.IsComVisible () ?? false, "true"); type = SimpleTypes.Class; Assert.IsNull (type.IsComVisible (), "null"); type = DefinitionLoader.GetTypeDefinition (); Assert.IsFalse (type.IsComVisible () ?? true, "false"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/Makefile.in0000664000175000017500000003147512642235731032302 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Interoperability.Com/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Interoperability.Com.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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: AutoLayoutTypesShouldNotBeComVisibleTest.cs0000664000175000017500000000777312413742070040563 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // AutoLayoutTypesShouldNotBeComVisibleTest.cs // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; [assembly: ComVisible (false)] namespace Test.Rules.Interoperability.Com { [TestFixture] public class AutoLayoutTypesShouldNotBeComVisibleTest : TypeRuleTestFixture { [ComVisible (true)] [StructLayout (LayoutKind.Auto)] public struct Bad { ushort a; ushort b; } [ComVisible (true)] [StructLayout (LayoutKind.Explicit)] public struct GoodExplicit { [FieldOffset (0)] ushort a; [FieldOffset (2)] ushort b; } [ComVisible (true)] [StructLayout (LayoutKind.Sequential)] public struct GoodSequential { ushort a; ushort b; } [ComVisible (false)] [StructLayout (LayoutKind.Auto)] public struct DoesNotApplyComInvisible { ushort a; ushort b; } [StructLayout (LayoutKind.Auto)] public struct DoesNotApplyNoComVisibleAttribute { ushort a; ushort b; } [ComVisible (true)] [StructLayout (LayoutKind.Auto)] public class DoesNotApplyType { ushort a; ushort b; } [ComVisible (true)] [StructLayout (LayoutKind.Auto)] internal struct DoesNotApplyInternal { ushort a; ushort b; } [ComVisible (true)] [StructLayout (LayoutKind.Auto)] public struct DoesNotApplyGeneric { ushort a; ushort b; } [Test] public void GoodTest () { // public explicit layout struct with [ComVisible (true)] AssertRuleSuccess (); // public sequential layout struct with [ComVisible (true)] AssertRuleSuccess (); } [Test] public void BadTest () { // public auto layout struct with [ComVisible (true)] AssertRuleFailure (); } [Test] public void DoesNotApply () { // public auto layout struct with [ComVisible (false)] AssertRuleDoesNotApply (); // public auto layout class with [ComVisible (true)] AssertRuleDoesNotApply (); // public generic auto layout struct with [ComVisible (true)] AssertRuleDoesNotApply> (); // internal auto layout struct with [ComVisible (true)] AssertRuleDoesNotApply (); // public auto layout struct with no ComVisible attribute AssertRuleDoesNotApply (); // public struct with no attributes AssertRuleDoesNotApply (SimpleTypes.Structure); } [ComVisible (true)] public enum Enum { Zero = 0 } [Flags] [ComVisible (true)] public enum Flags { One = 1 } [Test] public void SpecialCases () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } } } ComVisibleShouldInheritFromComVisibleTest.cs0000664000175000017500000000526712413742070040677 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // ComVisibleShouldInheritFromComVisibleTest.cs // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Interoperability.Com { [TestFixture] public class ComVisibleShouldInheritFromComVisibleTest : TypeRuleTestFixture { [ComVisible (false)] public class ComInvisibleClass { } [ComVisible (true)] public class ComVisibleClass { } [ComVisible (true)] public class ComVisibleInheritsFromInvisibleClass : ComInvisibleClass { } [ComVisible (true)] class NotReallyComVisibleInheritsFromInvisibleClass : ComInvisibleClass { } [ComVisible (false)] public class ComInvisibleInheritsFromVisibleClass : ComVisibleClass { } [Test] public void Good () { AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (); } [Test] public void DoesNotApply () { // BaseType is null AssertRuleDoesNotApply (); // not visible / no ComVisible attributes in inheritance chain AssertRuleDoesNotApply (SimpleTypes.Class); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } } } ComVisibleTypesShouldBeCreatableTest.cs0000664000175000017500000000617412413742070037650 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // Unit Tests for ComVisibleTypesShouldBeCreatableRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Interoperability.Com { /** pass */ [ComVisible (true)] public class ComVisibleCtorsGood { public ComVisibleCtorsGood () { } public ComVisibleCtorsGood (int param) { } } [ComVisible (true)] public class PrivateCtor { private PrivateCtor (int param) { } } /** don't apply */ [ComVisible (true)] public struct ComVisibleValueType { public ComVisibleValueType (int param) { } } [ComVisible (false)] public class NotComVisible { public NotComVisible(int param) { } } /** fail */ [ComVisible (true)] public class ParameterizedCtorBad { public ParameterizedCtorBad (int param) { } } [TestFixture] public class ComVisibleTypesShouldBeCreatableTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // Value type with a parameterized constructor. AssertRuleDoesNotApply (); // Type with ComVisible set to false. AssertRuleDoesNotApply (); // ComVisible must be explicit. AssertRuleDoesNotApply (SimpleTypes.Class); // Rule only applies to classes. AssertRuleDoesNotApply (SimpleTypes.Structure); AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } [Test] public void Good () { // Type with explicit ComVisible, a default constructor, and a parameterized constructor. AssertRuleSuccess (); // Type with explicit ComVisible but no public constructors. AssertRuleSuccess (); } [Test] public void Bad () { // Type with explicit ComVisible and a public parameterized constructor. AssertRuleFailure (1); } } } AvoidNonPublicFieldsInComVisibleValueTypesTest.cs0000664000175000017500000000526712413742070041631 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // Unit Tests for AvoidNonpublicFieldsInComVisibleValueTypesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Interoperability.Com { /** Pass */ [ComVisible (true)] public struct ComVisibleGood { public int SomeValue; } /** Do not apply */ [ComVisible (true)] public struct ComVisibleTypeNoFields { } [ComVisible (false)] public struct NonComVisibleType { public int SomeValue; } public struct NoDefinedComVisible { public int SomeValue; } [ComVisible (true)] public class ComVisibleRefType { public int SomeValue; } /** Fail */ [ComVisible (true)] public struct ComVisibleBad { internal int SomeValue; } [TestFixture] public class AvoidNonPublicFieldsInComVisibleValueTypesTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { // Reference type. AssertRuleDoesNotApply (); // Type without ComVisible. AssertRuleDoesNotApply (); // Type with no fields. AssertRuleDoesNotApply (); // Type with ComVisible = false. AssertRuleDoesNotApply (); } [Test] public void Good () { // Type with explicit ComVisible and only public fields. AssertRuleSuccess (); } [Test] public void Bad () { // Type with explicit ComVisible and an internal field. AssertRuleFailure (1); } } } Tests.Rules.Interoperability.Com.csproj0000775000175000017500000001313512413742070037623 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test Debug AnyCPU 9.0.30729 2.0 {393FCDDA-6AAF-4DBA-BB75-6BD85DAC84EE} Library Properties Tests.Rules.Interoperability.Com Tests.Rules.Interoperability.Com v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {468F7043-C0D5-480F-88A1-A262EC324E5E} Gendarme.Rules.Interoperability.Com False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true AvoidStaticMembersInComVisibleTypesTest.cs0000664000175000017500000000770212413742070040352 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // Tests.Rules.Interoperability.Com.AvoidStaticMembersInComVisibleTypesTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Interoperability.Com { [TestFixture] public class AvoidStaticMembersInComVisibleTypesTest : MethodRuleTestFixture { [ComVisible (true)] public class ComVisibleClass { public static void Bad () { } [ComVisible (false)] public static void GoodInvisible () { } [ComVisible (true)] public static void BadExplicitly () { } private static void DoesNotApplyPrivate () { } public void DoesNotApplyInstance () { } [ComRegisterFunction] public static void DoesNotApplyRegister () { } [ComUnregisterFunction] public static void DoesNotApplyUnregister () { } public static void DoesNotApplyGeneric () { } public static event EventHandler DoesNotApplyEvent { add { DoesNotApplyEvent += value; } remove { DoesNotApplyEvent -= value; } } public static int DoesNotApplyProperty { get; set; } public static ComVisibleClass operator +(ComVisibleClass o1, ComVisibleClass o2) { return new ComVisibleClass(); } [ComVisible (true)] public delegate void DoesNotApplyDelegate (); } [ComVisible (false)] public class ComInvisibleClass { public static void DoesNotApply () { } } public class NoAttributesClass { public static void DoesNotApply () { } } [ComVisible (true)] public interface Interface { void DoesNotApply (); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("DoesNotApplyPrivate"); AssertRuleDoesNotApply ("DoesNotApplyInstance"); AssertRuleDoesNotApply ("DoesNotApplyRegister"); AssertRuleDoesNotApply ("DoesNotApplyUnregister"); AssertRuleDoesNotApply ("op_Addition"); AssertRuleDoesNotApply ("add_DoesNotApplyEvent"); AssertRuleDoesNotApply ("remove_DoesNotApplyEvent"); AssertRuleDoesNotApply ("get_DoesNotApplyProperty"); AssertRuleDoesNotApply ("set_DoesNotApplyProperty"); AssertRuleDoesNotApply ("Invoke"); AssertRuleDoesNotApply ("DoesNotApply"); AssertRuleDoesNotApply ("DoesNotApply"); } [Test] public void Good () { AssertRuleSuccess ("GoodInvisible"); } [Test] public void Bad () { AssertRuleFailure ("Bad"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/Makefile.am0000664000175000017500000000016712413742070032256 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Interoperability.Com.csproj DISTCLEANFILES = Makefile.in all: ReviewComRegistrationMethodsTest.cs0000664000175000017500000000676112413742070037157 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // Tests.Rules.Interoperability.Com.ReviewComRegistrationMethodsTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Interoperability.Com { [TestFixture] public class ReviewComRegistrationMethodsTest : TypeRuleTestFixture { [ComVisible(false)] public class ComInvisible { [ComRegisterFunction] public void Register () { } } [ComVisible (true)] private class ExternallyInvisible { [ComRegisterFunction] public void Register () { } } [ComVisible (true)] public class GoodCase { [ComRegisterFunction] private void Register () { } [ComUnregisterFunction] internal void Unregister () { } } [ComVisible (true)] public class BadVisibleRegistrators { [ComRegisterFunction] public void Register () { } [ComUnregisterFunction] public void Unregister () { } } [ComVisible (true)] public class BadOnlyUnregister { [ComUnregisterFunction] private void Unregister () { } } [ComVisible (true)] public class BadOnlyPublicUnregister { [ComUnregisterFunction] public void Unregister () { } } [ComVisible (true)] public class BadOnlyRegister { [ComRegisterFunction] private void Register () { } } [ComVisible (true)] public class BadOnlyPublicRegister { [ComRegisterFunction] public void Register () { } } [ComVisible (true)] public class BadPublicRegisterPrivateUnregister { [ComRegisterFunction] public void Register () { } [ComUnregisterFunction] private void Unregister () { } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } [Test] public void Good () { AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (2); AssertRuleFailure (1); AssertRuleFailure (2); AssertRuleFailure (1); AssertRuleFailure (2); AssertRuleFailure (1); } } } AvoidInt64ArgumentsInComVisibleMethodsTest.cs0000664000175000017500000000577112413742070040705 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // AvoidInt64ArgumentsInComVisibleMethodsTest.cs // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Interoperability.Com { [TestFixture] public class AvoidInt64ArgumentsInComVisibleMethodsTest : MethodRuleTestFixture { [ComVisible (true)] public class ComVisibleClass { public void BadMethod (string a, long b) { return; } public void BadMethodWithTwoBadArgs (long a, string b, long c) { return; } public void GoodMethod (string a, int b) { return; } [ComVisible (false)] public void InvisibleMethod (string a, long b) { return; } } [ComVisible (false)] public class ComInvisibleClass { public void MethodWithInt64 (string a, long b) { } public void MethodWithInt32 (string a, int b) { } } public class ClassWithoutAttributes { public void MethodWithInt64 (string a, long b) { } public void MethodWithInt32 (string a, int b) { } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("InvisibleMethod"); AssertRuleDoesNotApply ("MethodWithInt64"); AssertRuleDoesNotApply ("MethodWithInt32"); AssertRuleDoesNotApply ("MethodWithInt64"); AssertRuleDoesNotApply ("MethodWithInt32"); } [Test] public void Good () { AssertRuleSuccess ("GoodMethod"); } [Test] public void Bad () { AssertRuleFailure ("BadMethod", 1); AssertRuleFailure ("BadMethodWithTwoBadArgs", 2); } } } DoNotUseAutoDualClassInterfaceTypeTest.cs0000664000175000017500000000552112413742070040141 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // Test.Rules.Interoperability.Com.DoNotUseAutoDualClassInterfaceTypeTest // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Runtime.InteropServices; using Mono.Cecil; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; using Test.Rules.Definitions; namespace Test.Rules.Interoperability.Com { [TestFixture] public class DoNotUseAutoDualClassInterfaceTypeTest : TypeRuleTestFixture { [ComVisible (true)] [ClassInterface (ClassInterfaceType.AutoDual)] public class BadClass { // do something } [ComVisible (true)] [ClassInterface (2)] public class BadClassShortConstuctor { // do something } [ComVisible (false)] [ClassInterface (ClassInterfaceType.AutoDual)] public class DoesNotApplyInvisible { // do something } [ComVisible (true)] public class GoodNoInterfaceAttribute { // do something } [ComVisible (true)] [ClassInterface (ClassInterfaceType.None)] public class GoodClassNone : ICloneable { public object Clone () { return new object (); } } [ComVisible (true)] [ClassInterface ((short)0)] public class GoodClassNoneShortConstructor : ICloneable { public object Clone () { return new object (); } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (); } [Test] public void Good () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void Bad () { AssertRuleFailure (); AssertRuleFailure (); } } } AvoidOverloadsInComVisibleInterfacesTest.cs0000664000175000017500000000700612413742070040522 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test// // Unit Tests for AvoidOverloadsInComVisibleInterfacesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using Gendarme.Rules.Interoperability.Com; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Interoperability.Com { /** pass */ [ComVisible (true)] public interface ComVisibleInterfaceGood { void SomeMethod(int Value); void SomeMethodWithValues(int ValueOne, int ValueTwo); } [ComVisible (true)] public interface ComVisibleInterfaceGood2 { void SomeMethod(int Value); [ComVisible (false)] void SomeMethod(int ValueOne, int ValueTwo); } /** does not apply */ [ComVisible (false)] public interface NonComVisibleInterface { void SomeMethod(); void SomeMethod(int IAmOverloaded); } [ComVisible (true)] public interface ComVisibleInterfaceNoMethods { } [ComVisible (true)] internal interface ComVisibleInterfaceInternal { void SomeMethod(int Value); void SomeMethod(int ValueOne, int ValueTwo); } /** fail */ [ComVisible (true)] public interface ComVisibleInterfaceBad { void SomeMethod(int Value); void SomeMethod(int ValueOne, int ValueTwo); } [ComVisible (true)] public interface ComVisibleInterfaceBad2 { void SomeMethod(int Value); void SomeMethod(int ValueOne, int ValueTwo); void SomeMethod(int ValueOne, int ValueTwo, int ValueThree); void SomeMethodOther(int Value); void SomeMethodOther(int ValueOne, int ValueTwo); } [TestFixture] public class AvoidOverloadsInComVisibleInterfacesTest : TypeRuleTestFixture { [Test] public void DoesNotApply() { // Interface with no methods. AssertRuleDoesNotApply (); // Internal interface. AssertRuleDoesNotApply (); // Non-interface. AssertRuleDoesNotApply (); // Non ComVisible interface. AssertRuleDoesNotApply (); } [Test] public void Good() { // ComVisible interface with no method overloading. AssertRuleSuccess (); // ComVisible interface with non-ComVisible overload AssertRuleSuccess (); } [Test] public void Bad() { // ComVisible interface with overloaded methods. AssertRuleFailure (1); // ComVisible interface with many overloaded methods. AssertRuleFailure (3); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com/Makefile.am0000664000175000017500000000177112413742070031341 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AutoLayoutTypesShouldNotBeComVisibleRule.cs \ AvoidInt64ArgumentsInComVisibleMethodsRule.cs \ AvoidNonPublicFieldsInComVisibleValueTypesRule.cs \ AvoidOverloadsInComVisibleInterfacesRule.cs \ AvoidStaticMembersInComVisibleTypesRule.cs \ ComVisibleShouldInheritFromComVisibleRule.cs \ ComVisibleTypesShouldBeCreatableRule.cs \ DoNotUseAutoDualClassInterfaceTypeRule.cs \ MarkComSourceInterfacesAsIDispatchRule.cs \ ReviewComRegistrationMethodsRule.cs \ ComRocks.cs tests_sources = \ AutoLayoutTypesShouldNotBeComVisibleTest.cs \ AvoidInt64ArgumentsInComVisibleMethodsTest.cs \ AvoidNonPublicFieldsInComVisibleValueTypesTest.cs \ AvoidOverloadsInComVisibleInterfacesTest.cs \ AvoidStaticMembersInComVisibleTypesTest.cs \ ComVisibleShouldInheritFromComVisibleTest.cs \ ComVisibleTypesShouldBeCreatableTest.cs \ DoNotUseAutoDualClassInterfaceTypeTest.cs \ MarkComSourceInterfacesAsIDispatchTest.cs \ ReviewComRegistrationMethodsTest.cs \ ComRocksTest.cs Gendarme.Rules.Interoperability.Com.csproj0000775000175000017500000001237712413742070037333 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com Debug AnyCPU 9.0.30729 2.0 {468F7043-C0D5-480F-88A1-A262EC324E5E} Library Properties Gendarme.Rules.Interoperability.Com Gendarme.Rules.Interoperability.Com v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Interoperability.Com.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 ..\..\console\bin\Release\Gendarme.Rules.Interoperability.Com.xml AllRules.ruleset 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework AssemblyStaticInfo.cs False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true DoNotUseAutoDualClassInterfaceTypeRule.cs0000664000175000017500000001072712413742070037216 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // Gendarme.Rules.Interoperability.Com.DoNotUseAutoDualClassInterfaceTypeRule // // Authors: // Yuri Stuken // // Copyright (C) 2010 Yuri Stuken // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// Classes should not use ClassInterfaceAttribute with the value of /// ClassInterfaceType.AutoDual because this may break COM clients /// if the class layout changes. /// /// /// Bad example: /// /// [ComVisible (true)] /// [ClassInterface (ClassInterfaceType.AutoDual)] /// class Bad { /// // do something /// } /// /// /// /// Good example (ClassInterfaceType.None): /// /// [ComVisible (true)] /// [ClassInterface (ClassInterfaceType.None)] /// class Good : ICloneable { /// public object Clone () /// { /// return new object (); /// } /// } /// /// /// /// Good example (no ClassInterface attribute, equal to ClassInterfaceType.AutoDispatch): /// /// [ComVisible (true)] /// class Good { /// // do something /// } /// /// [Problem ("Visible to COM class uses ClassInterface attribute with ClassInterfaceType.AutoDual, which may break COM clients if the class layout is chaged.")] [Solution ("Change the value of the ClassInterfaceAttribute to the AutoDispatch (default value) or None (and explicitly define an interface in this case).")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1408:DoNotUseAutoDualClassInterfaceType")] public class DoNotUseAutoDualClassInterfaceTypeRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (!type.IsTypeComVisible ()) return RuleResult.DoesNotApply; ClassInterfaceType? attributeValue = GetClassInterfaceAttributeValue (type); bool fromAssembly = false; // attribute not found on class, try assembly instead if (attributeValue == null) { attributeValue = GetClassInterfaceAttributeValue (type.Module.Assembly); fromAssembly = true; } // not found on assembly as well, set default value if (attributeValue == null) attributeValue = ClassInterfaceType.AutoDispatch; if (attributeValue == ClassInterfaceType.AutoDual) { if (fromAssembly) Runner.Report (type, Severity.High, Confidence.High, "Attribute was set on assembly level"); else Runner.Report (type, Severity.High, Confidence.High); return RuleResult.Failure; } else return RuleResult.Success; } private static ClassInterfaceType? GetClassInterfaceAttributeValue (ICustomAttributeProvider obj) { foreach (CustomAttribute attribute in obj.CustomAttributes) { // http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.classinterfaceattribute.aspx // any attribute without arguments can be skipped if (!attribute.HasConstructorArguments) continue; if (!attribute.AttributeType.IsNamed ("System.Runtime.InteropServices", "ClassInterfaceAttribute")) continue; var ctorArgs = attribute.ConstructorArguments; if (ctorArgs [0].Type.IsNamed ("System", "Int16")) return (ClassInterfaceType)(short)ctorArgs [0].Value; return (ClassInterfaceType)(int)ctorArgs [0].Value; } return null; } } } MarkComSourceInterfacesAsIDispatchRule.cs0000664000175000017500000001316212413742070037175 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Interoperability.Com// // Gendarme.Rules.Interoperability.Com.MarkComSourceInterfacesAsIDispatchRule // // Authors: // Nicholas Rioux // // Copyright (C) 2010 Nicholas Rioux // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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.Runtime.InteropServices; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Interoperability.Com { /// /// When a type is marked with the ComSourceInterfacesAttribute, every specified interface must /// be marked with a InterfaceTypeAttribute set to ComInterfaceType.InterfaceIsIDispatch. /// /// /// Bad example: /// /// interface IBadInterface { } /// [ComSourceInterfaces("Project.IBadInterface")] /// class TestClass { } /// /// /// /// Good example: /// /// [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] /// interface IGoodInterface { } /// [ComSourceInterfaces("Project.IGoodInterface")] /// class TestClass { } /// /// [Problem ("A type is marked with ComSourceInterfacesAttribute, but a specified interface is not marked with InterfaceTypeAttribute set to InterfaceIsIDispatch.")] [Solution ("Add an InterfaceTypeAttribute set to InterfaceIsIDispatch for all specified interfaces.")] [FxCopCompatibility ("Microsoft.Interoperability", "CA1412:MarkComSourceInterfacesAsIDispatch")] public class MarkComSourceInterfacesAsIDispatchRule : Rule, ITypeRule { private SortedDictionary interfaces = new SortedDictionary (); // Iterate through all assemblies and add the interfaces found to a list. private void FindInterfaces () { foreach (AssemblyDefinition assembly in Runner.Assemblies) { foreach (ModuleDefinition module in assembly.Modules) { foreach (TypeDefinition type in module.GetAllTypes ()) { if (!type.IsInterface) continue; interfaces.Add (type.GetFullName (), type); } } } } // Finds a CustomAttribute on a type from the given name. private static CustomAttribute FindCustomAttribute (ICustomAttributeProvider type, string nameSpace, string name) { foreach (var attribute in type.CustomAttributes) { if (attribute.AttributeType.IsNamed (nameSpace, name)) return attribute; } return null; } // Ensures the interface has a InterfaceTypeAttribute with // ComInterfaceType.InterfaceIsIDispatch passed to it. private void CheckInterface (TypeDefinition def) { if (def == null) return; if (!def.HasCustomAttributes) { Runner.Report (def, Severity.High, Confidence.Total, "No attributes are present on a specified interface"); return; } var attribute = FindCustomAttribute (def, "System.Runtime.InteropServices", "InterfaceTypeAttribute"); if (attribute == null) { Runner.Report (def, Severity.High, Confidence.Total, "No [InterfaceType] attribute is present on a specified interface"); return; } // default to bad value - anything not InterfaceIsIDispatch (2) will be reported // ToString covers both the ComInterfaceType (int) and short ctor variations if (attribute.ConstructorArguments [0].Value.ToString () != "2") Runner.Report (def, Severity.High, Confidence.Total, "The [InterfaceType] attribute is not set to InterfaceIsIDispatch"); } private void CheckInterface (string interface_name) { TypeDefinition td; if (interfaces.TryGetValue (interface_name, out td)) CheckInterface (td); } public override void Initialize (IRunner runner) { base.Initialize (runner); interfaces.Clear (); FindInterfaces (); } public RuleResult CheckType (TypeDefinition type) { if (!type.IsClass || !type.HasCustomAttributes) return RuleResult.DoesNotApply; var attribute = FindCustomAttribute (type, "System.Runtime.InteropServices", "ComSourceInterfacesAttribute"); if (attribute == null) return RuleResult.DoesNotApply; // The attribute's paramemters may be a single null-delimited string, or up to four System.Types. foreach (var arg in attribute.ConstructorArguments) { string string_value = arg.Value as string; if (string_value != null) { if (string_value.IndexOf ('\0') == -1) CheckInterface (string_value); else { foreach (var name in string_value.Split ('\0')) CheckInterface (name); } } else { TypeDefinition def_value = arg.Value as TypeDefinition; if (def_value != null) CheckInterface (def_value); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Makefile.am0000664000175000017500000000245312413742070022463 0ustar00directhexdirecthex00000000000000RULEDIRS= Gendarme.Rules.BadPractice \ Gendarme.Rules.Concurrency \ Gendarme.Rules.Correctness \ Gendarme.Rules.Design \ Gendarme.Rules.Design.Generic \ Gendarme.Rules.Design.Linq \ Gendarme.Rules.Exceptions \ Gendarme.Rules.Globalization \ Gendarme.Rules.Gendarme \ Gendarme.Rules.Interoperability \ Gendarme.Rules.Interoperability.Com \ Gendarme.Rules.Maintainability \ Gendarme.Rules.Naming \ Gendarme.Rules.NUnit \ Gendarme.Rules.Performance \ Gendarme.Rules.Portability \ Gendarme.Rules.Security \ Gendarme.Rules.Security.Cas \ Gendarme.Rules.Serialization \ Gendarme.Rules.Smells \ Gendarme.Rules.Ui TESTDIRS = Test.Rules SUBDIRS = $(TESTDIRS) $(RULEDIRS) EXTRA_DIST = rules.xml common.make DISTCLEANFILES = Makefile.in install-data-hook: $(INSTALL) -c -m 0644 $(addprefix $(srcdir)/, rules.xml) $(DESTDIR)$(prefix)/lib/gendarme; uninstall-hook: rm -f $(DESTDIR)$(prefix)/lib/gendarme/`basename rules.xml`; rules: for ASM in $(RULEDIRS); do \ cd $$ASM; \ make rule; \ cd ..; \ done; test: list='$(SUBDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) test) ; \ done; run-test: list='$(TESTDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) test) ; \ done; list='$(RULEDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) run-test) ; \ done; mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/0000775000175000017500000000000012642235743024504 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/ChangeLog0000664000175000017500000005660212413742070026257 0ustar00directhexdirecthex000000000000002010-06-20 Sebastien Pouliot * AvoidMessageChainsRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-16 Sebastien Pouliot * AvoidLargeClassesRule.cs: * AvoidSpeculativeGeneralityRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-10 Sebastien Pouliot * AvoidLargeClassesRule.cs: Be more accurate when reporting. E.g. report all common prefixes with a count 2010-06-10 Sebastien Pouliot * AvoidLongParameterListsRule.cs: Move HasConstructor check before a call. Rename two methods (Smaller->Smallest) * CodeDuplicatedLocator.cs: Don't create more than one empty List of patterns and avoid some allocations. Saves 74kb on self-test * Pattern.cs: Reuse the instructions array when possible. Saves 1320kb while executing self-test 2010-06-09 Sebastien Pouliot * CodeDuplicatedLocator.cs: Ignore duplicated code located inside generated code. * InstructionMatcher.cs: Refactor AreEquivalent. Parameters and variables do not need to the "at the same index" to be a match. Matching now also include STLOC* (not just LDLOC*) * Pattern.cs: Rework ComputePrefixes to set/reset Target on InstructionMatcher since this could lead to looking at instruction from another method (than Target) leading to exceptions or false positives 2010-06-04 Sebastien Pouliot * AvoidCodeDuplicatedInSiblingClassesRule.cs: * AvoidLargeClassesRule.cs: * AvoidLongParameterListsRule.cs: * CodeDuplicatedLocator.cs: Apply AvoidUnnecessarySpecializationRule * Pattern.cs: Apply ConsiderConvertingMethodToPropertyRule 2010-05-08 Sebastien Pouliot * AvoidLongParameterListsRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule on the use of TypeDefinition.Constructors property * InstructionMatcher.cs: Fix when "ldarg 0" is used instead of the, much more common, "ldarg_0" 2010-05-02 Sebastien Pouliot * InstructionMatcher.cs: Rework AreEquivalent to avoid memory allocations when comparing operands (like MethodReferences). This makes the rules using the matcher 2 times faster. 2010-04-29 Sebastien Pouliot * AvoidLargeClassesRule.cs: Apply AvoidRepetitiveCallsToProperties Rule on MemberReference::get_Name (6) * AvoidLongParameterListsRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule on MemberReference::get_Name 2010-04-26 Sebastien Pouliot * AvoidMessageChainsRule.cs: Change MaxChainLength from 5 to 4 and condition from >= to > (same effect) so the rule description (and documentation) makes more sense. 2010-03-24 Sebastien Pouliot * CodeDuplicatedLocator.cs: Add [Conditional("DEBUG")] on WriteToOutput. Fix typo IsExtractableToMethodBlock * InstructionMatcher.cs: Use rocks to cover all LDARG* and LDLOC* * Pattern.cs: Don't try to be too precise when checking compiler generated patterns since this only makes it difficult to support many compilers and adds false positives. New logic is more permissive (IL wise), more (operand wise) and less (IL wise) precise and should cover more compilers while reducing false positive (but it could fail to report some cases - which is less problematic than reporting false positive IMO) 2010-03-21 Sebastien Pouliot * AvoidLongMethodsRule.cs: Add more types (from Workflow and Silverlight) that use InitializeComponent to be ignored. Patch by Jeff Craig. 2010-01-24 Sebastien Pouliot * AvoidSwitchStatementsRule.cs: Ignore all generated code since their name will be compiler dependant. Fix unit test under Windows (well when compiled with CSC) 2009-07-07 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-02-23 Néstor Salceda * AvoidSpeculativeGeneralityRule.cs: Fix a typo. Thanks to Mat Steeples. 2008-12-22 Néstor Salceda * AvoidSwitchStatementsRule.cs: Added the code for handling the table-driven switches. 2008-12-22 Néstor Salceda * AvoidSwitchStatementsRule.cs: Fix some typos. Thanks Sebastien !! 2008-12-22 Néstor Salceda * AvoidSwitchStatementsRule.cs: New. Rule for avoid the switch statments smell. * Makefile.am: Add tests and rule to the build. 2008-12-17 Néstor Salceda * AvoidLongParameterListsRule.cs: Remove the extra checking which only introduces confussion. 2008-12-17 Néstor Salceda * AvoidCodeDuplicatedInSameClassRule.cs: Use the new nose for its checkings. * AvoidCodeDuplicatedInSiblingClassesRule.cs: Use the new nose for its checkings. * CodeDuplicatedLocator.cs: Use the new algorithm in this code. * ExpressionCollection.cs: Removed the old system. * ExpressionFillerVisitor.cs: Removed the old system. * InstructionMatcher.cs: The new nose. * Makefile.am: Adjust the changes to the build system. * Pattern.cs: An abstraction for a pattern of instructions. The common patterns (Disposables, foreach, returns ...) are here in order to check if a pattern can be extracted. 2008-12-15 Sebastien Pouliot * AvoidCodeDuplicatedInSameClassRule.cs: Use IsEnum, IsInterface and HasMethods * AvoidCodeDuplicatedInSiblingClassesRule.cs: Use HasMethods, IsEnum and IsInterface * AvoidLargeClassesRule.cs: Use HasFields * AvoidLongMethodsRule.cs: Use HasParameters and HasFields * AvoidLongParameterListsRule.cs: Use HasMethods, HasParameters and HasConstructors * AvoidSpeculativeGeneralityRule.cs: Use HasInterfaces, HasMethods and IsEnum * CodeDuplicatedLocator.cs: Use HasMethods 2008-11-17 Jesse Jones * AvoidMessageChainsRule.cs: Use Log instead of Trace. 2008-11-09 Sebastien Pouliot * Gendarme.Rules.Smells.csproj: Change AvoidMessageChainsRule to Compile. Fix the "remove from Makefile.am". 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Smells.mdp: * Gendarme.Rules.Smells.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-03 Sebastien Pouliot * AvoidSpeculativeGeneralityRule.cs: Use OpCodeEngine and avoid specializing (and public-izing) CountInheritedClassesFrom. 2008-11-02 Sebastien Pouliot * AvoidMessageChainsRule.cs: Change ValidLink to static (self-test) 2008-11-02 Jesse Jones * AvoidMessageChainsRule.cs: Clean up the Problem text a bit. When working backwards along a chain stop when we reach a static method. 2008-10-30 Jesse Jones * Makefile.am: Append onto the inherited EXTRA_RULES_OPTIONS. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Smells.xml, doc/Gendarme.Rules.Smells: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-18 Sebastien Pouliot * AvoidCodeDuplicatedInSiblingClassesRule.cs: Small changes in XML documentation to make it render more correctly in the wiki. * AvoidLongMethodsRule.cs: Small changes in XML documentation to make it render more correctly in the wiki. Remove XML doc that is not documenting the I*Rule. * AvoidLongParameterListsRule.cs: Accept a TypeReference (instead of a definition) in CheckDelegate. * AvoidSpeculativeGeneralityRule.cs: Small changes in XML documentation to make it render more correctly in the wiki. * ExpressionCollection.cs: Implement IEquatable (self-test) * Utilities.cs: Accept a TypeReference (instead of a definition) in GetInheritedClassesFrom (self-test). 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-10-14 Néstor Salceda * AvoidMessageChainsRule.cs: Added XML documentation. 2008-10-14 Néstor Salceda * AvoidSpeculativeGeneralityRule.cs: Added XML documentation. 2008-10-14 Néstor Salceda * AvoidLongParameterListsRule.cs: Added XML documentation. 2008-10-14 Néstor Salceda * AvoidLongMethodsRule.cs: Added XML documentation. 2008-10-14 Néstor Salceda * AvoidLargeClassesRule.cs: Added XML documentation. 2008-10-14 Néstor Salceda * AvoidCodeDuplicatedInSiblingClassesRule.cs: Added XML documentation. 2008-10-14 Néstor Salceda * AvoidCodeDuplicatedInSameClassRule.cs: Added XML documentation. 2008-09-10 Sebastien Pouliot * AvoidMessageChainsRule.cs: Use TraceBack rock to fix false positives. Use OpCodeBitmask to simplify the rule. Add OpCodeEngine to avoid executing the rule when possible. * Gendarme.Rules.Smells.mdp: Add rule to MD project file. * Makefile.am: Re-enable the rule now that the known false positives are fixed. 2008-08-14 Sebastien Pouliot * AvoidSpeculativeGeneralityRule.cs: Avoid creating an instance of AvoidUnusedParametersRule at each CheckType call if the rule is not already scheduled for execution. 2008-08-12 Sebastien Pouliot * AvoidLongMethodsRule.cs: Change rule to count logical source line of code by default, i.e. when debugging symbols are available. Otherwise rule continue to use IL-SLOC approximation. * CodeDuplicatedLocator.cs: Use IRule interface, instead of Rule, inside CompareMethodAgainstTypeMethods (since rules don't need to be based on the abstract Rule "convenience" class). 2008-08-07 Sebastien Pouliot * AvoidLongMethodsRule.cs: Use generic collections. 2008-07-21 Nestor Salceda * AvoidLongMethodsRule.cs: Checking only the static fields and constants will avoid the false positive with readonly fields. 2008-07-16 Sebastien Pouliot * AvoidLongParameterListsRule.cs: Fix CheckDelegate to work on MulticastDelegate definition (no Invoke method is present). 2008-07-10 Sebastien Pouliot * Makefile.am: Start using ../common.make. Do not build AvoidMessageChainsRule until its false positive rate is lower. 2008-07-09 Sebastien Pouliot * AvoidCodeDuplicatedInSameClassRule.cs: Don't add duplicate entries. * AvoidCodeDuplicatedInSiblingClassesRule.cs: Reuse (after clearing) the existing CodeDuplicatedLocator. Don't add duplicate entries. * CodeDuplicatedLocator.cs: Use generic based HashSet instead of StringCollection. Add a Clear method so the instance can be reused. * Utilities.cs: Use generics. [using both rules on System.dll (2.0 profile) now takes 10 seconds instead of 16 seconds] 2008-06-29 Sebastien Pouliot * AvoidLongMethodsRule.cs: Fix typo for IsStatic check. Report the actual versus maximum IL instruction found (since this is useful to the end user that wants to fix his code). 2008-05-10 Sebastien Pouliot * AvoidSpeculativeGeneralityRule.cs: Avoid calling Utilities. GetInheritedClassesFrom (since it returns a collection and we only need the count) and replace it by CountInheritedClassesFrom which works across all the assembly set of the runner (fix false positive in self-test). Also skip inactive rules when checking if the rule AvoidUnusedParametersRule is scheduled for execution. 2008-05-06 Sebastien Pouliot * AvoidLongParameterListsTest.cs: Don't consider static constructors when counting the smallest (# parameters) constructor. 2008-05-03 Sebastien Pouliot * AvoidLongParameterListsRule.cs: Change some methods to static. * AvoidMessageChainsRule.cs: Made IsDelimiter static and compare Code (enum) not OpCodes (struct) as this generate half the IL. Don't report a static string (dupes with Problem and Solution) since it make reports longer than needed. Add extra details when -v -v is supplied (chain length and maximum). 2008-04-26 Sebastien Pouliot * AvoidLargeClassesRule.cs: Fix string empty check. 2008-04-26 Nestor Salceda * AvoidMessageChainsRule.cs: Use descriptive messages when report a violation. 2008-04-26 Nestor Salceda * AvoidMessageChainsRule.cs: Trimming down several false positives. * Test/AviodMessageChainsTest.cs: Replaced tests with better ones. The latest gives us a lot of false positives. 2008-04-26 Nestor Salceda * AvoidMessageChainsRule.cs: Some fixes for avoid the exceptions in self test target. 2008-04-26 Nestor Salceda * AvoidMessageChainsRule.cs: Implemented logic for detect chains created with local variables. By the moment it's a bit constrained, only 5 local variables and without reassignments. * Test/AvoidMessageChainsTest.cs: Added test for check chains created with local variables. 2008-04-26 Nestor Salceda * AvoidMessageChainsRule.cs: New. First rule in the Rule Day :) * Test/AvoidMessageChainsTest.cs: New. Tests for AvoidMessageChains rule. * Makefile.am: Added both to the build. 2008-04-23 Nestor Salceda * AvoidLongMethodsRule.cs: The C# compiler was optimized in order to reduce the number of instructions, and then this rule failed. I have decremented the default MaxInstructions value, and all tests are passed successfully with the SVN HEAD and the 1.9 release. 2008-04-18 Nestor Salceda * AvoidLongParameterListsRule.cs: Implemented delegate checking. * Test/AvoidLongParameterListsRule.cs: Added tests for delegate special checking. 2008-04-18 Nestor Salceda * AvoidLongParameterListsRule.cs: Refactored to be a ITypeRule instead of IMethodRule. * Test/AvoidLongParameterListsRule.cs: Updated tests for the new refactoring and updated with the new Test utilites. * Makefile.am: Added the Test.Smells reference. 2008-04-14 Sebastien Pouliot * AvoidLongParameterListsRule.cs: Handle constructors just like methods. 2008-04-14 Nestor Salceda * CodeDuplicatedLocator.cs: Improved the defect reporting. When the rule finds a code duplicated issue, put the current method in Location and the other part in the comments, and put it with its complete signature, not only with the method name. 2008-04-08 Nestor Salceda * AvoidLargeClassesRule.cs, CodeDuplicatedLocator.cs, AvoidCodeDuplicatedInSiblingClassesRule.cs, AvoidCodeDuplicatedInSameClassRule.cs: Fix a typo. 2008-04-08 Nestor Salceda * Expression.cs: Moved to ExpressionCollection.cs * ExpressionCollection.cs: Moved due the new class name. * Makefile.am: Replaced Expression.cs with ExpressionCollection.cs 2008-04-06 Sebastien Pouliot * CodeDuplicatedLocator.cs: Renamed Expression to ExpressionCollection * Expression.cs: Add Equals(Expression) method to satisfy ImplementEqualsTypeRule. Renamed class to ExpressionCollection to satisfy UseCorrectSuffixRule * ExpressionFillerVisitor.cs: Renamed Expression to ExpressionCollection 2008-03-05 Sebastien Pouliot * AvoidSpeculativeGeneralityRule.cs: Change CheckMethods to static. 2008-02-17 Sebastien Pouliot * Expression.cs: Avoid double-cast and don't throw an exception here (not a good place). We need a rule for the later behaviour. 2008-02-16 Sebastien Pouliot * AvoidLongMethodsRule.cs: Avoid NRE when processing System.Object. 2008-02-16 Sebastien Pouliot * AvoidCodeDuplicatedInSameClassRule.cs: Ignore rule on generated code (e.g. C# compiler generates some duplication for anonymous methods). * Expression.cs: Fix some parameters to match base class. * ExpressionFillerVisitor.cs: Fix some parameters to match base class. 2008-02-16 Sebastien Pouliot * AvoidLongMethodsRule.cs: Display actual and maximum IL instruction counts if -v -v is supplied. 2008-02-15 Sebastien Pouliot * AvoidSpeculativeGeneralityRule.cs: Fix rule check since we now use a single collection for all rules. 2008-02-15 Nestor Salceda * Test/*.cs: Refactor the tests for accept the new rule's format. * *.cs: Adapt the rules to the new framework. * Makefile.am: Removed the -langversion:linq option. You should use at least the 1.9 gmcs version to compile. 2008-02-07 Nestor Salceda * AvoidLargeClassesRule.cs: Avoid positive when a class contains constants or readonly fields. 2008-02-07 Nestor Salceda * ExpressionFillerVisitor.cs, CodeDuplicatedLocator.cs, Expression.cs: For performance issues types which aren't visible outside of the assembly and haven't subclasses should be sealed. 2008-02-07 Nestor Salceda * AvoidLongMethodsRule.cs: As suggested by Sebastien, the new comparisons are better than a string comparison. 2008-02-07 Nestor Salceda * AvoidLongMethodsRule.cs: The rule should be applied to static constructors. Now we add several extra instructions for each field for initialize, specially if the field is an array. 2008-02-06 Nestor Salceda * AvoidLongMethodsRule.cs: The rule shouldn't be applied to static constructors. 2008-01-16 Nestor Salceda * AvoidLargeClassesRule.cs: The rule shouldn't be applied to enums. 2008-01-12 Sebastien Pouliot * AvoidLongParameterListsTest.cs: Don't report defects for p/invokes 2008-01-12 Sebastien Pouliot * AvoidLongMethodsRule.cs: Use new Location ctor. * AvoidLongParameterListsRule.cs: Use new Location ctor. Change two methods to static. * AvoidSpeculativeGeneralityRule.cs: Use new Location ctor. Change four methods to static. * CodeDuplicatedLocator.cs: Use new Location ctor. Change two methods to static. * Expression.cs: Change a method to static. * ExpressionFillerVisitor.cs: Change two methods to static. 2008-01-05 Sebastien Pouliot * AvoidLargeClassesRule.cs: Don't report defect if the fields are const or readonly or if they were generated (e.g. auto-implemented properties in C# 3). * AvoidLongMethodsRule.cs: Move InitWellKnownAutogeneratedNames code inside static ctor so we don't initialize the dictionary each time the rule is called. * Gendarme.Rules.Smells.mdp, Test/Test.Rules.Smells.mdp: MonoDevelop removed the "./" prefix before each file. * Makefile.am: Compile unit tests with -langversion:linq parameter. 2008-01-05 Nestor Salceda * Makefile.am: Compile with -langversion:linq parameter. * AvoidLargeClassesRule.cs, AvoidSpeculativeGeneralityRule.cs: Remove ugly IsCompilerGenerated helper method. Use rocks instead. 2007-12-21 Nestor Salceda * ExpressionFillerVisitor.cs: Add the ceq code to the acceptable instructions set. With this change, all the bugs in code compiled under csc without optimization flag are fixed. 2007-12-21 Nestor Salceda * ExpressionFillerVisitor.cs: Avoid creating empty expressions, because the equals method in the Expression class checks for the same size, and if the size is zero, then the equals returns true. Fixes one of the bug in code compiled under csc without optimization flag. 2007-11-30 Nestor Salceda * AvoidLargeClassesRule.cs: As the rule is only applied to types, then if the type is Compiler Generated, skip the type; instead of check the field names. 2007-11-30 Nestor Salceda * AvoidLargeClassesRule.cs: Added the special case for the fields prefixed as $$field-, when this happens, there aren't a common prefix. 2007-11-30 Nestor Salceda * Expression.cs, ExpressionFillerVisitor.cs: Added the code for including the Stfld in the Expressions, and computate it for check the code duplication. 2007-11-30 Nestor Salceda * AvoidLargeClassesRule.cs: Extract a method and use a predicate for the checking. This fixes the code duplication warning. 2007-11-29 Nestor Salceda * CodeDuplicatedLocator.cs: Renamed field's for avoid the common prefix that warn us for the LargeClass smell. 2007-11-29 Nestor Salceda * AvoidSpeculativeGeneralityRule.cs: Change the behavior of unnecessary delegation. A class with unnecessary delegation is a class that mostly forwards and delegates the calls. 2007-11-28 Nestor Salceda * AvoidCodeDuplicatedInSameClassRule.cs, AvoidCodeDuplicatedInSiblingClassesRule.cs, AvoidLongMethodsRule.cs, AvoidLongParameterListsRule.cs, AvoidLargeClassesRule.cs, AvoidSpeculativeGeneralityRule.cs: Avoid instantiating MessageCollection unless we use it for returning a message. 2007-10-19 Nestor Salceda * Expression.cs: When overriding the Equals method, if the value is null, then return false. Fixes the EqualShouldHandleNullArgRule violation. 2007-10-19 Nestor Salceda * Utilities.cs: Marked this class as static for avoid uninstantiated internal class rule violation. 2007-10-07 Sebastien Pouliot * Gendarme.Rules.Smells.mdp: Update project file. * Makefile.am: Use nunit-console2 to run the unit tests. 2007-10-04 Nestor Salceda * Gendarme.Rules.Smells.mdp: Removed empty directory entry in the MonoDevelop project file. 2007-10-04 Nestor Salceda * Gendarme.Rules.Smells.mdp: New. Created MonoDevelop project file for the smell rules. 2007-09-29 Nestor Salceda * Gendarme.Rules.Smells.xml.in: Added Uri for these rules. 2007-09-14 Nestor Salceda * AvoidCodeDuplicatedInSameClassRule.cs, AvoidCodeDuplicatedInSiblingClassesRule.cs, AvoidLargeClassesRule.cs, AvoidLongMethodsRule.cs, AvoidLongParameterListsRule.cs, AvoidSpeculativeGeneralityRule.cs, CodeDuplicatedLocator.cs, Expression.cs, ExpressionFillerVisitor.cs, Utilities.cs: Added svn propset svn:eol-native. 2007-09-14 Nestor Salceda * Makefile.am: Build Gendarme.Rules.Smells rules and tests. * Gendarme.Rules.Smells.xml.in: New. Configuration for Gendarme.Rules.Smells. * AvoidCodeDuplicatedInSameClassRule.cs, AvoidCodeDuplicatedInSiblingClassesRule.cs, AvoidLargeClassesRule.cs, AvoidLongMethodsRule.cs, AvoidLongParameterListsRule.cs, AvoidSpeculativeGeneralityRule.cs, CodeDuplicatedLocator.cs, Expression.cs, ExpressionFillerVisitor.cs, Utilities.cs: New. Rules for check smells in the code. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Pattern.cs0000664000175000017500000001233512413742070026444 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.Pattern class // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2008 Néstor Salceda // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { internal sealed class Pattern { Instruction[] instructions; int[] prefixes; bool? compilerGeneratedBlock; bool? extractableToMethodBlock; internal Pattern (Instruction[] block) { if (block == null) throw new ArgumentNullException ("block"); this.instructions = block; } // look for: isinst System.IDisposable static bool IsInstanceOfIDisposable (Instruction ins) { if (ins.OpCode.Code != Code.Isinst) return false; return (ins.Operand as TypeReference).IsNamed ("System", "IDisposable"); } // look for: // callvirt System.Void System.IDisposable::Dispose() // endfinally static bool IsIDisposableDisposePattern (Instruction ins) { if (ins.OpCode.Code != Code.Callvirt) return false; if (!(ins.Operand as MethodReference).IsNamed ("System", "IDisposable", "Dispose")) return false; return ins.Next.Is (Code.Endfinally); } // IIRC older xMCS generated that quite often bool IsDoubleReturn { get { return ((Count > 1) && (instructions[Count - 1].OpCode.Code == Code.Ret) && (instructions[Count - 2].OpCode.Code == Code.Ret)); } } // small patterns that highly suggest they were compiler generated bool ComputeUnlikelyUserPatterns () { bool call = false; for (int i = 0; i < Count; i++) { Instruction ins = instructions [i]; // foreach if (ins.OpCode.Code == Code.Callvirt) { MethodReference mr = (ins.Operand as MethodReference); if (mr.IsNamed ("System.Collections", "IEnumerator", "get_Current")) return true; if (mr.IsNamed ("System.Collections", "IEnumerator", "MoveNext")) return !call; } // if there's a unknown call then it's likely not (totally) compiler generated call |= (ins.OpCode.FlowControl == FlowControl.Call); // foreach if (IsInstanceOfIDisposable (ins)) return true; // foreach, using if (IsIDisposableDisposePattern (ins)) return true; } return false; } internal bool IsCompilerGeneratedBlock { get { if (compilerGeneratedBlock == null) compilerGeneratedBlock = ComputeUnlikelyUserPatterns () || IsDoubleReturn; return (bool) compilerGeneratedBlock; } } bool IsReturningCode { get { return ((Count == 4 && instructions[0].OpCode.StackBehaviourPush == StackBehaviour.Push1 && (instructions [1].OpCode.Code == Code.Brtrue || instructions [1].OpCode.Code == Code.Brtrue_S) && instructions[2].OpCode.StackBehaviourPush == StackBehaviour.Pushi && instructions[3].OpCode.Code == Code.Ret) || (Count > 1 && instructions[Count - 1].OpCode.Code == Code.Ret && instructions[Count - 2].OpCode.FlowControl == FlowControl.Cond_Branch)); } } internal bool IsExtractableToMethodBlock { get { if (extractableToMethodBlock == null) extractableToMethodBlock = !IsReturningCode; return (bool) extractableToMethodBlock; } } internal void ComputePrefixes (MethodDefinition method) { MethodDefinition target = InstructionMatcher.Target; InstructionMatcher.Target = method; try { int offset = 0; if ((prefixes == null) || (prefixes.Length < instructions.Length)) prefixes = new int [instructions.Length]; for (int index = 1; index < instructions.Length; index++) { while (offset > 0 && !InstructionMatcher.AreEquivalent (instructions [offset], instructions [index])) offset = prefixes [offset - 1]; if (InstructionMatcher.AreEquivalent (instructions [offset], instructions [index])) offset++; prefixes [index] = offset; } } finally { InstructionMatcher.Target = target; } } internal int Count { get { return instructions.Length; } } internal Instruction this[int index] { get { return instructions[index]; } } internal int[] Prefixes { get { return prefixes; } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Makefile.in0000664000175000017500000006612512642235732026561 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Smells ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) \ -r:../../bin/Gendarme.Rules.Performance.dll EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -r:System.Windows.Forms.dll console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AvoidCodeDuplicatedInSameClassRule.cs \ AvoidCodeDuplicatedInSiblingClassesRule.cs \ AvoidLargeClassesRule.cs \ AvoidLongMethodsRule.cs \ AvoidLongParameterListsRule.cs \ AvoidMessageChainsRule.cs \ AvoidSpeculativeGeneralityRule.cs \ AvoidSwitchStatementsRule.cs \ CodeDuplicatedLocator.cs \ InstructionMatcher.cs \ Pattern.cs tests_sources = \ AvoidCodeDuplicatedInSameClassTest.cs \ AvoidCodeDuplicatedInSiblingClassesTest.cs \ AvoidLargeClassesTest.cs \ AvoidLongMethodsTest.cs \ AvoidLongParameterListsTest.cs \ AvoidMessageChainsTest.cs \ AvoidSpeculativeGeneralityTest.cs \ AvoidSwitchStatementsTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Smells/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Smells/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/AvoidLongMethodsRule.cs0000664000175000017500000002625312413742070031071 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.AvoidLongMethodsRule class // // Authors: // Néstor Salceda // // (C) 2007-2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { // TODO: What does "This will work for classes that extend those types" mean? // Why does the summary bring up SequencePoints? Can the defaults be changed? /// /// This rule allows developers to measure the method size. The short sized /// methods allows you to maintain your code better, if you have long sized /// methods perhaps you have the Long Method smell. /// /// The rule will skip some well known methods, because they are autogenerated: /// /// /// Gtk.Bin::Build () /// /// /// Gtk.Window::Build () /// /// /// Gtk.Dialog::Build () /// /// /// System.Windows.Forms::InitializeComponents () /// /// /// System.Workflow.Activities.StateMachineWorkflowActivity::InitializeComponents () /// /// /// System.Workflow.Activities.SequentialWorkflowActivity::InitializeComponents () /// /// /// System.Windows.Controls.UserControl::InitializeComponents () /// /// /// This will work for classes that extend those types. /// /// If debugging symbols (e.g. Mono .mdb or MS .pdb) are available then the rule /// will compute the number of logical source line of code (SLOC). This number /// represent the lines where 'SequencePoint' are present in the code. By /// default the maximum SLOC is defined to 40 lines. /// /// Otherwise the rule falls back onto an IL-SLOC approximation. It's quite /// hard to determine how many SLOC exists based on the IL (e.g. LINQ). The metric /// being used is based on a screen (1024 x 768) full of source code where the /// number of IL instructions were counted. By default the maximum number of IL /// instructions is defined to be 165. /// /// /// Bad example: /// /// public void LongMethod () /// { /// Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); /// IList list = new ArrayList (); /// list.Add ("Foo"); /// list.Add (4); /// list.Add (6); /// /// IEnumerator listEnumerator = list.GetEnumerator (); /// while (listEnumerator.MoveNext ()) { /// Console.WriteLine (listEnumerator.Current); /// } /// /// try { /// list.Add ("Bar"); /// list.Add ('a'); /// } /// catch (NotSupportedException exception) { /// Console.WriteLine (exception.Message); /// Console.WriteLine (exception); /// } /// /// foreach (object value in list) { /// Console.Write (value); /// Console.Write (Environment.NewLine); /// } /// /// int x = 0; /// for (int i = 0; i < 100; i++) { /// x++; /// } /// Console.WriteLine (x); /// /// string useless = "Useless String"; /// if (useless.Equals ("Other useless")) { /// useless = String.Empty; /// Console.WriteLine ("Other useless string"); /// } /// /// useless = String.Concat (useless," 1"); /// for (int j = 0; j < useless.Length; j++) { /// if (useless[j] == 'u') { /// Console.WriteLine ("I have detected an u char"); /// } else { /// Console.WriteLine ("I have detected an useless char"); /// } /// } /// /// try { /// foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) { /// Console.WriteLine (environmentVariable); /// } /// } /// catch (System.Security.SecurityException exception) { /// Console.WriteLine (exception.Message); /// Console.WriteLine (exception); /// } /// /// Console.WriteLine ("I will add more useless code !!"); /// try { /// if (!(File.Exists ("foo.txt"))) { /// File.Create ("foo.txt"); /// File.Delete ("foo.txt"); /// } /// } /// catch (IOException exception) { /// Console.WriteLine (exception.Message); /// Console.WriteLine (exception); /// } /// } /// /// /// /// Good example: /// /// public void ShortMethod () /// { /// try { /// foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) { /// Console.WriteLine (environmentVariable); /// } /// } /// catch (System.Security.SecurityException exception) { /// Console.WriteLine (exception.Message); /// Console.WriteLine (exception); /// } /// } /// /// [Problem ("Long methods are usually hard to understand and maintain. This method can cause problems because it contains more code than the maximum allowed.")] [Solution ("You should apply an Extract Method refactoring, but there are other solutions.")] public class AvoidLongMethodsRule : Rule,IMethodRule { const int AssignationRatio = 7; const int DefaultAmountOfElements = 13; public AvoidLongMethodsRule () { MaxInstructions = 165; MaxSourceLineOfCode = 40; } public int MaxInstructions { get; set; } public int MaxSourceLineOfCode { get; set; } // Use IL to approximate the size of the method. By default logical // source lines are used (when debugging symbols are available). public bool UseIlApproximation { get; set; } private static bool IsAutogeneratedByTools (MethodDefinition method) { if (method.HasParameters) return false; string name = method.Name; if ((name != "Build") && (name != "InitializeComponent")) return false; TypeDefinition type = method.DeclaringType.Resolve (); if ((type == null) || (type.BaseType == null)) return false; string nspace = type.BaseType.Namespace; string tname = type.BaseType.Name; switch (name) { case "Build": if (nspace != "Gtk") return false; return (tname == "Bin" || tname == "Window" || tname == "Dialog"); case "InitializeComponent": switch (nspace) { case "System.Windows.Forms": return tname == "Form"; case "System.Workflow.Activities": return tname == "SequentialWorkflowActivity" || tname == "StateMachineWorkflowActivity"; case "System.Windows.Controls": return tname == "UserControl"; } break; } return false; } private static int CountStaticFields (TypeDefinition type) { int counter = 0; foreach (FieldDefinition field in type.Fields) { if (field.IsStatic || field.HasConstant) counter++; //if the field is an array, we should take care //about their elements. ArrayType array = field.FieldType as ArrayType; if (array != null) { for (int index = 0; index < array.Dimensions.Count; index++) //I can't calculate the array //length, then, i add a //default amount of elements //TODO: Perhaps we can do other //approach with random nunbers? counter+= DefaultAmountOfElements; } } return counter; } private static int CountInstanceFields (TypeDefinition type) { int counter = 0; foreach (FieldDefinition field in type.Fields) { if (!(field.IsStatic || field.HasConstant)) counter++; //I not take care about arrays here. } return counter; } private static int GetFieldCount (TypeDefinition type, bool staticFields) { if (!type.HasFields) return 0; return staticFields ? CountStaticFields (type) : CountInstanceFields (type); } private static int CountSourceLinesOfCode (MethodDefinition method) { int sloc = 0; int current_line = -1; foreach (Instruction ins in method.Body.Instructions) { SequencePoint sp = ins.SequencePoint; if (sp == null) continue; int line = sp.StartLine; // special value for PDB (so that debuggers can ignore a line) if (line == 0xFEEFEE) continue; // lines numbers may not be ordered (loops) or reused several times if ((current_line == -1) || (line > current_line)) sloc++; current_line = line; } return sloc; } private static int CountInstructions (MethodDefinition method) { int count = 0; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Nop: case Code.Box: case Code.Unbox: break; default: count++; break; } } return count; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply if method as no code (e.g. abstract, p/invoke) // rule does not apply to code outside the developer's control // rule does not apply to autogenerated code from some tools if (!method.HasBody || method.IsGeneratedCode () || IsAutogeneratedByTools (method)) return RuleResult.DoesNotApply; // rule applies! int field_count = 0; if (method.IsConstructor) field_count = GetFieldCount ((method.DeclaringType as TypeDefinition), method.IsStatic); // if we have debugging information available and we're not asked to use IL approximation if (!UseIlApproximation && method.DeclaringType.Module.HasSymbols) { // add a few extra lines to let the constructors initialize the fields int max = MaxSourceLineOfCode + field_count; int sloc = CountSourceLinesOfCode (method); if (sloc <= max) return RuleResult.Success; string message = String.Format (CultureInfo.CurrentCulture, "Logical SLOC: {0}. Maximum : {1}", sloc, max); Runner.Report (method, Severity.High, Confidence.High, message); } else { // success if the instruction count is below the defined threshold // add a few extra lines to let the constructors initialize the fields int max = MaxInstructions + field_count * AssignationRatio; int count = CountInstructions (method); if (count <= max) return RuleResult.Success; string message = String.Format (CultureInfo.CurrentCulture, "Method IL Size: {0}. Maximum Size: {1}", count, max); Runner.Report (method, Severity.High, Confidence.Normal, message); } return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/InstructionMatcher.cs0000664000175000017500000001171212413742070030652 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.InstructionMatcher class // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { internal static class InstructionMatcher { internal static MethodDefinition Current { get; set; } internal static MethodDefinition Target { get; set; } static bool AreEquivalent (ParameterReference source, ParameterReference target) { if ((source == null) || (target == null)) return false; int ss = source.Index; int ts = target.Index; if ((ss <= 0) || (ts <= 0)) return false; IList cp = Current.Parameters; IList tp = Target.Parameters; return ((cp.Count > ss) && (tp.Count > ts)) ? cp [ss].ParameterType.Equals (tp [ts].ParameterType) : false; } static bool AreEquivalent (VariableReference source, VariableReference target) { IList cv = Current.Body.Variables; IList tv = Target.Body.Variables; return cv.Count > source.Index && tv.Count > target.Index ? cv [source.Index].VariableType.Equals (tv [target.Index].VariableType) : false; } internal static bool AreEquivalent (Instruction source, Instruction target) { if (source.OpCode.Code != target.OpCode.Code) return false; if (source.OpCode.Code == Code.Ldstr) return true; //Check the types in ldarg stuff. Sometimes this scheme //could lead us to false positives. We need an analysis //which depends on the context. if (source.IsLoadArgument ()) { // case where 'ldarg this' is used (p.GetSequence () would be 0) if (!Current.HasParameters && !Target.HasParameters) return true; return AreEquivalent (source.GetParameter (Current), target.GetParameter (Target)); } // The same for ldloc / stloc if (source.IsLoadLocal () || source.IsStoreLocal ()) return AreEquivalent (source.GetVariable (Current), target.GetVariable (Target)); //WARNING: Dirty Evil Hack: this should be in the //Pattern class if (source.OpCode.Code == Code.Ret && source.Previous != null && (source.Previous.OpCode.StackBehaviourPush == StackBehaviour.Pushi || source.Previous.OpCode.Code == Code.Ldnull || source.Previous.OpCode.StackBehaviourPush == StackBehaviour.Push1)) return false; //if (source.Operand != target.Operand) if (source.Operand != null && target.Operand != null) { // we're sure that target.Operand is of the same type as source.Operand (same OpCode is used) Instruction si = (source.Operand as Instruction); if (si != null) return (si.Offset == ((Instruction) target.Operand).Offset); IMetadataTokenProvider sm = (source.Operand as IMetadataTokenProvider); if (sm != null) return sm.Equals (target.Operand as IMetadataTokenProvider); if (source.Operand == target.Operand) return true; // last chance: we do call ToString if (source.Operand.ToString () != target.Operand.ToString ()) return false; } return true; } //This is a Knuth-Morris-Pratt string-matching algorithm, but applied to //Mono.Cecil.Cil.Instruction instead of characters, and a //InstructionCollection instead of string. I think it's a nice //metaphor :) internal static bool Match (Pattern pattern, IList target) { int instructionsMatched = 0; pattern.ComputePrefixes (Current); for (int index = 0; index < target.Count; index++) { while (instructionsMatched > 0 && !AreEquivalent (pattern[instructionsMatched], target[index])) instructionsMatched = pattern.Prefixes[instructionsMatched - 1]; if (AreEquivalent (pattern[instructionsMatched], target[index])) instructionsMatched++; if (instructionsMatched == pattern.Count) return true; } return false; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/AvoidCodeDuplicatedInSiblingClassesRule.cs0000664000175000017500000001034112413742070034623 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.AvoidCodeDuplicatedInSiblingClassesRule class // // Authors: // Néstor Salceda // // (C) 2007-2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { /// /// This rule looks for code duplicated in sibling subclasses. /// /// /// Bad example: /// /// public class BaseClassWithCodeDuplicated { /// protected IList list; /// } /// /// public class OverriderClassWithCodeDuplicated : BaseClassWithCodeDuplicated { /// public void CodeDuplicated () /// { /// foreach (int i in list) { /// Console.WriteLine (i); /// } /// list.Add (1); /// } /// } /// /// public class OtherOverriderWithCodeDuplicated : BaseClassWithCodeDuplicated { /// public void OtherMethod () /// { /// foreach (int i in list) { /// Console.WriteLine (i); /// } /// list.Remove (1); /// } /// } /// /// /// /// Good example: /// /// public class BaseClassWithoutCodeDuplicated { /// protected IList list; /// /// protected void PrintValuesInList () /// { /// foreach (int i in list) { /// Console.WriteLine (i); /// } /// } /// } /// /// public class OverriderClassWithoutCodeDuplicated : BaseClassWithoutCodeDuplicated { /// public void SomeCode () /// { /// PrintValuesInList (); /// list.Add (1); /// } /// } /// /// public class OtherOverriderWithoutCodeDuplicated : BaseClassWithoutCodeDuplicated { /// public void MoreCode () /// { /// PrintValuesInList (); /// list.Remove (1); /// } /// } /// /// [Problem ("There is similar code in various methods in sibling classes. Your code will be better if you can unify them.")] [Solution ("You can apply the Pull Up Method refactoring.")] public class AvoidCodeDuplicatedInSiblingClassesRule : Rule, ITypeRule { private CodeDuplicatedLocator codeDuplicatedLocator; private List siblingClasses; public AvoidCodeDuplicatedInSiblingClassesRule () { codeDuplicatedLocator = new CodeDuplicatedLocator (this); siblingClasses = new List (); } private void FindCodeDuplicated (TypeDefinition type) { foreach (MethodDefinition method in type.Methods) foreach (TypeDefinition sibling in siblingClasses) codeDuplicatedLocator.CompareMethodAgainstTypeMethods (method, sibling); } public RuleResult CheckType (TypeDefinition type) { // don't analyze cases where no methods (or body) are available if (type.IsEnum || type.IsInterface) return RuleResult.DoesNotApply; foreach (TypeDefinition module_type in type.Module.GetAllTypes ()) { if ((module_type.BaseType != null) && module_type.BaseType.Equals (type)) siblingClasses.Add (module_type); } if (siblingClasses.Count >= 2) { codeDuplicatedLocator.Clear (); foreach (TypeDefinition sibling in siblingClasses) { FindCodeDuplicated (sibling); codeDuplicatedLocator.CheckedTypes.AddIfNew (sibling.Name); } } siblingClasses.Clear (); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/AvoidSwitchStatementsRule.cs0000664000175000017500000001203712413742070032152 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.AvoidSwitchStatementsRule class // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { // TODO: The text in this rule completely confuses me. Is is saying that // all switch statements should be avoided? How exactly do switch statements // lead to code duplication? As far as I can tell, this isn't true at all: switch // statements don't promote code duplication more than any other construct. // // The only real problem with switch statements I am aware of is that they // are sometimes used to dispatch on types which is a bad idea because // virtual methods are normally better for that. The end of the summary // seems to address this but in a rather confusing way. The best way to // clarify the problem IMO is to talk about the Open/Closed Principle. // // In addition this rule looks like it will fire for every single switch statement // in the assembly. The majority of switch statements are going to be fine // so the summary and solution text need to make it very clear that the code // may be perfectly fine. /// /// This rule checks for the Switch Statements smell. This can /// lead to code duplication, because the same switch could /// be repeated in various places in your program. Also, if /// need to do a little change, you may have to change every switch /// statement. The preferred way to do this is with virtual methods and polymorphism. /// /// /// Bad example: /// /// int balance = 0; /// foreach (Movie movie in movies) { /// switch (movie.GetTypeCode ()) { /// case MovieType.OldMovie: { /// balance += movie.DaysRented * movie.Price / 2; /// break; /// } /// case MovieType.ChildMovie: { /// //its an special bargain !! /// balance += movie.Price; /// break; /// } /// case MovieType.NewMovie: { /// balance += (movie.DaysRented + 1) * movie.Price; /// break: /// } /// } /// } /// /// /// /// Good example: /// /// abstract class Movie { /// abstract int GetPrice (); /// } /// class OldMovie : Movie { /// public override int GetPrice () /// { /// return DaysRented * Price / 2; /// } /// } /// class ChildMovie : Movie { /// public override int GetPrice () /// { /// return movie.Price; /// } /// } /// class NewMovie : Movie { /// public override int GetPrice () /// { /// return (DaysRented + 1) * Price; /// } /// } /// /// int balance = 0; /// foreach (Movie movie in movies) { /// balance += movie.GetPrice () /// } /// /// /// This rule is available since Gendarme 2.4 [Problem ("The problem with switch statements is the duplication. You may find the same switch in several places.")] [Solution ("You should consider polymorphism.")] public class AvoidSwitchStatementsRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; //Perhaps you are checking autogenerated code from a //yield statement if (method.DeclaringType.IsGeneratedCode ()) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode == OpCodes.Switch) { Runner.Report (method, instruction, Severity.Low, Confidence.Total); return RuleResult.Failure; } //Sometimes the compiler generates a table //driven comparison, there is the code for //handling too. if (instruction.OpCode == OpCodes.Ldsfld) { FieldReference field = (FieldReference) instruction.Operand; if (field.Name.Contains ("switch") && field.IsGeneratedCode ()) { Runner.Report (method, instruction, Severity.Low, Confidence.Total); return RuleResult.Failure; } } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/AvoidMessageChainsRule.cs0000664000175000017500000001301612413742070031351 0ustar00directhexdirecthex00000000000000// // AvoidMessageChainsRule class // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2008 Néstor Salceda // 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; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { // TODO: It may be worthwhile mentioning the law of demeter. The summary // doesn't really say what the message chain smell is. The summary could do a better // job explaining why the coupling is harmful (changes to the object inter-relationships // can cause cascading changes to the source code). It would be helpful if the summary // explained how to fix the problem (e.g. by adding accessors to encapsulate the structure). // The good example is not a good version of the bad example (it should call a ToFrench // or maybe a Language method on a person object). /// /// This rule checks for the Message Chain smell. This can cause problems because it /// means that your code is heavily coupled to the navigation structure. /// /// /// Bad example: /// /// public void Method (Person person) /// { /// person.GetPhone ().GetAreaCode ().GetCountry ().Language.ToFrench ("Hello world"); /// } /// /// /// /// Good example: /// /// public void Method (Language language) /// { /// language.ToFrench ("Hello world"); /// } /// /// [Problem ("The code contains long sequences of method calls: this means your code is heavily coupled to the navigation structure.")] [Solution ("You can apply the Hide Delegate refactoring or Extract Method to push down the chain.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidMessageChainsRule : Rule, IMethodRule { private int maxChainLength = 4; public int MaxChainLength { get { return maxChainLength; } set { maxChainLength = value; } } // this mask represents Callvirt, Call, Newobj and Newarr static OpCodeBitmask chain = new OpCodeBitmask (0x8000000000, 0x4400000000000, 0x400, 0x0); public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // no chain are possible without Call[virt] instructions within the method OpCodeBitmask calls = OpCodeBitmask.Calls; if (!calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; Log.WriteLine (this); Log.WriteLine (this, "-------------------------------------"); Log.WriteLine (this, method); // walk back so we don't process very long chains multiple times // (we don't need to go down to zero since it would not be big enough for a chain to exists) IList ic = method.Body.Instructions; for (int i = ic.Count - 1; i >= MaxChainLength; i--) { Instruction ins = ic [i]; // continue until we find a Call[virt] instruction if (!calls.Get (ins.OpCode.Code)) continue; // operators "break" chains MethodReference mr = (ins.Operand as MethodReference); if (mr.Name.StartsWith ("op_", StringComparison.Ordinal)) continue; int counter = 1; // trace back every call (including new objects and arrays) and // check if the caller is a call (i.e. not a local) Instruction caller = ins.TraceBack (method); while ((caller != null) && ValidLink (caller)) { counter++; i = ic.IndexOf (caller); caller = caller.TraceBack (method); } Log.WriteLine (this, "chain of length {0} at {1:X4}", counter, ins.Offset); if (counter > MaxChainLength) { string msg = String.Format (CultureInfo.CurrentCulture, "Chain length {0} versus maximum of {1}.", counter, MaxChainLength); Runner.Report (method, ins, Severity.Medium, Confidence.Normal, msg); } } return Runner.CurrentRuleResult; } static private bool ValidLink (Instruction ins) { bool valid = false; if (chain.Get (ins.OpCode.Code)) { // static method calls terminate chains MethodReference mr = ins.Operand as MethodReference; if (mr != null) { MethodDefinition method = mr.Resolve(); if (method != null && !method.IsStatic) valid = true; } else valid = true; // should be Newobj or Newarr } return valid; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Gendarme.Rules.Smells.csproj0000775000175000017500000001370512413742070032000 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {CC7BB0B5-094F-42F9-9CE7-1C33EF2B8A20} Library Properties Gendarme.Rules.Smells Gendarme.Rules.Smells v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 1591 1570 ..\..\console\bin\Debug\Gendarme.Rules.Smells.xml AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Smells.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6} Gendarme.Rules.Performance False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/AvoidLargeClassesRule.cs0000664000175000017500000001356212413742070031215 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.AvoidLargeClassesRule class // // Authors: // Néstor Salceda // // (C) 2007-2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { /// /// This rule allows developers to measure the classes size. When a /// class is trying to doing a lot of work, then you probabily have /// the Large Class smell. /// /// This rule will fire if a type contains too many fields (over 25 by default) or /// has fields with common prefixes. If the rule does fire then the type should /// be reviewed to see if new classes should be extracted from it. /// /// /// Bad example: /// /// public class MyClass { /// int x, x1, x2, x3; /// string s, s1, s2, s3; /// DateTime bar, bar1, bar2; /// string[] strings, strings1; /// } /// /// /// /// Good example: /// /// public class MyClass { /// int x; /// string s; /// DateTime bar; /// } /// /// //SUGGESTION: Public / Private ratios. //SUGGESTION: Lines of Code. //SUGGESTION: Weird distributions. [Problem ("The class is trying to do too much. Generally if a class is too large, duplicated code will not be far away.")] [Solution ("You can apply the Extract Class or Extract Subclass refactoring.")] public class AvoidLargeClassesRule : Rule,ITypeRule { private static int maxFields = 25; public static int MaxFields { get { return maxFields; } set { maxFields = value; } } List fields = new List (); private int GetNonConstantFieldsCount (TypeDefinition type) { fields.Clear (); //Skip the constants and others related from this check. //It's common use a class for store constants, by //example: Gendarme.Framework.MethodSignatures. foreach (FieldDefinition field in type.Fields) { if (field.IsSpecialName || field.HasConstant || field.IsInitOnly) continue; if (field.IsGeneratedCode ()) continue; fields.Add (field); } return fields.Count; } private int CountPrefixedFields (string prefix, int start) { int counter = 1; // include self for (int i = fields.Count - 1; i > start; i--) { FieldDefinition field = fields [i]; if (field.Name.StartsWith (prefix, StringComparison.Ordinal)) { fields.RemoveAt (i); counter++; } } return counter; } private static int GetIndexOfFirst (string value, Predicate predicate) { foreach (char character in value) if (predicate (character)) return value.IndexOf (character); return -1; } private static int GetIndexOfFirstDash (string value) { bool valueTruncated = false; if (value.IndexOf ('_') == 1) { value = value.Substring (2, value.Length - 2); valueTruncated = true; } foreach (char character in value) { if (character.Equals ('_')) return value.IndexOf (character) + (valueTruncated? 2 : 0); } return -1; } private static string GetFieldPrefix (MemberReference field) { string name = field.Name; int index = GetIndexOfFirst (name, delegate (char character) {return Char.IsNumber (character);}); if (index != -1) return name.Substring (0, index); index = GetIndexOfFirst (name, delegate (char character) {return Char.IsUpper (character);}); if (index != -1) return name.Substring (0, index); index = GetIndexOfFirstDash (name); if (index != -1) return name.Substring (0, index); return String.Empty; } private bool CheckForFieldCommonPrefixes (IMetadataTokenProvider type) { for (int i=0; i < fields.Count; i++) { FieldDefinition field = fields [i]; string prefix = GetFieldPrefix (field); if (prefix.Length == 0) continue; int count = CountPrefixedFields (prefix, i); if (count > 1) { string msg = String.Format (CultureInfo.InvariantCulture, "This type contains fields common prefixes: {0} fields prefixed with '{1}'.", count, prefix); Runner.Report (type, Severity.Medium, Confidence.High, msg); } } return false; } public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || !type.HasFields || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; int fcount = GetNonConstantFieldsCount (type); if (fcount > MaxFields) { string msg = String.Format (CultureInfo.InvariantCulture, "This type contains a lot of fields ({0} versus maximum of {1}).", fcount, MaxFields); Runner.Report (type, Severity.High, Confidence.High, msg); } // skip check if there are only constants or generated fields if (fcount > 0) CheckForFieldCommonPrefixes (type); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/AvoidSpeculativeGeneralityRule.cs0000664000175000017500000001733212413742070033154 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.AvoidSpeculativeGeneralityRule class // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Linq; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; using Gendarme.Rules.Performance; namespace Gendarme.Rules.Smells { // TODO: No one is going to know what "Abstract classes without responsibility" // or "Unnecessary delegation" are. It might also be nice to break at least // the unused arg check into a separate rule: it's fairly common in some frameworks // to have lots of unused arguments which makes this rule very annoying to use. // // The "Be carefull if you are developing a new framework" sentence in the summary // is very confusing. /// /// This rule allows developers to avoid the Speculative Generality smell. /// Be careful if you are developing a new framework or a new library, /// because this rule only inspects the assembly, then if you provide an /// abstract base class for extend by third party people, then the rule /// can warn you. You can ignore the message in this special case. /// /// We detect this smell by looking for: /// /// Abstract classes without responsibility /// Unnecessary delegation. /// Unused parameters. /// /// /// /// Bad example: /// /// // An abstract class with only one subclass. /// public abstract class AbstractClass { /// public abstract void MakeStuff (); /// } /// /// public class OverriderClass : AbstractClass { /// public override void MakeStuff () /// { /// } /// } /// /// If you use Telephone class only in one client, perhaps you don't need this kind of delegation. /// /// public class Person { /// int age; /// string name; /// Telephone phone; /// } /// /// public class Telephone { /// int areaCode; /// int phone; /// } /// /// /// /// Good example: /// /// public abstract class OtherAbstractClass{ /// public abstract void MakeStuff (); /// } /// /// public class OtherOverriderClass : OtherAbstractClass { /// public override void MakeStuff () /// { /// } /// } /// /// public class YetAnotherOverriderClass : OtherAbstractClass { /// public override void MakeStuff () /// { /// } /// } /// /// [Problem ("If you will need the feature in the future then you should implement it in the future.")] [Solution ("You can apply various refactorings: Collapse Hierarchy, Inline Class, Remove Parameter or Rename Method.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidSpeculativeGeneralityRule : Rule, ITypeRule { private bool HasExpectedInheritedTypeCount (TypeReference baseType, int expected) { int count = 0; foreach (AssemblyDefinition assembly in Runner.Assemblies) { foreach (ModuleDefinition module in assembly.Modules) { foreach (TypeDefinition type in module.GetAllTypes ()) { if ((baseType == type.BaseType) || (type.BaseType != null && type.BaseType.IsNamed (baseType.Namespace, baseType.Name))) { if (++count > expected) return false; } } } } return (count == expected); } private void CheckAbstractClassWithoutResponsability (TypeDefinition type) { if (type.IsAbstract) { if (HasExpectedInheritedTypeCount (type, 1)) Runner.Report (type, Severity.Medium, Confidence.Normal, "This abstract class has only one class inheritting from. Abstract classes without responsability are a sign for the Speculative Generality smell."); } } //return true if the method only contains only a single call. private static bool OnlyDelegatesCall (MethodDefinition method) { if (!method.HasBody) return false; // avoid looping if we're sure there's no call in the method if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return false; bool onlyOneCallInstruction = false; foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.Code == Code.Call || instruction.OpCode.Code == Code.Callvirt) if (onlyOneCallInstruction) return false; else onlyOneCallInstruction = true; } return onlyOneCallInstruction; } private static bool InheritsOnlyFromObject (TypeDefinition type) { return !type.HasInterfaces && type.BaseType.IsNamed ("System", "Object"); } private static bool MostlyMethodsDelegatesCall (TypeDefinition type) { if (!type.HasMethods) return false; // 0 / 2 + 1 <= 0 int methodCount = 0; int delegationCounter = 0; foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) continue; methodCount++; if (OnlyDelegatesCall (method)) delegationCounter++; } return methodCount / 2 + 1 <= delegationCounter; } private void CheckUnnecesaryDelegation (TypeDefinition type) { if (MostlyMethodsDelegatesCall (type) && InheritsOnlyFromObject (type)) Runner.Report (type, Severity.Medium, Confidence.Normal, "This class contains a lot of methods that only delegates the call to other. This kind of Delegation could be a sign for Speculative Generality"); } static bool AvoidUnusedParametersRuleScheduled (IRunner runner) { foreach (IRule rule in runner.Rules) { // skip rules that are loaded but inactive if (!rule.Active) continue; if (rule is AvoidUnusedParametersRule) return true; } return false; } private AvoidUnusedParametersRule avoidUnusedParameters; public override void Initialize (IRunner runner) { base.Initialize (runner); // look for AvoidUnusedParametersRule // note: we can be re-initialized multiple time (e.g. wizard runner) bool scheduled = AvoidUnusedParametersRuleScheduled (runner); if (!scheduled) { if (avoidUnusedParameters == null) avoidUnusedParameters = new AvoidUnusedParametersRule (); avoidUnusedParameters.Initialize (Runner); } else { avoidUnusedParameters = null; } } public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; CheckAbstractClassWithoutResponsability (type); if (avoidUnusedParameters != null) { foreach (MethodDefinition method in type.Methods) { avoidUnusedParameters.CheckMethod (method); } } CheckUnnecesaryDelegation (type); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/CodeDuplicatedLocator.cs0000664000175000017500000001316012413742070031221 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.CodeDuplicatedLocator class // // Authors: // Néstor Salceda // // (C) 2007-2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { internal sealed class CodeDuplicatedLocator { static ReadOnlyCollection Empty = new ReadOnlyCollection (new List ()); HashSet methods = new HashSet (); HashSet types = new HashSet (); Dictionary> patternsCached = new Dictionary> (); IRule parent_rule; internal CodeDuplicatedLocator (IRule rule) { parent_rule = rule; } internal ICollection CheckedMethods { get { return methods; } } internal ICollection CheckedTypes { get { return types; } } internal void Clear () { methods.Clear (); types.Clear (); } internal void CompareMethodAgainstTypeMethods (MethodDefinition current, TypeDefinition targetType) { if (CheckedTypes.Contains (targetType.Name)) return; foreach (MethodDefinition target in targetType.Methods) { if (target.IsConstructor || target.IsGeneratedCode ()) continue; Pattern duplicated = GetDuplicatedCode (current, target); if (duplicated != null && duplicated.Count > 0) { parent_rule.Runner.Report (current, duplicated[0], Severity.High, Confidence.Normal, String.Format (CultureInfo.InvariantCulture, "Duplicated code with {0}", target.GetFullName ())); } } } bool CanCompareMethods (MethodDefinition current, MethodDefinition target) { return current.HasBody && target.HasBody && !CheckedMethods.Contains (target.Name) && current != target; } [Conditional ("DEBUG")] void WriteToOutput (MethodDefinition current, MethodDefinition target, Pattern found) { Log.WriteLine (this, "Found pattern in {0} and {1}", current, target); Log.WriteLine (this, "\t Pattern"); for (int index = 0; index < found.Count; index++) Log.WriteLine (this, "\t\t{0} - {1}", found[index].OpCode.Code, found[index].Operand != null? found[index].Operand : "No operator"); } Pattern GetDuplicatedCode (MethodDefinition current, MethodDefinition target) { if (!CanCompareMethods (current, target)) return null; IList patterns = GetPatterns (current); if (patterns.Count == 0) return null; InstructionMatcher.Current = current; InstructionMatcher.Target = target; foreach (Pattern pattern in patterns) { if (pattern.IsCompilerGeneratedBlock || !pattern.IsExtractableToMethodBlock) continue; if (InstructionMatcher.Match (pattern, target.Body.Instructions)) { WriteToOutput (current, target, pattern); return pattern; } } return null; } IList GetPatterns (MethodDefinition method) { IList patterns = Empty; if (!patternsCached.TryGetValue (method, out patterns)) { patterns = GeneratePatterns (method); patternsCached.Add (method, patterns); } return patterns; } //TODO: Still needs some testing in order to get the best size //for every case: // The idea is get two overlapped statements in high level language static IList GeneratePatterns (MethodDefinition method) { Stack> result = new Stack> (); Stack current = new Stack (); int stackCounter = 0; var instructions = method.Body.Instructions; for (int index = instructions.Count - 1; index >= 0; index--) { Instruction currentInstruction = instructions [index]; stackCounter += currentInstruction.GetPushCount (); stackCounter -= currentInstruction.GetPopCount (method); if (result.Count != 0) result.Peek ().Push (currentInstruction); current.Push (currentInstruction); if (stackCounter == 0 && current.Count > 1) {//&& currentInstruction.OpCode.FlowControl != FlowControl.Branch) { result.Push (current); current = new Stack (); } } //We can remove the first ocurrence if (result.Count != 0) result.Pop (); if (result.Count == 0) return Empty; IList res = new List (); foreach (Stack stack in result) res.Add (new Pattern (stack.ToArray ())); return res; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/AvoidCodeDuplicatedInSameClassRule.cs0000664000175000017500000000753712413742070033606 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.AvoidCodeDuplicatedInSameClassRule class // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { /// /// This rule checks for duplicated code in the same class. /// /// /// Bad example: /// /// public class MyClass { /// private IList myList; /// /// public MyClass () { /// myList = new ArrayList (); /// myList.Add ("Foo"); /// myList.Add ("Bar"); /// myList.Add ("Baz"); /// } /// /// public void MakeStuff () { /// foreach (string value in myList) { /// Console.WriteLine (value); /// } /// myList.Add ("FooReplied"); /// } /// /// public void MakeMoreStuff () { /// foreach (string value in myList) { /// Console.WriteLine (value); /// } /// myList.Remove ("FooReplied"); /// } /// } /// /// /// /// Good example: /// /// public class MyClass { /// private IList myList; /// /// public MyClass () { /// myList = new ArrayList (); /// myList.Add ("Foo"); /// myList.Add ("Bar"); /// myList.Add ("Baz"); /// } /// /// private void PrintValuesInList () { /// foreach (string value in myList) { /// Console.WriteLine (value); /// } /// } /// /// public void MakeStuff () { /// PrintValuesInList (); /// myList.Add ("FooReplied"); /// } /// /// public void MakeMoreStuff () { /// PrintValuesInList (); /// myList.Remove ("FooReplied"); /// } /// } /// /// [Problem ("There is similar code in various methods in the same class. Your code will be better if you can unify them.")] [Solution ("You should apply the Extract Method refactoring and have a single implementation of the code.")] public class AvoidCodeDuplicatedInSameClassRule : Rule, ITypeRule { private CodeDuplicatedLocator locator; public AvoidCodeDuplicatedInSameClassRule () { locator = new CodeDuplicatedLocator (this); } public RuleResult CheckType (TypeDefinition type) { // don't analyze cases where no methods (or body) are available if (type.IsEnum || type.IsInterface || !type.HasMethods) return RuleResult.DoesNotApply; // ignore code generated by compiler/tools, since they can generate some amount of duplicated code if (type.IsGeneratedCode ()) return RuleResult.DoesNotApply; locator.Clear (); foreach (MethodDefinition current in type.Methods) { locator.CompareMethodAgainstTypeMethods (current, type); locator.CheckedMethods.AddIfNew (current.Name); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/0000775000175000017500000000000012642235743025423 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/ChangeLog0000664000175000017500000001433312413742070027171 0ustar00directhexdirecthex000000000000002010-06-10 Sebastien Pouliot * AvoidLargeClassesTest.cs: Adjust defects count for prefixes 2010-06-10 Sebastien Pouliot * AvoidCodeDuplicatedInSameClassTest.cs: Add test case for a (fixed) false positive when compiled with CSC 2010-01-26 Sebastien Pouliot * AvoidMessageChainsTest.cs: Adjust test to new condition and values. 2010-01-24 Sebastien Pouliot * AvoidSwitchStatementsTest.cs: Deal with different compiler generated names for iterators (gmcs versus csc). Also make the switch/case on string longer (> 6) so CSC won't optimize it as a serie of String::op_Equality (failing the unit test) 2008-12-22 Néstor Salceda * AvoidSwitchStatementsTest.cs: Added a test for table-driven comparisons, by example with strings. 2008-12-22 Néstor Salceda * AvoidSwitchStatementsTest.cs: New. Unit tests for AvoidSwitchStatementsRule. 2008-12-17 Sebastien Pouliot * AvoidCodeDuplicatedInSameClassTest.cs: Fix a test case so it compiles with CSC (mcs bug #460016) 2008-12-17 Néstor Salceda * AvoidCodeDuplicatedInSameClassTest.cs: Added more tests in order to improve the confidence about the code duplicated rules. 2008-12-15 Sebastien Pouliot * AvoidLargeClassesTest.cs: Test for DoesNotApply if a type has no fields. 2008-11-07 Alan McGovern * Tests.Rules.Smells.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-11-02 Jesse Jones * AvoidMessageChainsTest.cs: Added two test cases 1) verify that we work if distinct chains are not separated by a non-call 2) verify that a relatively complex linq query does not fail. 2008-09-15 Néstor Salceda * AvoidCodeDuplicatedInSameClassTest.cs: Added test for the issue that Alan notified to the group. 2008-09-10 Sebastien Pouliot * AvoidMessageChainsTest.cs: Re-enable some tests and add new ones for better coverage. * Tests.Rules.Smells.csproj: Add tests to MD project file. 2008-08-14 Sebastien Pouliot * AvoidSpeculativeGeneralityTest.cs: Update unit tests to the new syntax. * Tests.Rules.Smells.csproj: Add a reference to Mono.Cecil.Pdb.dll to make sure it's available when running unit tests. 2008-08-12 Sebastien Pouliot * AvoidLongMethodsTest.cs: Update unit tests to the new syntax. Test cases are now reused in both the (old) IL-approximation mode and the (new) logical source line of code modes. 2008-07-21 Nestor Salceda * AvoidLongMethodsTest.cs: Add test case for a class with readonly fields. 2008-07-18 Nestor Salceda * AvoidLongMethodsTest.cs: Add test case for non-static constructors. 2008-07-16 Sebastien Pouliot * AvoidLongParameterListsTest.cs: Add test case for MulticastDelegate 2008-05-11 Andres G. Aragoneses * Test.Rules.Smells.mdp: Fix references. 2008-05-10 Nestor Salceda * AvoidLargeClassesTest.cs, AvoidSpeculativeGeneralityTest.cs, AvoidCodeDuplicatedInSameClassTest.cs, AvoidLongMethodsTest.cs, AvoidCodeDuplicatedInSiblingClassesTest.cs: The reference for TestRunner class has been changed, it is placed now in Test.Rules.Helpers namespace. 2008-05-06 Sebastien Pouliot * AvoidLongParameterListsTest.cs: Add test case with a static ctor and a long instance ctor. 2008-04-26 Nestor Salceda * AvoidMessageChainsTest.cs: Added tests for check chains in the arguments. 2008-02-07 Nestor Salceda * AvoidLargeClassesTest.cs: Added a test for class storing common constant values. 2008-02-07 Nestor Salceda * AvoidLongMethodsTest.cs: Added a test for the new strategy for static constructors. 2008-02-06 Nestor Salceda * AvoidLongMethodsTest.cs: Added a test for static constructors. This rule shouldn't be applied to static constructors. 2008-01-16 Nestor Salceda * AvoidLargeClassesTest.cs: Added tests for skip the enums. This rule shouldn't be applied to enums. 2008-01-12 Sebastien Pouliot * AvoidLongParameterListsTest.cs: Don't report defects for p/invokes 2008-01-05 Sebastien Pouliot * AvoidLargeClassesTest.cs: Added test cases for const and readonly fields. Added test case for auto-implemented properties (C# 3) 2007-11-30 Nestor Salceda * AvoidCodeDuplicatedInSameClassTest.cs: Added the test for avoid the error if the code stores in a class field. 2007-11-29 Nestor Salceda * AvoidSpeculativeGeneralityTest.cs: Updated unit test for the new behavior for unnecessary delegation. 2007-10-07 Sebastien Pouliot * Test.Rules.Smells.mdp: Update project file. 2007-10-05 Nestor Salceda * Test.Rules.Smells.mdp: Changed output directory, by convention looking other Test.Rules.* projects. 2007-10-04 Nestor Salceda * Test.Rules.Smells.mdp: Removed empty directory entry in the MonoDevelop project file. 2007-10-04 Nestor Salceda * Test.Rules.Smells.mdp: New. Created MonoDevelop project file for the unit tests for the smell rules. 2007-09-14 Nestor Salceda * AvoidCodeDuplicatedInSameClassTest.cs, AvoidCodeDuplicatedInSiblingClassesTest.cs, AvoidLargeClassesTest.cs, AvoidLongMethodsTest.cs, AvoidLongParameterListsTest.cs, AvoidSpeculativeGeneralityTest.cs: Added svn propset svn:eol-native. 2007-09-14 Nestor Salceda * AvoidCodeDuplicatedInSameClassTest.cs, AvoidCodeDuplicatedInSiblingClassesTest.cs, AvoidLargeClassesTest.cs, AvoidLongMethodsTest.cs, AvoidLongParameterListsTest.cs, AvoidSpeculativeGeneralityTest.cs: New. Unit tests for the rules. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLongMethodsTest.cs0000664000175000017500000010227212413742070032014 0ustar00directhexdirecthex00000000000000// // Unit Test for AvoidLongMethods Rule. // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 System.Windows.Forms; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Smells; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; //Stubs for the Gtk testing. namespace Gtk { public class Bin { } public class Dialog { } public class Window { } } namespace Test.Rules.Smells { public class LongStaticConstructorWithFields { static readonly int foo; static string bar; static object baz; static LongStaticConstructorWithFields () { foo = 5; bar = "MyString"; baz = new object (); Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } public class LongStaticConstructorWithoutFields { static LongStaticConstructorWithoutFields () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } public class LongConstructorWithReadonlyFields { readonly int foo; readonly string bar, bar1, bar2, bar3; readonly object baz, baz1, baz2, baz3; public LongConstructorWithReadonlyFields () { foo = 5; bar = "MyString"; baz = new object (); Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } public class LongConstructorWithFields { readonly int foo; string bar, bar1, bar2, bar3; object baz, baz1, baz2, baz3; public LongConstructorWithFields () { foo = 5; bar = "MyString"; baz = new object (); Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } public class LongConstructorWithoutFields { public LongConstructorWithoutFields () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } public class MainWidget : Gtk.Bin { protected virtual void Build () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } public void InitializeComponent () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } public class MainDialog : Gtk.Dialog { protected virtual void Build () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } public void InitializeComponent () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } public class MainWindow : Gtk.Window { protected virtual void Build () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } public void InitializeComponent () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } public class MainForm : Form { public void InitializeComponent () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } protected virtual void Build () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } } [TestFixture] public class AvoidLongMethodsTest : MethodRuleTestFixture { public void LongMethod () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } public void ShortMethod () { try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } public void Build () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } public void InitializeComponent () { Console.WriteLine ("I'm writting a test, and I will fill a screen with some useless code"); IList list = new ArrayList (); list.Add ("Foo"); list.Add (4); list.Add (6); IEnumerator listEnumerator = list.GetEnumerator (); while (listEnumerator.MoveNext ()) Console.WriteLine (listEnumerator.Current); try { list.Add ("Bar"); list.Add ('a'); } catch (NotSupportedException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } foreach (object value in list) { Console.Write (value); Console.Write (Environment.NewLine); } int x = 0; for (int i = 0; i < 100; i++) x++; Console.WriteLine (x); string useless = "Useless String"; if (useless.Equals ("Other useless")) { useless = String.Empty; Console.WriteLine ("Other useless string"); } useless = String.Concat (useless," 1"); for (int j = 0; j < useless.Length; j++) { if (useless[j] == 'u') Console.WriteLine ("I have detected an u char"); else Console.WriteLine ("I have detected an useless char"); } try { foreach (string environmentVariable in Environment.GetEnvironmentVariables ().Keys) Console.WriteLine (environmentVariable); } catch (System.Security.SecurityException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } Console.WriteLine ("I will add more useless code !!"); try { if (!(File.Exists ("foo.txt"))) { File.Create ("foo.txt"); File.Delete ("foo.txt"); } } catch (IOException exception) { Console.WriteLine (exception.Message); Console.WriteLine (exception); } } [Test] public void LongMethodTest () { AssertRuleFailure ("LongMethod", 1); } [Test] public void EmptyMethodTest () { AssertRuleSuccess (SimpleMethods.EmptyMethod); } [Test] public void ShortMethodTest () { AssertRuleSuccess ("ShortMethod"); } [Test] public void FalseBuildMethodTest () { AssertRuleFailure ("Build", 1); } [Test] public void WidgetBuildMethodTest () { AssertRuleDoesNotApply ("Build"); } [Test] public void WidgetInitializeComponentMethodTest () { AssertRuleFailure ("InitializeComponent", 1); } [Test] public void DialogBuildMethodTest () { AssertRuleDoesNotApply ("Build"); } [Test] public void DialogInitializeComponentMethodTest () { AssertRuleFailure ("InitializeComponent", 1); } [Test] public void WindowBuildMethodTest () { AssertRuleDoesNotApply ("Build"); } [Test] public void WindowInitializeComponentMethodTest () { AssertRuleFailure ("InitializeComponent", 1); } [Test] public void FalseInitializeComponentTest () { AssertRuleFailure ("InitializeComponent", 1); } [Test] public void FormInitializeComponentTest () { AssertRuleDoesNotApply ("InitializeComponent"); } [Test] public void FormBuildMethodTest () { AssertRuleFailure ("Build", 1); } [Test] public void LongStaticConstructorWithoutFieldsTest () { AssertRuleFailure (".cctor", 1); } [Test] public void LongStaticConstructorWithFieldsTest () { AssertRuleSuccess (".cctor"); } [Test] public void LongConstructorWithoutFieldsTest () { AssertRuleFailure (".ctor", 1); } [Test] public void LongConstructorWithFieldsTest () { AssertRuleSuccess (".ctor"); } [Test] public void LongConstructorWithReadonlyFieldsTest () { AssertRuleSuccess (".ctor"); } } [TestFixture] public class AvoidLongMethods_IlTest : AvoidLongMethodsTest { public AvoidLongMethods_IlTest () { Rule.UseIlApproximation = true; } } [TestFixture] public class AvoidLongMethods_SlocTest : AvoidLongMethodsTest { public AvoidLongMethods_SlocTest () { Rule.UseIlApproximation = false; } [TestFixtureSetUp] public void FixtureSetUp () { AssemblyDefinition assembly = DefinitionLoader.GetAssemblyDefinition (); if (!assembly.MainModule.HasSymbols) Assert.Ignore ("Debugging symbols non-available to compute SLOC."); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLargeClassesTest.cs0000664000175000017500000001570612413742070032146 0ustar00directhexdirecthex00000000000000// // Unit Test for AvoidLargeClasses Rule. // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2007 Néstor Salceda // 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; using System.Reflection; using Mono.Cecil; using NUnit.Framework; using Gendarme.Framework; using Gendarme.Rules.Smells; using Test.Rules.Helpers; namespace Test.Rules.Smells { public enum LargeEnum { X, X1, X2, X3, X4, X5, X6, X7, X8, X9, Y, Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Z, Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, W, W1, W2, W3, W4, W5, W6, W7, W8, W9 } public class LargeClass { int x, x1, x2, x3; string foo, foo1, foo2, foo3; DateTime bar, bar1, bar2, bar3; float f, f1, f2, f3; char c, c1, c2, c3; short s, s1, s2, s3; string[] array; } public class ConstantClass { const int x = 0, x1 = 1, x2 = 2, x3 = 3; static readonly string foo, foo1, foo2, foo3; static readonly DateTime bar, bar1, bar2, bar3; float one, two, three, four; const char c = 'c', c1 = 'b', c2 = 'a', c3 = 'z'; const short s = 2, s1 = 4, s2 = 6, s3 = 8; static readonly string[] array; } public class ClassWithPrefixedFieldsWithCamelCasing { int fooBar; int fooBaz; } public class ClassWithoutPrefixedFieldsWithMDashCasing { int m_member; int m_other; } public class ClassWithPrefixedFieldsWithMDashCasing { int m_foo_bar; int m_foo_baz; } public class ClassWithPrefixedFieldsWithDashCasing { int phone_number; int phone_area_code; } public class ClassWithSomeConstantsFields { public const string DefaultPath = "path"; public const string DefaultConfig = "config"; } public class ClassWithSomeReadOnlyFields { public readonly int DefaultInteger = 1; public readonly double DefaultDouble = 1.0d; } public class NoFieldClass { } public class NotLargeClass { int a; } class AutoImplementedPropertiesClass { public double DoubleProperty { get; set; } public string StringProperty { get; set; } public int Int32ReadOnlyProperty { get; private set; } } [TestFixture] public class AvoidLargeClassesTest { private ITypeRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new AvoidLargeClassesRule (); runner = new TestRunner (rule); } [Test] public void LargeClassTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.LargeClass"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "Test.Rules.Smells.LargeClass failure test"); // 'x', 'foo', 'bar', 'f', 'c' and 's' are reported as prefixes Assert.AreEqual (6, runner.Defects.Count, "Test.Rules.Smells.LargeClass defect count check"); } [Test] public void NotLargeClassTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.NoFieldClass"); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckType (type), "Test.Rules.Smells.NoFieldClass does not apply test"); type = assembly.MainModule.GetType ("Test.Rules.Smells.NotLargeClass"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type), "Test.Rules.Smells.NotLargeClass success test"); } [Test] public void ConstantClassTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.ConstantClass"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type)); } [Test] public void ClassWithPrefixedFieldsWithCamelCasingTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.ClassWithPrefixedFieldsWithCamelCasing"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "Test.Rules.Smells.ClassWithPrefixedFieldsWithCamelCasing failure test"); Assert.AreEqual (1, runner.Defects.Count, "Test.Rules.Smells.ClassWithPrefixedFieldsWithCamelCasing defect count check"); } [Test] public void ClassWithoutPrefixedFieldsWithMDashCasingTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.ClassWithoutPrefixedFieldsWithMDashCasing"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type)); } [Test] public void ClassWithPrefixedFieldsWithDashCasingTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.ClassWithPrefixedFieldsWithDashCasing"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "Test.Rules.Smells.ClassWithPrefixedFieldsWithDashCasing failure test"); Assert.AreEqual (1, runner.Defects.Count, "Test.Rules.Smells.ClassWithPrefixedFieldsWithDashCasing defect count check"); } [Test] public void ClassWithPrefixedFieldsWithMDashCasingTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.ClassWithPrefixedFieldsWithMDashCasing"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "Test.Rules.Smells.ClassWithPrefixedFieldsWithMDashCasing failure test"); Assert.AreEqual (1, runner.Defects.Count, "Test.Rules.Smells.ClassWithPrefixedFieldsWithMDashCasing defect count check"); } [Test] public void ClassWithSomeConstantsFields () { type = assembly.MainModule.GetType ("Test.Rules.Smells.ClassWithSomeConstantsFields"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type)); } [Test] public void ClassWithSomeReadOnlyFields () { type = assembly.MainModule.GetType ("Test.Rules.Smells.ClassWithSomeReadOnlyFields"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type)); } [Test] public void ClassWithAutoImplementedProperties () { type = assembly.MainModule.GetType ("Test.Rules.Smells.AutoImplementedPropertiesClass"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type)); } [Test] public void EnumsShouldNotBeCheckedTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.LargeEnum"); Assert.AreEqual (RuleResult.DoesNotApply, runner.CheckType (type)); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj0000775000175000017500000001401312413742070032270 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {986B9EFB-7494-4410-8B01-56AB42388643} Library Properties Tests.Rules.Smells Tests.Rules.Smells v4.0 512 3.5 publish\ true Disk false Foreground 7 Days false false true 0 1.0.0.%2a false false true true full true ..\..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 Form {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {CC7BB0B5-094F-42F9-9CE7-1C33EF2B8A20} Gendarme.Rules.Smells False .NET Framework 3.5 SP1 Client Profile false False .NET Framework 3.5 SP1 true False Windows Installer 3.1 true mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSpeculativeGeneralityTest.cs0000664000175000017500000000727412413742070034107 0ustar00directhexdirecthex00000000000000// // Unit Test for AvoidSpeculativeGenerality Rule. // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Generic; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Rules.Smells; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Smells { // public abstract class AbstractClass { public abstract void MakeStuff (); } public class OverriderClass : AbstractClass { public override void MakeStuff () { } } // public abstract class OtherAbstractClass { public abstract void MakeStuff (); } public class OtherOverriderClass : OtherAbstractClass { public override void MakeStuff () { } } public class YetAnotherOverriderClass : OtherAbstractClass { public override void MakeStuff () { } } // public class ClassWithUnusedParameter { public void Foo (int x) { } } public class ClassWithFourUnusedParameters { public void Foo (int x) { } public void Bar (int x, char f) { } public void Baz (float f) { } } // public class UnnecessaryDelegatedClass { public void WriteLine (string message) { Console.WriteLine (message); } public DateTime GetDateTime () { return DateTime.Now; } } // public class NotUnnecessaryDelegatedClass { public void WriteLog (string message) { Console.WriteLine ("Starting Logging..."); Console.WriteLine ("[LOGGING FOR] {0}", message); } public void PrintBanner () { Console.WriteLine ("This is a simple banner"); Console.WriteLine ("For the incredible Foo-Bar program"); Console.WriteLine ("Send your suggestions to foo@domain.com"); } public DateTime GetDateTime () { return DateTime.Now; } } [TestFixture] public class AvoidSpeculativeGeneralityTest : TypeRuleTestFixture { [Test] public void AbstractClassesWithoutResponsabilityTest () { AssertRuleFailure (1); } [Test] public void AbstractClassesWithResponsabilityTest () { AssertRuleSuccess (); } [Test] public void ClassWithUnusedParameterTest () { AssertRuleFailure (1); } [Test] public void ClassWithFourUnusedParametersTest () { AssertRuleFailure (4); } [Test] public void ClassWithUnnecessaryDelegationTest () { AssertRuleFailure (1); } [Test] public void ClassWithoutUnnecessaryDelegationTest () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/Makefile.in0000664000175000017500000003141612642235732027473 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Smells/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Smells.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Smells/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Smells/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidCodeDuplicatedInSiblingClassesTest.cs0000664000175000017500000000673312413742070035564 0ustar00directhexdirecthex00000000000000// // Unit Test for AvoidCodeDuplicatedInSiblingClasses Rule. // // Authors: // Néstor Salceda // // (C) 2007 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Rules.Smells; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Helpers; namespace Test.Rules.Smells { public class BaseClassWithCodeDuplicated { protected IList list; } public class OverriderClassWithCodeDuplicated : BaseClassWithCodeDuplicated { public void CodeDuplicated () { foreach (int i in list) { Console.WriteLine (i); } list.Add (1); } } public class OtherOverriderWithCodeDuplicated : BaseClassWithCodeDuplicated { public void OtherMethod () { foreach (int i in list) { Console.WriteLine (i); } list.Remove (1); } } public class BaseClassWithoutCodeDuplicated { protected IList list; protected void PrintValuesInList () { foreach (int i in list) { Console.WriteLine (i); } } } public class OverriderClassWithoutCodeDuplicated : BaseClassWithoutCodeDuplicated { public void SomeCode () { PrintValuesInList (); list.Add (1); } } public class OtherOverriderWithoutCodeDuplicated : BaseClassWithoutCodeDuplicated { public void MoreCode () { PrintValuesInList (); list.Remove (1); } } [TestFixture] public class AvoidCodeDuplicatedInSiblingClassesTest { private ITypeRule rule; private AssemblyDefinition assembly; private TypeDefinition type; private TestRunner runner; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); rule = new AvoidCodeDuplicatedInSiblingClassesRule (); runner = new TestRunner (rule); } [Test] public void BaseClassWithCodeDuplicatedTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.BaseClassWithCodeDuplicated"); Assert.AreEqual (RuleResult.Failure, runner.CheckType (type), "Test.Rules.Smells.BaseClassWithCodeDuplicated failure test"); Assert.AreEqual (1, runner.Defects.Count, "Test.Rules.Smells.BaseClassWithCodeDuplicated defect count check"); } [Test] public void BaseClassWithoutCodeDuplicatedTest () { type = assembly.MainModule.GetType ("Test.Rules.Smells.BaseClassWithoutCodeDuplicated"); Assert.AreEqual (RuleResult.Success, runner.CheckType (type)); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidLongParameterListsTest.cs0000664000175000017500000001361012413742070033345 0ustar00directhexdirecthex00000000000000// // Unit Test for AvoidLongParameterLists Rule. // // Authors: // Néstor Salceda // // (C) 2007-2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Runtime.InteropServices; using Mono.Cecil; using NUnit.Framework; using Gendarme.Framework; using Gendarme.Rules.Smells; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Smells { [TestFixture] public class AvoidLongParameterListsTest : TypeRuleTestFixture { class ExternalMethodWrapper { [DllImport ("gdiplus.dll")] static internal extern int GdipCreateLineBrushFromRectI (object rect, int color1, int color2, int linearGradientMode, int wrapMode, IntPtr brush); } [Test] public void ExternalMethodTest () { AssertRuleDoesNotApply (); } class MethodWithoutLongParametersWrapper { public void SimpleMethod () {} public void MethodWithoutLongParameterList (int x, char c, object obj, bool j, string f) {} } [Test] public void MethodWithoutParametersTest () { AssertRuleSuccess (); } class MethodWithLongParametersWrapper { public void MethodWithLongParameterList (int x, char c, object obj, bool j, string f, float z, double u, short s, int v, string[] array) {} } [Test] public void MethodWithLongParametersTest () { AssertRuleFailure (1); } class OverloadedMethodWrapper { public void MethodWithLongParameterList (int x, char c, object obj, bool j, string f, float z, double u, short s, int v, string[] array) {} public void MethodWithLongParameterList (int x, char c) {} } [Test] public void OverloadedMethodWrapperTest () { AssertRuleSuccess (); } class FailingOverloadedMethodWrapper { public void MethodWithLongParameterList (int x, char c, object obj, bool j, string f, float z, double u, short s, int v, string[] array) {} public void MethodWithLongParameterList (int x, char c, object obj, bool j, string f, float z, double u, short s) {} } [Test] public void FailingOverloadedMethodWrapperTest () { //Only report de smaller fail AssertRuleFailure (1); } class VariousViolationsMethodWrapper { [DllImport ("gdiplus.dll")] static internal extern int GdipCreateLineBrushFromRectI (object rect, int color1, int color2, int linearGradientMode, int wrapMode, IntPtr brush); public void SimpleMethod () {} public void FirstOverload (int x, char c, object obj, bool j, string f) {} public void FirstOverload (int x, char c, object obj, bool j, string f, float z, double u, short s, int v, string[] array) {} public void SecondOverload (int x, char c) {} public void SecondOverload (int x, char c, object obj, bool j, string f, float z, double u, short s, int v, string[] array) {} public void ThirdOverload (int x, char c, object obj, bool j, string f, float z, double u, short s) {} public void ThirdOverload (int x, char c, object obj, bool j, string f, float z, double u, short s, int v, string[] array) {} public void FourthOverload (int x, char c, object obj, bool j, string f, float z, double u, short s) {} public void FourthOverload (int x, char c, object obj, bool j, string f, float z, double u, short s, int v, string[] array) {} } [Test] public void VariousViolationsMethodWrapperTest () { //Fail the Third and Fourth Overloads AssertRuleFailure (2); } class ShortConstructorWrapper { public ShortConstructorWrapper (int x, float f, char c) {} } [Test] public void ShortConstructorWrapperTest () { AssertRuleSuccess (); } class LongConstructorWrapper { public LongConstructorWrapper (int x, float f, char c, string str, object obj, double d, short s, object[] array) {} } [Test] public void LongConstructorWrapperTest () { AssertRuleFailure (1); } class ShortDelegateWrapper { public delegate void ShortDelegate (int x, char c); } [Test] public void ShortDelegateWrapperTest () { AssertRuleSuccess (); } class LongDelegateWrapper { public delegate void LongDelegate (int x, float f, char c, string str, object obj, double d, short s, object[] array); } [Test] public void LongDelegateWrapperTest () { AssertRuleFailure (1); } class StaticConstructor { static StaticConstructor () { } public StaticConstructor (int a, bool b, char c, double d, Enum e, float f) { } } [Test] public void StaticConstructorTest () { AssertRuleFailure (1); } [Test] public void MulticastDelegateTest () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidCodeDuplicatedInSameClassTest.cs0000664000175000017500000004657312413742070034540 0ustar00directhexdirecthex00000000000000// // Unit Test for AvoidCodeDuplicatedInSameClass Rule. // // Authors: // Néstor Salceda // // (C) 2007 - 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Reflection; using System.IO; using System.Xml; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Smells; using Mono.Cecil; using Mono.Cecil.Cil; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Smells { [TestFixture] public class AvoidCodeDuplicatedInSameClassTest : TypeRuleTestFixture { static IList myList; class DuplicatedCodeWithForeachLoops { public void PrintAndAddANewValue () { foreach (string value in myList) Console.WriteLine (value); myList.Add ("FooReplied"); } public void PrintAndRemoveANewValue () { foreach (string value in myList) Console.WriteLine (value); myList.Remove ("FooReplied"); } } [Test] public void FailOnDuplicatedCodeWithForeachLoopsTest () { AssertRuleFailure (1); } class DuplicatedCodeInDifferentPlaces { public void ShowBannerAndAdd () { Console.WriteLine ("Banner"); Console.WriteLine ("Print"); myList.Add ("MoreBar"); } public void AddAndShowBanner () { myList.Add ("MoreFoo"); Console.WriteLine ("Banner"); Console.WriteLine ("Print"); } } [Test] public void FailOnDuplicatedCodeInDifferentPlacesTest () { AssertRuleFailure (1); } class DuplicatedCodeInForLoop { public void PrintUsingAForLoopAndAddAValue () { for (int index = 0; index < myList.Count; index++) Console.WriteLine (myList[index]); myList.Add ("MoreFoo"); } public void PrintUsingAForLoopAndRemoveAValue () { for (int index = 0; index < myList.Count; index++) Console.WriteLine (myList[index]); myList.Remove ("MoreFoo"); } } [Test] public void FailOnDuplicatedCodeInForLoopTest () { AssertRuleFailure (1); } class DuplicatedCodeInConditional { public void IfConditionAndRemove () { if (myList.Contains ("MoreFoo") & myList.Contains ("MoreBar")) myList.Remove ("MoreFoo"); } public void IfConditionAndRemoveReplied () { if (myList.Contains ("MoreFoo") & myList.Contains ("MoreFoo")) myList.Remove ("MoreFoo"); } } [Test] public void FailOnDuplicatedCodeInConditionalTest () { AssertRuleFailure (1); } class NonDuplicatedWithOneInstructionOnly { public void WriteLine () { Console.WriteLine ("Foo"); } public void WriteTheSame () { Console.WriteLine ("Foo"); } } [Test] public void SuccessOnNonDuplicatedWithOneInstructionOnlyTest () { AssertRuleSuccess (); } class LazyLoad { IList otherList; public IList MyList { get { if (myList == null) myList = new ArrayList (); return myList; } } public IList OtherList { get { if (otherList == null) otherList = new ArrayList (); return otherList; } } } [Test] public void SuccesOnLazyLoadTest () { AssertRuleSuccess (); } class NonDuplicatedForeachLoop { void PrintValuesInList () { foreach (string value in myList) Console.WriteLine (value); } public void PrintAndAddANewValue () { PrintValuesInList (); myList.Add ("FooReplied"); } public void PrintAndRemoveANewValue () { PrintValuesInList (); myList.Remove ("FooReplied"); } } [Test] public void SuccessOnNonDuplicatedForeachLoopTest () { AssertRuleSuccess (); } class NonDuplicatedForLoop { private void PrintValuesInListUsingAForLoop () { for (int index = 0; index < myList.Count; index++) Console.WriteLine (myList[index]); } public void PrintUsingAForLoopAndRemoveAValueIfNotExists () { PrintValuesInListUsingAForLoop (); if (!myList.Contains ("Bar")) myList.Remove ("Bar"); } public void PrintUsingAForLoopAndRemoveAValueIfExists () { PrintValuesInListUsingAForLoop (); if (myList.Contains ("Bar")) myList.Remove ("Bar"); } } [Test] public void SuccessOnNonDuplicatedForLoopTest () { AssertRuleSuccess (); } //Smaller tests class NonDuplicatedCodeIntoForeachLoop { public void PrintValues () { foreach (string value in myList) Console.WriteLine (value); } public void PrintValuesInSameLine () { foreach (string value in myList) Console.Write (value); } } [Test] public void SuccessOnNonDuplicatedCodeIntoForeachLoopTest () { AssertRuleSuccess (); } class NonDuplicatedCodeWithUsingBlock { public void UsingAndReadStream () { using (Stream stream = new FileStream ("sample.txt", FileMode.Open)) stream.ReadByte (); } public void UsingAndWriteStream () { using (Stream stream = new FileStream ("sample.txt", FileMode.Create)) stream.WriteByte (1); } } [Test] public void SuccessOnNonDuplicatedCodeWithUsingBlockTest () { AssertRuleSuccess (); } class NonDuplicatedInSwitchs { Severity severity = Severity.Low; Confidence confidence = Confidence.Normal; //Althoug both are referring to option as argument, it //isn't the same switch. public void FirstNonDuplicatedSwitch (string option) { switch (option) { case "AUDIT": case "AUDIT+": case "AUDIT-": severity = Severity.Audit; break; case "LOW": case "LOW+": case "LOW-": severity = Severity.Low; break; case "MEDIUM": case "MEDIUM+": case "MEDIUM-": severity = Severity.Medium; break; case "HIGH": case "HIGH+": case "HIGH-": severity = Severity.High; break; case "CRITICAL": case "CRITICAL+": case "CRITICAL-": severity = Severity.Critical; break; default: break; } } public void SecondNonDuplicatedSwitch (string option) { switch (option) { case "LOW": case "LOW+": case "LOW-": confidence = Confidence.Low; break; case "NORMAL": case "NORMAL+": case "NORMAL-": confidence = Confidence.Normal; break; case "HIGH": case "HIGH+": case "HIGH-": confidence = Confidence.High; break; case "TOTAL": case "TOTAL+": case "TOTAL-": confidence = Confidence.Total; break; default: break; } } } [Test] public void SuccessOnNonDuplicatedInSwitchsTest () { AssertRuleSuccess (); } class DuplicatedInSwitchsLoadingByFields { string option = "LOW"; Severity severity = Severity.Low; public void FirstDuplicatedSwitch () { switch (option) { case "AUDIT": case "AUDIT+": case "AUDIT-": severity = Severity.Audit; break; case "LOW": case "LOW+": case "LOW-": severity = Severity.Low; break; case "MEDIUM": case "MEDIUM+": case "MEDIUM-": severity = Severity.Medium; break; case "HIGH": case "HIGH+": case "HIGH-": severity = Severity.High; break; case "CRITICAL": case "CRITICAL+": case "CRITICAL-": severity = Severity.Critical; break; default: break; } } public void SecondDuplicatedSwitch () { switch (option) { case "AUDIT": case "AUDIT+": case "AUDIT-": severity = Severity.Audit; break; case "LOW": case "LOW+": case "LOW-": severity = Severity.Low; break; case "MEDIUM": case "MEDIUM+": case "MEDIUM-": severity = Severity.Medium; break; case "HIGH": case "HIGH+": case "HIGH-": severity = Severity.High; break; case "CRITICAL": case "CRITICAL+": case "CRITICAL-": severity = Severity.Critical; break; default: break; } } } [Test] public void FailOnDuplicatedInSwitchsLoadingByFieldsTest () { AssertRuleFailure (1); } class NonDuplicatedInSwitchsLoadingByFields { string option = "LOW"; Severity severity = Severity.Low; Confidence confidence = Confidence.Normal; //Althoug both are referring to option as argument, it //isn't the same switch. public void FirstNonDuplicatedSwitch () { switch (option) { case "AUDIT": case "AUDIT+": case "AUDIT-": severity = Severity.Audit; break; case "LOW": case "LOW+": case "LOW-": severity = Severity.Low; break; case "MEDIUM": case "MEDIUM+": case "MEDIUM-": severity = Severity.Medium; break; case "HIGH": case "HIGH+": case "HIGH-": severity = Severity.High; break; case "CRITICAL": case "CRITICAL+": case "CRITICAL-": severity = Severity.Critical; break; default: break; } } public void SecondNonDuplicatedSwitch () { switch (option) { case "LOW": case "LOW+": case "LOW-": confidence = Confidence.Low; break; case "NORMAL": case "NORMAL+": case "NORMAL-": confidence = Confidence.Normal; break; case "HIGH": case "HIGH+": case "HIGH-": confidence = Confidence.High; break; case "TOTAL": case "TOTAL+": case "TOTAL-": confidence = Confidence.Total; break; default: break; } } } [Test] public void SuccesOnNonDuplicatedInSwitchsLoadingByFieldsTest () { AssertRuleSuccess (); } class NonDuplicatedCodeInParameterChecking { void MethodWithParameters (string x, string y) { if ((x == null) || (y == null)) return; char z = 'a'; } void MethodWithParameters (object x, string y) { if ((x == null) || (y == null)) return; int f = 2; } } [Test] public void SuccessOnNonDuplicatedCodeInParameterChecking () { AssertRuleSuccess (); } class NonDuplicatedCodeInForeachLoopsReturningBoolean { bool ForeachComparingTypes () { foreach (object obj in myList) { if (obj.GetType ().Equals (Type.EmptyTypes)) return true; } return false; } bool ForeachComparingValues () { foreach (int x in myList) { if (x % 2 == 0) return true; } return false; } } [Test] public void SuccessOnNonDuplicatedCodeInForeachLoopsReturningBooleanTest () { AssertRuleSuccess (); } class FalsePositiveInConsoleRunner { Runner runner; static string GetAttribute (XmlNode node, string name, string defaultValue) { XmlAttribute xa = node.Attributes [name]; if (xa == null) return defaultValue; return xa.Value; } IRule GetRule (string name) { foreach (IRule rule in runner.Rules) { if (rule.GetType ().ToString ().Contains (name)) return rule; } return null; } void SetCustomParameters (XmlNode rules) { foreach (XmlElement parameter in rules.SelectNodes ("parameter")) { string ruleName = GetAttribute (parameter, "rule", String.Empty); string propertyName = GetAttribute (parameter, "property", String.Empty); int value = Int32.Parse (GetAttribute (parameter, "value", String.Empty)); IRule rule = GetRule (ruleName); if (rule == null) throw new XmlException (String.Format ("The rule with name {0} doesn't exist. Review your configuration file.", ruleName)); PropertyInfo property = rule.GetType ().GetProperty (propertyName); if (property == null) throw new XmlException (String.Format ("The property {0} can't be found in the rule {1}. Review your configuration file.", propertyName, ruleName)); if (!property.CanWrite) throw new XmlException (String.Format ("The property {0} can't be written in the rule {1}. Review your configuration file", propertyName, ruleName)); property.GetSetMethod ().Invoke (rule, new object[] {value}); } } } [Test] public void SuccessOnFalsePositiveInConsoleRunnerTest () { AssertRuleSuccess (); } class NonDuplicatedCodeCheckingSubsetOfParameters { ArrayList engine_dependencies = new ArrayList (); void Initialize () { if (engine_dependencies.Count == 0) return; foreach (object eda in engine_dependencies) Console.WriteLine (eda); } void TearDown () { if ((engine_dependencies == null) || (engine_dependencies.Count == 0)) return; foreach (object eda in engine_dependencies) Console.Write (eda); } } [Test] public void SuccessOnNonDuplicatedCodeCheckingSubsetOfParametersTest () { AssertRuleSuccess (); } class NonDuplicatedCheckingAndReturningDifferentOperations { ulong mask; bool IsSubsetOf (string bitmask) { if (bitmask == null) return false; return ((mask & bitmask[0]) == mask); } bool Equals (string bitmask) { if (bitmask == null) return false; return (mask == bitmask[0]); } } [Test] public void SuccessOnNonDuplicatedCheckingAndReturningDifferentOperationsTest () { AssertRuleSuccess (); } class CheckingIntegersAndStrings { private IRunner Runner; bool CheckParameters (TypeReference eventType, MethodReference invoke) { if (invoke.Parameters.Count == 2) return true; Runner.Report (eventType, Severity.Medium, Confidence.High, "The delegate should have 2 parameters"); return false; } bool CheckGenericDelegate (TypeReference type) { if (type.FullName == "System.EventHandler`1") return true; Runner.Report (type, Severity.Medium, Confidence.High, "Generic delegates should use EventHandler"); return false; } } [Test] public void SuccessOnCheckingIntegersAndStringsTest () { AssertRuleSuccess (); } class NonDuplicatedComparingAndReturningNull { string CheckTwoOptions (TypeReference type) { if (type.Implements ("System.Collections", "IDictionary") || type.Implements ("System.Collections.Generic", "IDictionary`2")) return null; return "'Dictionary' should only be used for types implementing IDictionary and IDictionary."; } string CheckThreeOptions (TypeReference type) { if (type.Implements ("System.Collections", "ICollection") || type.Implements ("System.Collections", "IEnumerable") || type.Implements ("System.Collections.Generic", "ICollection`1")) return null; if (type.Inherits ("System.Collections", "Queue") || type.Inherits ("System.Collections", "Stack") || type.Inherits ("System.Data", "DataSet") || type.Inherits ("System.Data", "DataTable")) return null; return "'Collection' should only be used for implementing ICollection or IEnumerable or inheriting from Queue, Stack, DataSet and DataTable."; } } [Test] public void SuccessOnNonDuplicatedComparingAndReturningNullTest () { AssertRuleSuccess (); } class NonDuplicatedCodeComparingStringEmpty { int IndexOfFirstCorrectChar (string name) { return 1; } string CheckStringAndReturn (string name) { if (String.IsNullOrEmpty (name)) return String.Empty; if (name.Length == 1) return name.ToUpperInvariant (); int index = IndexOfFirstCorrectChar (name); return Char.ToUpperInvariant (name [index]) + name.Substring (index + 1); } string CheckStringAndReturnTheOpposite (string name) { if (String.IsNullOrEmpty (name)) return String.Empty; if (name.Length == 1) return name.ToLowerInvariant (); int index = IndexOfFirstCorrectChar (name); return Char.ToLowerInvariant (name [index]) + name.Substring (index + 1); } } [Test] public void SuccessOnNonDuplicatedCodeComparingStringEmptyTest () { AssertRuleSuccess (); } class NonDuplicatedCodeWithNonCompatibleTypes { public string EngineType { get; internal set; } public void SetEngineTypeFromType (Type engineType) { if (engineType == null) throw new ArgumentNullException ("engineType"); EngineType = engineType.FullName; } public void SetEngineTypeFromString (string engineType) { if (engineType == null) throw new ArgumentNullException ("engineType"); EngineType = engineType; } } [Test] public void SuccessOnNonDuplicatedCodeWithNonCompatibleTypesTest () { //Although it seems the same pattern, we are not able to //extract the code fairly //If we chains the ctors, we could receive a nullref //exception. AssertRuleSuccess (); } class NonDuplicateCodeWithNonCompatibleTypesInLocals { public void LocalSimple () { MethodDefinition method = null; if (method == null) throw new Exception (); Console.WriteLine (method); } public void OptionEnum () { TypeDefinition type = null; if (type == null) throw new Exception (); Console.WriteLine (type); } } [Test] public void SuccessOnNonDuplicateCodeWithNonCompatibleTypesInLocals () { AssertRuleSuccess (); } // produced a false positive when compiled with CSC class AvoidLongMethodsRule { private static int CountInstanceFields (TypeDefinition type) { int counter = 0; foreach (FieldDefinition field in type.Fields) { if (!(field.IsStatic || field.HasConstant)) counter++; //I not take care about arrays here. } return counter; } private static int CountInstructions (MethodDefinition method) { int count = 0; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Nop: case Code.Box: case Code.Unbox: break; default: count++; break; } } return count; } } [Test] public void IEnumerator_MoveNext_Block () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidMessageChainsTest.cs0000664000175000017500000001537512413742070032312 0ustar00directhexdirecthex00000000000000// // Unit Tests for AvoidMessageChains Rule // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Linq; using System.Reflection; using Gendarme.Framework; using Gendarme.Rules.Smells; using Mono.Cecil; using Test.Rules.Fixtures; using Test.Rules.Definitions; using NUnit.Framework; namespace Test.Rules.Smells { class One { public Two ReturnTwo (int x) {return null;} public Two Two {get; set;} } class Two { public Three ReturnThree (string x) {return null;} public Three Three {get; set;} public object Tag {get; set;} } class Three { public Four ReturnFour (object o, int f) {return null;} public Four Four {get; set;} } class Four { public Five ReturnFive (float f) {return null;} } class Five { public Six ReturnSix () {return null;} } class Six { public One ReturnOne (char c) {return null;} } [TestFixture] public class AvoidMessageChainsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public void MethodWithSmallChain () { // 1111111 2222222222222 333333333333333333333333333333333 new One ().ReturnTwo (3).ReturnThree ("Avoid chaining me"); } public void MethodWithArgumentsWithSmallChain (string s) { // 1111111111 222222222222222 33333333333333333333333333333 Four four = new Two ().ReturnThree (s).ReturnFour (new object (), 3); } [Test] public void MethodWithSmallChainTest () { // default is 5 so small chains (like 3) are ok AssertRuleSuccess ("MethodWithSmallChain"); AssertRuleSuccess ("MethodWithArgumentsWithSmallChain"); } [Test] public void MethodWithSmallChainLowerLimitTest () { int chain = Rule.MaxChainLength; try { // unless we lower the limit Rule.MaxChainLength = 2; AssertRuleFailure ("MethodWithSmallChain", 1); AssertRuleFailure ("MethodWithArgumentsWithSmallChain", 1); } finally { Rule.MaxChainLength = chain; } } public void MethodWithChain () { object obj = new object (); // 1111111 2222222222222 333333333333333333333333333333 4444444444444444444 55555555555555 666666666666 777777777777777 new One ().ReturnTwo (3).ReturnThree ("Ha ha! Chained").ReturnFour (obj, 5).ReturnFive (3).ReturnSix ().ReturnOne ('a'); } public void MethodWithChain_Array () { // 11111111111111 222222222222 33333333 44444444444 5555555555555555555 6666666 Console.WriteLine (new byte [5].Clone ().ToString ().ToUpperInvariant ().Trim ()); } [Test] public void MethodWithChainTest () { AssertRuleFailure ("MethodWithChain", 1); AssertRuleFailure ("MethodWithChain_Array", 1); } public void MethodWithVariousChains () { object obj = new object (); new One ().ReturnTwo (3).ReturnThree ("Ha ha! Chained").ReturnFour (obj, 5).ReturnFive (3).ReturnSix ().ReturnOne ('a'); Two two= new Three ().ReturnFour (obj, 3).ReturnFive (4 + 4).ReturnSix ().ReturnOne ('2').ReturnTwo (8); } [Test] public void MethodWithVariousChainsTest () { AssertRuleFailure ("MethodWithVariousChains", 2); } public void MethodWithArgumentsChained (int x, float f) { //11111111 2222222222222 333333333333333333333333333333 44444444444444444444444444444 55555555555555 666666666666 777777777777777 new One ().ReturnTwo (x).ReturnThree ("Ha ha! Chained").ReturnFour (new object (), x).ReturnFive (f).ReturnSix ().ReturnOne ('a'); } [Test] public void MethodWithArgumentsChainedTest () { AssertRuleFailure ("MethodWithArgumentsChained", 1); } public void SmallChainWithTemporaryVariables () { // 11111111111111111111111111111111 2222222222 3333333 Version version = Assembly.GetExecutingAssembly ().GetName ().Version; int major = version.Major; } public void NoChainWithTemporaryVariables () { int x; char c; Console.WriteLine ("More tests"); } [Test] public void NoChainWithTemporaryVariablesTest () { AssertRuleSuccess ("SmallChainWithTemporaryVariables"); AssertRuleSuccess ("NoChainWithTemporaryVariables"); } public bool Compare (int x, long y) { // 11111111111 2222222222222222222 3333333 11111111111 2222222 3333333333333333333 return (x.ToString ().ToUpperInvariant ().Trim () == y.ToString ().Trim ().ToLowerInvariant ()); } [Test] public void CompareTest () { AssertRuleSuccess ("Compare"); } private static One Start {get; set;} public void StaticProperty () { One beta = new One(); // 1 222 333 11111 222 333 beta.Two.Tag = ((PlatformID) Start.Two.Tag); // because Start is static there's no load instruction between these two lines // 11111 222 333 Console.WriteLine(Start.Two.Tag); } [Test] public void StaticPropertyTest () { AssertRuleSuccess ("StaticProperty"); } public object Linq () { var query = from n in Runner.Defects group n by n.Rule into a orderby a.Key.Name select new { Rule = a.Key, Value = from o in a group o by o.Target into r orderby r.ToString() select new { Target = r.Key, Value = r } }; return query; } [Test] public void LinqTest () { AssertRuleSuccess ("Linq"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/Makefile.am0000664000175000017500000000015012413742070027443 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Smells.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Test/AvoidSwitchStatementsTest.cs0000664000175000017500000000716212413742070033104 0ustar00directhexdirecthex00000000000000// Unit Test for AvoidSwitchStatements Rule. // // Authors: // Néstor Salceda // // (C) 2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Test.Rules.Fixtures; using Test.Rules.Definitions; using Test.Rules.Helpers; using Gendarme.Framework; using Gendarme.Rules.Smells; using NUnit.Framework; namespace Test.Rules.Smells { [TestFixture] public class AvoidSwitchStatementsTest : MethodRuleTestFixture { [Test] public void SkipOnBodylessMethodsTest () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } [Test] public void SuccessOnEmptyMethodsTest () { AssertRuleSuccess (SimpleMethods.EmptyMethod); } void MethodWithSwitch (Severity severity) { switch (severity) { case Severity.High: case Severity.Low: default: break; } } [Test] public void FailOnMethodWithSwitchTest () { AssertRuleFailure ("MethodWithSwitch", 1); } void MethodWithoutSwitch (Severity severity) { if (severity == Severity.High || severity == Severity.Low) return; } [Test] public void SuccessOnMethodWithoutSwitch () { AssertRuleSuccess ("MethodWithoutSwitch"); } IEnumerable MethodWithoutSwitchAndGenerator (IEnumerable enumerable) { foreach (string value in enumerable) yield return value; yield return null; } [Test] public void SuccessOnMethodWithoutSwitchAndGeneratorTest () { // compiler generated code (mono gmcs) Type type = Type.GetType ("Test.Rules.Smells.AvoidSwitchStatementsTest+c__Iterator0"); if (type == null) { // if not found try the output of MS csc type = Type.GetType ("Test.Rules.Smells.AvoidSwitchStatementsTest+d__0"); } Assert.IsNotNull (type, "compiler generated type name"); AssertRuleDoesNotApply (type, "MoveNext"); } // if the number of elements in the swicth is small (like <= 6) then CSC (but not GMCS) // well generate code using String::op_Equality instead of a switch IL statement void SwitchWithStrings (string sample) { switch (sample) { case "Foo": case "Bar": return; case "Baz": case "Bad": throw new ArgumentException ("sample"); case "Zoo": case "Yoo": throw new FormatException ("sample"); case "*": break; } } [Test] public void FailOnSwitchWithStringsTest () { AssertRuleFailure ("SwitchWithStrings", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/Makefile.am0000664000175000017500000000143312413742070026531 0ustar00directhexdirecthex00000000000000include ../common.make EXTRA_RULES_OPTIONS += -r:../../bin/Gendarme.Rules.Performance.dll rules_sources = \ AvoidCodeDuplicatedInSameClassRule.cs \ AvoidCodeDuplicatedInSiblingClassesRule.cs \ AvoidLargeClassesRule.cs \ AvoidLongMethodsRule.cs \ AvoidLongParameterListsRule.cs \ AvoidMessageChainsRule.cs \ AvoidSpeculativeGeneralityRule.cs \ AvoidSwitchStatementsRule.cs \ CodeDuplicatedLocator.cs \ InstructionMatcher.cs \ Pattern.cs EXTRA_TESTS_OPTIONS += -r:System.Windows.Forms.dll tests_sources = \ AvoidCodeDuplicatedInSameClassTest.cs \ AvoidCodeDuplicatedInSiblingClassesTest.cs \ AvoidLargeClassesTest.cs \ AvoidLongMethodsTest.cs \ AvoidLongParameterListsTest.cs \ AvoidMessageChainsTest.cs \ AvoidSpeculativeGeneralityTest.cs \ AvoidSwitchStatementsTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Smells/AvoidLongParameterListsRule.cs0000664000175000017500000001623212413742070032421 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Smells.AvoidLongParameterListsRule class // // Authors: // Néstor Salceda // // (C) 2007-2008 Néstor Salceda // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Linq; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Smells { // TODO: What does "Other time, it's quite hard determine a long parameter list" mean? // Can the default be changed? This rule should may need to be reviewed if C# adds // default arguments. The solution is really confusing. What is "preserve whole object"? // The introduction of a helper class to bundle state together? What is "parameter object"? // The params keyword? /// /// This rule allows developers to measure the parameter list size in a method. /// If you have methods with a lot of parameters, perhaps you have a Long /// Parameter List smell. /// /// This rule counts the method's parameters, and compares it against a maximum value. /// If you have an overloaded method, then the rule will get the shortest overload /// and compare the shortest overload against the maximum value. /// /// Other time, it's quite hard determine a long parameter list. By default, /// a method with 6 or more arguments will be flagged as a defect. /// /// /// Bad example: /// /// public void MethodWithLongParameterList (int x, char c, object obj, bool j, string f, /// float z, double u, short s, int v, string[] array) /// { /// // Method body ... /// } /// /// /// /// Good example: /// /// public void MethodWithoutLongParameterList (int x, object obj) /// { /// // Method body.... /// } /// /// //SUGGESTION: Setting all required properties in a constructor isn't //uncommon. //SUGGESTION: Different value for public / private / protected methods *may* //be useful. [Problem ("Generally, long parameter lists are hard to understand because they become hard to use and inconsistent. And you will be forever changing them if you need more data.")] [Solution ("You should apply the Replace parameter with method refactoring, or preserve whole object or introduce parameter object")] public class AvoidLongParameterListsRule : Rule, ITypeRule { private int maxParameters = 6; public int MaxParameters { get { return maxParameters; } set { maxParameters = value; } } private static MethodDefinition GetSmallestConstructorFrom (TypeDefinition type) { MethodDefinition smallest = null; int scount = 0; foreach (MethodDefinition constructor in type.Methods) { if (!constructor.IsConstructor) continue; // skip the static ctor since it will always be the smallest one if (constructor.IsStatic) continue; if (smallest == null) { smallest = constructor; scount = smallest.HasParameters ? smallest.Parameters.Count : 0; } else { int ccount = constructor.HasParameters ? constructor.Parameters.Count : 0; if (scount > ccount) { smallest = constructor; scount = ccount; } } } return smallest; } private bool HasMoreParametersThanAllowed (IMethodSignature method) { return (method.HasParameters ? method.Parameters.Count : 0) >= MaxParameters; } private void CheckConstructor (IMethodSignature constructor) { //Skip enums, interfaces, , static classes ... //All stuff that doesn't contain a constructor if (constructor == null) return; if (HasMoreParametersThanAllowed (constructor)) Runner.Report (constructor, Severity.Medium, Confidence.High, "This constructor contains a long parameter list."); } private void CheckMethod (IMethodSignature method) { if (HasMoreParametersThanAllowed (method)) Runner.Report (method, Severity.Medium, Confidence.High, "This method contains a long parameter list."); } //TODO: Perhaps we can perform this action with linq instead of //loop + hashtable private static IEnumerable GetSmallestOverloaded (TypeDefinition type) { IDictionary possibleOverloaded = new Dictionary (); foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor || method.IsPInvokeImpl) continue; string name = method.Name; if (!possibleOverloaded.ContainsKey (name)) possibleOverloaded.Add (name, method); else { MethodDefinition candidate = possibleOverloaded [name]; int ccount = candidate.HasParameters ? candidate.Parameters.Count : 0; int mcount = method.HasParameters ? method.Parameters.Count : 0; if (ccount > mcount) possibleOverloaded [name] = method; } } return possibleOverloaded.Values; } private static bool OnlyContainsExternalMethods (TypeDefinition type) { bool has_methods = false; foreach (MethodDefinition method in type.Methods) { if (method.IsConstructor) continue; has_methods = true; if (!method.IsPInvokeImpl) return false; } // all methods are p/invoke return has_methods; } private RuleResult CheckDelegate (TypeReference type) { MethodDefinition method = type.GetMethod ("Invoke"); // MulticastDelegate inherits from Delegate without overriding Invoke if ((method != null) && HasMoreParametersThanAllowed (method)) Runner.Report (type, Severity.Medium, Confidence.High, "This delegate contains a long parameter list."); return Runner.CurrentRuleResult; } public RuleResult CheckType (TypeDefinition type) { // we don't control, nor report, p/invoke declarations - sometimes the poor C // guys don't have a choice to make long parameter lists ;-) if (OnlyContainsExternalMethods (type)) return RuleResult.DoesNotApply; if (type.IsDelegate ()) return CheckDelegate (type); if (type.HasMethods) { CheckConstructor (GetSmallestConstructorFrom (type)); foreach (MethodDefinition method in GetSmallestOverloaded (type)) CheckMethod (method); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/0000775000175000017500000000000012642235742025505 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/ChangeLog0000664000175000017500000011111512413742070027250 0ustar00directhexdirecthex000000000000002010-06-20 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesRule.cs: Fix properties access * ReviewLinqMethodRule.cs: Apply AvoidRepetitiveCallsToPropertiesRule 2010-06-14 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesRule.cs: Filter out some well known properties that are often called several times 2010-06-10 Sebastien Pouliot * AvoidReturningArraysOnPropertiesRule.cs: Skip rule if the type has no properties. 2010-06-06 Sebastien Pouliot * PreferCharOverloadRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-06-04 Sebastien Pouliot * AvoidConcatenatingCharsRule.cs: * AvoidRepetitiveCallsToPropertiesRule.cs: * PreferCharOverloadRule.cs: * ReviewLinqMethodRule.cs: Apply AvoidUnnecessarySpecializationRule 2010-05-24 Sebastien Pouliot * AvoidUnusedParametersRule.cs: Documented (MSDN) as a Performance rule but it's actually in the Usage category (e.g. when suppressing a defect) and we need to be compatible with the later. * Makefile.am: Add define for CODE_ANALYSIS on unit tests (required for [SuppressMessage] to be present) and add GlobalSuppressions.cs to the build 2010-05-14 Antoine Vandecreme * ReviewLinqMethodRule.cs: Add support to detect use of Count() instead of Any() in conditions 2010-05-14 Antoine Vandecreme * ReviewLinqMethodRule.cs: Fix NullReferenceException, I haven't analysed the reason of the null value but I guess it happens in Linq queries such as : myEnumerable.Where(v => v.IsCondition()).OrderBy(v => v.Value) when searching the type of the object on which OrderBy is applied (actually, always IEnumerable, so no defect possible) 2010-05-14 Antoine Vandecreme * ReviewLinqMethodRule.cs: Fix the optimisation test which was skipping .Net 3.5 assemblies. 2010-04-28 Sebastien Pouliot * AvoidUnusedParametersRule.cs: Ignore methods decorated with a [Conditional] attribute. 2010-04-27 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Ignore methods decorated with a [Conditional] attribute. * AvoidUninstantiatedInternalClassesRule.cs: Ignore internal types named NamespaceDoc since they are used by monodoc to include namespace-related documentation (suggested by Jesse Jones) 2010-04-13 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesRule.cs: Don't assume a MethodReference for FlowControl.Call. Calli, while uncommon, would provide a CallSite. 2010-01-31 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesRule.cs: Fix false positives on long message chains. Make InlineLimit a configurable property. 2010-01-30 Sebastien Pouliot * AvoidConcatenatingCharsRule.cs: Apply AvoidMessageChainsRule and make the check safer against names starting with Object* * AvoidUncalledPrivateCodeRule.cs: Apply AvoidRepetitive CallsToPropertiesRule * AvoidUninstantiatedInternalClassesRule.cs: Apply AvoidRepetitive CallsToPropertiesRule * AvoidUnneededCallsOnStringRule.cs: Apply PreferEmptyInstanceOver NullRule * AvoidUnneededUnboxingRule.cs: Apply PreferEmptyInstanceOverNullRule * AvoidUnsealedUninheritedInternalClassesRule.cs: Apply Avoid RepetitiveCallsToPropertiesRule * AvoidUnusedParametersRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule * MathMinMaxCandidateRule.cs: Apply PreferEmptyInstanceOverNullRule * PreferCharOverloadRule.cs: Apply AvoidRepetitiveCallsToProperties Rule and add extra HasParameters check * RemoveUnusedLocalVariablesRule.cs: Apply AvoidRepetitiveCallsTo PropertiesRule 2010-01-20 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesRule.cs: Apply MethodCanBeMadeStaticRule * ReviewLinqMethodRule.cs: Apply AvoidUnusedParametersRule and AvoidRepetitiveCallsToPropertiesRule 2010-01-17 Sebastien Pouliot * AvoidConcatenatingCharsRule.cs: New. Rule will warn if boxing is required to concatenate string. * Makefile.am: Add new rule and tests to the build. 2010-01-10 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesRule.cs: New rule to warn if a virtual or non-likely inline-able properties (getter) are called several times by a method. * Makefile.am: Add new rule and tests to the build. 2010-01-04 Sebastien Pouliot * Makefile.am: Add new rule and tests to the build. 2010-01-03 Sebastien Pouliot * AvoidLocalDataStoreSlotRule.cs: New. Rule to promote the use of [ThreadStatic] and [ContextStatic] attributes over the slower LocalDataStoreSlot-based API. * Makefile.am: Add new rule and tests to the build. 2009-08-16 Jesse Jones * AvoidLargeNumberOfLocalVariablesRule.cs, IDisposableWithDestructorWithoutSuppressFinalizeRule, AvoidLargeStructureRule.cs, DontIgnoreMethodResultRule.cs, AvoidUnusedParametersRule.cs, AvoidUnsealedConcreteAttributesRule.cs, PreferCharOverloadRule.cs: Edited descriptions. 2009-07-08 Jesse Jones * CompareWithStringEmptyEfficientlyRule.cs: Use .NET instead of .Net in a doc comment. 2009-07-05 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2009-05-14 Jb Evain * AvoidMethodWithLargeMaximumStackSize.cs: new rule. 2009-03-20 Daniel Nauck * PreferLiteralOverInitOnlyFieldsRule.cs: Fixed "good example" documentation. 2009-01-27 Jesse Jones * ReviewLinqMethodRule.cs, Makefile.am: Added new rule. 2008-12-24 Sebastien Pouliot * PreferCharOverloadRule.cs: New. Rule to promote the use of the char-based overload for String.[IndexOf|LastIndexOf|Replace] over the string-based ones (when the string is one character long). * Makefile.am: Add new rule and tests to the build. 2008-12-24 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Clear cache on TearDown so the wizard won't reuse it if executed again (since it could be broken). 2008-12-13 Jesse Jones * RemoveUnusedLocalVariablesRule.cs: Fix AnalyzeModule so that it activates the rule properly when multiple assemblies or modules are being checked. 2008-12-11 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Array have special methods (e.g. Address) that cannot be resolved and, if not ignored, would cause NRE [Fix bug #458178] 2008-12-02 Sebastien Pouliot * AvoidTypeGetTypeForConstantStringsRule.cs: Use HasParameters * AvoidUncalledPrivateCodeRule.cs: Use HasGenericParameters, HasOverrides, HasInterfaces, HasNestedTypes, HasCustomAttributes, HasMethods and HasConstructors * AvoidUninstantiatedInternalClassesRule.cs: Use HasParameters, HasFields, HasMethods and HasConstructors * AvoidUnneededCallsOnStringRule.cs: Use HasParameters * AvoidUnusedParametersRule.cs: Use HasOverrides and HasParameters * AvoidUnusedPrivateFieldsRule.cs: Use HasFields * ConsiderCustomAccessorsForNonVisibleEventsRule.cs: Use HasEvents 2008-11-24 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Simplify call into CheckAssemblyForMethodUsage 2008-11-16 Andrés G. Aragoneses * AvoidRepetitiveCastsRule.cs: Adding two more examples (as this rule also warns about normal cast). 2008-11-16 Andrés G. Aragoneses * AvoidRepetitiveCastsRule.cs: Update comment. 2008-11-13 Cedric Vivier * AvoidTypeGetTypeForConstantStrings.cs: Do not emit a false positive when using the supported way to detect if running on Mono runtime. 2008-11-09 Sebastien Pouliot * AvoidRepetitiveCastsRule.cs: Remove unneeded parameter on GetOrigin method (self-test). 2008-11-07 Jesse Jones * AvoidRepetitiveCastsRule.cs: Fixed three different false positive cases. Note that we did lose an arguably valid warning in StackEntryAnalysis which we may be able to recover by doing a TraceBack on nullary method calls. 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Performance.mdp: * Gendarme.Rules.Performance.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-30 Jesse Jones * Makefile.am: Append onto the inherited EXTRA_RULES_OPTIONS. 2008-10-24 Sebastien Pouliot * AvoidLargeStructureRule.cs: Add null check in SizeOfStruct (self test) * AvoidUninstantiatedInternalClassesRule.cs: Change visibility of ProcessType and ProcessMethod to private. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Performance.xml, doc/Gendarme.Rules.Performance: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-10-13 Sebastien Pouliot * AvoidRepetitiveCastsRule.cs: Fix XML documentation. * ConsiderCustomAccessorsForNonVisibleEventsRule.cs: Add XML documentation. * EmptyDestructorRule.cs: Renamed to RemoveUnneededFinalizerRule. Now consider a finalizer empty if it only nullify fields. Add XML documentation and [FxCopCompatibility] attribute. * IDisposableWithDestructorWithoutSuppressFinalizeRule.cs: Renamed to UseSuppressFinalizeOnIDisposableTypeWithFinalizerRule. Add XML documentation. Check both Dipose (implicit and explicit) when the two methods are present. Use OpCodeEngine to skip Dispose that do not contains any call[virt] instructions. * ImplementEqualsTypeRule.cs: Add XML documentation. Under 2.0 or later suggest implementing IEquatable (for the same end result). * OverrideValueTypeDefaultsRule.cs: Add [FxCopCompatibility] attribute. * RemoveUnusedLocalVariablesRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use recent GetVariable rock to simplify the logic. 2008-10-12 Sebastien Pouliot * AvoidUnusedPrivateFieldsRule.cs: : Add XML documentation and [FxCopCompatibility] attribute. Use OpCodeEngine to skip methods without instruction that involves fields. Ignore delegates. * CompareWithStringEmptyEfficientlyRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use OpCodeEngine to skip methods without Call[virt] instruction. Handle the case where Object.Equals is being called (csc). * DontIgnoreMethodResultRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Use OpCodeEngine to skip methods without Pop instruction. * OverrideValueTypeDefaultsRule.cs: Add XML documentation. 2008-10-12 Sebastien Pouliot * AvoidUnneededFieldInitializationRule.cs: New. Rule to check if constructor needlessly initialize some fields to their default values. * PreferLiteralOverInitOnlyFieldsRule.cs: New. Rule to check if some "static readonly" fields could be changed into "const". * Makefile.am: add new rules and tests to the build. 2008-10-11 Sebastien Pouliot * AvoidUnneededCallsOnStringRule.cs: Simplification by using the new Instruction's rocks. * AvoidUnsealedUninheritedInternalClassesRule.cs: Report the determined confidence level. * MathMinMaxCandidateRule.cs: Add XML documentation. Use OpCodeEngine and OpCodeBitmask to simplify the rule. * UseIsOperatorRule.cs: Add XML documentation. Use OpCodeEngine to skip methods without a Isinst, Ldnull *and* Ceq instruction. * UseStringEmptyRule.cs: Add XML documentation. Use OpCodeEngine to skip methods without a Ldstr instruction. * UseTypeEmptyTypesRule.cs: Add XML documentation. Use OpCodeEngine to skip methods without a Newarr and Ldc_I4[_S|0] instructions. Use new rock to simplify rule. 2008-10-11 Sebastien Pouliot * AvoidUnneededUnboxingRule.cs: Add XML documentation. Use OpCodeEngine to skip methods without Unbox[_Any] instructions. * AvoidUnsealedConcreteAttributesRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Remove unneeded string in Report. * AvoidUnsealedUninheritedInternalClassesRule.cs: Add XML documentation. Adjust confidence based on the presence (or absence) of [InternalsVisibleTo]. Remove unneeded string in Report. * AvoidUnusedParametersRule.cs: Use OpCodeEngine to find methods that loads another method (delegate) using Ldftn. Add XML documentation and [FxCopCompatibility] attribute. 2008-10-10 Sebastien Pouliot * AvoidTypeGetTypeForConstantStringsRule.cs: Add XML documentation. Use OpCodeEngine to skip methods without Call or Callvirt instructions and without an Ldstr instruction. * AvoidUncalledPrivateCodeRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * AvoidUninstantiatedInternalClassesRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Remove CheckSpecialTypes method since is now checked by IsGeneratedCode. Base confidence level on whether the assembly is decorated with [InternalsVisibleTo] or not. * AvoidUnneededCallsOnStringRule.cs: Add XML documentation. Use OpCodeEngine to skip methods without Call or Callvirt instructions. Split core into separate methods and check more instructions. 2008-10-09 Sebastien Pouliot * AvoidLargeNumberOfLocalVariablesRule.cs: Add XML documentation and [FxCopCompatibility] attribute. * AvoidLargeStructureRule.cs: Add XML documentation. Change logic to be easier to test completely. * AvoidRepetitiveCastsRule.cs: Rewrote logic so it is possible to report line numbers with the defects. Add OpCodeEngine to skip methods that do not have Castclass or IsInst instructions. Add XML documentation and [FxCopCompatibility] attribute. * AvoidReturningArraysOnPropertiesRule.cs: Add XML documentation and [FxCopCompatibility] attribute. Return DoesNotApply if the method is not a getter. 2008-08-26 Sebastien Pouliot * Test/ImplementEqualsTypeTest.cs: Add test case with generics. 2008-08-11 Sebastien Pouliot * AvoidUnneededUnboxingRule.cs: Fix case for static parameter-less methods. 2008-08-09 Sebastien Pouliot * AvoidReturningArraysOnPropertiesRule.cs: Use shorter overload. * AvoidUncalledPrivateCodeRule.cs: Split DoesNotApply-checks into a separate method. Avoid unneeded specialization on some methods (self tests) * AvoidUninstantiatedInternalClassesRule.cs: Avoid unneeded specialization on CheckSpecialTypes (self-test). Use shorter overload. * CompareWithStringEmptyEfficientlyRule.cs: Use shorter overload. * ImplementEqualsTypeRule.cs: Use shorter overload. * MathMinMaxCandidateRule.cs: Add missing Ldind_I2. Use shorter overload. * UseStringEmptyRule.cs: Use shorter overload. 2008-08-06 Sebastien Pouliot * AvoidRepetitiveCastsRule.cs: Fix calls to methods. 2008-08-05 Sebastien Pouliot * AvoidUnusedParametersRule.cs: Use a bitmask (maximum of 64 parameters) to see which parameter gets used (or not). Save more than 84MB (12%) of memory allocated over all Mono 2.0 assemblies 2008-08-05 Peter Johanson * AvoidUnusedParametersRule.cs: Properly check every delegate created inside a method, to see if a certain method is used in a delegate instance. 2008-08-04 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Fix rule not to apply for compiler generated add/remove methods on events. 2008-07-26 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Don't ignore properties and detect use when generics are used. [Fix bug #410000] 2008-07-23 Sebastien Pouliot * AvoidUnusedPrivateFieldsRule.cs: Fix [Problem] and [Solution] to match the rule (wrong copy-paste). Don't process literals (e.g. const) since their value is copied into IL and this results in many false positives (handled or not). * Makefile.am: Compile without optimization since newer gmcs is now converting "" into String.Empty automagically (making our test cases fails). 2008-07-13 Sebastien Pouliot * AvoidLargeNumberOfLocalVariablesRule.cs: Rule to warn if a method has a very large of local variables - since it's likely the JIT won't be able to do a good job assigning registers to them. * Makefile.am: add rule and tests to the build. 2008-07-12 Sebastien Pouliot * AvoidUnusedPrivateFieldsRule.cs: Rule to warn if a private field is unused in a type. * Makefile.am: add rule and tests to the build. 2008-07-09 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-08 Sebastien Pouliot * AvoidTypeGetTypeForConstantStringsRule.cs: Handle the case where Resolve returns null (cannot find the required assemblies) * AvoidUncalledPrivateCodeRule.cs: Handle the case where Resolve returns null (cannot find the required assemblies) * CompareWithStringEmptyEfficientlyRule.cs: Handle the case where Resolve returns null (cannot find the required assemblies) * MonoCompatibilityReviewRule.cs: Dispose as soon as possible. * Makefile.am: Rebuild if the framework has changed. 2008-07-05 Sebastien Pouliot * AvoidRepetitiveCastsRule.cs: New. Rule to check if the code repeat some cast operations more than one time. * AvoidUncalledPrivateCodeRule.cs: Apply AvoidRepetitiveCastsRule to rule (self-test). * Gendarme.Rules.Performance.mdp: Update MD project file. * Makefile.am: add rule and tests to the build. 2008-06-28 Sebastien Pouliot * AvoidLargeStructureRule.cs: Handle arrays correctly. 2008-06-28 Sebastien Pouliot * AvoidLargeStructureRule.cs: Add missing [Problem] and [Solution] attributes to the rule. 2008-06-27 Sebastien Pouliot * AvoidTypeGetTypeForConstantStringsRule.cs: New. Rule to check if calls to Type.GetType(string), which requires reflection, could be changed into, faster, typeof(x). * Gendarme.Rules.Performance.mdp: Update MD project file. * Makefile.am: add rule and tests to the build. 2008-06-11 Jb Evain * AvoidUninstantiatedInternalClassesRule.cs: when facing an internal sealed class, with a single private ctor, the rule does not apply, it's basically a static class. 2008-06-04 Sebastien Pouliot * ConsiderCustomAccessorsForNonVisibleEventsRule.cs: New. Rule that checks type non-visible events and report them if they are marked as synchronized (making it possible to remove the lock, if unneeded, and remove the lock performance penality). * Gendarme.Rules.Performance.mdp: Update MD project file. * Makefile.am: add rule and tests to the build. 2008-05-19 Sebastien Pouliot * AvoidUnneededUnboxingRule.cs: New. Rule to warn about multiple, unneeded, unboxing inside methods. * Makefile.am: add rule and tests to the build. 2008-05-17 Sebastien Pouliot * RemoveUnusedLocalVariablesRule.cs: New. Rule to warn about unused variables inside methods. * Makefile.am: add rule and tests to the build. 2008-05-11 Sebastien Pouliot * DontIgnoreMethodResultRule.cs: Change logic to check for specific cases (black list) instead of everything minus exceptions (white- listing). Cut down a lot on false positives. 2008-05-01 Sebastien Pouliot * AvoidLargeStructureRule.cs: Remove unused GetPackSize method. Use IsPrimitive definition (inside a collection, the switch case was big enough to do the same) for well known values. 2008-04-27 Andres G. Aragoneses * Gendarme.Rules.Performance.mdp: updated. 2008-04-27 Jb Evain * AvoidUnusedParametersRule.cs: replace IsEventCallback method by a call to the rock of the same name. 2008-04-27 Jb Evain * AvoidUnusedParametersRule.cs: refactoring work. Rule does not apply any more to even callbacks of kind Callback (object sender, *EventArgs ea). 2008-04-27 Jb Evain * AvoidUninstantiatedInternalClassesRule.cs: remove duplicated code using the AllMethods rocks. 2008-04-27 Jb Evain * AvoidUncalledPrivateCodeRule.cs: use an HashSet instead of a List for faster lookup. 2008-04-27 Jb Evain * AvoidUninstantiatedInternalClassesRule.cs: use an HashSet instead of a List to keep track of types, for faster lookups. 2008-04-26 Sebastien Pouliot * AvoidLargeStructureRule.cs: New. Rule to check for oversized structures. * CompareWithStringEmptyEfficientlyRule.cs: Fix false positives. * Makefile.am: add rule and tests to the build. 2008-04-26 Sebastien Pouliot * CompareWithStringEmptyEfficientlyRule.cs: Remove debugging NIE hack. 2008-04-26 Jb Evain * UseTypeEmptyTypesRule.cs: New rule that checks for unecessary creation of empty array of types (used a lot for reflection), while we can use Type.EmptyTypes. * Makefile.am: add the new guy to the build. 2008-04-26 Sebastien Pouliot * CompareWithStringEmptyEfficientlyRule.cs: Replace the existing UsingStringLengthInsteadOfCheckingEmptyStringRule rule. Add checks for String.Empty and Equality and Inequality operators. * UsingStringLengthInsteadOfCheckingEmptyStringRule.cs: Removed * Makefile.am: Update build with new names. 2008-04-25 Sebastien Pouliot * AvoidReturningArraysOnPropertiesRule.cs: Add an alternate solution (to return a collection) and remove details as it does not provide more information (than the [Solution] already provides). * UseStringEmptyRule.cs: Remove variable to track defect state and use Runner.CurrentRuleResult instead. Remove details as it does not provide more information (than the [Solution] already provides). 2008-04-20 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Use the token in the cache (instead of the MethodReference). Does not work on Mono when using generics. 2008-04-13 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Refactor to cache results (and save tons of memory). Now check for public/protected methods inside non-visible types. 2008-04-12 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Fix false positives when a private method is used in its declaring type's nested type(s) [Cedric Vivier] 2008-04-06 Sebastien Pouliot * AvoidUninstantiatedInternalClassesTest.cs: Report generic types correctly. * DontIgnoreMethodResultTest: Exclude Stack.Pop (and it's generic version). 2008-04-05 Sebastien Pouliot * MathMinMaxCandidateRule.cs: New. Rule that checks for code patterns that should be replaced by Math.Min or Math.Max since the JIT can inline them for better performance (wrt manually inlining them). Suggestion from Marek Safar (bug #373269) * Gendarme.Rules.Performance.mdp: Add rule to MD project file. * Makefile.am: Add rule and tests to the build. 2008-03-30 Sebastien Pouliot * ImplementEqualsTypeRule.cs: New. Rule to suggest providing an Equals(type) method if Equals(object) is overriden. This can make a bug difference for ValueType since this remove boxing. * Gendarme.Rules.Performance.mdp: Add rule to MD project file. * Makefile.am: Add rule and tests to the build. 2008-03-16 Sebastien Pouliot * AvoidUnusedParametersRule.cs: Don't report defects on methods that contains parameter inheriting from EventArgs. GUI apps use them a lot and, while not real "false positive", the method signature is outside the developer's control so it cannot be fixed (signature-wise) and rarely denotes a real problem. Fix bug #350288 2008-03-05 Sebastien Pouliot * AvoidUnneededCallsOnStringRule.cs: Source file renamed from AvoidToStringOnStringsRule.cs since the rule has been generalized to cover more similar cases. E.g. Clone(), Substring(0) and ToString(IFormatProvider). * Makefile.am: Rename rule and test files. 2008-02-16 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Remove {0} from [Problem] attribute * AvoidUninstantiatedInternalClassesRule.cs: Remove unused parameter. 2008-02-16 Nestor Salceda * AvoidUnusedParametersRule.cs: Removed unused variable. 2008-02-15 Sebastien Pouliot * EmptyDestructorRule.cs * IDisposableWithDestructorWithoutSuppressFinalizeRule.cs: Fix namespace change. 2008-02-15 Nestor Salceda * Test/*.cs: Refactor the tests for accept the new rule's format. * *.cs: Adapt the rules to the new framework. * Makefile.am: Removed the -langversion:linq option. You should use at least the 1.9 gmcs version to compile. 2008-02-07 Nestor Salceda * DisposableTypesShouldHaveFinalizerRule.cs, FinalizersShouldCallBaseClassFinalizerRule.cs, FinalizersShouldBeProtectedRule.cs: Replaced TypeDefinition.GetFinalizer with TypeDefinition.GetMethod for avoid some warnings when compiling. 2008-02-06 Sebastien Pouliot * AvoidUnsealedUninheritedInternalClassesRule.cs: New. Rule to check for non-sealed and non-visible types [Scott Peterson] * UseIsOperatorRule.cs: New. Rule to check when using the "is" operator would be better than a cast+null check [Seo Sanghyeon] * Gendarme.Rules.Performance.xml.in: Add rule description. * Gendarme.Rules.Performance.mdp: Add rule to MonoDevelop project file. * Makefile.am: Add rule and tests to the build. 2008-02-03 Sebastien Pouliot * AvoidUninstantiatedInternalClassesRule.cs: Reworked to reduce false positives. * DontIgnoreMethodResultRule.cs: Add more exceptions to reduce false positives. 2008-01-30 Sebastien Pouliot * DontIgnoreMethodResultRule.cs: Don't report on compiler/tools generated code since this is out of the developer's control. 2008-01-29 Sebastien Pouliot * AvoidUninstantiatedInternalClassesRule.cs: Reduce false positives a bit more by handling "out" and variable types. 2008-01-13 Sebastien Pouliot * EmptyDestructorRule.cs: Use new IsFinalizer rock. 2008-01-11 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Use new Location ctors. * AvoidUninstantiatedInternalClassesRule.cs: Use new Location ctors. * UseStringEmptyRule.cs: Use new Location ctors. * UsingStringLengthInsteadOfCheckingEmptyStringRule.cs: Don't create MessageCollection until needed. Use new Location ctors. 2008-01-08 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Don't report any serialization constructors since they are invoked by the runtime. * DontIgnoreMethodResultRule.cs: Don't report BeginInvoke methods that accept a Delegate (for any type). Better error reporting when a new unused instance is created. 2008-01-06 Sebastien Pouliot * AvoidToStringOnStringsRule.cs: Fix false positives on corlib (when an overloaded ToString, with parameters, is used). * AvoidUnusedParametersRule.cs: Fix false positives on corlib (where icalls were reported) * EmptyDestructorRule.cs: Simplify using rocks. 2008-01-05 Sebastien Pouliot * AvoidUninstantiatedInternalClassesRule.cs: Don't report this if the class holds the assembly entry point (i.e. Main method). * DontIgnoreMethodResultRule.cs: Add Directory.CreateDirectory to stuff we can safely ignore. Change some methods to static. * Gendarme.Rules.Performance.mdp: Add linq to compiler options. 2008-01-04 Sebastien Pouliot * AvoidToStringOnStringsRule.cs: Simplified to use rocks * AvoidUncalledPrivateCodeRule.cs: Use IsGeneratedCode instead of the older IsCompilerGenerated to avoid more false-positives. * AvoidUninstantiatedInternalClassesRule.cs: Simplified to use rocks * AvoidUnsealedConcreteAttributesRule.cs: New. Rule to check that concrete attribute classes are sealed [Daniel Abramov] * AvoidUnusedParametersRule.cs: Simplified to use rocks and to avoid creating (most time) an unneeded MessageCollection. * IDisposableWithDestructorWithoutSuppressFinalizeRule.cs: Simplified to use rocks * Gendarme.Rules.Performance.mdp: Add rule to MonoDevelop project file. * Makefile.am: Add rule and tests to the build. 2008-01-03 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Updated/simplified to use rocks. * AvoidUninstantiatedInternalClassesRule.cs: Fix rule to handle enums correctly. 2008-01-03 Sebastien Pouliot * AvoidReturningArraysOnPropertiesRule.cs: New. Rule to warn for properties that returns arrays. By Adrian Tsai. * Gendarme.Rules.Performance.xml.in: Add rule description. * Gendarme.Rules.Performance.mdp: Add rule to MonoDevelop project file. * Makefile.am: Add rule and tests to the build. 2007-12-21 Nestor Salceda * AvoidUnusedParameterRule.cs: If the method is anonymous then, gendarme will skip it. 2007-11-30 Sebastien Pouliot * AvoidUninstantiatedInternalClassesRule.cs: Reworked to make the rule works with all types defined in the assembly. Information for each assembly is cached to speed up searches. 2007-11-29 Sebastien Pouliot * AvoidUninstantiatedInternalClassesRule.cs: Reworked to check for the more general CompilerGeneratedAttribute (removing the direct check required for ). Refactor to reduce code duplication for checking attributes. 2007-11-29 Sebastien Pouliot * AvoidUninstantiatedInternalClassesRule.cs: Ignore special types like and . Also check for nested types (like array defs) and use constants instead of strings. 2007-11-29 Nestor Salceda * AvoidUncalledPrivateCodeRule: Allow if the method is a compiler generated method. 2007-11-22 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Allow unused private ctor. * AvoidUnusedParametersRule.cs: Add checks for Ldarga[_S] IL opcodes. Don't create a MessageCollection unless we have at least one message to return to the runner. 2007-11-22 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Don't report unused code for explicit interface implementation. * Makefile.am: Use nunit-console2 to run tests 2007-11-22 Sebastien Pouliot * DontIgnoreMethodResultRule.cs: Don't create a MessageCollection unless we have at least one message to return to the runner. Reduce false positives by handling all Append* methods from StringBuilder and add exception for PermissionSet.[Add|Remove]Permission. 2007-11-22 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Use MethodReference (not MethodDefinition) when iterating thru overrides. 2007-11-22 Sebastien Pouliot * UseStringEmptyRule.cs: Don't create a MessageCollection unless we have at least one message to return to the runner. 2007-11-21 Sebastien Pouliot * AvoidUninstantiatedInternalClassesRule.cs: Simplified logic. Avoid using strings. IsInstantiated logic looks incomplete in scope (needs more tests). 2007-11-21 Sebastien Pouliot * AvoidUncalledPrivateCodeRule.cs: Simplified logic. Avoid using strings. Consider finalizers (since it's normal that they look uncalled). 2007-11-18 Nestor Salceca * Gendarme.Rules.Performance.xml.in: Fix the problem closing tag in AvoidStringOnStringsRule description. 2007-11-10 Nestor Salceda * Gendarme.Rules.Performance.xml.in: Added Uri for UsingStringLengthInsteadOfEmptyStringRule, AvoidUninstantiatedInternalClassesRule, AvoidUncalledPrivateCodeRule, AvoidToStringOnStringsRule and DontIgnoreMethodResultRule. 2007-11-10 Nestor Salceda * Gendarme.Rules.Performance.xml.in: Added documentation for AvoidToStringOnStringsRule and DontIgnoreMethodResultRule. 2007-10-08 Sebastien Pouliot * AvoidToStringOnStringsRule.cs: Fix in case where the method has no body (e.g. p/invoke, icalls...); * UsingStringLengthInsteadOfCheckingEmptyStringRule.cs: Fix in case where the method has no body (e.g. p/invoke, icalls...); 2007-10-07 Sebastien Pouliot * AvoidToStringOnStringsRule.cs: New rule (Lukasz Knop, GSoC 2007) * AvoidUncalledPrivateCodeRule.cs: New rule (Nidhi Rawal, GSoC 2007) * AvoidUninstantiatedInternalClassesRule.cs: New rule (Nidhi Rawal, GSoC 2007) * DontIgnoreMethodResultRule.cs: New rule (Lukasz Knop, GSoC 2007) * UsingStringLengthInsteadOfCheckingEmptyStringRule.cs: New rule (Nidhi Rawal, GSoC 2007) * Gendarme.Rules.Performance.xml.in: Update rule descriptions. * Makefile.am: Add new rules/tests to build. * Gendarme.Rules.Performance.mdp: Update project file. 2007-10-04 Nestor Salceda * Gendarme.Rules.Performance.mdp, Test.Rules.Performance.mdp: Added AvoidUnusedParametersRule and the respective unit test to MonoDevelop project file. 2007-09-29 Nestor Salceda * Gendarme.Rules.Performance.xml.in: Added Uri for AvoidUnusedParametersRule. 2007-09-04 Nestor Salceda * AvoidUnusedParametersRule.cs: Fixes a NullReference exception if the method hasn't body. 2007-08-31 Nestor Salceda * AvoidUnusedParametersRule.cs: Following the Jb Evain comments, I used a guard pattern for the method.HasBody in the ContainsReferenceDelegateInstructionFor method. I also avoid 2 cast instructions in IsReferencedByDelegateMethod. 2007-08-31 Nestor Salceda * Gendarme.Rules.Performance.xml.in: Added the rule information in the xml file. 2007-08-31 Nestor Salceda * AvoidUnusedParametersRule.cs: New rule to check for unused parameters in a method. * Makefile.am: Added the sources of the rule and the unit tests. 2006-10-15 Sebastien Pouliot * Gendarme.Rules.Performance.xml.in: Update Uri for rules (to generate more useful reports). 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-28 Christian Birkl * Gendarme.Rules.Performance.csproj: Included ChangeLog * EmptyDestructorRule.cs, IDisposableWithDestructorWithoutSuppressFinalizeRule.cs, UseStringEmptyRule.cs: Migrated untyped IList messages collection to typed MessageCollection class. 2006-09-19 Sebastien Pouliot * UseStringEmptyRule.cs: Deal with [g]mcs generating leave instruction (instead of leave.s). Updated rule to use RuleSuccess and RuleFailure (easier to read). 2006-09-18 Sebastien Pouliot * Gendarme.Rules.Performance.xml.in: Update name and description for UseStringEmptyRule. * UseStringEmptyRule.cs: Update rule to provide location (which results in better reports). 2006-08-21 Sebastien Pouliot * Gendarme.Rules.Performance.xml.in: Add description for new rule. * Gendarme.Rules.Performance.mdp: Add new rule to MonoDevelop project. * Makefile.am: Add UseStringEmptyRule.cs and UseStringEmptyTest.cs to the build. * UseStringEmptyRule.cs: New rule to check for the use of "" literal instead of String.Empty. 2006-07-31 Sebastien Pouliot * Gendarme.Rules.Performance.mdp: New. Project file for MonoDevelop. 2006-06-13 Sebastien Pouliot * Makefile.am: Use -pkg:mono-nunit to reference nunit assemblies. Added self-test target to promote compliance ;-) 2006-03-01 Sebastien Pouliot * Makefile.am: Fix deps on run-test mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/OverrideValueTypeDefaultsRule.cs0000664000175000017500000001174612413742070033774 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.OverrideValueTypeDefaultsRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Performance { /// /// This rule checks all value types, except enumerations, to see if they use the default /// implementation of Equals(object) and GetHashCode() methods. While /// ValueType implementations work for any value type they do so at the expense of /// performance (the default implementation uses reflection to access fields). You can easily /// override both methods /// with much faster code since you know all meaningful fields inside your structure. /// At the same time you should also provide, if your language allows it, operator overloads /// for equality (op_Equality, ==) and inequality (op_Inequality, /// !=). /// /// /// Bad example: /// /// public struct Coord { /// int X, Y, Z; /// } /// /// /// /// Good example: /// /// public struct Coord { /// int X, Y, Z; /// /// public override bool Equals (object obj) /// { /// if (obj == null) { /// return false; /// } /// Coord c = (Coord)obj; /// return ((X == c.X) && (Y == c.Y) && (Z == c.Z)); /// } /// /// public override int GetHashCode () /// { /// return X ^ Y ^ Z; /// } /// /// public static bool operator == (Coord left, Coord right) /// { /// return left.Equals (right); /// } /// /// public static bool operator != (Coord left, Coord right) /// { /// return !left.Equals (right); /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This type does not override the default ValueType implementation of Equals(object) and GetHashCode() which are quite slow.")] [Solution ("To avoid performance penalities of the default implementations you should override, or implement, the specified methods.")] [FxCopCompatibility ("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes")] public class OverrideValueTypeDefaultsRule : Rule, ITypeRule { private const string MissingImplementationMessage = "Missing type-specific implementation for '{0}'. {1}"; private const string MissingOperatorsMessage = "If your langage supports overloading operators then you should implement the equality (==) and inequality (!=) operators."; public RuleResult CheckType (TypeDefinition type) { // rule applies only to ValueType, except enums and generated code if (!type.IsValueType || type.IsEnum || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // note: no inheritance check required since we're dealing with structs bool equals = type.HasMethod (MethodSignatures.Equals); bool gethashcode = type.HasMethod (MethodSignatures.GetHashCode); bool operators = type.HasMethod (MethodSignatures.op_Equality) && type.HasMethod (MethodSignatures.op_Inequality); // note: we want to avoid reporting 4 defects each (well most) of the time // the rule is triggered (it's too verbose to be useful) if (equals && gethashcode && operators) return RuleResult.Success; // drop severity one level if only operators are missing (since overloading them // is not available in every language) Severity severity = (equals || gethashcode) ? Severity.Medium : Severity.Low; string msg = String.Format (CultureInfo.InvariantCulture, MissingImplementationMessage, !equals && !gethashcode ? "Equals(object)' and 'GetHashCode()" : equals ? "GetHashCode()" : "Equals(object)", operators ? String.Empty : MissingOperatorsMessage); Runner.Report (type, severity, Confidence.High, msg); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/UseIsOperatorRule.cs0000664000175000017500000000706612413742070031432 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.UseIsOperatorRule class // // Authors: // Seo Sanghyeon // // Copyright (c) 2008 Seo Sanghyeon // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Performance { /// /// This rule looks for complex cast operations (e.g. a as /// with a null check) that can be simplified using the is operator /// (C# syntax). Note: in some case a compiler, like [g]mcs, can optimize the code and /// generate IL identical to a is operator. In this case the rule will not report /// an error even if you could see one while looking the at source code. /// /// /// Bad example: /// /// bool is_my_type = (my_instance as MyType) != null; /// /// /// /// Good example: /// /// bool is_my_type = (my_instance is MyType); /// /// /// This rule is available since Gendarme 2.0 [Problem ("The method should use the \"is\" operator and avoid the cast and comparison to null.")] [Solution ("Replace the cast and compare to null with the simpler \"is\" operator.")] [EngineDependency (typeof (OpCodeEngine))] public class UseIsOperatorRule : Rule, IMethodRule { OpCodeBitmask bitmask = new OpCodeBitmask (0x100000, 0x10000000000000, 0x0, 0x1); public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // check if the method contains a Isinst, Ldnull *and* Ceq instruction if (!bitmask.IsSubsetOf (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; IList instructions = method.Body.Instructions; int n = instructions.Count - 2; for (int i = 0; i < n; i++) { Code code0 = instructions [i].OpCode.Code; if (code0 != Code.Isinst) continue; Code code1 = instructions [i + 1].OpCode.Code; if (code1 != Code.Ldnull) continue; Code code2 = instructions [i + 2].OpCode.Code; if (code2 != Code.Ceq) continue; Runner.Report (method, instructions[i], Severity.High, Confidence.High); } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask bitmask = new OpCodeBitmask (); bitmask.Set (Code.Isinst); bitmask.Set (Code.Ldnull); bitmask.Set (Code.Ceq); Console.WriteLine (bitmask); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/PreferCharOverloadRule.cs0000664000175000017500000001614212413742070032376 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.PreferCharOverloadRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { // rule request from // https://bugzilla.novell.com/show_bug.cgi?id=406889 /// /// This rule looks for calls to String methods that use String /// parameters when a Char parameter could have been used. Using the /// Char overload is preferred because it will be faster. /// /// Note, however, that this may result in subtly different behavior on versions of /// .NET before 4.0: the string overloads do a culture based comparison using /// CultureInfo.CurrentCulture and the char methods do an ordinal /// comparison (a simple compare of the character values). This can result in /// a change of behavior (for example the two can produce different results when /// precomposed characters are used). If this is important it is best to use an /// overload that allows StringComparison or CultureInfo to be explicitly specified /// see [http://msdn.microsoft.com/en-us/library/ms973919.aspx#stringsinnet20_topic4] /// for more details. /// /// With .NET 4.0 String's behavior will change and the various methods /// will be made more consistent. In particular the comparison methods will be changed /// so that they all default to doing an ordinal comparison. /// /// /// Bad example: /// /// if (s.IndexOf (":") == -1) { /// Console.WriteLine ("no separator found"); /// } /// /// /// /// Good example: /// /// if (s.IndexOf (':') == -1) { /// Console.WriteLine ("no separator found"); /// } /// /// /// This rule is available since Gendarme 2.4 [Problem ("This code is calling a string-based overload when a char-based overload could be used.")] [Solution ("Replace the string parameters with chararacter parameters.")] [EngineDependency (typeof (OpCodeEngine))] public class PreferCharOverloadRule : Rule, IMethodRule { static string GetString (Instruction parameter) { if ((parameter == null) || (parameter.OpCode.Code != Code.Ldstr)) return String.Empty; return (parameter.Operand as string); } void Report (MethodDefinition method, Instruction ins, Confidence confidence, MemberReference call, string parameter) { string msg = String.Format (CultureInfo.InvariantCulture, "Prefer the use of: {0}('{1}'...);", call.Name, parameter); Runner.Report (method, ins, Severity.Medium, confidence, msg); } void CheckIndexOf (MethodDefinition method, MethodReference call, Instruction ins) { // check that first parameter is a string of length equal to one string p1 = GetString (ins.TraceBack (method, -1)); if (p1.Length != 1) return; IList pdc = call.Parameters; int last = pdc.Count; if (!pdc [last - 1].ParameterType.IsNamed ("System", "StringComparison")) { // confidence is normal because it's possible that the code expects a // culture sensitive comparison (but that will break in .NET 4). Report (method, ins, Confidence.Normal, call, p1); return; } // we try to find out what's the StringComparison Instruction sc = ins.TraceBack (method, -last); switch (sc.OpCode.Code) { case Code.Ldc_I4_4: // if it's StringComparison.Ordinal (4) then it's identical to what a Char would do Report (method, ins, Confidence.High, call, p1); break; case Code.Ldc_I4_5: // if it's StringComparison.OrdinalIgnoreCase (5) then it's identical as long as the Char is not case sensitive if (p1 == p1.ToLowerInvariant () && p1 == p1.ToUpperInvariant ()) { Report (method, ins, Confidence.High, call, p1); } break; } // otherwise the Char overload is not usable as a direct replacement } void CheckReplace (MethodDefinition method, Instruction ins) { string p1 = GetString (ins.TraceBack (method, -1)); if (p1.Length != 1) return; string p2 = GetString (ins.TraceBack (method, -2)); if (p2.Length != 1) return; string msg = String.Format (CultureInfo.InvariantCulture, "Prefer the use of: Replace('{0}','{1}');", p1, p2); // confidence is higher since there's no StringComparison to consider Runner.Report (method, ins, Severity.Medium, Confidence.High, msg); } static bool CheckFirstParameterIsString (IMethodSignature method) { return (method.HasParameters && method.Parameters [0].ParameterType.IsNamed ("System", "String")); } public RuleResult CheckMethod (MethodDefinition method) { // rule apply only if the method has a body (e.g. p/invokes, icalls don't) if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Call or Callvirt instructions in the method ? if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if ((ins.OpCode.Code != Code.Call) && (ins.OpCode.Code != Code.Callvirt)) continue; MethodReference call = (ins.Operand as MethodReference); if (!call.DeclaringType.IsNamed ("System", "String")) continue; switch (call.Name) { case "IndexOf": case "LastIndexOf": // 3 overloads each - parameters are identical (between them) // and the String (or Char) is always the first one if (CheckFirstParameterIsString (call)) CheckIndexOf (method, call, ins); break; case "Replace": // both parameters needs to be length == 1 if (CheckFirstParameterIsString (call)) CheckReplace (method, ins); break; } // String.Split could be a candidate but it is unlikely we // would be able to guess (often) the content of the arrays } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUnusedPrivateFieldsRule.cs0000664000175000017500000001201412413742070033563 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUnusedPrivateFieldsRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule checks all private fields inside each type to see if some of them are not /// being used. This could be a leftover from debugging or testing code or a more /// serious typo where a wrong field is being used. In any case this makes the type bigger /// than it needs to be which can affect performance when a large number of instances /// exist. /// /// /// Bad example: /// /// public class Bad { /// int level; /// bool b; /// /// public void Indent () /// { /// level++; /// #if DEBUG /// if (b) Console.WriteLine (level); /// #endif /// } /// } /// /// /// /// Good example: /// /// public class Good { /// int level; /// #if DEBUG /// bool b; /// #endif /// /// public void Indent () /// { /// level++; /// #if DEBUG /// if (b) Console.WriteLine (level); /// #endif /// } /// } /// /// [Problem ("This type contains private fields which seem to be unused.")] [Solution ("Remove unused fields to reduce the memory required by the type or correct the use of the field.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] public class AvoidUnusedPrivateFieldsRule : Rule, ITypeRule { private HashSet fields = new HashSet (); // all instruction that load and store fields (instance or static) static OpCodeBitmask LoadStoreFields = new OpCodeBitmask (0x0, 0x3F00000000000000, 0x0, 0x0); public RuleResult CheckType (TypeDefinition type) { // rule does not apply to enums, interfaces and delegates // or types and structures without fields // nor does it apply to generated code (quite common for anonymous types) if (type.IsEnum || type.IsInterface || !type.HasFields || type.IsDelegate () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // copy all fields into an hashset fields.Clear (); foreach (FieldDefinition field in type.Fields) { if (!field.IsPrivate || field.IsLiteral || field.IsGeneratedCode ()) continue; fields.Add (field); } // scan all methods, including constructors, to find if the field is used if (fields.Count > 0) { CheckFieldsUsageInType (type); // scan nested types becuase they also have access to private fields of their parent if (type.HasNestedTypes) { foreach (TypeDefinition nested in type.NestedTypes) CheckFieldsUsageInType (nested); } // check remaining (private) fields in the set foreach (FieldDefinition field in fields) { Runner.Report (field, Severity.Medium, Confidence.Normal); } } return Runner.CurrentRuleResult; } private void CheckFieldsUsageInType (TypeDefinition type) { foreach (MethodDefinition method in type.Methods) { if (!method.HasBody) continue; // don't check the method if it does not access any field if (!OpCodeEngine.GetBitmask (method).Intersect (LoadStoreFields)) continue; foreach (Instruction ins in method.Body.Instructions) { FieldDefinition fd = ins.GetField (); if (fd == null) continue; fields.Remove (fd); } if (fields.Count == 0) break; } } #if false public void Bitmask () { OpCodeBitmask fields = new OpCodeBitmask (); fields.Set (Code.Ldfld); fields.Set (Code.Ldflda); fields.Set (Code.Ldsfld); fields.Set (Code.Ldsflda); fields.Set (Code.Stfld); fields.Set (Code.Stsfld); Console.WriteLine (fields); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/CompareWithStringEmptyEfficientlyRule.cs0000664000175000017500000001071312413742070035471 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.CompareWithStringEmptyEfficientlyRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule will fire if a string is compared to "" or String.Empty. /// Instead use a String.Length test which should be a bit faster. Another /// possibility (with .NET 2.0) is to use the static String.IsNullOrEmpty method. /// String.IsNullOrEmpty. /// /// /// Bad example: /// /// public void SimpleMethod (string myString) /// { /// if (myString.Equals (String.Empty)) { /// } /// } /// /// /// /// Good example: /// /// public void SimpleMethod (string myString) /// { /// if (myString.Length == 0) { /// } /// } /// /// [Problem ("This method compares a string with an empty string by using the Equals method or the equality (==) or inequality (!=) operators.")] [Solution ("Compare String.Length with 0 instead. The string length is known and it's faster to compare integers than to compare strings.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Performance", "CA1820:TestForEmptyStringsUsingStringLength")] public class CompareWithEmptyStringEfficientlyRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule apply only if the method has a body (e.g. p/invokes, icalls don't) if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // is there any Call or Callvirt instructions in the method OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); if (!OpCodeBitmask.Calls.Intersect (bitmask)) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { Code code = ins.OpCode.Code; if ((code != Code.Call) && (code != Code.Callvirt)) continue; MethodReference mref = (ins.Operand as MethodReference); // covers Equals(string) method and both == != operators switch (mref.Name) { case "Equals": if (mref.Parameters.Count > 1) continue; TypeReference type = mref.DeclaringType; if (type.Namespace != "System") continue; string name = type.Name; if ((name != "String") && (name != "Object")) continue; break; case "op_Equality": case "op_Inequality": if (!mref.DeclaringType.IsNamed ("System", "String")) continue; break; default: continue; } Instruction prev = ins.Previous; switch (prev.OpCode.Code) { case Code.Ldstr: if ((prev.Operand as string).Length > 0) continue; break; case Code.Ldsfld: FieldReference field = (prev.Operand as FieldReference); if (!field.DeclaringType.IsNamed ("System", "String")) continue; // unlikely to be anything else (at least with released fx) if (field.Name != "Empty") continue; break; default: continue; } Runner.Report (method, ins, Severity.Medium, Confidence.High); } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUnusedParametersRule.cs0000664000175000017500000001371212413742070033133 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUnusedParametersRule class // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2007 Néstor Salceda // Copyright (C) 2008, 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule is used to ensure that all parameters in a method signature are being used. /// The rule wont report a defect against the following: /// /// Methods that are referenced by a delegate; /// Methods used as event handlers; /// Abstract methods; /// Virtual or overriden methods; /// External methods (e.g. p/invokes) /// /// /// /// Bad example: /// /// public void MethodWithUnusedParameters (IEnumerable enumerable, int x) /// { /// foreach (object item in enumerable) { /// Console.WriteLine (item); /// } /// } /// /// /// /// Good example: /// /// public void MethodWithUsedParameters (IEnumerable enumerable) /// { /// foreach (object item in enumerable) { /// Console.WriteLine (item); /// } /// } /// /// [Problem ("The method contains one or more unused parameters.")] [Solution ("You should remove or use the unused parameters.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] public class AvoidUnusedParametersRule : Rule, IMethodRule { private static bool ContainsReferenceDelegateInstructionFor (MethodDefinition method, MethodDefinition delegateMethod) { if (!method.HasBody) return false; if (!OpCodeEngine.GetBitmask (method).Get (Code.Ldftn)) return false; foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.Code == Code.Ldftn && instruction.Operand.Equals (delegateMethod)) return true; } return false; } private static bool IsReferencedByDelegate (MethodDefinition delegateMethod) { TypeDefinition declaringType = delegateMethod.DeclaringType as TypeDefinition; if (declaringType == null) return false; foreach (var method in declaringType.Methods) if (ContainsReferenceDelegateInstructionFor (method, delegateMethod)) return true; return false; } public RuleResult CheckMethod (MethodDefinition method) { // catch abstract, pinvoke and icalls - where rule does not apply if (!method.HasBody) return RuleResult.DoesNotApply; // skip methods without parameters if (!method.HasParameters) return RuleResult.DoesNotApply; // rule doesn't apply to virtual, overrides or generated code // doesn't apply to code referenced by delegates (note: more complex check moved last) if (method.IsVirtual || method.HasOverrides || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // Also EventArgs parameters are often required in method signatures, // but often not required. Reduce "false positives"(*) for GUI apps // (*) it's more a "don't report things outside developer's control" if (method.IsEventCallback () || IsReferencedByDelegate (method)) return RuleResult.DoesNotApply; // methods with [Conditional] can be empty (not using any parameter) IL-wise but not source-wise, ignore them if (method.HasAttribute ("System.Diagnostics", "ConditionalAttribute")) return RuleResult.DoesNotApply; // rule applies // we limit ourselves to the first 64 parameters (so we can use a bitmask) IList pdc = method.Parameters; int pcount = pdc.Count; if (pcount > 64) pcount = 64; ulong mask = 0; // scan IL to see which parameter is being used foreach (Instruction ins in method.Body.Instructions) { ParameterDefinition parameter = ins.GetParameter (method); if (parameter == null) continue; mask |= ((ulong)1 << parameter.Index); } // quick out based on value - i.e. every parameter is being used int shift = 64 - pcount; if ((mask << shift) == (UInt64.MaxValue << shift)) return RuleResult.Success; for (int i = 0; i < pcount; i++) { if ((mask & ((ulong) 1 << i)) == 0) { ParameterDefinition parameter = pdc [i]; string text = String.Format (CultureInfo.InvariantCulture, "Parameter '{0}' of type '{1}' is never used in the method.", parameter.Name, parameter.ParameterType); Runner.Report (parameter, Severity.Medium, Confidence.Normal, text); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/ImplementEqualsTypeRule.cs0000664000175000017500000001077112413742070032632 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.ImplementEqualsTypeRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Performance { /// /// This rule looks for types that override Object.Equals(object) but do not /// provide a Equals(x) overload using the type. Such an overload removes the /// need to cast the object to the correct type. For value types this also removes the /// costly boxing operations. Assemblies targeting .NET 2.0 (and later) should /// also implement System.IEquatable<T>. /// /// /// Bad example: /// /// public class Bad { /// public override bool Equals (object obj) /// { /// return base.Equals (obj); /// } /// /// public override int GetHashCode () /// { /// return base.GetHashCode (); /// } /// } /// /// /// /// Good example: /// /// // IEquatable<T> is only available since /// // version 2.0 of the .NET framework /// public class Good : IEquatable<Good> { /// public override bool Equals (object obj) /// { /// return (obj as Good); /// } /// /// public bool Equals (Good other) /// { /// return (other != null); /// } /// /// public override int GetHashCode () /// { /// return base.GetHashCode (); /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("Since this type overrides Equals(object) it is also a good candidate to provide a Equals method for it's own type.")] [Solution ("Implement the suggested method or interface (2.0) to avoid casting and, for ValueType, boxing penalities.")] public class ImplementEqualsTypeRule : Rule, ITypeRule { private string [] parameters = new string [1]; public RuleResult CheckType (TypeDefinition type) { // rule does not apply to enums, delegates and to generated code if (type.IsEnum || type.IsDelegate () || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // rule applies only if the type overrides Equals(object) if (!type.HasMethod (MethodSignatures.Equals)) return RuleResult.DoesNotApply; // if so then the type should also implement Equals(type) since this avoid a cast // operation (for reference types) and also boxing (for value types). // we suggest to implement IEquatable if // * the assembly targets the 2.0 (or later) runtime // * and it does not already implement it if (type.Module.Runtime >= TargetRuntime.Net_2_0) { if (!type.Implements ("System", "IEquatable`1")) { Runner.Report (type, Severity.Medium, Confidence.Total, "Implement System.IEquatable"); } return Runner.CurrentRuleResult; } parameters [0] = type.GetFullName (); if (type.GetMethod (MethodAttributes.Public, "Equals", "System.Boolean", parameters) != null) return RuleResult.Success; // we consider this a step more severe for value types since it will need // boxing/unboxing with Equals(object) Severity severity = type.IsValueType ? Severity.Medium : Severity.Low; string msg = String.Format (CultureInfo.InvariantCulture, "Implement 'bool Equals({0})'", type.Name); Runner.Report (type, severity, Confidence.High, msg); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidLargeStructureRule.cs0000664000175000017500000001513412413742070032617 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidLargeStructureRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule will fire if a value type (struct in C#) is larger than a maximum value /// (16 bytes by default). This is a problem because, unlike reference types, value /// types are bitwise-copied whenever they are assigned to a variable or passed to /// a method. If the type /// cannot be reduced in size then it should be /// turned into a reference type (class in C#). /// /// /// Bad example: /// /// public struct BigArgb { /// long a, r, g, b; /// } /// /// /// /// Good example: /// /// public sealed class BigArgb { /// long a, r, g, b; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This structure is larger than the recommended size (16 bytes) which can degrade performance.")] [Solution ("Try to reduce the struct size or change it into a class.")] public class AvoidLargeStructureRule : Rule, ITypeRule { private const int MaximumRecommendedSize = 16; private const int DefaultPaddingSize = 8; // actually we should use IntPtr.Size but that would make the rule // return different results on 64 bits systems private const int ReferenceSize = 4; static Dictionary Primitives = new Dictionary (14) { { "Byte", 1 }, { "SByte", 1 }, { "Boolean", 1 }, { "Int16", 2 }, { "UInt16", 2 }, { "Char", 2 }, { "Int32", 4 }, { "UInt32", 4 }, { "Single", 4 }, { "Int64", 8 }, { "UInt64", 8 }, { "Double", 8 }, { "IntPtr", ReferenceSize }, // so rule return the same results { "UIntPtr", ReferenceSize }, // on 32 and 64 bits architectures }; private int max_size = MaximumRecommendedSize; private int medium_severity_limit; private int high_severity_limit; private int critical_severity_limit; public override void Initialize (IRunner runner) { base.Initialize (runner); medium_severity_limit = max_size * 2; high_severity_limit = max_size * 4; critical_severity_limit = max_size * 16; } /// The maximum size structs may be without a defect. /// Defaults to 16 bytes. [DefaultValue (MaximumRecommendedSize)] [Description ("The maximum size structs may be without a defect.")] public int MaxSize { get { return max_size; } set { if (value <= 0) throw new ArgumentOutOfRangeException ("MaxSize", "Must be positive"); max_size = value; } } private static long SizeOfEnum (TypeDefinition type) { foreach (FieldDefinition field in type.Fields) { // we looking for the special value__ // padding, if required, will be computed by caller if (!field.IsStatic) return SizeOf (field.FieldType); } return 4; // Int32 size } // Note: Needs to be public since this is being tested by our unit tests public static long SizeOfStruct (TypeDefinition type) { if (type == null) return 0; long total = 0; long largest = ReferenceSize; foreach (FieldDefinition field in type.Fields) { // static fields do not count if (field.IsStatic) continue; // add size of the type long size = SizeOf (field.FieldType); // would this be aligned correctly if (size > 1) { long align = Math.Min (ReferenceSize, size); if (total % align != 0) size += (align - total % align); } total += size; if (largest < size) largest = Math.Min (size, DefaultPaddingSize); } // minimal size, even for an empty struct, is one byte if (total == 0) return 1; if (total < ReferenceSize) return total; long remainder = (total % ReferenceSize); if (remainder != 0) total += (largest - remainder); return total; } private static long SizeOf (TypeReference type) { if (!type.IsValueType || type.IsArray) return ReferenceSize; // list based on Type.IsPrimitive if (type.Namespace == "System") { int size; if (Primitives.TryGetValue (type.Name, out size)) return (long) size; } TypeDefinition td = type.Resolve (); // we don't know enough about the type so we assume it's a reference if (td == null) return ReferenceSize; if (td.IsEnum) return SizeOfEnum (td); return SizeOfStruct (td); } public RuleResult CheckType (TypeDefinition type) { // we only check value types not generated by tools (including the compiler) // we also exclude enums since they cannot be larger than 64 bits (8 bytes) if (!type.IsValueType || type.IsEnum || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // rule applies long size = SizeOfStruct (type); if (size <= max_size) return RuleResult.Success; // here we compute severity based on the actual struct size Severity severity = Severity.Low; if (size > critical_severity_limit) severity = Severity.Critical; else if (size > high_severity_limit) severity = Severity.High; else if (size > medium_severity_limit) severity = Severity.Medium; string text = String.Format (CultureInfo.CurrentCulture, "Structure size is {0} bytes.", size); Runner.Report (type, severity, Confidence.High, text); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUnsealedConcreteAttributesRule.cs0000664000175000017500000000625112413742070035136 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUnsealedConcreteAttributesRule // // Authors: // Daniel Abramov // // Copyright (C) 2007 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule fires if an attribute is defined which is both concrete (i.e. not abstract) /// and unsealed. This is a performance problem because it means that /// System.Attribute.GetCustomAttribute has to search the attribute type /// hierarchy for derived types. To fix this either seal the type or make it abstract. /// /// /// Bad example: /// /// [AttributeUsage (AttributeTargets.All)] /// public class BadAttribute : Attribute { /// } /// /// /// /// Good example (sealed): /// /// [AttributeUsage (AttributeTargets.All)] /// public sealed class SealedAttribute : Attribute { /// } /// /// /// /// Good example (abstract and sealed): /// /// [AttributeUsage (AttributeTargets.All)] /// public abstract class AbstractAttribute : Attribute { /// } /// /// [AttributeUsage (AttributeTargets.All)] /// public sealed class ConcreteAttribute : AbstractAttribute { /// } /// /// /// Before Gendarme 2.0 this rule was named AvoidUnsealedAttributesRule. [Problem ("Because of performance issues, concrete attributes should be sealed.")] [Solution ("Unless you plan to inherit from this attribute you should consider sealing it.")] [FxCopCompatibility ("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")] public class AvoidUnsealedConcreteAttributesRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies only to attributes if (!type.IsAttribute ()) return RuleResult.DoesNotApply; if (type.IsAbstract) // it's ok return RuleResult.Success; if (type.IsSealed) // it's ok return RuleResult.Success; Runner.Report (type, Severity.Medium, Confidence.High); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Makefile.in0000664000175000017500000007231012642235732027554 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Performance ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) # turn off optimization for tests since gmcs (unlike MS csc) now turns "" into String.Empty when optimizing is on EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) -unsafe -o- -d:CODE_ANALYSIS console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ AvoidConcatenatingCharsRule.cs \ AvoidLargeNumberOfLocalVariablesRule.cs \ AvoidLargeStructureRule.cs \ AvoidLocalDataStoreSlotRule.cs \ AvoidMethodWithLargeMaximumStackSizeRule.cs \ AvoidRepetitiveCallsToPropertiesRule.cs \ AvoidRepetitiveCastsRule.cs \ AvoidReturningArraysOnPropertiesRule.cs \ AvoidTypeGetTypeForConstantStringsRule.cs \ AvoidUncalledPrivateCodeRule.cs \ AvoidUninstantiatedInternalClassesRule.cs \ AvoidUnnecessaryOverridesRule.cs \ AvoidUnneededCallsOnStringRule.cs \ AvoidUnneededFieldInitializationRule.cs \ AvoidUnneededUnboxingRule.cs \ AvoidUnsealedConcreteAttributesRule.cs \ AvoidUnsealedUninheritedInternalClassesRule.cs \ AvoidUnusedParametersRule.cs \ AvoidUnusedPrivateFieldsRule.cs \ CompareWithStringEmptyEfficientlyRule.cs \ ConsiderCustomAccessorsForNonVisibleEventsRule.cs \ DontIgnoreMethodResultRule.cs \ EmptyDestructorRule.cs \ IDisposableWithDestructorWithoutSuppressFinalizeRule.cs \ ImplementEqualsTypeRule.cs \ MathMinMaxCandidateRule.cs \ OverrideValueTypeDefaultsRule.cs \ PreferCharOverloadRule.cs \ PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceRule.cs \ PreferLiteralOverInitOnlyFieldsRule.cs \ RemoveUnusedLocalVariablesRule.cs \ ReviewLinqMethodRule.cs \ UseIsOperatorRule.cs \ UseStringEmptyRule.cs \ UseTypeEmptyTypesRule.cs tests_sources = \ AvoidConcatenatingCharsTest.cs \ AvoidLargeNumberOfLocalVariablesTest.cs \ AvoidLocalDataStoreSlotTest.cs \ AvoidRepetitiveCallsToPropertiesTest.cs \ AvoidUnnecessaryOverridesTest.cs \ AvoidUnneededFieldInitializationTest.cs \ EmptyDestructorTest.cs \ GlobalSuppressions.cs \ IDisposableWithDestructorWithoutSuppressFinalizeTest.cs \ UseStringEmptyTest.cs \ UseTypeEmptyTypesTest.cs \ AvoidUnusedParametersTest.cs \ CompareWithStringEmptyEfficientlyTest.cs \ AvoidMethodWithLargeMaximumStackSizeTest.cs \ AvoidUncalledPrivateCodeTest.cs \ AvoidUnneededCallsOnStringTest.cs \ AvoidUninstantiatedInternalClassesTest.cs \ DontIgnoreMethodResultTest.cs \ AvoidReturningArraysOnPropertiesTest.cs \ AvoidUnsealedConcreteAttributesTest.cs \ UseIsOperatorTest.cs \ AvoidUnsealedUninheritedInternalClassesTest.cs \ OverrideValueTypeDefaultsTest.cs \ ImplementEqualsTypeTest.cs \ MathMinMaxCandidateTest.cs \ AvoidLargeStructureTest.cs \ RemoveUnusedLocalVariablesTest.cs \ AvoidUnneededUnboxingTest.cs \ ConsiderCustomAccessorsForNonVisibleEventsTest.cs \ AvoidTypeGetTypeForConstantStringsTest.cs \ AvoidRepetitiveCastsTest.cs \ AvoidUnusedPrivateFieldsTest.cs \ PreferCharOverloadTest.cs \ PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceTest.cs \ PreferLiteralOverInitOnlyFieldsTest.cs \ ReviewLinqMethodTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Performance/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Performance/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/DontIgnoreMethodResultRule.cs0000664000175000017500000001324012413742070033265 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.DontIgnoreMethodResultRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // Copyright (C) 2007-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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule fires if a method is called that returns a new instance but that instance /// is not used. This is a performance problem because it is wasteful to create and /// collect objects which are never actually used. It may also indicate a logic problem. /// Note that this rule currently only checks methods within a small number of System /// types. /// /// /// Bad example: /// /// public void GetName () /// { /// string name = Console.ReadLine (); /// // This is a bug: strings are (mostly) immutable so Trim leaves /// // name untouched and returns a new string. /// name.Trim (); /// Console.WriteLine ("Name: {0}", name); /// } /// /// /// /// Good example: /// /// public void GetName () /// { /// string name = Console.ReadLine (); /// name = name.Trim (); /// Console.WriteLine ("Name: {0}", name); /// } /// /// [Problem ("The method ignores the result value from a method call.")] [Solution ("Don't ignore the result value.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults")] public class DoNotIgnoreMethodResultRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule only applies if the method has a body // rule doesn't not apply to generated code (out of developer's control) if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // check if the method contains a Pop instruction if (!OpCodeEngine.GetBitmask (method).Get (Code.Pop)) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { if (instruction.OpCode.Code == Code.Pop) { CheckForViolation (method, instruction.Previous); } } return Runner.CurrentRuleResult; } private static bool IsCallException (MethodReference method) { switch (method.DeclaringType.GetFullName ()) { case "System.String": // Since strings are immutable, calling System.String methods that returns strings // better be assigned to something return !method.ReturnType.IsNamed ("System", "String"); case "System.IO.DirectoryInfo": // GetDirectories overloads don't apply to the instance return (method.Name != "GetDirectories"); case "System.Security.PermissionSet": // Intersection and Union returns a new PermissionSet (it does not change the instance) return !method.ReturnType.IsNamed ("System.Security", "PermissionSet"); default: // this is useless anytime, if unassigned, more in cases like a StringBuilder return (method.Name != "ToString"); } } private static bool IsNewException (MemberReference method) { switch (method.GetFullName ()) { // supplying a callback is enough to make the Timer creation worthwhile case "System.Void System.Threading.Timer::.ctor(System.Threading.TimerCallback,System.Object,System.Int32,System.Int32)": return true; default: return false; } } private void CheckForViolation (MethodDefinition method, Instruction instruction) { if ((instruction.OpCode.Code == Code.Newobj || instruction.OpCode.Code == Code.Newarr)) { MemberReference member = (instruction.Operand as MemberReference); if ((member != null) && !IsNewException (member)) { string s = String.Format (CultureInfo.InvariantCulture, "Unused object of type '{0}' created.", member.GetFullName ()); Runner.Report (method, instruction, Severity.High, Confidence.Normal, s); } } if (instruction.OpCode.Code == Code.Call || instruction.OpCode.Code == Code.Callvirt) { MethodReference callee = instruction.Operand as MethodReference; if (callee != null && !callee.ReturnType.IsValueType) { // check for some common exceptions (to reduce false positive) if (!IsCallException (callee)) { string s = String.Format (CultureInfo.InvariantCulture, "Do not ignore method results from call to '{0}'.", callee.GetFullName ()); Runner.Report (method, instruction, Severity.Medium, Confidence.Normal, s); } } } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidConcatenatingCharsRule.cs0000664000175000017500000001373612642235713033415 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidConcatenatingCharsRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule will warn you if boxing is used to concatenate a string /// since this will slow down your code and can be easily avoided. This /// often happen when concatenating System.String and System.Char /// values together. However the rule is not limited to check boxing on /// System.Char since compilers often transform a character into its /// integer value (e.g. 'a' == 61) and the same boxing issue exists on integers. /// /// /// Bad example: /// /// public string PrintIndex (string a, char b) /// { /// // This is compiled into String.Concat(params object[]) /// // and requires boxing the 4 characters /// Console.WriteLine ('[' + a + ',' + b + ']'); /// } /// /// /// /// Good example: /// /// public string PrintIndex (string a, char b) /// { /// // This is compiled into String.Concat(params string[]) /// // and no boxing is required /// Console.WriteLine ("[" + a + "," + b.ToString () + "]"); /// } /// /// /// This rule is available since Gendarme 2.8 [Problem ("Unneeded boxing was found for concatenating a string.")] [Solution ("Change your code to avoid the boxing when creating your string.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidConcatenatingCharsRule : Rule, IMethodRule { static bool HasReferenceToStringConcatObject (ModuleDefinition module) { foreach (MemberReference mr in module.GetMemberReferences ()) { if (mr.IsNamed ("System", "String", "Concat")) { MethodReference method = (mr as MethodReference); // catch both System.Object and System.Object[] if (!method.HasParameters) continue; TypeReference ptype = method.Parameters [0].ParameterType; switch (ptype.Name) { case "Object": case "Object[]": return (ptype.Namespace == "System"); } } } return false; } public override void Initialize (IRunner runner) { base.Initialize (runner); // turn off the rule if String.Concat(object...) is not used in the module Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = e.CurrentAssembly.Name.Name == "mscorlib" || HasReferenceToStringConcatObject (e.CurrentModule); }; } private void ReportBoxing (MethodDefinition method, Instruction ins, Confidence confidence) { string msg = String.Format (CultureInfo.InvariantCulture, "Type '{0}' is being boxed.", (ins.Operand as TypeReference).GetFullName ()); Runner.Report (method, ins, Severity.High, confidence, msg); } // look for boxing in the compiler-constructed array private void ScanArray (MethodDefinition method, Instruction ins) { while (ins != null) { switch (ins.OpCode.Code) { case Code.Newarr: return; case Code.Box: ReportBoxing (method, ins, Confidence.Normal); break; } ins = ins.Previous; } } private void CheckParameters (IMethodSignature concat, MethodDefinition caller, Instruction ins) { // check for boxed (likely char, but could be other types too) on any parameter for (int i = 0; i < concat.Parameters.Count; i++) { Instruction source = ins.TraceBack (caller, -i); if ((source == null) || (source.OpCode.Code != Code.Box)) continue; ReportBoxing (caller, source, Confidence.High); } } public RuleResult CheckMethod (MethodDefinition method) { // rule apply only if the method has a body (e.g. p/invokes, icalls don't) if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Call or Callvirt instructions in the method ? if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if ((ins.OpCode.Code != Code.Call) && (ins.OpCode.Code != Code.Callvirt)) continue; // look for String.Concat overloads using System.Object MethodReference mr = (ins.Operand as MethodReference); if (!mr.HasParameters || !mr.IsNamed ("System", "String", "Concat")) continue; TypeReference ptype = mr.Parameters [0].ParameterType; if (ptype.Namespace != "System") continue; // very unlikely switch (ptype.Name) { case "Object": CheckParameters (mr, method, ins); break; case "Object[]": if ((ins.Previous.OpCode.Code == Code.Stelem_Ref) || ins.Previous.IsLoadLocal ()) ScanArray (method, ins.Previous); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUnneededFieldInitializationRule.cs0000664000175000017500000001044312413742070035245 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUnneededFieldInitializationRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule looks for constructors that assign fields to their default value /// (e.g. 0 for an integer, null for an object or a string). Since the CLR zero initializes /// all values there is no need, under most circumstances, to assign default values. /// Doing so only adds size to source code and in IL. /// /// /// Bad example: /// /// public class Bad { /// int i; /// string s; /// /// public Bad () /// { /// i = 0; /// s = null; /// } /// } /// /// /// /// Good example: /// /// public class Good { /// int i; /// string s; /// /// public Good () /// { /// // don't assign 'i' since it's already 0 /// // but we might prefer to assign a string to String.Empty /// s = String.Empty; /// } /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("This constructor needlessly initializes zero initializes some fields.")] [Solution ("Remove the unneeded initialization from the constructors.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily")] public class AvoidUnneededFieldInitializationRule : Rule, IMethodRule { // note: it's tempting to use IType rule here, since it would avoid iterating // all non-constructors methods. However the reporting would be less precise // since we want to report which source line inside a ctor is problematic public RuleResult CheckMethod (MethodDefinition method) { if (!method.IsConstructor || !method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; TypeReference type = method.DeclaringType; foreach (Instruction ins in method.Body.Instructions) { // check for assignation on instance or static fields Code code = ins.OpCode.Code; bool is_static = (code == Code.Stsfld); bool is_instance = (code == Code.Stfld); if (!is_static && !is_instance) continue; // special case: a struct ctor MUST assign every instance fields if (type.IsValueType && is_instance) continue; // make sure we assign to this type (and not another one) FieldReference fr = (ins.Operand as FieldReference); if (fr.DeclaringType != type) continue; bool unneeded = false; if (fr.FieldType.IsValueType) { unneeded = ins.Previous.IsOperandZero (); } else { unneeded = ins.Previous.OpCode.Code == Code.Ldnull; } if (unneeded) { // we're more confident about the unneeded initialization // on static ctor, since another (previous) ctor, can't set // the values differently Confidence c = method.IsStatic ? Confidence.High : Confidence.Normal; Runner.Report (method, ins, Severity.Medium, c, fr.Name); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidLargeNumberOfLocalVariablesRule.cs0000664000175000017500000000673312413742070035145 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidLargeNumberOfLocalVariablesRule // // Authors: // Sebastien Pouliot // // 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; using System.ComponentModel; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule warns when the number of local variables exceed a maximum value (default is /// 64). Having a large amount of local variables makes it hard to generate code that /// performs well and, likely, makes the code harder to understand. /// /// This rule is available since Gendarme 2.0 [Problem ("The number of local variables is so large that the JIT will be unable to properly allocate registers.")] [Solution ("Refactor your code to reduce the number of variables or split the method into several methods.")] [FxCopCompatibility ("Microsoft.Performance", "CA1809:AvoidExcessiveLocals")] public class AvoidLargeNumberOfLocalVariablesRule : Rule, IMethodRule { private const int DefaultMaxVariables = 64; private int max_variables = DefaultMaxVariables; /// The maximum number of local variables which methods may have without a defect being reported. /// Defaults to 64. [DefaultValue (DefaultMaxVariables)] [Description ("The maximum number of local variables which methods may have without a defect being reported.")] public int MaximumVariables { get { return max_variables; } set { max_variables = value; } } public RuleResult CheckMethod (MethodDefinition method) { // ingore methods without body and generated code if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // special case for System.Windows.Forms since it's designer does not // mark this code as generated :-( if (method.Name == "InitializeComponent") { if (method.DeclaringType.Inherits ("System.Windows.Forms", "Form")) return RuleResult.DoesNotApply; } int num = method.Body.Variables.Count; if (num <= MaximumVariables) return RuleResult.Success; string msg = String.Format (CultureInfo.InvariantCulture, "Found {0} local variables (maximum {1}).", num, MaximumVariables); Runner.Report (method, Severity.High, Confidence.High, msg); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/PreferLiteralOverInitOnlyFieldsRule.cs0000664000175000017500000001457212413742070035077 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.PreferConstantOverStaticFieldsRule // // Authors: // Sebastien Pouliot // // 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; using System.Linq; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule looks for InitOnly fields (readonly in C#) that could be /// turned into Literal (const in C#) because their value is known at /// compile time. Literal fields don't need to be initialized (i.e. they don't /// force the compiler to add a static constructor to the type) resulting in less code and the /// value (not a reference to the field) will be directly used in the IL (which is OK /// if the field has internal visibility, but is often problematic if the field is visible outside /// the assembly). /// /// /// Bad example: /// /// public class ClassWithReadOnly { /// static readonly int One = 1; /// } /// /// /// /// Good example: /// /// public class ClassWithConst /// { /// const int One = 1; /// } /// /// /// This rule is available since Gendarme 2.2 [Problem ("Static readonly fields were found where a literal (const) field could be used.")] [Solution ("Replace the static readonly fields with const(ant) fields.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Performance", "CA1802:UseLiteralsWhereAppropriate")] public class PreferLiteralOverInitOnlyFieldsRule : Rule, ITypeRule { static OpCodeBitmask Constant = new OpCodeBitmask (0xFFFE00000, 0x2000000000000, 0x0, 0x0); static OpCodeBitmask Convert = new OpCodeBitmask (0x0, 0x80203FC000000000, 0x400F87F8000001FF, 0x0); public RuleResult CheckType (TypeDefinition type) { if (type.IsEnum || type.IsInterface || type.IsDelegate ()) return RuleResult.DoesNotApply; // get the static constructor MethodDefinition cctor = type.Methods.FirstOrDefault (m => m.IsConstructor && m.IsStatic); if (cctor == null) return RuleResult.DoesNotApply; // check if we store things into static fields if (!OpCodeEngine.GetBitmask (cctor).Get (Code.Stsfld)) return RuleResult.DoesNotApply; // verify each store we do in a static field foreach (Instruction ins in cctor.Body.Instructions) { if (ins.OpCode.Code != Code.Stsfld) continue; // make sure we assign to this type (and not another one) FieldReference fr = (ins.Operand as FieldReference); if (fr.DeclaringType != type) continue; // if it's this one then we have a FieldDefinition available FieldDefinition field = (fr as FieldDefinition); // check for static (we already know with Stsfld) and readonly if (!field.IsInitOnly) continue; // look at what is being assigned Instruction previous = ins.Previous; // while skipping conversions if (Convert.Get (previous.OpCode.Code)) previous = previous.Previous; // and report constant stuff if (Constant.Get (previous.OpCode.Code)) { // adjust severity based on the field visibility and it's type Severity s = (field.FieldType.IsNamed ("System", "String") || !field.IsVisible ()) ? Severity.High : Severity.Medium; Runner.Report (field, s, Confidence.Normal); } } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask constant = new OpCodeBitmask (); constant.Set (Code.Ldstr); constant.Set (Code.Ldc_I4); constant.Set (Code.Ldc_I4_0); constant.Set (Code.Ldc_I4_1); constant.Set (Code.Ldc_I4_2); constant.Set (Code.Ldc_I4_3); constant.Set (Code.Ldc_I4_4); constant.Set (Code.Ldc_I4_5); constant.Set (Code.Ldc_I4_6); constant.Set (Code.Ldc_I4_7); constant.Set (Code.Ldc_I4_8); constant.Set (Code.Ldc_I4_M1); constant.Set (Code.Ldc_I4_S); constant.Set (Code.Ldc_I8); constant.Set (Code.Ldc_R4); constant.Set (Code.Ldc_R8); Console.WriteLine (constant); OpCodeBitmask convert = new OpCodeBitmask (); convert.Set (Code.Conv_I); convert.Set (Code.Conv_I1); convert.Set (Code.Conv_I2); convert.Set (Code.Conv_I4); convert.Set (Code.Conv_I8); convert.Set (Code.Conv_Ovf_I); convert.Set (Code.Conv_Ovf_I_Un); convert.Set (Code.Conv_Ovf_I1); convert.Set (Code.Conv_Ovf_I1_Un); convert.Set (Code.Conv_Ovf_I2); convert.Set (Code.Conv_Ovf_I2_Un); convert.Set (Code.Conv_Ovf_I4); convert.Set (Code.Conv_Ovf_I4_Un); convert.Set (Code.Conv_Ovf_I8); convert.Set (Code.Conv_Ovf_I8_Un); convert.Set (Code.Conv_Ovf_U); convert.Set (Code.Conv_Ovf_U_Un); convert.Set (Code.Conv_Ovf_U1); convert.Set (Code.Conv_Ovf_U1_Un); convert.Set (Code.Conv_Ovf_U2); convert.Set (Code.Conv_Ovf_U2_Un); convert.Set (Code.Conv_Ovf_U4); convert.Set (Code.Conv_Ovf_U4_Un); convert.Set (Code.Conv_Ovf_U8); convert.Set (Code.Conv_Ovf_U8_Un); convert.Set (Code.Conv_R_Un); convert.Set (Code.Conv_R4); convert.Set (Code.Conv_R8); convert.Set (Code.Conv_U); convert.Set (Code.Conv_U1); convert.Set (Code.Conv_U2); convert.Set (Code.Conv_U4); convert.Set (Code.Conv_U8); Console.WriteLine (convert); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/EmptyDestructorRule.cs0000664000175000017500000001062712413742070032040 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.RemoveUnneededFinalizerRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { // similar to findbugs // FI: Empty finalizer should be deleted (FI_EMPTY) // FI: Finalizer does nothing but call superclass finalizer (FI_USELESS) // FI: Finalizer only nulls fields (FI_FINALIZER_ONLY_NULLS_FIELDS) /// /// This rule looks for types that have an empty finalizer (a.k.a. destructor in C# or /// Finalize method). Finalizers that simply set fields to null are considered to be /// empty because this does not help the garbage collection. You should remove the empty /// finalizer to alleviate pressure on the garbage collector and finalizer thread. /// /// /// Bad example (empty): /// /// class Bad { /// ~Bad () /// { /// } /// } /// /// /// /// Bad example (only nulls fields): /// /// class Bad { /// object o; /// /// ~Bad () /// { /// o = null; /// } /// } /// /// /// /// Good example: /// /// class Good { /// object o; /// } /// /// /// Prior to Gendarme 2.2 this rule was named EmptyDestructorRule [Problem ("The type has an useless (empty or only nullifying fields) finalizer.")] [Solution ("Remove the finalizer from this type to reduce the GC workload.")] [FxCopCompatibility ("Microsoft.Performance", "CA1821:RemoveEmptyFinalizers")] public class RemoveUnneededFinalizerRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies only to type with a finalizer MethodDefinition finalizer = type.GetMethod (MethodSignatures.Finalize); if (finalizer == null) return RuleResult.DoesNotApply; // rule applies // finalizer is present, look if it has any code within it // i.e. look if is does anything else than calling it's base class int nullify_fields = 0; foreach (Instruction ins in finalizer.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: // it's empty if we're calling the base class finalizer MethodReference mr = (ins.Operand as MethodReference); if ((mr == null) || !mr.IsFinalizer ()) return RuleResult.Success; break; case Code.Nop: case Code.Leave: case Code.Leave_S: case Code.Ldarg_0: case Code.Endfinally: case Code.Ret: case Code.Ldnull: // ignore break; case Code.Stfld: // considered as empty as long as it's only to nullify them if (ins.Previous.OpCode.Code == Code.Ldnull) { nullify_fields++; continue; } return RuleResult.Success; default: // finalizer isn't empty (normal) return RuleResult.Success; } } // finalizer is empty (bad / useless) string msg = nullify_fields == 0 ? String.Empty : String.Format (CultureInfo.InvariantCulture, "Contains {0} fields being nullified needlessly", nullify_fields); Runner.Report (type, Severity.Medium, Confidence.Normal, msg); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUninstantiatedInternalClassesRule.cs0000664000175000017500000002011212413742070035641 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUninstantiatedInternalClassesRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-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; using System.Collections.Generic; using System.Linq; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule will fire if a type is only visible within its assembly, can be instantiated, but /// is not instantiated. Such types are often leftover (dead code) or are debugging/testing /// code and not required. However in some case the types might by needed, e.g. when /// accessed thru reflection or if the [InternalsVisibleTo] attribute is used on the /// assembly. /// /// /// Bad example: /// /// // defined, but never instantiated /// internal class MyInternalClass { /// // ... /// } /// /// public class MyClass { /// static void Main () /// { /// // ... /// } /// } /// /// /// /// Good example: /// /// internal class MyInternalClass { /// // ... /// } /// /// public class MyClass { /// static void Main () /// { /// MyInternalClass c = new MyInternalClass (); /// // ... /// } /// } /// /// [Problem ("The internal type is not instantiated by code within the assembly.")] [Solution ("Remove the type or add the code that uses it. If the type contains only static methods then either add the static modifier to the type or add the private construtor to the type to prevent the compiler from emitting a default public instance constructor.")] [FxCopCompatibility ("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")] public class AvoidUninstantiatedInternalClassesRule : Rule, ITypeRule { // we use this to cache the information about the assembly // i.e. all types instantiated by the assembly private Dictionary> cache = new Dictionary> (); void CacheInstantiationFromAssembly (AssemblyDefinition assembly) { if (cache.ContainsKey (assembly)) return; var typeset = new HashSet (); foreach (ModuleDefinition module in assembly.Modules) foreach (TypeDefinition type in module.Types) ProcessType (type, typeset); cache.Add (assembly, typeset); } static void AddType (ISet typeset, TypeReference type) { // we're interested in the array element type, not the array itself if (type.IsArray) type = type.GetElementType (); // only keep stuff from this assembly, which means we have a TypeDefinition (not a TypeReference) // and types that are not visible outside the assembly (since this is what we check for) TypeDefinition td = (type as TypeDefinition); if ((td != null) && !td.IsVisible ()) typeset.Add (type); } static void ProcessType (TypeDefinition type, HashSet typeset) { if (type.HasFields) { foreach (FieldDefinition field in type.Fields) { TypeReference t = field.FieldType; // don't add the type itself (e.g. enums) if (type != t) AddType (typeset, t); } } if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) ProcessMethod (method, typeset); } if (type.HasNestedTypes) { foreach (TypeDefinition nested in type.NestedTypes) ProcessType (nested, typeset); } } static void ProcessMethod (MethodDefinition method, HashSet typeset) { // this is needed in case we return an enum, a struct or something mapped // to p/invoke (i.e. no ctor called). We also need to check for arrays. TypeReference t = method.ReturnType; AddType (typeset, t); if (method.HasParameters) { // an "out" from a p/invoke must be flagged foreach (ParameterDefinition parameter in method.Parameters) { // we don't want the reference (&) on the type t = parameter.ParameterType.GetElementType (); AddType (typeset, t); } } if (!method.HasBody) return; MethodBody body = method.Body; if (body.HasVariables) { // add every type of variables we use foreach (VariableDefinition variable in body.Variables) { t = variable.VariableType; AddType (typeset, t); } } // add every type we create or refer to (e.g. loading fields from an enum) foreach (Instruction ins in body.Instructions) { if (ins.Operand == null) continue; t = ins.Operand as TypeReference; if (t == null) { MethodReference m = ins.Operand as MethodReference; if (m != null) { t = m.DeclaringType; GenericInstanceType generic = (t as GenericInstanceType); if (generic != null) t = generic.GetElementType (); } else { FieldReference f = ins.Operand as FieldReference; if (f != null) t = f.DeclaringType; } } if (t != null) AddType (typeset, t); } } static bool HasSinglePrivateConstructor (TypeDefinition type) { if (!type.HasMethods) return false; MethodDefinition constructor = null; foreach (MethodDefinition method in type.Methods) { if (!method.IsConstructor) continue; if (constructor != null) return false; // more than one ctor constructor = method; } if (constructor == null) return false; return (constructor.IsPrivate && !constructor.HasParameters); } public RuleResult CheckType (TypeDefinition type) { // rule apply to internal (non-visible) types // note: IsAbstract also excludes static types (2.0) if (type.IsVisible () || type.IsAbstract || type.IsGeneratedCode ()) return RuleResult.DoesNotApply; // people use this pattern to have a static class in C# 1. if (type.IsSealed && HasSinglePrivateConstructor (type)) return RuleResult.DoesNotApply; // used for documentation purpose by monodoc if (type.Name == "NamespaceDoc") return RuleResult.DoesNotApply; // rule applies // if the type holds the Main entry point then it is considered useful AssemblyDefinition assembly = type.Module.Assembly; MethodDefinition entry_point = assembly.EntryPoint; if ((entry_point != null) && (entry_point.DeclaringType == type)) return RuleResult.Success; // create a cache of all type instantiation inside this CacheInstantiationFromAssembly (assembly); HashSet typeset = null; if (cache.ContainsKey (assembly)) typeset = cache [assembly]; // if we can't find the non-public type being used in the assembly then the rule fails if (typeset == null || !typeset.Contains (type)) { // base confidence on whether the internals are visible or not Confidence c = assembly.HasAttribute ("System.Runtime.CompilerServices", "InternalsVisibleToAttribute") ? Confidence.Low : Confidence.Normal; Runner.Report (type, Severity.High, c); return RuleResult.Failure; } return RuleResult.Success; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/ReviewLinqMethodRule.cs0000664000175000017500000002650712413742070032115 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.ReviewLinqMethodRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// Linq extension methods operate on sequences of values so they generally /// have linear time complexity. However you may be able to achieve better /// than linear time performance if you use a less general method or take /// advantage of a method provided by an Sytem.Collections.Generic.IEnumerable<T> /// subclass. /// /// /// Bad example: /// /// public string FirstOrMissing (IEnumerable<string> sequence, string missing) /// { /// // Count () is O(n) /// if (sequence.Count () > 0) { /// return sequence.First (); /// } /// return missing; /// } /// /// public void Append (List<string> lines, string line) /// { /// // Last () is O(n) /// if (lines.Count == 0 || lines.Last () != line) { /// lines.Add (line); /// } /// } /// /// /// /// Good example: /// /// public string FirstOrMissing (IEnumerable<string> sequence, string missing) /// { /// // We don't need an exact count so we can use the O(1) Any () method. /// if (sequence.Any ()) { /// return sequence.First (); /// } /// return missing; /// } /// /// public void Append (List<string> lines, string line) /// { /// // Lines is a List so we can use the O(1) subscript operator instead of /// // the Last () method. /// if (lines.Count == 0 || lines [lines.Count - 1] != line) { /// lines.Add (line); /// } /// } /// /// /// This rule is available since Gendarme 2.6 [Problem ("A linq extension method with linear time complexity is used, but a more efficient method is available.")] [Solution ("Use the more efficient method.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class ReviewLinqMethodRule : Rule, IMethodRule { private readonly OpCodeBitmask Comparisons = new OpCodeBitmask (0x2801400000000000, 0x0, 0x0, 0xB); private readonly OpCodeBitmask Conditions = new OpCodeBitmask (0x300180000000000, 0x0, 0x0, 0x0); public readonly MethodSignature CountProperty = new MethodSignature ("get_Count", null, new string [0]); public readonly MethodSignature LengthProperty = new MethodSignature ("get_Length", null, new string [0]); public readonly MethodSignature Subscript = new MethodSignature ("get_Item", null, new string [] {"System.Int32"}); public readonly MethodSignature Sort = new MethodSignature ("Sort", null, new string [1]); private bool HasMethod (TypeReference type, MethodSignature method) { if (type.HasMethod (method)) return true; TypeDefinition td = type.Resolve (); return td != null && td.BaseType != null && HasMethod (td.BaseType, method); } private void CheckForCountProperty (TypeReference type, MethodDefinition method, Instruction ins) { if (HasMethod (type, CountProperty)) { string message = "Use the Count property instead of the Count () method."; Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } else if (type.IsArray || HasMethod (type, LengthProperty)) { // note: arrays [] always have a Length property but resolving arrays return the element type string message = "Use the Length property instead of the Count () method."; Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } } private void CheckForAny (MethodDefinition method, Instruction ins) { // call System.Int32 System.Linq.Enumerable::Count(System.Collections.Generic.IEnumerable`1) // ldc.i4.0 // cgt, clt, ceq, ble, ble.s, bge or bge.s Instruction n1 = ins.Next; Instruction n2 = n1 != null ? n1.Next : null; if (n1 != null && n2 != null) { object rhs = n1.GetOperand (method); if (rhs != null && rhs.Equals (0)) { if (Comparisons.Get (n2.OpCode.Code)) { string message = "Use Any () instead of Count ()."; Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } } } // ldc.i4.0 // ldarg.1 // call System.Int32 System.Linq.Enumerable::Count(System.Collections.Generic.IEnumerable`1) // cgt, clt, ceq, ble, ble.s, bge or bge.s Instruction p1 = ins.Previous; Instruction p2 = p1 != null ? p1.Previous : null; if (p1 != null && p2 != null && n1 != null) { object rhs = p2.GetOperand (method); if (rhs != null && rhs.Equals (0)) { if (Comparisons.Get (n1.OpCode.Code)) { string message = "Use Any () instead of Count ()."; Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } } } // call System.Int32 System.Linq.Enumerable::Count(System.Collections.Generic.IEnumerable`1) // brtrue, brtrue.s, brfalse or brfalse.s if (n1 != null) { if (Conditions.Get(n1.OpCode.Code)) { string message = "Use Any () instead of Count ()."; Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } } } private void CheckForSubscript (TypeReference type, MethodDefinition method, Instruction ins, string name) { if (type.IsArray) { string message = String.Format (CultureInfo.InvariantCulture, "Use operator [] instead of the {0} method.", name); Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } else { TypeDefinition td = type.Resolve (); // resolve of an array returns the element type... if (td != null && HasMethod (td, Subscript)) { string message = String.Format (CultureInfo.InvariantCulture, "Use operator [] instead of the {0} method.", name); Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } } } private void CheckForSort (TypeReference type, MethodDefinition method, Instruction ins, string name) { if (type.IsArray) { string message = String.Format (CultureInfo.InvariantCulture, "Use Array.Sort instead of the {0} method.", name); Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } else { TypeDefinition td = type.Resolve (); // resolve of an array returns the element type... if (td != null && HasMethod (td, Sort)) { string message = String.Format (CultureInfo.InvariantCulture, "Use Sort instead of the {0} method.", name); Log.WriteLine (this, "{0:X4} {1}", ins.Offset, message); Runner.Report (method, ins, Severity.Medium, Confidence.High, message); } } } public override void Initialize (IRunner runner) { base.Initialize (runner); // The IEnumerable extension methods were introduced in .NET 3.5 (but runtime 2 !) // so disable the rule if the assembly can't have Linq Runner.AnalyzeAssembly += (object o, RunnerEventArgs e) => { Active = CanHasLinq (e.CurrentAssembly); }; } private static bool CanHasLinq (AssemblyDefinition assembly) { if (assembly.MainModule.Runtime < TargetRuntime.Net_2_0) return false; return assembly.References ("System.Core"); } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; OpCodeBitmask calls = OpCodeBitmask.Calls; if (!calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; Log.WriteLine (this, "--------------------------------------"); Log.WriteLine (this, method); // Loop through each instruction, foreach (Instruction ins in method.Body.Instructions) { // if we're calling a method, if (!calls.Get (ins.OpCode.Code)) continue; // and the method is a System.Linq.Enumerable method then, var target = ins.Operand as MethodReference; if (!target.DeclaringType.IsNamed ("System.Linq", "Enumerable")) continue; string tname = target.Name; int tcount = target.HasParameters ? target.Parameters.Count : 0; // see if we can use a more efficient method. if (tname == "Count" && tcount == 1) { TypeReference tr = ins.Previous.GetOperandType (method); if (tr != null) { CheckForCountProperty (tr, method, ins); CheckForAny (method, ins); } } else if ((tname == "ElementAt" || tname == "ElementAtOrDefault") && tcount == 2) { Instruction arg = ins.TraceBack (method); TypeReference tr = arg.GetOperandType (method); if (tr != null) CheckForSubscript (tr, method, ins, tname); } else if ((tname == "Last" || tname == "LastOrDefault") && tcount == 1) { TypeReference tr = ins.Previous.GetOperandType (method); if (tr != null) CheckForSubscript (tr, method, ins, tname); } else if (tname == "OrderBy" || tname == "OrderByDescending") { Instruction arg = ins.TraceBack (method); TypeReference tr = arg.GetOperandType (method); if (tr != null) CheckForSort (tr, method, ins, tname); } } return Runner.CurrentRuleResult; } #if false private static OpCodeBitmask ComparisonsBitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Cgt); mask.Set (Code.Ceq); mask.Set (Code.Clt); mask.Set (Code.Ble); mask.Set (Code.Ble_S); mask.Set (Code.Bge); mask.Set (Code.Bge_S); Console.WriteLine ("ComparisonsBitmask : " + mask); return mask; } private static OpCodeBitmask ConditionsBitmask () { OpCodeBitmask mask = new OpCodeBitmask (); mask.Set (Code.Brtrue); mask.Set (Code.Brtrue_S); mask.Set (Code.Brfalse); mask.Set (Code.Brfalse_S); Console.WriteLine ("ConditionsBitmask : " + mask); return mask; } #endif } } AvoidUnsealedUninheritedInternalClassesRule.cs0000664000175000017500000000675512413742070036550 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance// // Gendarme.Rules.Performance.AvoidUnsealedUninheritedInternalClassesRule // // Authors: // Scott Peterson // // Copyright (C) 2008 Scott Peterson // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule will fire for classes which are internal to the assembly and have no derived /// classes, but are not sealed. Sealing the type clarifies the type hierarchy and /// allows the compiler/JIT to perform optimizations such as eliding virtual method calls. /// /// /// Bad example: /// /// // this one is correct since MyInheritedStuff inherits from this class /// internal class MyBaseStuff { /// } /// /// // this one is bad, since no other class inherit from MyConcreteStuff /// internal class MyInheritedStuff : MyBaseStuff { /// } /// /// /// /// Good example: /// /// // this one is correct since the class is abstract /// internal abstract class MyAbstractStuff { /// } /// /// // this one is correct since the class is sealed /// internal sealed class MyConcreteStuff : MyAbstractStuff { /// } /// /// /// This rule is available since Gendarme 2.0 and, before 2.2, was named AvoidUnsealedUninheritedInternalClassesRule [Problem ("Due to performance issues, types which are not visible outside of the assembly and which have no derived types should be sealed.")] [Solution ("You should seal this type, unless you plan to inherit from this type in the near-future.")] public class AvoidUnsealedUninheritedInternalTypeRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { if (type.IsAbstract || type.IsSealed || type.IsVisible () || type.IsGeneratedCode ()) return RuleResult.Success; ModuleDefinition module = type.Module; string name = type.Name; string nspace = type.Namespace; foreach (TypeDefinition type_definition in module.GetAllTypes ()) { // skip ourself if (type_definition.IsNamed (nspace, name)) continue; if (type_definition.Inherits (nspace, name)) return RuleResult.Success; } Confidence c = module.Assembly.HasAttribute ("System.Runtime.CompilerServices", "InternalsVisibleToAttribute") ? Confidence.High : Confidence.Total; Runner.Report (type, Severity.Medium, c); return RuleResult.Failure; } } } IDisposableWithDestructorWithoutSuppressFinalizeRule.cs0000664000175000017500000001250612413742070040526 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance// // Gendarme.Rules.Performance.UseSuppressFinalizeOnIDisposableTypeWithFinalizerRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005,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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule will fire if a type implements System.IDisposable and has a finalizer /// (called a destructor in C#), but the Dispose method does not call System.GC.SuppressFinalize. /// Failing to do this should not cause properly written code to fail, but it does place a non-trivial /// amount of extra pressure on the garbage collector and on the finalizer thread. /// /// /// Bad example: /// /// class BadClass : IDisposable { /// ~BadClass () /// { /// Dispose (false); /// } /// /// public void Dispose () /// { /// // GC.SuppressFinalize is missing so the finalizer will be called /// // which puts needless extra pressure on the garbage collector. /// Dispose (true); /// } /// /// private void Dispose (bool disposing) /// { /// if (ptr != IntPtr.Zero) { /// Free (ptr); /// ptr = IntPtr.Zero; /// } /// } /// /// [DllImport ("somelib")] /// private static extern void Free (IntPtr ptr); /// /// private IntPtr ptr; /// } /// /// /// /// Good example: /// /// class GoodClass : IDisposable { /// ~GoodClass () /// { /// Dispose (false); /// } /// /// public void Dispose () /// { /// Dispose (true); /// GC.SuppressFinalize (this); /// } /// /// private void Dispose (bool disposing) /// { /// if (ptr != IntPtr.Zero) { /// Free (ptr); /// ptr = IntPtr.Zero; /// } /// } /// /// [DllImport ("somelib")] /// private static extern void Free (IntPtr ptr); /// /// private IntPtr ptr; /// } /// /// /// Prior to Gendarme 2.2 this rule was named IDisposableWithDestructorWithoutSuppressFinalizeRule [Problem ("The type has a finalizer and implements IDisposable, but Dispose does not call System.GC.SuppressFinalize.")] [Solution ("Add a call to GC.SuppressFinalize inside your Dispose method.")] [EngineDependency (typeof (OpCodeEngine))] public class UseSuppressFinalizeOnIDisposableTypeWithFinalizerRule : Rule, ITypeRule { private bool Recurse (MethodDefinition method, int level) { // some methods have no body (e.g. p/invokes, icalls) if ((method == null) || !method.HasBody) return false; // don't iterate the IL unless we know there are some call[virt] inside them if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return false; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Call: case Code.Callvirt: // are we calling GC.SuppressFinalize ? MethodReference callee = (ins.Operand as MethodReference); if (callee.IsNamed ("System", "GC", "SuppressFinalize")) { return true; } else if (level < 3) { if (Recurse (callee.Resolve (), level + 1)) return true; } break; } } return false; } private void CheckDispose (MethodDefinition dispose) { if ((dispose != null) && !Recurse (dispose, 0)) { Runner.Report (dispose, Severity.High, Confidence.Normal); } } public RuleResult CheckType (TypeDefinition type) { // rule does not apply to enums, interfaces and delegates if (type.IsEnum || type.IsInterface || type.IsDelegate ()) return RuleResult.DoesNotApply; // rule applies to types that implements System.IDisposable if (!type.Implements ("System", "IDisposable")) return RuleResult.DoesNotApply; // and provide a finalizer if (type.GetMethod (MethodSignatures.Finalize) == null) return RuleResult.DoesNotApply; // rule applies! // look if GC.SuppressFinalize is being called in the Dispose methods // or one of the method it calls CheckDispose (type.GetMethod (MethodSignatures.Dispose)); CheckDispose (type.GetMethod (MethodSignatures.DisposeExplicit)); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidReturningArraysOnPropertiesRule.cs0000664000175000017500000000714712413742070035362 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidReturningArraysOnPropertiesRule // // Authors: // Adrian Tsai // // Copyright (c) 2007 Adrian Tsai // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule check for properties which return arrays. This can be a problem because /// properties are supposed to execute very quickly so it's likely that this property /// is returning a reference to the internal state of the object. This means that /// the caller can change the object's internal state via a back-door channel which /// is usually a very bad thing and it means that the array's contents may change /// unexpectedly if the caller holds onto the array. /// /// The preferred approach is to either return a read-only collection or to change /// the property to a method and return a copy of the array (it's important to use /// a method so that callers are not misled about the performance of the property). /// /// /// Bad example: /// /// public byte[] Foo { /// get { /// // return the data inside the instance /// return foo; /// } /// } /// /// public byte[] Bar { /// get { /// // return a copy of the instance's data /// // (this is bad because users expect properties to execute quickly) /// return (byte[]) bar.Clone (); /// } /// } /// /// /// /// Good example: /// /// public byte[] GetFoo () /// { /// return (byte[]) foo.Clone (); /// } /// /// public byte[] GetFoo () /// { /// return (byte[]) bar.Clone (); /// } /// /// [Problem ("By convention properties should not return arrays.")] [Solution ("Return a read-only collection or replace the property by a method and return a copy of the array.")] [FxCopCompatibility ("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")] public class AvoidReturningArraysOnPropertiesRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); // avoid checking all methods unless the type has some properties Runner.AnalyzeType += delegate (object o, RunnerEventArgs e) { Active = e.CurrentType.HasProperties; }; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.IsGetter) return RuleResult.DoesNotApply; if (!method.ReturnType.IsArray) return RuleResult.Success; Runner.Report (method, Severity.Medium, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Gendarme.Rules.Performance.csproj0000775000175000017500000001752612413742070034011 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6} Library Properties Gendarme.Rules.Performance Gendarme.Rules.Performance 3.5 true v4.0 http://localhost/Gendarme.Rules.Performance/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Performance.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 ..\..\console\bin\Release\Gendarme.Rules.Performance.xml 1591 1570 AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidTypeGetTypeForConstantStringsRule.cs0000664000175000017500000001016412413742070035620 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidTypeGetTypeForConstantStringsRule // // Authors: // Sebastien Pouliot // // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule warns when a method use Type.GetType(string) with a constant string. /// Such calls requires reflection in order to return a Type instance and, for /// known types, can be replaced with a much faster typeof(x). /// /// /// Bad example: /// /// booleanType = Type.GetType ("System.Boolean"); /// /// /// /// Good example: /// /// booleanType = typeof (bool); /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method calls Type.GetType(string) on a constant string. This call requires reflection in order return an instance of the type.")] [Solution ("For known values it is faster to use typeof(x), C# syntax, to obtain the same result without the reflection penality.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidTypeGetTypeForConstantStringsRule : Rule, IMethodRule { // the rule idea came from // http://lists.ximian.com/archives/public/mono-patches/2008-June/121564.html public RuleResult CheckMethod (MethodDefinition method) { // rule apply only if the method has a body (e.g. p/invokes, icalls don't) if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Call or Callvirt instructions in the method ? OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); if (!OpCodeBitmask.Calls.Intersect (bitmask)) return RuleResult.DoesNotApply; // and a call to Ldstr ? if (!bitmask.Get (Code.Ldstr)) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode.FlowControl != FlowControl.Call) continue; // look for calls to: static Type System.Type.GetType(string...) MethodReference mr = (ins.Operand as MethodReference); if ((mr == null) || !mr.HasParameters) continue; if (!mr.IsNamed ("System", "Type", "GetType")) continue; if (ins.Previous.OpCode.Code != Code.Ldstr) continue; string type_name = (ins.Previous.Operand as string); // one good reason to use this (besides non-visible types) is get a type from an unreferenced assembly if ((type_name == null) || type_name.Contains (", ")) continue; // another good reason is the supported way to detect if running on mono runtime if (type_name == "Mono.Runtime") continue; string msg = String.Format (CultureInfo.InvariantCulture, "Replace call to Type.GetType(\"{0}\") into typeof({0}).", type_name); Runner.Report (method, ins, Severity.Medium, Confidence.Normal, msg); } return Runner.CurrentRuleResult; } } } ConsiderCustomAccessorsForNonVisibleEventsRule.cs0000664000175000017500000000736512413742070037245 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance// // Gendarme.Rules.Performance.ConsiderCustomAccessorsForNonVisibleEventsRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule looks for non-visible events to see if their add/remove accessors are /// the default ones. The default, compiler generated, accessor is marked as synchronized /// which means that the runtime will bracket them between Monitor.Enter and /// Monitor.Exit calls. This is the safest approach unless, for non-visible events, /// you have a performance bottleneck around the events. In this case you should review /// if your code needs the locks or if you can provide an alternative to them. /// /// /// Bad example: /// /// private event EventHandler<TestEventArgs> TimeCritical; /// /// /// /// Good example: /// /// static object TimeCriticalEvent = new object (); /// EventHandlerList events = new EventHandlerList (); /// /// private event EventHandler<TestEventArgs> TimeCritical { /// add { /// events.AddHandler (TimeCriticalEvent, value); /// } /// remove { /// events.AddHandler (TimeCriticalEvent, value); /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("The compiler created add/remove event accessors are, by default, synchronized, i.e. the runtime will wrap them inside a Monitor.Enter/Exit.")] [Solution ("For non-visible events see if your code could work without being synchronized by supplying your own accessor implementations.")] public class ConsiderCustomAccessorsForNonVisibleEventsRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule applies only to classes that defines events if (type.IsEnum || type.IsInterface || type.IsValueType || !type.HasEvents) return RuleResult.DoesNotApply; // type can be non-visible (private or internal) but still reachable // with an interface or with an attribute (internals) bool type_visible = type.IsVisible (); foreach (EventDefinition evnt in type.Events) { MethodDefinition adder = evnt.AddMethod; // we assume that Add|Remove have the same visibility if (adder.IsVisible ()) continue; // report if Add|Remove is synchronized if (adder.IsSynchronized) { Confidence confidence = type_visible ? Confidence.Normal : Confidence.Low; Runner.Report (evnt, Severity.Medium, confidence); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidMethodWithLargeMaximumStackSizeRule.cs0000664000175000017500000000520512413742070036050 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidMethodWithLargeMaximumStackSizeRule // // Authors: // Jb Evain // // 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.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule fires if a method has a large maximum stack size (default is /// 100). Having a large maximum stack size makes it hard to generate code that /// performs well and, likely, makes the code harder to understand. /// /// This rule is available since Gendarme 2.6 [Problem ("The method has a large max stack, which is a sign of complex code.")] [Solution ("Refactor your code to reduce the size of the method.")] public class AvoidMethodWithLargeMaximumStackSizeRule : Rule, IMethodRule { private int max_stack_size = 100; public int MaximumStackSize { get { return max_stack_size; } set { max_stack_size = value; } } public RuleResult CheckMethod (MethodDefinition method) { // ingore methods without body and generated code if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; int num = method.Body.MaxStackSize; if (num <= MaximumStackSize) return RuleResult.Success; string msg = String.Format (CultureInfo.InvariantCulture, "Found {0} maximum stack size (maximum {1}).", num, MaximumStackSize); Runner.Report (method, Severity.High, Confidence.High, msg); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUncalledPrivateCodeRule.cs0000664000175000017500000002473612413742070033531 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUncalledPrivateCodeRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-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; using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Performance { /// /// This rule will check for internally visible methods which are never called. /// The rule will warn you if a private method isn't called in its declaring type or /// if an internal method doesn't have any callers in the assembly or isn't invoked by /// the runtime or a delegate. /// /// /// Bad example: /// /// public class MyClass { /// private void MakeSuff () /// { /// // ... /// } /// /// public void Method () /// { /// Console.WriteLine ("Foo"); /// } /// } /// /// /// /// Good example (removing unused code): /// /// public class MyClass { /// public void Method () /// { /// Console.WriteLine ("Foo"); /// } /// } /// /// /// /// Good example (use the code): /// /// public class MyClass { /// private void MakeSuff () /// { /// // ... /// } /// /// public void Method () /// { /// Console.WriteLine ("Foo"); /// MakeSuff (); /// } /// } /// /// [Problem ("This private or internal (assembly-level) member does not have callers in the assembly, is not invoked by the common language runtime, and is not invoked by a delegate.")] [Solution ("Remove the unused code or add code to call it.")] [FxCopCompatibility ("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] public class AvoidUncalledPrivateCodeRule : Rule, IMethodRule { static bool HasAnySpecialAttribute (ICustomAttributeProvider method) { if (!method.HasCustomAttributes) return false; foreach (CustomAttribute ca in method.CustomAttributes) { TypeReference cat = ca.AttributeType; string name = cat.Name; if ((cat.IsNamed ("System.Diagnostics", name)) || (cat.Namespace == "System.Runtime.InteropServices" && (name == "ComRegisterFunctionAttribute" || name == "ComUnregisterFunctionAttribute"))) { return true; } } return false; } static private bool Applicable (MethodDefinition method) { // rule doesn't apply to static ctor (called by the runtime) if (method.IsStatic && method.IsConstructor) return false; // don't consider the compiler generated add / remove on events if (((method.IsAddOn || method.IsRemoveOn) && method.IsSynchronized)) return false; // rule doesn't apply if the method is the assembly entry point or Main if (method.IsEntryPoint () || method.IsMain ()) return false; // rule doesn't apply if the method is generated by the compiler or by a tool if (method.IsGeneratedCode ()) return false; // does not apply if the method is used to register/unregister COM objects // or it is decorated with a [Conditional("x")] attribute if (HasAnySpecialAttribute (method)) return false; return true; } public RuleResult CheckMethod (MethodDefinition method) { // check if the the rule applies to this method if (!Applicable (method)) return RuleResult.DoesNotApply; // we can't be sure if this code won't be reached indirectly if (method.IsVirtual && !method.IsFinal) return RuleResult.Success; // if the method is visible outside the assembly if (method.IsVisible ()) return RuleResult.Success; // check if the method is private if (method.IsPrivate) { if (!CheckPrivateMethod (method)) { Runner.Report (method, Severity.High, Confidence.Normal, "The private method code is not used in its declaring type."); return RuleResult.Failure; } return RuleResult.Success; } if (method.IsPublic && CheckPublicMethod (method)) return RuleResult.Success; if (method.IsAssembly && CheckInternalMethod (method)) return RuleResult.Success; // internal methods and visible methods (public or protected) inside a non-visible type // needs to be checked if something in the assembly is using this method bool need_to_check_assembly = (method.IsAssembly || ((method.IsPublic || method.IsFamily) && !method.DeclaringType.IsVisible ())); if (!need_to_check_assembly || CheckAssemblyForMethodUsage (method)) return RuleResult.Success; // method is unused and unneeded Runner.Report (method, Severity.High, Confidence.Normal, "The method is not visible outside its declaring assembly, nor used within."); return RuleResult.Failure; } public override void TearDown () { // reusing the cache (e.g. the wizard) is not a good thing if an exception // occured while building it (future analysis results would be bad) cache.Clear (); base.TearDown (); } private static bool CheckPrivateMethod (MethodDefinition method) { // it's ok for have unused private ctor (and common before static class were introduced in 2.0) // this also covers private serialization constructors if (method.IsConstructor) return true; // it's ok (used or not) if it's required to implement explicitely an interface if (method.HasOverrides) return true; TypeDefinition type = (method.DeclaringType as TypeDefinition); // then we must check if this type use the private method if (CheckTypeForMethodUsage (type, method)) return true; // then we must check if this type's nested types (if any) use the private method if (!type.HasNestedTypes) return false; foreach (TypeDefinition nested in type.NestedTypes) { if (CheckTypeForMethodUsage (nested, method)) return true; } // report if the private method is uncalled return false; } // note: we need to be consistant with some stuff we propose in other rules private static bool CheckPublicMethod (MethodDefinition method) { // handle things like operators - but not properties if (method.IsSpecialName && !method.IsProperty ()) return true; // handle non-virtual Equals, e.g. Equals(type) string name = method.Name; if (method.HasParameters && (name == "Equals")) { IList pdc = method.Parameters; if ((pdc.Count == 1) && (pdc [0].ParameterType == method.DeclaringType)) return true; } // check if this method is needed to satisfy an interface TypeDefinition type = (method.DeclaringType as TypeDefinition); if (type.HasInterfaces) { foreach (TypeReference tr in type.Interfaces) { TypeDefinition intf = tr.Resolve (); if (intf != null) { foreach (MethodReference member in intf.Methods) { if (name == member.Name) return true; } } } } return false; } private static bool CheckInternalMethod (MethodReference method) { // internal ctor for serialization are ok return MethodSignatures.SerializationConstructor.Matches (method); } private static bool CheckAssemblyForMethodUsage (MethodReference method) { // scan each module in the assembly that defines the method AssemblyDefinition assembly = method.DeclaringType.Module.Assembly; foreach (ModuleDefinition module in assembly.Modules) { // scan each type foreach (TypeDefinition type in module.GetAllTypes ()) { if (CheckTypeForMethodUsage (type, method)) return true; } } return false; } static Dictionary> cache = new Dictionary> (); private static ulong GetToken (MethodReference method) { return (ulong) method.DeclaringType.Module.Assembly.GetHashCode () << 32 | method.GetElementMethod ().MetadataToken.ToUInt32 (); } private static bool CheckTypeForMethodUsage (TypeDefinition type, MethodReference method) { if (type.HasGenericParameters) type = type.GetElementType ().Resolve (); HashSet methods = GetCache (type); if (methods.Contains (GetToken (method))) return true; MethodDefinition md = method.Resolve (); if ((md != null) && md.HasOverrides) { foreach (MethodReference mr in md.Overrides) { if (methods.Contains (GetToken (mr))) return true; } } return false; } private static HashSet GetCache (TypeDefinition type) { HashSet methods; if (!cache.TryGetValue (type, out methods)) { methods = new HashSet (); cache.Add (type, methods); if (type.HasMethods) { foreach (MethodDefinition md in type.Methods) { if (!md.HasBody) continue; BuildMethodUsage (methods, md); } } } return methods; } private static void BuildMethodUsage (ISet methods, MethodDefinition method) { foreach (Instruction ins in method.Body.Instructions) { MethodReference mr = (ins.Operand as MethodReference); // avoid CallSite - but do not limit ourselves to Call[virt]+Newobj (e.g. ldftn) if ((mr == null) || (ins.OpCode.Code == Code.Calli)) continue; TypeReference type = mr.DeclaringType; if (!type.IsArray) { // if (type.GetElementType ().HasGenericParameters) // the simpler ^^^ does not work under Mono but works on MS type = type.Resolve (); if (type != null && type.HasGenericParameters) { methods.Add (GetToken (type.GetMethod (mr.Name))); } } methods.Add (GetToken (mr)); } } } } PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceRule.cs0000664000175000017500000001042312413742070043523 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance// // Gendarme.Rules.Performance.PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceRule // // Authors: // Julien Hoarau // // Copyright (C) 2010 Julien Hoarau // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; namespace Gendarme.Rules.Performance { /// /// This rule fires if a method use an interface of a primitive type as parameter. /// (IComparable, IFormattable, IConvertible, IComparable<T>, IEquatable<int> ...) /// Using generic method with an interface constraint instead avoid boxing of value /// type when calling the method. /// /// /// Bad example: /// /// public bool GreaterThan (IComparable arg1, IComparable arg2) /// { /// return arg1.CompareTo (arg2) > 0 /// } /// /// /// /// Good example: /// /// public bool GreaterThan<T> (T arg1, T arg2) where T : IComparable /// { /// return arg1.CompareTo (arg2) > 0 /// } /// /// [Problem("The method should use interface constraint on generic type parameter to avoid boxing of value type")] [Solution("Replace the interface parameter with interface constraint on generic type parameter.")] public class PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceRule : Rule, IMethodRule { static bool CheckGenericArgument (GenericInstanceType git) { if ((git == null) || !git.HasGenericArguments) return false; // should not happen with the '`1' but... TypeReference arg = git.GenericArguments [0]; switch (arg.MetadataType) { case MetadataType.MVar: return (arg.IsGenericParameter && arg.IsNamed (String.Empty, "T")); case MetadataType.ValueType: return arg.IsNamed ("System", "Decimal"); case MetadataType.Boolean: case MetadataType.Byte: case MetadataType.Char: case MetadataType.Double: case MetadataType.Single: case MetadataType.Int16: case MetadataType.Int32: case MetadataType.Int64: case MetadataType.SByte: case MetadataType.UInt16: case MetadataType.UInt32: case MetadataType.UInt64: return true; default: return false; } } static bool IsPrimitiveInterface (MemberReference type) { switch (type.Name) { case "IComparable": case "IFormattable": case "IConvertible": return true; // no doubt case "IComparable`1": case "IEquatable`1": // maybe, check generic argument type return CheckGenericArgument (type as GenericInstanceType); default: return false; } } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasParameters) return RuleResult.DoesNotApply; foreach (ParameterDefinition parameter in method.Parameters) { TypeReference type = parameter.ParameterType; if (type.Namespace != "System") continue; if (IsPrimitiveInterface (type)) { string msg = String.Format (CultureInfo.InvariantCulture, "You are using {0} as parameter, which cause boxing with value type as argument", type.GetFullName ()); Runner.Report (method, Severity.Low, Confidence.Total, msg); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUnneededUnboxingRule.cs0000664000175000017500000001464412413742070033112 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUnneededUnboxingRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule checks methods which unbox the same value type multiple times (i.e. the /// value is copied from the heap into the stack). Because the copy is relatively expensive, /// the code should be rewritten to minimize unboxes. For example, using a local variable /// of the right value type should remove the need for more than one unbox instruction /// per variable. /// /// /// Bad example: /// /// public struct Message { /// private int msg; /// private IntPtr hwnd, lParam, wParam, IntPtr result; /// /// public override bool Equals (object o) /// { /// bool result = (this.msg == ((Message) o).msg); /// result &= (this.hwnd == ((Message) o).hwnd); /// result &= (this.lParam == ((Message) o).lParam); /// result &= (this.wParam == ((Message) o).wParam); /// result &= (this.result == ((Message) o).result); /// return result; /// } /// } /// /// /// /// Good example: /// /// public struct Message { /// private int msg; /// private IntPtr hwnd, lParam, wParam, IntPtr result; /// /// public override bool Equals (object o) /// { /// Message msg = (Message) o; /// bool result = (this.msg == msg.msg); /// result &= (this.hwnd == msg.hwnd); /// result &= (this.lParam == msg.lParam); /// result &= (this.wParam == msg.wParam); /// result &= (this.result == msg.result); /// return result; /// } /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method unboxes (converts from object to a value type) the same value multiple times.")] [Solution ("Cast the variable, once, into a temporary variable and use the temporary.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidUnneededUnboxingRule : Rule, IMethodRule { private static string Previous (MethodDefinition method, Instruction ins) { string kind, name; ins = ins.Previous; Code previous_op_code = ins.OpCode.Code; switch (previous_op_code) { case Code.Ldarg_0: case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: kind = "Parameter"; int index = previous_op_code - Code.Ldarg_0; if (!method.IsStatic) index--; name = (index >= 0) ? method.Parameters [index].Name : String.Empty; break; case Code.Ldarg: case Code.Ldarg_S: case Code.Ldarga: case Code.Ldarga_S: kind = "Parameter"; name = (ins.Operand as ParameterDefinition).Name; break; case Code.Ldfld: case Code.Ldsfld: kind = "Field"; name = (ins.Operand as FieldReference).Name; break; case Code.Ldloc_0: case Code.Ldloc_1: case Code.Ldloc_2: case Code.Ldloc_3: kind = "Variable"; int vindex = previous_op_code - Code.Ldloc_0; name = method.Body.Variables [vindex].GetName (); break; case Code.Ldloc: case Code.Ldloc_S: kind = "Variable"; name = (ins.Operand as VariableDefinition).GetName (); break; default: return String.Empty; } return String.Format (CultureInfo.InvariantCulture, "{0} '{1}' unboxed to type '{2}' {{0}} times.", kind, name, (ins.Operand as TypeReference).GetFullName ()); } // unboxing is never critical - but a high amount can be a sign of other problems too private static Severity GetSeverityFromCount (int count) { if (count < 4) return Severity.Low; if (count < 8) return Severity.Medium; // >= 8 return Severity.High; } static OpCodeBitmask Unbox = new OpCodeBitmask (0x0, 0x40000000000000, 0x400000000, 0x0); private Dictionary unboxed = new Dictionary (); public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Unbox or Unbox_Any instructions in the method ? if (!Unbox.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.Code) { case Code.Unbox: case Code.Unbox_Any: string previous = Previous (method, ins); if (previous.Length == 0) continue; int num; if (!unboxed.TryGetValue (previous, out num)) { unboxed.Add (previous, 1); } else { unboxed [previous] = ++num; } break; } } // report findings (one defect per variable/parameter/field) foreach (KeyValuePair kvp in unboxed) { // we can't (always) avoid unboxing one time if (kvp.Value < 2) continue; string s = String.Format (CultureInfo.InvariantCulture, kvp.Key, kvp.Value); Runner.Report (method, GetSeverityFromCount (kvp.Value), Confidence.Normal, s); } unboxed.Clear (); return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask unbox = new OpCodeBitmask (); unbox.Set (Code.Unbox); unbox.Set (Code.Unbox_Any); Console.WriteLine (unbox); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidRepetitiveCallsToPropertiesRule.cs0000664000175000017500000001745012413742070035326 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidRepetitiveCallsToPropertiesRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Text; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// The rule warn if virtual, or unlikely to be inline-able, property getters /// are called several times by a method. In most cases repetitive calls simply /// requires more time without any gains since the result will always be identical. /// You should ignore the reported defects if a different value is expected /// each time the property is called (e.g. calling DateTime.Now). /// /// /// Bad example: /// /// private int Report (IList list) /// { /// if (list.Count > 1) { /// DisplayList (list); /// } /// Console.WriteLine ("# items: {0}", list.Count); /// return list.Count; /// } /// /// /// /// Good example: /// /// private int Report (IList list) /// { /// int count = list.Count; /// if (count > 1) { /// DisplayList (list); /// } /// Console.WriteLine ("# items: {0}", count); /// return count; /// } /// /// /// This rule is available since Gendarme 2.8 [Problem ("This method calls several times into the same properties. This is expensive for virtual properties or when the property cannot be inlined.")] [Solution ("Unless a different value is expected from each call, refactor your code to avoid the multiple calls by caching the returned value.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidRepetitiveCallsToPropertiesRule : Rule, IMethodRule { private const int Default = 20; private int inline_limit = Default; /// /// Methods with a code size below InlineLimit (20 by default) /// are considered to be inline-able by the JIT. /// [DefaultValue (Default)] [Description ("Maximum IL size of a property getter to be considered inline-able.")] public int InlineLimit { get { return inline_limit; } set { inline_limit = value; } } // for Mono see INLINE_LENGTH_LIMIT in mini.c // MS JIT probably use another limit (or is based on something else) private bool IsInliningCandidate (MethodDefinition method) { return (!method.HasBody || (method.Body.CodeSize < InlineLimit)); } Dictionary> calls = new Dictionary> (); static string GetKey (MethodDefinition caller, MethodDefinition callee, Instruction ins) { if (callee.IsStatic) return callee.GetFullName (); IMetadataTokenProvider chain = callee; Instruction instance = ins.TraceBack (caller); StringBuilder sb = new StringBuilder (); while (instance != null) { MemberReference mr = (chain as MemberReference); if (mr == null) sb.Append (chain.ToString ()); // ?? "null") else sb.Append (mr.GetFullName ()); sb.Append ('.'); chain = (instance.Operand as IMetadataTokenProvider); if (chain == null) { sb.Append (instance.GetOperand (caller)); break; } instance = instance.TraceBack (caller); } if (chain != null) sb.Append (chain.ToString ()); return sb.ToString (); } // virtual non-virtual // Low 2 2-5 // Medium 3-5 6-11 // High 6-9 12-19 // Critical 10+ 20+ // // note: inlining strategy is complex and varies between runtimes static Severity GetSeverity (int count, bool virtualCall) { if (!virtualCall) count >>= 1; if (count < 3) return Severity.Low; else if (count < 6) return Severity.Medium; else if (count < 10) return Severity.High; return Severity.Critical; } static bool Filter (MethodDefinition method) { TypeReference type = method.DeclaringType; // Elapsed* and IsRunning if (type.IsNamed ("System.Diagnostics", "Stopwatch")) return true; // Now and UtcNow else if (type.IsNamed ("System", "DateTime")) return method.IsStatic; return false; } public RuleResult CheckMethod (MethodDefinition method) { // applies only to methods with IL that are not generated by the compiler or tools if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // avoid processing methods that do not call any methods if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; calls.Clear (); foreach (Instruction ins in method.Body.Instructions) { MethodReference mr = ins.GetMethod (); if ((mr == null) || mr.HasParameters) continue; MethodDefinition md = mr.Resolve (); // md can be null for things like: new byte[,]; if ((md == null) || !md.IsGetter) continue; if ((!md.IsVirtual || md.IsFinal) && IsInliningCandidate (md)) continue; // some properties are known, by design, to be called several time if (Filter (md)) continue; string key = GetKey (method, md, ins); KeyValuePair kvp; if (calls.TryGetValue (key, out kvp)) { kvp = new KeyValuePair (md, kvp.Value + 1); calls [key] = kvp; } else { kvp = new KeyValuePair (md, 1); calls.Add (key, kvp); } } return ReportResults (method); } private RuleResult ReportResults (IMetadataTokenProvider method) { foreach (KeyValuePair> kvp in calls) { // look which getter we're calling more than once int count = kvp.Value.Value; if (count == 1) continue; MethodDefinition md = kvp.Value.Key; if (md.IsVirtual && !md.IsFinal) { // virtual calls are expensive, so the code better cache the value string msg = String.Format (CultureInfo.InvariantCulture, "Multiple ({0}) calls to virtual property '{1}'.", count, md.ToString ()); Runner.Report (method, GetSeverity (count, true), Confidence.Normal, msg); } else if (!IsInliningCandidate (md)) { // non-virtual calls might be inlined // otherwise caching the value is again a good idea int size = md.HasBody ? md.Body.CodeSize : 0; string msg = String.Format (CultureInfo.InvariantCulture, "Multiple ({0}) calls to non-virtual property '{1}', likely non-inlined due to size ({2} >= {3}).", count, md.ToString (), size, InlineLimit); Runner.Report (method, GetSeverity (count, false), Confidence.Normal, msg); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUnneededCallsOnStringRule.cs0000664000175000017500000001324012413742070034032 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUnneededCallsOnStringRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // 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; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { // rule idea credits to FindBug - http://findbugs.sourceforge.net/ // Dm: Method invokes toString() method on a String (DM_STRING_TOSTRING) // and was later extended to more cases, including one that covers // DMI: Invocation of substring(0), which returns the original value (DMI_USELESS_SUBSTRING) /// /// This rule detects when some methods, like Clone(), Substring(0), /// ToString() or ToString(IFormatProvider), are being called on a /// string instance. Since these calls all return the original string they don't do anything /// useful and should be carefully reviewed to see if they are working as intended and, /// if they are, the method call can be removed. /// /// /// Bad example: /// /// public void PrintName (string name) /// { /// Console.WriteLine ("Name: {0}", name.ToString ()); /// } /// /// /// /// Good example: /// /// public void PrintName (string name) /// { /// Console.WriteLine ("Name: {0}", name); /// } /// /// /// Prior to Gendarme 2.0 this rule was more limited and named AvoidToStringOnStringsRule [Problem ("This method needlessly calls some method(s) on a string instance. This may produce some performance penalities.")] [Solution ("Remove the unneeded call(s) on the string instance.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidUnneededCallsOnStringRule : Rule, IMethodRule { private const string MessageString = "There is no need to call {0}({1}) on a System.String instance."; public RuleResult CheckMethod (MethodDefinition method) { // rule apply only if the method has a body (e.g. p/invokes, icalls don't) if (!method.HasBody) return RuleResult.DoesNotApply; // is there any Call or Callvirt instructions in the method ? if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction instruction in method.Body.Instructions) { switch (instruction.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference mr = (instruction.Operand as MethodReference); if ((mr == null) || !mr.HasThis) continue; string text = null; switch (mr.Name) { case "Clone": text = CheckClone (mr, instruction, method); break; case "Substring": text = CheckSubstring (mr, instruction); break; case "ToString": text = CheckToString (mr, instruction, method); break; default: continue; } if (text.Length > 0) Runner.Report (method, instruction, Severity.Medium, Confidence.Normal, text); break; } } return Runner.CurrentRuleResult; } private static string CheckClone (MethodReference call, Instruction ins, MethodDefinition method) { if (call.HasParameters) return String.Empty; if (!ins.Previous.GetOperandType (method).IsNamed ("System", "String")) return String.Empty; return String.Format (CultureInfo.InvariantCulture, MessageString, call.Name, String.Empty); } private static string CheckSubstring (MethodReference call, Instruction ins) { if (!call.DeclaringType.IsNamed ("System", "String")) return String.Empty; // ensure it's System.String::Substring(System.Int32) and that it's given 0 as a parameter if (call.HasParameters && (call.Parameters.Count != 1)) return String.Empty; if (!ins.Previous.IsOperandZero ()) return String.Empty; return String.Format (CultureInfo.InvariantCulture, MessageString, call.Name, "0"); } private static string CheckToString (MethodReference call, Instruction ins, MethodDefinition method) { if (call.DeclaringType.IsNamed ("System", "String")) { // most probably ToString(IFormatProvider), possibly ToString() return String.Format (CultureInfo.InvariantCulture, MessageString, call.Name, (call.HasParameters && (call.Parameters.Count > 1)) ? "IFormatProvider" : String.Empty); } else { // signature for Clone is identical (well close enough) to share code return CheckClone (call, ins, method); } } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/0000775000175000017500000000000012642235743026425 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/ChangeLog0000664000175000017500000004403712413742070030177 0ustar00directhexdirecthex000000000000002010-06-20 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesTest.cs: Add property access test case 2010-06-15 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesTest.cs: Add missing using clause. Fix test build. 2010-06-14 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesTest.cs: Add test cases for DateTime and Stopwatch properties 2010-06-10 Sebastien Pouliot * UseStringEmptyTest.cs: Add test case about switch/cases being optimized, by compilers, into if/else 2010-06-05 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Flush uncommitted tests 2010-06-04 Sebastien Pouliot * Tests.Rules.Performance.csproj: Fix unit tests for solution (non makefile) builds 2010-05-24 Sebastien Pouliot * AvoidUnsealedConcreteAttributesTest.cs: * AvoidUnusedParametersTest.cs: * GlobalSuppressions.cs: Add FxCop compatibility unit tests 2010-05-13 Antoine Vandecreme * ReviewLinqMethodTest.cs: Add tests cases where a method use Count() instead of Any() in conditions 2010-04-28 Sebastien Pouliot * AvoidUnusedParametersTest.cs: Add test case where a method is decorated with a [Conditional("X")] attribute 2010-04-27 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add test case where a method is decorated with a [Conditional("X")] attribute * AvoidUninstantiatedInternalClassesTest.cs: Add test case for NamespaceDoc 2010-04-18 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs * ConsiderCustomAccessorsForNonVisibleEventsTest.cs: With newer CSC (e.g. 10.0) we cannot assume the event accessor to be auto-generated by the presence of IsSynchronized. Fix unit test when compiled with CSC 2010-01-17 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesTest.cs: Add test case with a long message chain. 2010-01-17 Sebastien Pouliot * AvoidConcatenatingCharsTest.cs: New. Unit tests for AvoidConcatenatingCharsRule 2010-01-10 Sebastien Pouliot * AvoidRepetitiveCallsToPropertiesTest.cs: New. Unit tests for AvoidRepetitiveCallsToPropertiesRule 2010-01-03 Sebastien Pouliot * AvoidLocalDataStoreSlotTest.cs: New. Unit tests for AvoidLocalDataStoreSlotRule 2009-05-14 Jb Evain * AvoidMethodWithLargeMaximumStackSizeTest.cs: added unit tests for the new rule. 2009-01-27 Jesse Jones * ReviewLinqMethodTest.cs: Added new rule. 2008-12-24 Sebastien Pouliot * PreferCharOverloadTest.cs: New. Unit tests for PreferCharOverloadRule 2008-12-11 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add test cases for multidim and jagged arrays. Adapted from test case on bug #458178 2008-11-09 Jesse Jones * AvoidRepetitiveCastsTest.cs: Added some more tests (and removed one) for the false positive rule fixes. 2008-11-07 Alan McGovern * Tests.Rules.Performance.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-30 Sebastien Pouliot * AvoidUnneededFieldInitializationTest.cs: Fix a failure when tests are compiled with gmcs. csc ignore such initialization. 2008-10-29 Sebastien Pouliot * AvoidUnneededFieldInitializationTest.cs: Commit the real tests and not a dupe of the rule. Thanks to Jesse for pointing this out. 2008-10-24 Sebastien Pouliot * CompareWithStringEmptyEfficientlyTest.cs: Add new test case for something that was not a bug after all :) 2008-10-13 Sebastien Pouliot * ConsiderCustomAccessorsForNonVisibleEventsTest.cs: Remove unneeded namespace. Fix copy-paste error in tests. * EmptyDestructorTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. More coverage. * IDisposableWithDestructorWithoutSuppressFinalizeTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. More coverage. * ImplementEqualsTypeTest.cs: More coverage. * RemoveUnusedLocalVariablesTest.cs: Remove unneeded namespaces. More coverage. 2008-10-12 Sebastien Pouliot * AvoidUnusedPrivateFieldsTest.cs: More coverage. * CompareWithStringEmptyEfficientlyTest.cs: Remove unneeded namespaces. More coverage. Re-active Object.Equals test. * DontIgnoreMethodResultTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. More coverage. 2008-10-12 Sebastien Pouliot * AvoidUnneededFieldInitializationTest.cs: New. Unit tests for AvoidUnneededFieldInitializationRule. * PreferLiteralOverInitOnlyFieldsTest.cs: New. Unit tests for PreferLiteralOverInitOnlyFieldsRule. 2008-10-11 Sebastien Pouliot * MathMinMaxCandidateTest.cs: : Remove unneeded namespaces. More coverage. Change results checks since rule is smarter to skip methods. * UseIsOperatorTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. More coverage. * UseStringEmptyTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. More coverage. * UseTypeEmptyTypesTest.cs: Remove unneeded namespaces. More coverage. 2008-10-11 Sebastien Pouliot * AvoidUnneededUnboxingTest.cs: Change some results (Success to DoesNotApply) for methods that do not contain Unbox[_Any]. * AvoidUnsealedConcreteAttributesTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. * AvoidUnsealedUninheritedInternalClassesTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. * AvoidUnusedParametersTest.cs: Convert to new, shorter, syntax for tests. 2008-10-10 Sebastien Pouliot * AvoidTypeGetTypeForConstantStringsTest.cs: Add test case to get complete coverage. Add some string literals so the rule can apply on all test case (methods needs a LDSTR or it will be ignored). * AvoidUncalledPrivateCodeTest.cs: Remove unneeded namespaces. Disable warnings for 414 too. * AvoidUninstantiatedInternalClassesTest.cs: Convert to new, shorter, syntax for tests. Disable warnings for 169, 414. Add test case for EntryPoint (since the type will be used by the runtime). * AvoidUnneededCallsOnStringTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. 2008-10-09 Sebastien Pouliot * AvoidLargeNumberOfLocalVariablesTest.cs: Add test cases to get more coverage. * AvoidLargeStructureTest.cs: Add test cases to get more coverage. * AvoidRepetitiveCastsTest.cs: Adjust results (Success becoming DoesNotApply) since OpCodeEngine can skip them. Remove unneeded namespaces. Disable warnings. * AvoidReturningArraysOnPropertiesTest.cs: Convert to new, shorter, syntax for tests. Remove unneeded namespaces. Disable warnings. 2008-09-10 Sebastien Pouliot * Test.Rules.Performance.mdp: Add a reference to System.Xml.dll 2008-08-17 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add test case from Mono.Rocks that triggers, when compiled under Mono (bug #320901), false positives. 2008-08-10 Sebastien Pouliot * RemoveUnusedLocalVariablesTest.cs: Add test case from Richard Birkby. 2008-08-06 Sebastien Pouliot * AvoidRepetitiveCastsTest.cs: Add test cases from Richard Birkby (FalsePositive5) and Peter Johanson (IndexerResultCastTest). 2008-08-05 Sebastien Pouliot * AvoidUnusedParametersTest.cs: Start using the new test code. Change from Success to DoesNotApply the result for parameter-less methods. 2008-08-05 Peter Johanson * AvoidUnusedParametersTest.cs: Ensure the rule works for several methods used with delegates inside one method. 2008-08-04 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add test cases for events. Compilers generates default add/remove methods for them and they should not be reported since they are outside developer's control. 2008-07-26 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add test case for detected unused properties (Marek Safar) and add another test case for generics (Richard Birkby) [Fix bug #410000] 2008-07-23 Sebastien Pouliot * AvoidUnusedPrivateFieldsTest.cs: Modify test cases to ignore literals. Remove Ignore from generic test since DefinitionLoader was fixed (the problem was not related to mono). 2008-07-13 Sebastien Pouliot * AvoidLargeNumberOfLocalVariablesTest.cs: New. Unit tests for AvoidLargeNumberOfLocalVariablesRule. 2008-07-12 Sebastien Pouliot * AvoidUnusedPrivateFieldsTest.cs: New. Unit tests for AvoidUnusedPrivateFieldsRule. There is a bug that prevent from running the generic test on mono (needs more investigation) but the rule itself works. 2008-07-05 Sebastien Pouliot * AvoidRepetitiveCastsTest.cs: New. Unit tests for AvoidRepetitiveCastsRule. * Test.Rules.Performance.mdp: Update MD project file. 2008-06-28 Sebastien Pouliot * AvoidLargeStructureTest.cs: Add test case for arrays. 2008-06-27 Sebastien Pouliot * AvoidTypeGetTypeForConstantStringsTest.cs: New. Unit tests for AvoidTypeGetTypeForConstantStringsRule. * Test.Rules.Performance.mdp: Update MD project file. 2008-06-11 Jb Evain * AvoidUninstantiatedInternalClassesTest.cs: add tests for the sealed + private ctor case, and abstract + private ctor case. 2008-06-04 Sebastien Pouliot * ConsiderCustomAccessorsForNonVisibleEventsTest.cs: New. Unit tests for ConsiderCustomAccessorsForNonVisibleEventsRule. * Test.Rules.Performance.mdp: Update MD project file. 2008-05-19 Sebastien Pouliot * AvoidUnneededUnboxingTest.cs: New. Unit tests for AvoidUnneededUnboxingRule 2008-05-17 Sebastien Pouliot * RemoveUnusedLocalVariablesTest.cs: New. Unit tests for RemoveUnusedLocalVariablesRule. A bit limited since it depends on the compiler removing (or not) the unused variables. 2008-05-11 Andres G. Aragoneses * Test.Rules.Performance.mdp: Fix references. 2008-04-27 Andres G. Aragoneses * Test.Rules.Performance.mdp: Updated. 2008-04-27 Jb Evain * AvoidUnusedParametersTest.cs: Rule does not apply to event callback. 2008-04-26 Sebastien Pouliot * AvoidLargeStructureTest.cs: New. Unit tests for AvoidLargeStructureRule. * UseTypeEmptyTypesTest.cs: Adapt tests so they works when compiled with CSC (which optimized out the previous version). 2008-04-26 Jb Evain * UseTypeEmptyTypesTest.cs: New tests for the new UseTypeEmptyTypesRule that checks for unecessary creation of empty array of types. * Makefile.am: add the new guy to the build. 2008-04-26 Sebastien Pouliot * CompareWithStringEmptyEfficientlyTest.cs: New. This replace UsingStringLengthInsteadOfCheckingEmptyStringTest.cs with more test cases and the new test format. * UsingStringLengthInsteadOfCheckingEmptyStringTest.cs: removed 2008-04-20 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add test case using generics. 2008-04-13 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Fix some cases (e.g. bad values, checking ctors instead of methods)... and add new ones. Update tests to new format. 2008-04-12 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add test case where a private method is used in its declaring type's nested type(s) [Cedric Vivier] 2008-04-06 Sebastien Pouliot * AvoidUninstantiatedInternalClassesTest.cs: Add test cases for [un]used generic types. * DontIgnoreMethodResultTest: Add test cases for Stack.Pop (which we ignore on purpose). Renamed to *DoNot*IgnoreMethodResultRule. 2008-04-05 Sebastien Pouliot * MathMinMaxCandidateTest.cs: New. Tests for MathMinMaxCandidateRule * Test.Rules.Performance.mdp: Add test to MD project file. 2008-03-30 Sebastien Pouliot * ImplementEqualsTypeTest.cs: New. Test for ImplementEqualsTypeRule. * Test.Rules.Performance.mdp: Add test to MD project file. 2008-03-16 Sebastien Pouliot * AvoidUnusedParametersTest.cs: Add EventArgs test cases. 2008-03-05 Sebastien Pouliot * AvoidUnneededCallsOnStringTest.cs: Source file renamed from AvoidToStringOnStringsTest.cs since the rule has been generalized to cover more similar cases. 2008-02-15 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Fix RuleResult checks in loops. 2008-02-06 Sebastien Pouliot * AvoidUnsealedUninheritedInternalClassesTest.cs: New. Unit tests by Scott Peterson. * UseIsOperatorTest.cs: New. Unit tests. * Test.Rules.Performance.mdp: Update project file. 2008-02-03 Sebastien Pouliot * AvoidUninstantiatedInternalClassesTest.cs: Add more test cases. * DontIgnoreMethodResultTest.cs: Add test cases for more exceptions. 2008-01-29 Sebastien Pouliot * AvoidUninstantiatedInternalClassesTest.cs: Add nested enum test cases. 2008-01-08 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add more test cases for serialization constructors. 2008-01-04 Sebastien Pouliot * AvoidUnsealedConcreteAttributesTest.cs: New. Unit tests by Daniel Abramov * Test.Rules.Performance.mdp: Add new test for MonoDevelop project file. 2008-01-03 Sebastien Pouliot * AvoidReturningArraysOnPropertiesTest.cs: New. Unit tests by Adrian Tsai * AvoidUninstantiatedInternalClassesTest.cs: Add new enum test cases. * Test.Rules.Performance.mdp: Add new test for MonoDevelop project file. 2007-12-21 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs, AvoidUnusedParametersTest.cs: Fix anonymous test cases since GMCS and CSC don't compile the types, or methods, using the same names. 2007-12-21 Nestor Salceda * AvoidUnusedParametersTest.cs: Added a testcase for anonymous methods due #350288 bug. 2007-11-30 Sebastien Pouliot * AvoidUninstantiatedInternalClassesTest.cs: Change the behavior of a test since the condition is already checked by another rule. 2007-11-29 Nestor Salceda * AvoidUncalledPrivateCodeTest.cs: Added testcase for check compiler generated methods, by example anonymous methods. 2007-11-22 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Change behaviour, it's ok to have unused private ctor (and it's common before static classes were available). * AvoidUnusedParametersTest.cs: Added test cases for operators when tracking some false positives reported in Cecil (make self-check) 2007-11-22 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Add test case for explicit interface implementation. 2007-11-21 Sebastien Pouliot * AvoidUninstantiatedInternalClassesTest.cs: Moved class outside the fixture (because it made them all nested). Removed test for InternalsVisibleToAttribute. This must be done from another assembly (or it will mess every results in this one). 2007-11-21 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Word around bug #343465 so test all works under Mono and MS runtimes. 2007-11-21 Sebastien Pouliot * AvoidUncalledPrivateCodeTest.cs: Handle more cases (don't check for method.Name). Add test case for finalizers. 2007-10-07 Sebastien Pouliot * AvoidToStringOnStringsTest.cs: Unit tests (Lukasz Knop, GSoC 2007) * AvoidUncalledPrivateCodeTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * AvoidUninstantiatedInternalClassesTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * DontIgnoreMethodResultTest.cs: Unit tests (Lukasz Knop, GSoC 2007) * UsingStringLengthInsteadOfCheckingEmptyStringTest.cs: Unit tests (Nidhi Rawal, GSoC 2007) * Test.Rules.Performance.mdp: Update project file. 2007-09-04 Nestor Salceda * AvoidUnusedParametersTest.cs: Added a test case for empty method. 2007-08-31 Nestor Salceda * AvoidUnusedParametersTest.cs: New. Unit tests for AvoidUnusedParametersRule. 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-20 Jonathan Chambers * Test.Rules.Performance.csproj: Make reference to nunit.framework not a specific version for portability. 2006-09-19 Sebastien Pouliot * EmptyDestructorTest.cs: Fixed test case, EmptyDestructor should not return null (as this is an error, i.e. counter-productive). 2006-08-21 Sebastien Pouliot * UseStringEmptyTest.cs: New. Unit tests for UseStringEmptyRule. * Test.Rules.Performance.mdp: Add new test to MonoDevelop project. 2006-07-31 Sebastien Pouliot * Test.Rules.Performance.mdp: New. Project file for MonoDevelop. * EmptyDestructorTest.cs, IDisposableWithDestructorWithoutSuppressFinalizeTest.cs: Add a property for the IntPtr to remove compiler warnings. 2006-03-01 Sebastien Pouliot * EmptyDestructorTest.cs, IDisposableWithDestructorWithoutSuppressFinalizeTest.cs: Conditions for success/failure were inverted when Gendarme framework was updated. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/UseStringEmptyTest.cs0000664000175000017500000001111212413742070032542 0ustar00directhexdirecthex00000000000000// // Unit tests for UseStringEmptyRule // // Authors: // Sebastien Pouliot // // Copyright (C) 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 Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class UseStringEmptyTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } public class TestCase { public const string public_const_field = ""; private static string private_static_field = ""; public string GetConstField () { return public_const_field; } public string GetStaticField () { return private_static_field; } public string Append (string user_value) { return user_value + ""; } public string Enclose (string user_value) { return "" + user_value + ""; } // nice way public string public_field = ""; public string GetField () { return public_field; } public string Prepend (string user_value) { return String.Empty + user_value; } public int NoStringWereHarmedInThisTestCase () { return 42; } public void SmallSwitch (string s) { switch (s) { // case String.Empty: error CS0150: A constant value is expected case "": Console.WriteLine ("empty"); break; default: Console.WriteLine (s); break; } } public void LargeSwitch (string s) { switch (s) { // case String.Empty: error CS0150: A constant value is expected case "": Console.WriteLine ("unknown"); break; case "zero": Console.WriteLine ("0"); break; case "one": Console.WriteLine ("1"); break; case "two": Console.WriteLine ("2"); break; case "three": Console.WriteLine ("3"); break; case "four": Console.WriteLine ("4"); break; default: Console.WriteLine ("large value"); break; } } } [Test] public void GetConstField () { AssertRuleFailure ("GetConstField", 1); } [Test] public void Append () { AssertRuleFailure ("Append", 1); } [Test] public void Enclose () { // this could be one (csc) or two ([g]mcs) defects depending on how this is compiled AssertRuleFailure ("Enclose"); } [Test] public void Constructor () { // the "public_field" field is set to "" in the (hidden) ctor AssertRuleFailure (".ctor", 1); } [Test] public void StaticConstructor () { // the "private_static_field" field is set to "" in the (hidden) class ctor AssertRuleFailure (".cctor", 1); } [Test] public void GetField () { AssertRuleDoesNotApply ("GetField"); } [Test] public void GetStaticField () { AssertRuleDoesNotApply ("GetStaticField"); } [Test] public void Prepend () { AssertRuleDoesNotApply ("Prepend"); } [Test] public void NoHarm () { AssertRuleDoesNotApply ("NoStringWereHarmedInThisTestCase"); } [Test] [Ignore ("switch/case optimized into if/else by compilers")] public void Switch () { // compilers optimize the switch into a bunch of if/else - however, syntax wise, // String.Empty cannot be used in a swicth/case. Undetectable IL wise AssertRuleSuccess ("SmallSwitch"); AssertRuleSuccess ("LargeSwitch"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/RemoveUnusedLocalVariablesTest.cs0000664000175000017500000000701112413742070035030 0ustar00directhexdirecthex00000000000000// // Unit tests for RemoveUnusedLocalVariablesRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class RemoveUnusedLocalVariablesTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.GeneratedCodeMethod); } [Test] public void Empty () { AssertRuleSuccess (SimpleMethods.EmptyMethod); } private bool ReturnConstant () { // compiler create this local variable return true; } private bool ReturnLocal_Ok () { bool a = false; return a; } [Test] public void Return () { AssertRuleSuccess ("ReturnConstant"); AssertRuleSuccess ("ReturnLocal_Ok"); } private bool ReturnLocal_Unused () { bool a = false; bool b; // unused but CSC removed it from IL while [g]mcs keeps it return a; } private bool ReturnLocal_StoreOnly () { bool a = false; bool b = false; // stored only - so it's, in fact, unused // again CSC removes it from IL while [g]mcs keeps it return a; } [Test] [Ignore ("depends if the compiler removes the unused variables or not from IL")] public void CompilerDependent () { AssertRuleFailure ("ReturnLocal_StoreOnly"); AssertRuleFailure ("ReturnLocal_Unused"); } // test case provided by Richard Birkby internal sealed class FalsePositive6 { public void Run () { GetType (); foreach (string s in AddValues ()) { Console.WriteLine (s); } } public static IEnumerable AddValues () { string newValue = null; foreach (string value in new string [] { "1", "2", "3" }) { decimal firstValue; decimal secondValue; if (Decimal.TryParse (newValue, out firstValue) && Decimal.TryParse (value, out secondValue)) { newValue = (firstValue + secondValue).ToString (); } else { newValue = null; } } yield return newValue; } } [Test] public void Out () { AssertRuleSuccess ("AddValues"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUncalledPrivateCodeTest.cs0000664000175000017500000004770712413742070034463 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidUncalledPrivateCodeRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2007-2008,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; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.Serialization; using System.Runtime.InteropServices; using Gendarme.Rules.Performance; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Performance { #pragma warning disable 169, 414 // from Mono.Rocks // note: error CS1109: Extension methods must be defined in a top level static class; StaticType is a nested class public static class StaticType { public static IEnumerable Repeat (this IEnumerable self, int number) { // Check.Self (self); return CreateRepeatIterator (self, number); } private static IEnumerable CreateRepeatIterator (IEnumerable self, int number) { for (int i = 0; i < number; i++) { foreach (var element in self) yield return element; } } } [TestFixture] public class AvoidUncalledPrivateCodeTest : MethodRuleTestFixture { public class UncalledPrivateMethod { private void display () { } } public class CalledPrivateMethod { private void display () { } public static void Main (string [] args) { CalledPrivateMethod c = new CalledPrivateMethod (); c.display (); } } [Test] public void PrivateMethodsInPublicType () { AssertRuleFailure ("display", 1); AssertRuleSuccess ("display"); AssertRuleDoesNotApply ("Main"); } public class UncalledInternalMethod { internal void print () { } } public class CalledInternalMethod { internal void CalledMethod () { } } public class MethodCallingClass { public static void Main (string [] args) { CalledInternalMethod c = new CalledInternalMethod (); c.CalledMethod (); } } [Test] public void InternalMethodsInPublicTypes () { AssertRuleFailure ("print", 1); AssertRuleSuccess ("CalledMethod"); AssertRuleDoesNotApply ("Main"); } private class PrivateMethodInPrivateClass { private void privateMethodNotCalled () { privateMethodCalled (); } // only called by uncalled method - but we don't report that private void privateMethodCalled () { } } [Test] public void PrivateMethodsInPrivateType () { AssertRuleFailure ("privateMethodNotCalled", 1); AssertRuleSuccess ("privateMethodCalled"); } private class PublicMethodsInPrivateClass { public void PublicCalledMethod () { } public virtual void PublicVirtualUncalledMethod () { } public void PublicUncalledMethod () { } public static void Main (string [] args) { PublicMethodsInPrivateClass p = new PublicMethodsInPrivateClass (); p.PublicCalledMethod (); } } internal class PublicMethodsInInternalClass { public void PublicCalledMethod () { } public virtual void PublicVirtualUncalledMethod () { } public void PublicUncalledMethod () { } public static void Main (string [] args) { PublicMethodsInInternalClass p = new PublicMethodsInInternalClass (); p.PublicCalledMethod (); } } [Test] public void PublicMethods () { AssertRuleFailure ("PublicUncalledMethod"); AssertRuleSuccess ("PublicVirtualUncalledMethod"); AssertRuleSuccess ("PublicCalledMethod"); AssertRuleFailure ("PublicUncalledMethod"); AssertRuleSuccess ("PublicVirtualUncalledMethod"); AssertRuleSuccess ("PublicCalledMethod"); } public class AnonymousMethod { private void MethodWithAnonymousMethod () { string [] values = new string [] { "one", "two", "three" }; if (Array.Exists (values, delegate (string myString) { return myString.Length == 3; })) Console.WriteLine ("Exists strings with length == 3"); } } internal class NestedClasses { public class AnotherClass { private void UncalledPrivateInNestedInternal () { } internal void UncalledInternalInNestedInternal () { } // public method but not visible outside the assembly public void UncalledPublicInNestedInternal () { } // protected method but not visible outside the assembly protected void UncalledProtectedInNestedInternal () { } } } public class NestedCalledMethods { class Nested { void callParentDisplay () { display (); display2 (); } } private static void display () { } internal static void display2 () { } } [Test] public void NestedMethods () { AssertRuleFailure ("UncalledPrivateInNestedInternal"); AssertRuleFailure ("UncalledInternalInNestedInternal"); AssertRuleFailure ("UncalledPublicInNestedInternal"); AssertRuleFailure ("UncalledProtectedInNestedInternal"); AssertRuleSuccess ("display"); } interface Iface1 { void IfaceMethod1 (); } interface Iface2 { void IfaceMethod2 (); } // both methods are unused but needed to satisfy interface requirements public class ImplementingExplicitInterfacesMembers : Iface1, Iface2 { void Iface1.IfaceMethod1 () { } void Iface2.IfaceMethod2 () { } } [Test] public void ImplementingExplicitInterfaces () { AssertRuleSuccess (); } public class PrivateConstructorNotCalled { private PrivateConstructorNotCalled () { } } public class StaticConstructorNotCalled { static int i = 0; static StaticConstructorNotCalled () { i = 5; } } [Test] public void Constructors () { AssertRuleSuccess (); AssertRuleDoesNotApply (".cctor"); } [Serializable] public class PublicSerializableConstructorNotCalled { private int i; public PublicSerializableConstructorNotCalled (SerializationInfo info, StreamingContext context) { i = 0; } } [Serializable] public class PrivateSerializableConstructorNotCalled { private int i; private PrivateSerializableConstructorNotCalled (SerializationInfo info, StreamingContext context) { i = 0; } } [Serializable] public class ProtectedSerializableConstructorNotCalled { private int i; protected ProtectedSerializableConstructorNotCalled (SerializationInfo info, StreamingContext context) { i = 0; } } [Serializable] public class InternalSerializableConstructorNotCalled { private int i; internal InternalSerializableConstructorNotCalled (SerializationInfo info, StreamingContext context) { i = 0; } } [Test] public void SerializationConstructors () { AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } public class UncalledPublicOverriddenMethod { public override string ToString () { return ToStringToo (); } internal virtual string ToStringToo () { return String.Empty; } } public class UncalledInternalOverriddenMethod : UncalledPublicOverriddenMethod { // this can be accessed thru UncalledPublicOverriddenMethod internal override string ToStringToo () { return "aha!"; } } [Test] public void UncalledOverriddenMethodTest () { AssertRuleSuccess (); AssertRuleSuccess (); } public class UsingComRegisterAndUnRegisterFunctionAttribute { [ComRegisterFunction] private void register () { } [ComUnregisterFunction] private void unregister () { } } [Test] public void ComRegisterFunctions () { AssertRuleDoesNotApply ("register"); AssertRuleDoesNotApply ("unregister"); } public class CallingPrivateMethodsThroughDelegates { delegate string delegateExample (); private string privateMethod () { return String.Empty; } public static void Main (string [] args) { CallingPrivateMethodsThroughDelegates c = new CallingPrivateMethodsThroughDelegates (); delegateExample d = new delegateExample (c.privateMethod); } } [Test] public void Delegates () { AssertRuleSuccess ("privateMethod"); } public class ClassWithFinalizer { // finalizer is private but we can't report it as unused ~ClassWithFinalizer () { } // note: don't add anything else in this class or the test will break } [Test] public void Finalizer () { AssertRuleSuccess (); } internal class MyList : IList { public MyList () { } public int Add (object value) { throw new NotImplementedException (); } public void Clear () { throw new NotImplementedException (); } public bool Contains (object value) { throw new NotImplementedException (); } public int IndexOf (object value) { throw new NotImplementedException (); } public void Insert (int index, object value) { throw new NotImplementedException (); } public bool IsFixedSize { get { throw new NotImplementedException (); } } public bool IsReadOnly { get { throw new NotImplementedException (); } } public void Remove (object value) { throw new NotImplementedException (); } public void RemoveAt (int index) { throw new NotImplementedException (); } public object this [int index] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } public void CopyTo (Array array, int index) { throw new NotImplementedException (); } public int Count { get { throw new NotImplementedException (); } } public bool IsSynchronized { get { throw new NotImplementedException (); } } public object SyncRoot { get { throw new NotImplementedException (); } } public IEnumerator GetEnumerator () { throw new NotImplementedException (); } } public class MyExplicitList : IList { int IList.Add (object value) { throw new NotImplementedException (); } void IList.Clear () { throw new NotImplementedException (); } bool IList.Contains (object value) { throw new NotImplementedException (); } int IList.IndexOf (object value) { throw new NotImplementedException (); } void IList.Insert (int index, object value) { throw new NotImplementedException (); } bool IList.IsFixedSize { get { throw new NotImplementedException (); } } bool IList.IsReadOnly { get { throw new NotImplementedException (); } } void IList.Remove (object value) { throw new NotImplementedException (); } void IList.RemoveAt (int index) { throw new NotImplementedException (); } object IList.this [int index] { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } } void ICollection.CopyTo (Array array, int index) { throw new NotImplementedException (); } int ICollection.Count { get { throw new NotImplementedException (); } } bool ICollection.IsSynchronized { get { throw new NotImplementedException (); } } object ICollection.SyncRoot { get { throw new NotImplementedException (); } } IEnumerator IEnumerable.GetEnumerator () { throw new NotImplementedException (); } } [Test] public void InterfaceImplementations () { new MyList (); AssertRuleSuccess (); AssertRuleSuccess (); } private AssemblyDefinition assembly; private TypeDefinition GetTest (string name) { if (assembly == null) { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } string fullname = "Test.Rules.Performance.AvoidUncalledPrivateCodeTest/" + name; return assembly.MainModule.GetType (fullname); } [Test] public void AnonymousMethodTest () { // compiler generated code is compiler dependant, check for [g]mcs (inner type) TypeDefinition type = GetTest ("AnonymousMethod/<>c__CompilerGenerated0"); // otherwise try for csc (inside same class) if (type == null) type = GetTest ("AnonymousMethod"); Assert.IsNotNull (type, "type not found"); foreach (MethodDefinition method in type.Methods) { switch (method.Name) { case "MethodWithAnonymousMethod": // this isn't part of the test (but included with CSC) break; default: if (!method.IsConstructor) AssertRuleDoesNotApply (method); break; } } } // from libanculus // http://code.google.com/p/libanculus-sharp/source/browse/trunk/src/Anculus.Core/Sorting/QuickSorter.cs public class Anculus { public void Sort (IList list, IComparer comparer) { Sort (list, comparer, 0, list.Count - 1); } private static void Sort (IList list, IComparer comparer, int lower, int upper) { if (lower < upper) { int split = Pivot (list, comparer, lower, upper); Sort (list, comparer, lower, split - 1); Sort (list, comparer, split + 1, upper); } } private static int Pivot (IList list, IComparer comparer, int lower, int upper) { return 0; } } [Test] [Ignore ("Mono bug #320901")] // https://bugzilla.novell.com/show_bug.cgi?id=320901 public void Generics () { AssertRuleSuccess (); } internal abstract class X { protected static bool a () { return false; } public T b () { return default(T); } } internal class Y : X { public override string ToString () { return a () ? String.Empty : base.ToString (); } } [Test] public void InheritedGenerics () { Y y = new Y (); Assert.AreEqual (0.0f, y.b (), "float"); AssertRuleSuccess (); AssertRuleSuccess> ("a"); AssertRuleSuccess> ("b"); } // test case from gmcs - bug #410000 class EmptyAddressOf /*: EmptyExpression, IMemoryLocation */ { // THIS PROPERTY IS NEVER USED public bool IsFixed { get { return true; } } } [Test] public void UnusedProperty () { AssertRuleFailure ("get_IsFixed"); } // test case provided by Richard Birkby internal sealed class FalsePositive1 { public void Run () { GetType (); Foo f = new Foo (); f.FalsePositive1 (); } sealed class Foo { public void FalsePositive1 () { GetType (); } } } public void RunFalsePositive () { new FalsePositive1 ().Run (); } [Test] public void MoreGenerics () { AssertRuleSuccess (); } interface IFoo { event EventHandler Foo; } interface IBar { event EventHandler Bar; } private class EventCases : IFoo, IBar { private event EventHandler unused; event EventHandler Unused { add { unused += value; } remove { unused -= value; } } private event EventHandler used; event EventHandler Used { add { used += value; } remove { used -= value; } } public EventCases () { Used += new EventHandler (Common); (this as IFoo).Foo += new EventHandler (Common); Bar += new EventHandler (Common); } void Common (object sender, EventArgs e) { Used -= new EventHandler (Common); } private event EventHandler foo, bar; event EventHandler IFoo.Foo { add { foo += value; } remove { foo -= value; } } public event EventHandler Bar { add { bar += value; } remove { bar -= value; } } } [Test] public void Events () { AssertRuleFailure ("add_Unused", 1); AssertRuleFailure ("remove_Unused", 1); AssertRuleSuccess ("add_Used"); AssertRuleSuccess ("remove_Used"); AssertRuleSuccess ("Test.Rules.Performance.AvoidUncalledPrivateCodeTest.IFoo.add_Foo"); // not used but we ignore explicit interfaces AssertRuleSuccess ("Test.Rules.Performance.AvoidUncalledPrivateCodeTest.IFoo.remove_Foo"); AssertRuleSuccess ("add_Bar"); AssertRuleSuccess ("remove_Bar"); } [Test] public void Events_Autogenerated () { MethodDefinition md = DefinitionLoader.GetMethodDefinition ("add_foo"); if (!md.IsSynchronized) Assert.Ignore ("newer versions of CSC (e.g. 10.0) does not set the Synchronized"); // older CSC (and xMCS) compilers still generate it's own add/remove methods that set the // synchronize flags and we simply ignore them since they are out of the developer's control AssertRuleDoesNotApply (md); AssertRuleDoesNotApply ("remove_foo"); } [Test] [Ignore ("Mono bug #320901")] // https://bugzilla.novell.com/show_bug.cgi?id=320901 public void MonoRocks () { AssertRuleSuccess (typeof (StaticType), "CreateRepeatIterator"); } // Test cases devired from bug #458178 void MultidimArray () { const int LengthA = 2; const int LengthB = 2; bool [,] array = new bool [LengthA, LengthB]; for (int i = 0; i < LengthA; i++) { for (int j = 0; j < LengthB; j++) { array [i, j] = true; } } } void JaggedArray () { const int LengthA = 2; const int LengthB = 2; bool [][] array = new bool [LengthA][]; for (int i = 0; i < LengthA; i++) { for (int j = 0; j < LengthB; j++) { array [i][j] = true; } } } void NullableArray () { const int LengthA = 2; const int LengthB = 2; bool? [,] array = new bool? [LengthA, LengthB]; for (int i = 0; i < LengthA; i++) { for (int j = 0; j < LengthB; j++) { array [i, j] = true; } } } [Test] // https://bugzilla.novell.com/show_bug.cgi?id=458178 public void Arrays () { AssertRuleFailure ("MultidimArray", 1); AssertRuleFailure ("JaggedArray", 1); AssertRuleFailure ("NullableArray", 1); } [Conditional ("DO_NOT_DEFINE")] static void WriteLine (string s) { Console.WriteLine (s); } [Test] public void ConditionalCode () { AssertRuleDoesNotApply ("WriteLine"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidLargeStructureTest.cs0000664000175000017500000002040112413742070033537 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidLargeStructureRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Metadata; using Gendarme.Framework; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Performance { #pragma warning disable 169, 649 [TestFixture] public class AvoidLargeStructureTest : TypeRuleTestFixture { private int GetSize (Type type) { return (int) AvoidLargeStructureRule.SizeOfStruct (DefinitionLoader.GetTypeDefinition (type)); } [Test] public void Class () { AssertRuleDoesNotApply (); } // Also note that this rule deals with the managed size of a structure, // not it's unmanaged representation (i.e. [StructLayout] attribute is ignored). // note: we need unsafe to call sizeof on structs struct Empty { } [Test] public unsafe void StructEmpty () { AssertRuleSuccess (); // note: under MS runtime sizeof(Empty) returns 1 // while is returns 0 under Mono // Assert.AreEqual (sizeof (Empty), GetSize (type), "Size"); } struct Small { byte b; } [Test] public unsafe void StructSmall () { AssertRuleSuccess (); Assert.AreEqual (sizeof (Small), GetSize (typeof (Small)), "Size"); } struct DualBytes { byte b1; byte b2; } [Test] public unsafe void StructDualBytes () { AssertRuleSuccess (); Assert.AreEqual (sizeof (DualBytes), GetSize (typeof (DualBytes)), "Size"); } struct DualSmall { Small s1; Small s2; } [Test] public unsafe void StructDualSmall () { AssertRuleSuccess (); Assert.AreEqual (sizeof (DualSmall), GetSize (typeof (DualSmall)), "Size"); } struct Misaligned { byte b; char c; int i; } [Test] public unsafe void StructMisaligned () { AssertRuleSuccess (); Assert.AreEqual (sizeof (Misaligned), GetSize (typeof (Misaligned)), "Size"); } // 20 bytes - due to misalignment of bytes and chars struct MisalignedLarge { byte b1; char c1; byte b2; char c2; byte b3; char c3; byte b4; char c4; int length; } [Test] public unsafe void StructMisalignedLarge () { AssertRuleFailure (); Assert.AreEqual (sizeof (MisalignedLarge), GetSize (typeof (MisalignedLarge)), "Size"); } // 16 bytes - due to "correct" alignment of bytes and chars struct AlignedLarge { byte b1; byte b2; byte b3; byte b4; char c1; char c2; char c3; char c4; int length; } [Test] public unsafe void StructAlignedLarge () { AssertRuleSuccess (); Assert.AreEqual (sizeof (AlignedLarge), GetSize (typeof (AlignedLarge)), "Size"); } struct Half { double d; } [Test] public unsafe void StructHalf () { AssertRuleSuccess (); Assert.AreEqual (sizeof (Half), GetSize (typeof (Half)), "Size"); } struct FiveBytes { float d; byte b; } [Test] public unsafe void StructFiveBytes () { AssertRuleSuccess (); Assert.AreEqual (sizeof (FiveBytes), GetSize (typeof (FiveBytes)), "Size"); } struct NineBytes { double d; byte b; } [Test] public unsafe void StructNineBytes () { AssertRuleSuccess (); Assert.AreEqual (sizeof (NineBytes), GetSize (typeof (NineBytes)), "Size"); } struct Limit { int a; float d; long l; } [Test] public unsafe void StructLimit () { AssertRuleSuccess (); Assert.AreEqual (sizeof (Limit), GetSize (typeof (Limit)), "Size"); } struct ComposedUnderLimit { Half empty; Small small; } [Test] public unsafe void StructComposedUnderLimit () { AssertRuleSuccess (); Assert.AreEqual (sizeof (ComposedUnderLimit), GetSize (typeof (ComposedUnderLimit)), "Size"); } struct ComposedLimit { Half empty; Half full; } [Test] public unsafe void StructComposedLimit () { AssertRuleSuccess (); Assert.AreEqual (sizeof (ComposedLimit), GetSize (typeof (ComposedLimit)), "Size"); } struct ComposedOverLimit { Limit limit; Small small; } [Test] public unsafe void StructComposedOverLimit () { AssertRuleFailure (); Assert.AreEqual (sizeof (ComposedOverLimit), GetSize (typeof (ComposedOverLimit)), "Size"); } // other types defined in TypeCode enum struct LessCommonTypes { Char c; DateTime date; Decimal value; //DBNull dbnull; //object o; } // note: is we add a DBNull or object inside the struct then CSC will report a CS0208 // when we call sizeof, even with unsafe, on the type. [Test] public unsafe void StructLessCommonTypes () { AssertRuleFailure (); // DateTime is 8 bytes under MS while it has 16 bytes on Mono //Assert.AreEqual (8, sizeof (DateTime), "DateTime"); //Assert.AreEqual (16, sizeof (Decimal), "Decimal"); //Assert.AreEqual (sizeof (LessCommonTypes), GetSize (typeof (LessCommonTypes)), "Size"); } /* error CS0523: Struct member 'Inner.x' of type 'Inner' causes a cycle in the struct layout struct Inner { Inner x; } */ /* error CS05223: two times struct Outer { Inner x; } struct Inner { Outer x; } */ // from Mono.Cecil struct Elem { public bool Simple; public bool String; public bool Type; public bool BoxedValueType; public Type FieldOrPropType; public object Value; public TypeReference ElemType; } struct FixedArg { bool SzArray; uint NumElem; Elem [] Elems; } [Test] public unsafe void Array () { AssertRuleSuccess (); // note: sizeof (FixedArg) does not work (well compile) because of the array //Assert.AreEqual (sizeof (FixedArg), GetSize (typeof (FixedArg)), "Size"); Assert.AreEqual (12, GetSize (typeof (FixedArg)), "Size"); } struct BunchOfEnums { ConsoleColor cc; ConsoleKey ck; ConsoleModifiers cm; ConsoleSpecialKey csk; DateTimeKind kind; DayOfWeek dow; } [Test] public unsafe void Enums () { AssertRuleFailure (1); Assert.AreEqual (24, GetSize (typeof (BunchOfEnums)), "Size"); } struct WithStaticField { static bool init; BunchOfEnums boe1; BunchOfEnums boe2; } [Test] public unsafe void Static () { AssertRuleFailure (1); // static does not cound Assert.AreEqual (48, GetSize (typeof (WithStaticField)), "Size"); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "Severity"); } struct High { WithStaticField wsf1; WithStaticField wsf2; } [Test] public unsafe void HighSeverity () { AssertRuleFailure (1); Assert.AreEqual (96, GetSize (typeof (High)), "Size"); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "Severity"); } struct Critical { High wsf1; High wsf2; High wsf3; High wsf4; } [Test] public unsafe void CriticalSeverity () { AssertRuleFailure (1); Assert.AreEqual (384, GetSize (typeof (Critical)), "Size"); Assert.AreEqual (Severity.Critical, Runner.Defects [0].Severity, "Severity"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/Makefile.in0000664000175000017500000003144312642235732030475 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Performance/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Performance.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Performance/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Performance/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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: AvoidReturningArraysOnPropertiesTest.cs0000664000175000017500000000405212413742070036222 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for AvoidReturningArraysOnPropertiesRule // // Authors: // Adrian Tsai // // Copyright (c) 2007 Adrian Tsai // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Performance { #pragma warning disable 649 [TestFixture] public class AvoidReturningArraysOnPropertiesTest : MethodRuleTestFixture { public class ShouldBeCaught { byte [] foo; byte [] Foo { get { return foo; } } } public class ShouldBeIgnored { byte [] Bar () { return new byte [10]; } int foo; int Foo { get { return foo; } set { foo = value; } } } [Test] public void Bad () { AssertRuleFailure ("get_Foo", 1); } [Test] public void Good () { AssertRuleSuccess ("get_Foo"); } [Test] public void DoesNotApply () { // not a property AssertRuleDoesNotApply ("Bar"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidConcatenatingCharsTest.cs0000664000175000017500000001341712413742070034333 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidConcatenatingCharsRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Tests.Rules.Performance { [TestFixture] public class AvoidConcatenatingCharsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no calls, so String.Concat is never called AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } string s; char c; static string ss; static char sc; const char cc = 'a'; const string cs = "s"; private string ManualConcat (char a, char b) { // compiled as String.Concat return a.ToString () + b.ToString (); } private string Concat_String_Array (string s) { // Concat(params string[]) return String.Concat (s); } private string Concat_String_2 (string s) { return String.Concat (s, 42.ToString ()); } private string Concat_String_3 (string s) { return String.Concat (s, "s", 'c'.ToString ()); } private string Concat_String_4 (string s) { return String.Concat (s, "s", 'c'.ToString (), 42.ToString ()); } [Test] public void ConcatString () { AssertRuleSuccess ("ManualConcat"); AssertRuleSuccess ("Concat_String_Array"); AssertRuleSuccess ("Concat_String_2"); AssertRuleSuccess ("Concat_String_Array"); AssertRuleSuccess ("Concat_String_3"); AssertRuleSuccess ("Concat_String_4"); } private void Object_Locals () { string s = "a"; char c = 'c'; Console.WriteLine (s + c); } private void Object_Parameters (string s, char c) { Console.WriteLine (c + s); } private string Object_Fields () { return (s + c); } private string Object_StaticFields () { return (sc + ss); } private string Concat_String_Int_2 (string s) { return String.Concat (s, 42); } private string Object_Mixed_3 (char c) { return ('a' + c + cs); } private string Concat_Object_Mixed_3 (char c) { // csc compile this as 'box int' with value '61' return String.Concat ('a', c, cs); } [Test] public void ConcatObject () { AssertRuleFailure ("Object_Locals"); AssertRuleFailure ("Object_Parameters"); AssertRuleFailure ("Object_Fields"); AssertRuleFailure ("Object_StaticFields"); AssertRuleFailure ("Concat_String_Int_2"); AssertRuleFailure ("Object_Mixed_3"); AssertRuleFailure ("Concat_Object_Mixed_3"); } // all those are compiled as Concat(params object[]) by csc private string Concat_Object_1 (char c) { // special case - should be replaced by Object.ToString() to save the boxing return String.Concat (c); } private string Object_Mixed_4 (string s) { return (cc + s + String.Empty + ss); } private string Concat_Object_Mixed_4 (string s) { return String.Concat (cc, s, String.Empty, ss); } private string Concat_Object_NonChar_4 (string s) { return String.Concat (cc, s, String.Empty, 42); } private string Concat_ObjectArray_String () { object [] array = new object [] { "s", "s" }; return String.Concat (array); } private string Concat_ObjectArray_Parameter (int [] array) { return String.Concat (array); } [Test] public void ConcatObject_Array () { AssertRuleFailure ("Concat_Object_1"); AssertRuleFailure ("Object_Mixed_4"); AssertRuleFailure ("Concat_Object_Mixed_4"); AssertRuleFailure ("Concat_Object_NonChar_4"); // there is no boxing visible in this case AssertRuleSuccess ("Concat_ObjectArray_String"); AssertRuleSuccess ("Concat_ObjectArray_Parameter"); } private string Concat_NoBox_Object () { // same as "this.ToString ();" but no boxing return String.Concat (this); } private string Concat_NoBox_String_Object () { return String.Concat ("string: ", this); } [Test] public void ConcatObject_NoBoxing () { AssertRuleSuccess ("Concat_NoBox_Object"); AssertRuleSuccess ("Concat_NoBox_String_Object"); } } } AvoidTypeGetTypeForConstantStringsTest.cs0000664000175000017500000001076512413742070036477 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for AvoidTypeGetTypeForConstantStringsRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Performance { [TestFixture] public class AvoidTypeGetTypeForConstantStringsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no CALL or CALLVIRT AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } // http://lists.ximian.com/archives/public/mono-patches/2008-June/121564.html System.Type booleanType; System.Type stringType; System.Type intType; System.Type typeType; System.Type shortType; public void CacheTypesBad () { booleanType = System.Type.GetType ("System.Boolean"); stringType = System.Type.GetType ("System.String"); intType = System.Type.GetType ("System.Int32"); typeType = System.Type.GetType ("System.Type"); shortType = System.Type.GetType ("System.Int16"); } public void CacheTypesGood () { booleanType = typeof (bool); stringType = typeof (string); intType = typeof (int); typeType = typeof (Type); shortType = typeof (short); } [Test] public void Cache () { AssertRuleFailure ("CacheTypesBad", 5); AssertRuleDoesNotApply ("CacheTypesGood"); } public System.Type GetType0 (string s) { s += "a"; // to get a LDSTR return s.GetType (); } public System.Type GetType1 (string s) { s += "a"; // to get a LDSTR return System.Type.GetType (s); } string instance_field; public System.Type GetType2 () { instance_field += "x"; // to get a LDSTR return System.Type.GetType (instance_field, true); } static string static_field; public System.Type GetType3 () { static_field += "x"; // to get a LDSTR return System.Type.GetType (static_field, true, true); } [Test] public void GetTypes () { AssertRuleSuccess ("GetType0"); AssertRuleSuccess ("GetType1"); AssertRuleSuccess ("GetType2"); AssertRuleSuccess ("GetType3"); } public class Type { public static System.Type GetType (string s) { return null; } } public System.Type GetType () { return Type.GetType ("System.Int32"); } [Test] public void LookAlike () { AssertRuleSuccess ("GetType"); } public System.Type GetTypeFromAnotherAssembly () { return System.Type.GetType ("System.Drawing.Printing.SysPrn, System.Drawing"); } private bool IsMonoRuntime () { return (null != System.Type.GetType ("Mono.Runtime")); } [Test] public void GoodReasons () { // there are some good reasons to use a string // e.g. loading a non-visible type (not easy to detect) // or more commonly getting a type from an assembly that is not loaded AssertRuleSuccess ("GetTypeFromAnotherAssembly"); // or the supported way to detect if we are running on mono runtime AssertRuleSuccess ("IsMonoRuntime"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnusedParametersTest.cs0000664000175000017500000002572512413742070034071 0ustar00directhexdirecthex00000000000000// // Unit Test for AvoidUnusedParameters Rule. // // Authors: // Néstor Salceda // Sebastien Pouliot // // (C) 2007 Néstor Salceda // 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; using System.Collections; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.InteropServices; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Performance { public abstract class AbstractClass { public abstract void AbstractMethod (int x); } public class VirtualClass { public virtual void VirtualMethod (int x) { } } public class OverrideClass : VirtualClass { public override void VirtualMethod (int x) { } } [TestFixture] public class AvoidUnusedParametersTest : MethodRuleTestFixture { [TestFixtureSetUp] public void SetUp () { Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } public void PrintBannerUsingParameter (Version version) { Console.WriteLine ("Welcome to the foo program {0}", version); } public void PrintBannerUsingAssembly (Version version) { Console.WriteLine ("Welcome to the foo program {0}", Assembly.GetExecutingAssembly ().GetName ().Version); } public void PrintBannerWithoutParameters () { Console.WriteLine ("Welcome to the foo program {0}", Assembly.GetExecutingAssembly ().GetName ().Version); } [Test] public void PrintBanner () { AssertRuleSuccess ("PrintBannerUsingParameter"); AssertRuleFailure ("PrintBannerUsingAssembly", 1); AssertRuleDoesNotApply ("PrintBannerWithoutParameters"); } public void MethodWithUnusedParameters (IEnumerable enumerable, int x) { Console.WriteLine ("Method with unused parameters"); } [Test] public void MethodWithUnusedParametersTest () { AssertRuleFailure ("MethodWithUnusedParameters", 2); } public void MethodWith5UsedParameters (int x, IEnumerable enumerable, string foo, char c, float f) { Console.WriteLine (f); Console.WriteLine (c); Console.WriteLine (foo); Console.WriteLine (enumerable); Console.WriteLine (x); } [Test] public void MethodWith5UsedParametersTest () { AssertRuleSuccess ("MethodWith5UsedParameters"); } public static void StaticMethodWithUnusedParameters (int x, string foo) { } [Test] public void StaticMethodWithUnusedParametersTest () { AssertRuleFailure ("StaticMethodWithUnusedParameters", 2); } public static void StaticMethodWithUsedParameters (int x, string foo) { Console.WriteLine (x); Console.WriteLine (foo); } [Test] public void StaticMethodWithUsedParametersTest () { AssertRuleSuccess ("StaticMethodWithUsedParameters"); } public static void StaticMethodWith5UsedParameters (int x, string foo, IEnumerable enumerable, char c, float f) { Console.WriteLine (f); Console.WriteLine (c); Console.WriteLine (foo); Console.WriteLine (enumerable); Console.WriteLine (x); } [Test] public void StaticMethodWith5UsedParametersTest () { AssertRuleSuccess ("StaticMethodWith5UsedParameters"); } public static void StaticMethodWith5UnusedParameters (int x, string foo, IEnumerable enumerable, char c, float f) { } [Test] public void StaticMethodWith5UnusedParametersTest () { AssertRuleFailure ("StaticMethodWith5UnusedParameters", 5); } public delegate void SimpleCallback (int x); public void SimpleCallbackImpl (int x) { } public void SimpleCallbackImpl2 (int x) { } [Test] public void DelegateMethodTest () { SimpleCallback callback = new SimpleCallback (SimpleCallbackImpl); AssertRuleDoesNotApply ("SimpleCallbackImpl"); } [Test] public void DelegateMethodTestWithMultipleDelegates () { SimpleCallback callback = new SimpleCallback (SimpleCallbackImpl); SimpleCallback callback2 = new SimpleCallback (SimpleCallbackImpl2); AssertRuleDoesNotApply ("SimpleCallbackImpl"); AssertRuleDoesNotApply ("SimpleCallbackImpl2"); } public void AnonymousMethodWithUnusedParameters () { SimpleCallback callback = delegate (int x) { //Empty }; } [Test] public void AnonymousMethodTest () { MethodDefinition method = null; // compiler generated code is compiler dependant, check for [g]mcs (inner type) TypeDefinition type = DefinitionLoader.GetTypeDefinition (typeof (AvoidUnusedParametersTest).Assembly, "AvoidUnusedParametersTest/<>c__CompilerGenerated0"); if (type != null) method = DefinitionLoader .GetMethodDefinition (type, "c__2", null); // otherwise try for csc (inside same class) if (method == null) { type = DefinitionLoader.GetTypeDefinition (); foreach (MethodDefinition md in type.Methods) { if (md.Name.StartsWith ("")) { method = md; break; } } } Assert.IsNotNull (method, "method not found!"); AssertRuleDoesNotApply (method); } public delegate void SimpleEventHandler (int x); public event SimpleEventHandler SimpleEvent; public void OnSimpleEvent (int x) { } [Test] public void EventTest () { SimpleEvent += new SimpleEventHandler (OnSimpleEvent); AssertRuleDoesNotApply ("OnSimpleEvent"); } public void EmptyMethod (int x) { } [Test] public void EmptyMethodTest () { AssertRuleFailure ("EmptyMethod", 1); } public static bool operator == (AvoidUnusedParametersTest t1, AvoidUnusedParametersTest t2) { return t1.Equals (t2); } public static bool operator != (AvoidUnusedParametersTest t1, AvoidUnusedParametersTest t2) { return !t1.Equals (t2); } public struct StructureOk { public static bool operator == (StructureOk s1, StructureOk s2) { return Object.ReferenceEquals (s1, s2); } public static bool operator != (StructureOk s1, StructureOk s2) { return !Object.ReferenceEquals (s1, s2); } } public struct StructureBad { public static bool operator == (StructureBad s1, StructureBad s2) { return true; } public static bool operator != (StructureBad s1, StructureBad s2) { return false; } } [Test] public void OperatorsClass () { AssertRuleSuccess ("op_Equality"); AssertRuleSuccess ("op_Inequality"); } [Test] public void OperatorsStructureOk () { AssertRuleSuccess ("op_Equality"); AssertRuleSuccess ("op_Inequality"); } [Test] public void OperatorsStructureBad () { AssertRuleFailure ("op_Equality", 2); AssertRuleFailure ("op_Inequality", 2); } [Test] public void OperatorsCecil () { AssertRuleSuccess ("op_Equality"); AssertRuleSuccess ("op_Inequality"); } public void ButtonClick_EvenArgsUnused (object o, EventArgs e) { if (o == null) throw new ArgumentNullException ("o"); } public void ButtonClick_NoParameterUnused (object o, EventArgs e) { Console.WriteLine ("uho"); } [Test] public void EventArgs () { AssertRuleDoesNotApply ("ButtonClick_EvenArgsUnused"); AssertRuleDoesNotApply ("ButtonClick_NoParameterUnused"); } [Test] public void AbstractMethodTest () { AssertRuleDoesNotApply ("AbstractMethod"); } [Test] public void VirtualMethodTest () { AssertRuleDoesNotApply ("VirtualMethod"); } [Test] public void OverrideMethodTest () { AssertRuleDoesNotApply ("VirtualMethod"); } // using our own extern helps more in coverage than SimpleMethods.External would [DllImport ("libc.so")] private static extern double cos (double x); [Test] public void ExternMethodTest () { AssertRuleDoesNotApply ("cos"); } [Conditional ("DO_NOT_DEFINE")] void WriteLine (string s) { // the C.WL will not be compiled since DO_NOT_DEFINE is undefined // which means parameter 's' will be unused by the method Console.WriteLine (s); } [Test] public void ConditionalCode () { AssertRuleDoesNotApply ("WriteLine"); } public class FxCopTest { // CA1801 public class ReviewUnusedParameters { static public void Fail (int count) { } // manually suppressed - no MessageId [SuppressMessage ("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] static public void ManuallySuppressed (int count) { } // automatically suppressed using VS2010 [System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "count")] static public void AutomaticallySuppressed (int count) { } // automatically suppressed using VS2010 (see GlobalSupressions.cs) static public void GloballySuppressed (int count) { } } } [Test] public void CA1801 () { AssertRuleFailure ("Fail", 1); AssertRuleDoesNotApply ("ManuallySuppressed"); AssertRuleDoesNotApply ("AutomaticallySuppressed"); AssertRuleDoesNotApply ("GloballySuppressed"); } } } AvoidUninstantiatedInternalClassesTest.cs0000664000175000017500000002174312413742070036524 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for AvoidUninstantiatedInternalClassesRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // Copyright (C) 2008, 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; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Performance; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Performance { #pragma warning disable 169, 414 internal class UninstantiatedInternalClass { public void display () { } public static void Main (string [] args) { } } internal class InstantiatedInternalClass { public void display () { } public static void Main (string [] args) { InstantiatedInternalClass i = new InstantiatedInternalClass (); i.display (); } } internal class NestedInternalUninstantiatedClass { public class NestedClass { public void display () { } } } internal class NestedInternalInstantiatedClass { public class NestedClass { public static void Main (string [] args) { NestedInternalInstantiatedClass n = new NestedInternalInstantiatedClass (); } } } public class NonInternalClassNotInstantiated { public void display () { } } internal struct InternalUninstantiatedStruct { public void display () { } public static void Main (string [] args) { } } internal struct InternalInstantiatedStruct { public void display () { } public static void Main (string [] args) { InternalInstantiatedStruct i = new InternalInstantiatedStruct (); i.display (); } } // people may use the following two patterns to have // static classes in C# 1. internal sealed class InternalSealedClassWithPrivateCtor { private InternalSealedClassWithPrivateCtor () { } public static void Foo () { } } internal abstract class InternalAbstractClassWithPrivateCtor { private InternalAbstractClassWithPrivateCtor () { } public static void Bar () { } } public static class StaticClass { public static void display () { } } // note: we now consider this valid for this rule (it should be flagged that display isn't used by anyone elsewhere) internal class MethodContainingObjectCallIsNotCalled { public void display () { MethodContainingObjectCallIsNotCalled n = new MethodContainingObjectCallIsNotCalled (); } } internal interface IFace { void display (); } public class NestedEnumReturnInstantiated { private enum PrivateEnum { Good, Bad, Unsure } private static PrivateEnum GetMe () { return PrivateEnum.Good; } } public class NestedEnumUsingInstantiated { private enum PrivateEnum { Good, Bad, Unsure } private static bool GetMe () { PrivateEnum pe = PrivateEnum.Bad; return (pe == PrivateEnum.Good); } } public class NestedEnumExternInstantiated { private enum PrivateEnum { Good, Bad, Unsure } [DllImport ("outofhere.dll")] private static extern PrivateEnum GetMe (); } public class NestedEnumExternOutInstantiated { private enum PrivateEnum { Good, Bad, Unsure } [DllImport ("outofhere.dll")] private static extern void GetMe (out PrivateEnum me); } public class NestedEnumNotInstantiated { private enum PrivateEnum { Good, Bad, Unsure } } public class NestedEnumUsedAsParameter { private enum PrivateEnum { Good, Bad, Unsure } private bool Get (PrivateEnum p) { return false; } } public class NestedConstValue { public class Strings { public const string Hello = "Allo"; } } public class ClassWithDelegate { delegate void MyOwnDelegate (int x); } public abstract class ClassWithArray { private class ExistAsArrayOnly { int value; } private ExistAsArrayOnly [] Get () { return null; } } internal class Item { T item; public Item () { } public Item (T item) { this.item = item; } public T GetItem () { return item; } } internal class Items { T item1; V item2; public Items (T item1, V item2) { this.item1 = item1; this.item2 = item2; } } [TestFixture] public class AvoidUninstantiatedInternalClassesTest : TypeRuleTestFixture { private AssemblyDefinition assembly; [TestFixtureSetUp] public void FixtureSetUp () { string unit = Assembly.GetExecutingAssembly ().Location; assembly = AssemblyDefinition.ReadAssembly (unit); } private TypeDefinition GetTest (string name) { string fullname = "Test.Rules.Performance." + name; return assembly.MainModule.GetType (fullname); } [Test] public void UninstantiatedInternalClassTest () { AssertRuleFailure (1); } [Test] public void InstantiatedInternalClassTest () { AssertRuleSuccess (); } [Test] public void NestedInternalUninstantiatedClassTest () { AssertRuleFailure (1); } [Test] public void NestedInternalInstantiatedClassTest () { AssertRuleSuccess (); } [Test] public void NonInternalClassNotInstantiatedTest () { AssertRuleDoesNotApply (); } [Test] public void InternalInstantiatedStructTest () { AssertRuleSuccess (); } [Test] public void InternalUninstantiatedStructTest () { AssertRuleFailure (); } [Test] public void InternalSealedClassWithPrivateCtor () { AssertRuleDoesNotApply (); } [Test] public void InternalAbstractClassWithPrivateCtorTest () { AssertRuleDoesNotApply (); } [Test] public void StaticClassTest () { AssertRuleDoesNotApply (GetTest ("StaticClass")); } [Test] public void MethodContainingObjectCallIsNotCalledTest () { AssertRuleSuccess (); } [Test] public void IFaceTest () { AssertRuleDoesNotApply (); } [Test] public void NestedEnumReturnInstantiated () { AssertRuleSuccess (GetTest ("NestedEnumReturnInstantiated/PrivateEnum")); } [Test] public void NestedEnumUsingInstantiated () { AssertRuleSuccess (GetTest ("NestedEnumUsingInstantiated/PrivateEnum")); } [Test] public void NestedEnumExternInstantiated () { AssertRuleSuccess (GetTest ("NestedEnumExternInstantiated/PrivateEnum")); } [Test] public void NestedEnumExternOutInstantiated () { AssertRuleSuccess (GetTest ("NestedEnumExternOutInstantiated/PrivateEnum")); } [Test] public void NestedEnumNotInstantiated () { AssertRuleFailure (GetTest ("NestedEnumNotInstantiated/PrivateEnum"), 1); } [Test] public void NestedEnumUsedAsParameter () { AssertRuleSuccess (GetTest ("NestedEnumUsedAsParameter/PrivateEnum")); } [Test] public void StructExistAsArrayOnly () { AssertRuleSuccess (GetTest ("ClassWithArray/ExistAsArrayOnly")); } [Test] public void Generics_ItemT () { Item item = new Item (1); // used just above AssertRuleSuccess > (); AssertRuleFailure> (1); } [Test] public void EntryPoint () { MethodDefinition main = DefinitionLoader.GetMethodDefinition ("Main"); try { main.DeclaringType.Module.Assembly.EntryPoint = main; AssertRuleSuccess (main.DeclaringType.Resolve ()); } finally { main.DeclaringType.Module.Assembly.EntryPoint = null; } } /// This namespace contains the command-line options processing library distributed by the mono team. internal sealed class NamespaceDoc { } [Test] public void MonoDoc () { AssertRuleDoesNotApply (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/EmptyDestructorTest.cs0000664000175000017500000000534112413742070032764 0ustar00directhexdirecthex00000000000000// // Unit tests for RemoveUnneededFinalizerRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-2006, 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class RemoveUnneededFinalizerTest : TypeRuleTestFixture { class NoDestructorClass { } [Test] public void NoDestructor () { AssertRuleDoesNotApply (); } class EmptyDestructorClass { ~EmptyDestructorClass () { } } [Test] public void EmptyDestructor () { AssertRuleFailure (1); } class DestructorClass { IntPtr ptr; public DestructorClass () { ptr = (IntPtr) 1; } public IntPtr Handle { get { return ptr; } } ~DestructorClass () { ptr = IntPtr.Zero; } } [Test] public void Destructor () { AssertRuleSuccess (); } class NullifyFieldClass : DestructorClass { object field; ~NullifyFieldClass () { field = null; } } [Test] public void NullifyField () { AssertRuleFailure (1); } class SettingFieldClass : DestructorClass { object field; ~SettingFieldClass () { field = this; } } class DelegatedCleanupClass : DestructorClass { object field; ~DelegatedCleanupClass () { Cleanup (); } void Cleanup () { field = null; } } [Test] public void MoreCoverage () { AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/ImplementEqualsTypeTest.cs0000664000175000017500000001505712413742070033563 0ustar00directhexdirecthex00000000000000// // Unit tests for ImplementEqualsTypeRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Performance { [TestFixture] public class ImplementEqualsTypeTest : TypeRuleTestFixture { [Test] public void Enum () { // rule does not apply to enums AssertRuleDoesNotApply (SimpleTypes.Enum); // nor delegates AssertRuleDoesNotApply (SimpleTypes.Delegate); // or generated code AssertRuleDoesNotApply (SimpleTypes.GeneratedType); } public struct StructWithoutEqualsObject { int i; } public struct StructWithEqualsObject { public override bool Equals (object obj) { return base.Equals (obj); } // only to avoid compiler warnings - not part of the rule/test public override int GetHashCode () { return base.GetHashCode (); } } public struct StructWithEqualsType { public bool Equals (StructWithEqualsType type) { return Equals (type); } } public struct StructWithBothEquals { public override bool Equals (object obj) { return base.Equals (obj); } public bool Equals (StructWithBothEquals type) { return Equals (type); } // only to avoid compiler warnings - not part of the rule/test public override int GetHashCode () { return base.GetHashCode (); } } public struct EquatableStructWithBothEquals : IEquatable { public override bool Equals (object obj) { return base.Equals (obj); } // only to avoid compiler warnings - not part of the rule/test public override int GetHashCode () { return base.GetHashCode (); } public bool Equals (EquatableStructWithBothEquals other) { return Equals (other); } } [Test] public void Structure () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleSuccess (); } public class ClassWithoutEqualsObject { int i; } public class ClassWithEqualsObject { public override bool Equals (object obj) { return base.Equals (obj); } // only to avoid compiler warnings - not part of the rule/test public override int GetHashCode () { return base.GetHashCode (); } } public class ClassWithEqualsType { public bool Equals (ClassWithEqualsType type) { return Equals (type); } } public class ClassWithBothEquals { public override bool Equals (object obj) { return base.Equals (obj); } public bool Equals (ClassWithBothEquals type) { return Equals (type); } // only to avoid compiler warnings - not part of the rule/test public override int GetHashCode () { return base.GetHashCode (); } } public class EquatableClassWithBothEquals : IEquatable { public override bool Equals (object obj) { return base.Equals (obj); } public bool Equals (EquatableClassWithBothEquals type) { return Equals (type); } // only to avoid compiler warnings - not part of the rule/test public override int GetHashCode () { return base.GetHashCode (); } } [Test] public void Class () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleSuccess (); } public interface InterfaceWithoutEqualsObject { int GetHashCode (); } public interface InterfaceWithEqualsObject { bool Equals (object obj); } public interface InterfaceWithEqualsType { bool Equals (InterfaceWithEqualsType type); } public interface InterfaceWithBothEquals { bool Equals (object obj); bool Equals (InterfaceWithBothEquals type); } public interface EquatableInterfaceWithBothEquals : IEquatable { bool Equals (object obj); } [Test] public void Interface () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleFailure (1); AssertRuleFailure (1); AssertRuleSuccess (); } public class BadGeneric { public override bool Equals (object obj) { return base.Equals (obj); } public override int GetHashCode () { return base.GetHashCode (); } } public class Generic { public override bool Equals (object obj) { return base.Equals (obj); } public override int GetHashCode () { return base.GetHashCode (); } public bool Equals (Generic other) { return true; } } public class EquatableGeneric : IEquatable> { public override bool Equals (object obj) { return base.Equals (obj); } public override int GetHashCode () { return base.GetHashCode (); } public bool Equals (EquatableGeneric other) { return true; } } [Test] public void Generics () { AssertRuleFailure> (1); AssertRuleFailure> (1); AssertRuleSuccess> (); } } } AvoidUnsealedUninheritedInternalClassesTest.cs0000664000175000017500000000474712413742070037476 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for AvoidUnsealedUninheritedInternalClassesRule // // Authors: // Scott Peterson // // Copyright (C) 2008 Scott Peterson // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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 Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Performance { public class Visible { } public class Outer { internal class UnsealedInner { } internal sealed class SealedInner { } } internal abstract class Abstract { } internal class Concrete : Abstract { } internal class Base : Abstract { } internal sealed class Final : Base { } internal sealed class Sealed { } internal class Unsealed { } [TestFixture] public class AvoidUnsealedUninheritedInternalTypeTest : TypeRuleTestFixture{ [Test] public void TestVisable () { AssertRuleSuccess (); } [Test] public void TestUnsealedInner () { AssertRuleFailure (1); } [Test] public void TestSealedInner () { AssertRuleSuccess (); } [Test] public void TestAbstract () { AssertRuleSuccess (); } [Test] public void TestConcrete () { AssertRuleFailure (1); AssertRuleSuccess (); } [Test] public void TestSealed () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void TestUnsealed () { AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/OverrideValueTypeDefaultsTest.cs0000664000175000017500000000721112413742070034713 0ustar00directhexdirecthex00000000000000// // Unit tests for OverrideValueTypeDefaultsRule // // Authors: // Sebastien Pouliot // // 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 Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Performance { [TestFixture] public class OverrideValueTypeDefaultsTest : TypeRuleTestFixture { [Test] public void Class () { // rule does not apply to class AssertRuleDoesNotApply (); } [Test] public void Enum () { // rule does not apply to enums AssertRuleDoesNotApply (SimpleTypes.Enum); } [Test] public void Interface () { // rule does not apply to interface AssertRuleDoesNotApply (SimpleTypes.Interface); } public struct EmptyStruct { } public struct PublicStruct { int i; } protected struct ProtectedStruct { object obj; } private struct PrivateStruct { EmptyStruct empty; object obj; } internal struct InternalStruct { string s; } public struct EqualsOnly { public override bool Equals (object obj) { return base.Equals (obj); } } public struct GetHashCodeOnly { public override int GetHashCode () { return base.GetHashCode (); } } public struct OverridesOnly { public override bool Equals (object obj) { return base.Equals (obj); } public override int GetHashCode () { return base.GetHashCode (); } } public struct OperatorsOnly { public static bool operator== (OperatorsOnly left, OperatorsOnly right) { return left.Equals (right); } public static bool operator != (OperatorsOnly left, OperatorsOnly right) { return !left.Equals (right); } } public struct Ok { public override bool Equals (object obj) { return base.Equals (obj); } public override int GetHashCode () { return base.GetHashCode (); } public static bool operator == (Ok left, Ok right) { return left.Equals (right); } public static bool operator != (Ok left, Ok right) { return !left.Equals (right); } } [Test] public void Structure () { AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleFailure (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/Tests.Rules.Performance.csproj0000775000175000017500000002025412413742070034300 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {0C697291-D955-43C8-994E-A03B6A77A21A} Library Properties Tests.Rules.Performance Tests.Rules.Performance 3.5 true v4.0 http://localhost/Tests.Rules.Performance/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full true bin\Debug\ TRACE;DEBUG;CODE_ANALYSIS prompt 4 true AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 true AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6} Gendarme.Rules.Performance False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceTest.cs0000664000175000017500000001076012413742070044456 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceRule // // Authors: // Julien Hoarau // // Copyright (C) 2010 Julien Hoarau // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; namespace Tests.Rules.Performance { [TestFixture] public class PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceTest : MethodRuleTestFixture { private class TestCase { private void MethodWithoutParameters () { } private void MethodWithInterfaceOfBaseTypeParameter (IComparable comparable) { } private void MethodWithGenericInterfaceOfBaseTypeParameter (IComparable comparable) { } private void MethodWithGenericInterfaceOfBaseTypeParameter2a (IComparable comparable) { } private void MethodWithGenericInterfaceOfBaseTypeParameter2b (IComparable comparable) { } private void MethodWithGenericInterfaceOfBaseTypeParameter2c (IComparable comparable) { } private void MethodWithInterfaceParameter (IDisposable disposable) { } private void MethodWithMultipleParameters (IDisposable disposable, IConvertible convertible) { } private void GenericMethodWithMultipleParameters (IDisposable disposable, T convertible) where T : IConvertible { } private void MethodWithInterfaceConstraintOnGeneric (T comparable) where T : IComparable { } private void MethodWithInterfaceConstraintOnGeneric2 (TComparable comparable) where TComparable : IComparable { } private void MethodWithInterfaceConstraintOnGeneric3 (TComparable comparable) where TComparable : IComparable { } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("MethodWithoutParameters"); } [Test] public void MethodWithInterfaceOfBaseTypeParameter () { AssertRuleFailure ("MethodWithInterfaceOfBaseTypeParameter", 1); } [Test] public void MethodWithGenericInterfaceOfBaseTypeParameter () { AssertRuleFailure ("MethodWithGenericInterfaceOfBaseTypeParameter", 1); } [Test] public void MethodWithGenericInterfaceOfBaseTypeParameter2 () { AssertRuleFailure ("MethodWithGenericInterfaceOfBaseTypeParameter2a", 1); AssertRuleFailure ("MethodWithGenericInterfaceOfBaseTypeParameter2b", 1); AssertRuleSuccess ("MethodWithGenericInterfaceOfBaseTypeParameter2c"); } [Test] public void MethodWithMultipleParameters () { AssertRuleFailure ("MethodWithMultipleParameters", 1); } [Test] public void MethodWithInterfaceParameter () { AssertRuleSuccess ("MethodWithInterfaceParameter"); } [Test] public void MethodWithInterfaceConstraintOnGeneric () { AssertRuleSuccess ("MethodWithInterfaceConstraintOnGeneric"); } [Test] public void MethodWithInterfaceConstraintOnGeneric2 () { AssertRuleSuccess ("MethodWithInterfaceConstraintOnGeneric2"); } [Test] public void MethodWithInterfaceConstraintOnGeneric3 () { AssertRuleSuccess ("MethodWithInterfaceConstraintOnGeneric3"); } [Test] public void GenericMethodWithMultipleParameters () { AssertRuleSuccess ("GenericMethodWithMultipleParameters"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/UseTypeEmptyTypesTest.cs0000664000175000017500000000545012413742070033252 0ustar00directhexdirecthex00000000000000// // Unit tests for UseTypeEmptyTypesRule // // Authors: // Jb Evain // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class UseTypeEmptyTypesTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no newarr AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public class TestCase { Type [] empty = new Type [0]; public bool CreateEmptyTypeArray () { Type [] array = new Type [0]; return (array == null); } public bool CreateNotEmptyTypeArray () { Type [] array = new Type [42]; return (array == null); } public byte [] CreateEmptyNonTypeArray () { return new byte [0]; } public bool CreateUnknownSizedTypeArray (int x) { Type [] array = new Type [x]; return (array == null); } } [Test] public void CreateEmptyTypeArray () { AssertRuleFailure ("CreateEmptyTypeArray"); } [Test] public void CreateEmptyTypeArrayInCtor () { AssertRuleFailure (".ctor"); } [Test] public void CreateNotEmptyTypeArray () { AssertRuleSuccess ("CreateNotEmptyTypeArray"); } [Test] public void CreateEmptyNonTypeArray () { AssertRuleSuccess ("CreateEmptyNonTypeArray"); } [Test] public void CreateUnknownSizedTypeArray () { // no Ldc_I4[_S|_0] AssertRuleDoesNotApply ("CreateUnknownSizedTypeArray"); } } } AvoidLargeNumberOfLocalVariablesTest.cs0000664000175000017500000001252212413742070036006 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for AvoidLargeNumberOfLocalVariablesRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace System.Windows.Forms { public class Form { public void InitializeComponent () { } } } namespace Test.Rules.Performance { [TestFixture] public class AvoidLargeNumberOfLocalVariablesTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply ("InitializeComponent"); } private void SmallMethod (int a) { int x = a * a - a; Console.WriteLine (x * x); } [Test] public void Small () { AssertRuleSuccess ("SmallMethod"); AssertRuleSuccess ("WriteLine"); } private void LargeMethod () { byte b1 = 1, b2 = 2, b3 = 3, b4 = 4, b5 = 5, b6 = 6, b7 = 7, b8 = 8; sbyte sb1 = 1, sb2 = 2, sb3 = 3, sb4 = 4, sb5 = 5, sb6 = 6, sb7 = 7, sb8 = 8; short s1 = 1, s2 = 2, s3 = 3, s4 = 4, s5 = 5, s6 = 6, s7 = 7, s8 = 8; ushort us1 = 1, us2 = 2, us3 = 3, us4 = 4, us5 = 5, us6 = 6, us7 = 7, us8 = 8; int i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5, i6 = 6, i7 = 7, i8 = 8; uint ui1 = 1, ui2 = 2, ui3 = 3, ui4 = 4, ui5 = 5, ui6 = 6, ui7 = 7, ui8 = 8; long l1 = 1, l2 = 2, l3 = 3, l4 = 4, l5 = 5, l6 = 6, l7 = 7, l8 = 8; ulong ul1 = 1, ul2 = 2, ul3 = 3, ul4 = 4, ul5 = 5, ul6 = 6, ul7 = 7, ul8 = 8; WriteLine (b1, sb1, s1, us1, i1, ui1, l1, ul1); WriteLine (b2, sb2, s2, us2, i2, ui2, l2, ul2); WriteLine (b3, sb3, s3, us3, i3, ui3, l3, ul3); WriteLine (b4, sb4, s4, us4, i4, ui4, l4, ul4); WriteLine (b5, sb5, s5, us5, i5, ui5, l5, ul5); WriteLine (b6, sb6, s6, us6, i6, ui6, l6, ul6); WriteLine (b7, sb7, s7, us7, i7, ui7, l7, ul7); WriteLine (b8, sb8, s8, us8, i8, ui8, l8, ul8); } // CSC creates an array 64 user variables + 1 compiler variable for the array (CWL) // so we need to move the CWL elsewhere for the test private void WriteLine (byte b, sbyte sb, short s, ushort us, int i, uint ui, long l, ulong ul) { Console.WriteLine ("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}", b, sb, s, us, i, ui, l, ul); } [Test] public void Large () { // 64 variables AssertRuleSuccess ("LargeMethod"); } private void TooLargeMethod () { byte b1 = 1, b2 = 2, b3 = 3, b4 = 4, b5 = 5, b6 = 6, b7 = 7, b8 = 8; sbyte sb1 = 1, sb2 = 2, sb3 = 3, sb4 = 4, sb5 = 5, sb6 = 6, sb7 = 7, sb8 = 8; short s1 = 1, s2 = 2, s3 = 3, s4 = 4, s5 = 5, s6 = 6, s7 = 7, s8 = 8; ushort us1 = 1, us2 = 2, us3 = 3, us4 = 4, us5 = 5, us6 = 6, us7 = 7, us8 = 8; int i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5, i6 = 6, i7 = 7, i8 = 8; uint ui1 = 1, ui2 = 2, ui3 = 3, ui4 = 4, ui5 = 5, ui6 = 6, ui7 = 7, ui8 = 8; long l1 = 1, l2 = 2, l3 = 3, l4 = 4, l5 = 5, l6 = 6, l7 = 7, l8 = 8; ulong ul1 = 1, ul2 = 2, ul3 = 3, ul4 = 4, ul5 = 5, ul6 = 6, ul7 = 7, ul8 = 8; string template = "{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}"; Console.WriteLine (template, b1, sb1, s1, us1, i1, ui1, l1, ul1); Console.WriteLine (template, b2, sb2, s2, us2, i2, ui2, l2, ul2); Console.WriteLine (template, b3, sb3, s3, us3, i3, ui3, l3, ul3); Console.WriteLine (template, b4, sb4, s4, us4, i4, ui4, l4, ul4); Console.WriteLine (template, b5, sb5, s5, us5, i5, ui5, l5, ul5); Console.WriteLine (template, b6, sb6, s6, us6, i6, ui6, l6, ul6); Console.WriteLine (template, b7, sb7, s7, us7, i7, ui7, l7, ul7); Console.WriteLine (template, b8, sb8, s8, us8, i8, ui8, l8, ul8); } [Test] public void TooLarge () { // 65 variables ([g]mcs) and 66 variables (one temp for CSC) AssertRuleFailure ("TooLargeMethod", 1); } [Test] public void SmallMaximum () { int max = Rule.MaximumVariables; try { Rule.MaximumVariables = 1; AssertRuleSuccess ("SmallMethod"); AssertRuleFailure ("LargeMethod", 1); } finally { Rule.MaximumVariables = max; } } } } IDisposableWithDestructorWithoutSuppressFinalizeTest.cs0000664000175000017500000001377112413742070041462 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for UseSuppressFinalizeOnIDisposableTypeWithFinalizerRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-2006,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; using System.Runtime.InteropServices; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class UseSuppressFinalizeOnIDisposableTypeWithFinalizerTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } class NoDestructorClass { } [Test] public void NoDestructor () { AssertRuleDoesNotApply (); } class DestructorClass { IntPtr ptr; public DestructorClass () { ptr = (IntPtr) 1; } public IntPtr Handle { get { return ptr; } } ~DestructorClass () { ptr = IntPtr.Zero; } } [Test] public void Destructor () { AssertRuleDoesNotApply (); } class IDisposableNoDestructorWithoutSuppressFinalizeClass: IDisposable { public void Dispose () { } } [Test] public void IDisposableNoDestructorWithoutSuppressFinalize () { AssertRuleDoesNotApply (); } class IDisposableNoDestructorWithSuppressFinalizeClass: IDisposable { public void Dispose () { GC.SuppressFinalize (this); } } [Test] public void IDisposableNoDestructorWithSuppressFinalize () { AssertRuleDoesNotApply (); } class IDisposableDestructorWithoutSuppressFinalizeClass: IDisposable { ~IDisposableDestructorWithoutSuppressFinalizeClass () { } public void Dispose () { } } [Test] public void IDisposableDestructorWithoutSuppressFinalize () { AssertRuleFailure (1); } class IDisposableDestructorWithSuppressFinalizeClass: IDisposable { ~IDisposableDestructorWithSuppressFinalizeClass () { } public void Dispose () { GC.SuppressFinalize (this); } } [Test] public void IDisposableDestructorWithSuppressFinalize () { AssertRuleSuccess (); } class ExplicitIDisposableDestructorWithoutSuppressFinalizeClass: IDisposable { ~ExplicitIDisposableDestructorWithoutSuppressFinalizeClass () { } void IDisposable.Dispose () { } } [Test] public void ExplicitIDisposableDestructorWithoutSuppressFinalize () { AssertRuleFailure (1); } class ExplicitIDisposableDestructorWithSuppressFinalizeClass: IDisposable { ~ExplicitIDisposableDestructorWithSuppressFinalizeClass () { } void IDisposable.Dispose () { GC.SuppressFinalize (this); } } [Test] public void ExplicitIDisposableDestructorWithSuppressFinalize () { AssertRuleSuccess (); } class BothIDisposableDestructorWithoutSuppressFinalizeClass : IDisposable { ~BothIDisposableDestructorWithoutSuppressFinalizeClass () { } void IDisposable.Dispose () { } public void Dispose () { } } [Test] public void BothIDisposableDestructorWithoutSuppressFinalize () { AssertRuleFailure (2); } class IndirectClass : IDisposable { ~IndirectClass () { } void IDisposable.Dispose () { Dispose (); } public void Dispose () { ReallyDispose (); } void ReallyDispose () { GC.SuppressFinalize (this); } } [Test] public void Indirect () { AssertRuleSuccess (); } class IndirectDeepClass : IDisposable { ~IndirectDeepClass () { } void IDisposable.Dispose () { Dispose (); } public void Dispose () { AskForDisposal (); } void AskForDisposal () { CouldDispose (); } void CouldDispose () { ReallyDispose (); } void ReallyDispose () { GC.SuppressFinalize (this); } } [Test] public void IndirectDeep () { // one level too deep for the explicit Dispose method AssertRuleFailure (1); } abstract class AbstractClass : IDisposable { ~AbstractClass () { } abstract public void Dispose (); } [Test] public void Abstract () { AssertRuleSuccess (); } class PInvokeClass : IDisposable { ~PInvokeClass () { } public void Dispose () { UnmanagedDispose (); } [DllImport ("liberty.so")] static extern void UnmanagedDispose (); } [Test] public void PInvoke () { AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/PreferLiteralOverInitOnlyFieldsTest.cs0000664000175000017500000001117212413742070036017 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferLiteralOverInitOnlyFieldsRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Performance { [TestFixture] public class PreferLiteralOverInitOnlyFieldsTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Delegate); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); } public class ClassWithConstants { public const sbyte one = 1; public const short two = 2; public const int three = 3; public const long four = 4; public const float five = 5.0f; public const double six = 6.0d; public const string seven = "7"; } public struct StructureWithConstants { const byte one = 1; const ushort two = 2; const uint three = 3; const ulong four = 4; const float five = 5.0f; const double six = 6.0d; const string seven = "7"; } [Test] public void NoStaticConstructor () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } public class ClassWithStatics { public static sbyte one = 1; public static short two = 2; public static int three = 3; public static long four = 4; public static float five = 5.0f; public static double six = 6.0d; public static string seven = "7"; } public struct StructureWithStatics { public static byte one = 1; public static ushort two = 2; public static uint three = 3; public static ulong four = 4; public static float five = 5.0f; public static double six = 6.0d; public static string seven = "7"; } [Test] public void NotReadOnly () { AssertRuleSuccess (); AssertRuleSuccess (); } public class ClassWithReadOnly { static readonly sbyte one = 1; static readonly short two = 2; static readonly int three = 3; static readonly long four = 4; static readonly float five = 5.0f; static readonly double six = 6.0d; static readonly string seven = "7"; } public struct StructureWithReadOnly { public static readonly byte one = 1; public static readonly ushort two = 2; public static readonly uint three = 3; public static readonly ulong four = 4; public static readonly float five = 5.0f; public static readonly double six = 6.0d; public static readonly string seven = "7"; } [Test] public void ReadOnly () { AssertRuleFailure (7); AssertRuleFailure (7); } class ClassWithNoStaticField { static ClassWithNoStaticField () { Console.WriteLine (ClassWithConstants.one); } } struct SructureWithNoStaticField { static SructureWithNoStaticField () { Console.WriteLine (StructureWithReadOnly.one); } } [Test] public void NoStaticField () { AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } class ClassSettingOutsideField { static ClassSettingOutsideField () { ClassWithStatics.one = -1; } } struct StructureSettingOutsideField { static StructureSettingOutsideField () { StructureWithStatics.one = 1; } } [Test] public void SettingOutsideField () { AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/MathMinMaxCandidateTest.cs0000664000175000017500000001676512413742070033423 0ustar00directhexdirecthex00000000000000// // Unit tests for MathMinMaxCandidateTest // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Performance { [TestFixture] public class MathMinMaxCandidateTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no greater or lesser than AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } // Decimal is not a primitive type Decimal DecimalMinWithMax (Decimal d) { return (d < Decimal.MaxValue) ? d : Decimal.MaxValue; } static Decimal DecimalMaxWithMinusOne (Decimal d) { return (d >= Decimal.MinusOne) ? d : Decimal.MinusOne; } [Test] public void DecimalNotInlined () { AssertRuleDoesNotApply ("DecimalMinWithMax"); AssertRuleDoesNotApply ("DecimalMaxWithMinusOne"); } byte a, b; int ManualIntMinMethod (int a, int b) { return (a > b) ? b : a; } ulong ManualULongMaxMethod (ulong a, ulong b) { return (a > b) ? a : b; } long ManualLongMinMethod (long a, long b) { return (a >= b) ? b : a; } uint ManualUIntMaxMethod (uint a, uint b) { return (a >= b) ? a : b; } [Test] public void MathMinMaxOverloaded () { AssertRuleFailure ("ManualIntMinMethod"); AssertRuleFailure ("ManualUIntMaxMethod"); AssertRuleFailure ("ManualLongMinMethod"); AssertRuleFailure ("ManualULongMaxMethod"); AssertRuleFailure ("UsingCustomMinWithByteFields"); } private float f; float MinWithValue { get { return f; } set { if (f < value) f = value; } } private double d; double MaxWithValue { get { return d; } set { if (d >= value) d = value; } } [Test] public void Half () { AssertRuleSuccess ("set_MinWithValue"); AssertRuleSuccess ("set_MaxWithValue"); } // removes compiler warning (and create test case) void SetFields (byte a, byte b) { this.a = a; this.b = b; selection_start = Math.Min (a, b); index = Math.Max (b, a); large_change = Math.Min (b, a); maximum = Math.Max (a, b); } [Test] public void UsingMathMinMax () { AssertRuleDoesNotApply ("SetFields"); } void UsingCustomMinWithByteFields () { byte c = 0; if (a > b) { c = b; } else { c = a; } Console.WriteLine (c); } private int selection_start; private int index; private void DoMoreStuffInsideCondition () { if (index >= selection_start) { Start = selection_start; End = index; } else { Start = index; End = selection_start; } } // from mcs/class/System/System.Net/CookieContainer.cs public int Capacity { get { return End; } set { if (value < 0 || (value < End && End != Int32.MaxValue)) throw new ArgumentOutOfRangeException ("value"); if (value < Start) Start = value; End = value; } } [Test] public void LookAlike () { AssertRuleSuccess ("DoMoreStuffInsideCondition"); AssertRuleSuccess ("set_Capacity"); } int ManualMixedMin (char a, int b) { return (a >= b) ? a : b; } char ManualCharMax (char a, char b) { return (a >= b) ? a : b; } [Test] public void NonOverloadedTypes () { AssertRuleSuccess ("ManualMixedMin"); AssertRuleSuccess ("ManualCharMax"); } // from mcs/class/Managed.Windows.Forms/System.Windows.Forms.Theming/Default/CheckBoxPainter.cs private int Clamp (int value, int lower, int upper) { if (value < lower) return lower; else if (value > upper) return upper; else return value; } [Test] public void ClampValue () { AssertRuleFailure ("Clamp"); } // from mcs/class/System/System.Text.RegularExpressions/compiler.cs private int Start; private int End; public int Length { get { return Start < End ? End - Start : Start - End; } } [Test] public void OperationsAfterBranch_BothSize () { AssertRuleSuccess ("get_Length"); } // from mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollBar.cs private int large_change; private int maximum; public int LargeChange { get { if (large_change > maximum) return (maximum + 1); else return large_change; } } [Test] public void OperationsAfterBranch_OneSize () { AssertRuleSuccess ("get_LargeChange"); } void MinOut (short a, short b, out short c) { c = (a > b) ? b : a; } void MaxRef (ref ushort a, ushort b) { a = (a > b) ? a : b; } void Out (out int a) { a = (this.a > b) ? Start : End; } void Ref (ref int b) { b = (a < b) ? End : Start; } [Test] public void SpecialParameters () { AssertRuleFailure ("MinOut"); AssertRuleFailure ("MaxRef"); AssertRuleSuccess ("Out"); AssertRuleSuccess ("Ref"); } sbyte MinArray (sbyte [] array) { // small index (specialized opcodes) return (array [0] <= array [1]) ? array [0] : array [1]; } void MaxArray (ulong [] array) { // large index (general opcodes) array [12] = (array [10] >= array [11]) ? array [10] : array [11]; } uint Array (uint [] array) { return (array [0] >= array [1]) ? array [2] : array [3]; } [Test] [Ignore ("Rule does not consider arrays - need tests to see if the JIT does better than manual inlining")] public void Arrays () { AssertRuleSuccess ("Array"); AssertRuleFailure ("MinArray"); AssertRuleFailure ("MaxArray"); } static double Minimum (double d, float f) { return (d < f) ? d : f; } static double Maximum (double d, float f) { return (d >= f) ? f : d; } [Test] public void Static () { AssertRuleFailure ("Minimum"); AssertRuleFailure ("Maximum"); } } } ConsiderCustomAccessorsForNonVisibleEventsTest.cs0000664000175000017500000001731312413742070040166 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for ConsiderCustomAccessorsForNonVisibleEventsRule // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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; using System.ComponentModel; using Mono.Cecil; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Performance { [TestFixture] public class ConsiderCustomAccessorsForNonVisibleEventsTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Structure); AssertRuleDoesNotApply (); } public class TestEventArgs : EventArgs { } public class PublicDefaultType { // visible, ok to let the compiler make them synchronized public event EventHandler Public; protected event EventHandler Protected; // non-visible, warn as it would be better to have them without a lock internal event EventHandler Internal; private event EventHandler Private; } public class PublicManualType { // visible, ok to let the compiler make them synchronized public event EventHandler Public; protected event EventHandler Protected; // non-visible, ok they are lock-free EventHandlerList events = new EventHandlerList (); static object InternalEvent = new object (); internal event EventHandler Internal { add { events.AddHandler (InternalEvent, value); } remove { events.RemoveHandler (InternalEvent, value); } } static object PrivateEvent = new object (); private event EventHandler Private { add { events.AddHandler (PrivateEvent, value); } remove { events.RemoveHandler (PrivateEvent, value); } } } protected class ProtectedDefaultType { // visible, ok to let the compiler make them synchronized public event EventHandler Public; protected event EventHandler Protected; internal event EventHandler Internal; private event EventHandler Private; } public class ProtectedManualType { // visible, ok to let the compiler make them synchronized public event EventHandler Public; protected event EventHandler Protected; // non-visible, ok they are lock-free EventHandlerList events = new EventHandlerList (); static object InternalEvent = new object (); internal event EventHandler Internal { add { events.AddHandler (InternalEvent, value); } remove { events.RemoveHandler (InternalEvent, value); } } static object PrivateEvent = new object (); private event EventHandler Private { add { events.AddHandler (PrivateEvent, value); } remove { events.RemoveHandler (PrivateEvent, value); } } } // type is private still it could be publicly visible (e.g. thru an interface) private class PrivateDefaultType { // visible, ok to let the compiler make them synchronized public event EventHandler Public; protected event EventHandler Protected; // non-visible, warn as it would be better to have them without a lock internal event EventHandler Internal; private event EventHandler Private; } // type is private still it could be publicly visible (e.g. thru an interface) private class PrivateManualType { // visible, ok to let the compiler make them synchronized public event EventHandler Public; protected event EventHandler Protected; // non-visible, ok they are lock-free EventHandlerList events = new EventHandlerList (); static object InternalEvent = new object (); internal event EventHandler Internal { add { events.AddHandler (InternalEvent, value); } remove { events.RemoveHandler (InternalEvent, value); } } static object PrivateEvent = new object (); private event EventHandler Private { add { events.AddHandler (PrivateEvent, value); } remove { events.RemoveHandler (PrivateEvent, value); } } } // type is internal still it could be publicly visible // (e.g. using an attribute to make it visible to other assemblies) internal class InternalDefaultType { // visible, ok to let the compiler make them synchronized public event EventHandler Public; protected event EventHandler Protected; // non-visible, warn as it would be better to have them without a lock internal event EventHandler Internal; private event EventHandler Private; } // type is internal still it could be publicly visible // (e.g. using an attribute to make it visible to other assemblies) internal class InternalManualType { // visible, ok to let the compiler make them synchronized public event EventHandler Public; protected event EventHandler Protected; // non-visible, ok they are lock-free EventHandlerList events = new EventHandlerList (); static object InternalEvent = new object (); internal event EventHandler Internal { add { events.AddHandler (InternalEvent, value); } remove { events.RemoveHandler (InternalEvent, value); } } static object PrivateEvent = new object (); private event EventHandler Private { add { events.AddHandler (PrivateEvent, value); } remove { events.RemoveHandler (PrivateEvent, value); } } } [Test] public void Visible () { AssertRuleSuccess (); AssertRuleSuccess (); MethodDefinition md = DefinitionLoader.GetMethodDefinition ("add_Public"); if (md.IsSynchronized) { // older CSC (and xMCS) compilers still generate it's own add/remove methods that set the // synchronize flags and we simply ignore them since they are out of the developer's control AssertRuleFailure (2); AssertRuleFailure (2); } } [Test] public void NonVisible () { MethodDefinition md = DefinitionLoader.GetMethodDefinition ("add_Public"); if (!md.IsSynchronized) Assert.Ignore ("newer versions of CSC (e.g. 10.0) does not set the Synchronized"); // older CSC (and xMCS) compilers still generate it's own add/remove methods that set the // synchronize flags and we simply ignore them since they are out of the developer's control AssertRuleFailure (4); AssertRuleFailure (2); AssertRuleFailure (4); AssertRuleFailure (2); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnneededCallsOnStringTest.cs0000664000175000017500000001216112413742070034762 0ustar00directhexdirecthex00000000000000// // Unit test for AvoidUnneededCallsOnStringRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { #pragma warning disable 649 [TestFixture] public class AvoidUnneededCallsOnStringTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public class Item { private string field = ""; private int nonStringField; private static int nonStringStaticField; public string ToStringOnLocalString () { string a = String.Empty; return a.ToString (); } public string ToStringOnParameter (string param) { return param.ToString (); } public static string ToStringOnParameterStatic (string param) { return param.ToString (); } public string ToStringOnStaticField () { return String.Empty.ToString (); } public string ToStringOnField () { return field.ToString (); } public string ToStringOnMethodResult () { return String.Empty.ToLower ().ToString (); } private int ReturnInt () { return 0; } public void ValidToString (int param) { int local = 0; string var = local.ToString (); var = nonStringField.ToString (); var = nonStringStaticField.ToString (); var = param.ToString (); var = ReturnInt ().ToString (); } public string ThisToString () { return this.ToString (); } // ToString(IFormatProvider) public string ToStringIFormatProviderField () { return String.Empty.ToString (null); } private object value; public string ToStringBadParameterType (string format) { return ((int) value).ToString (format); } // Clone public object CloneField () { return String.Empty.Clone (); } public object Clone () { return null; } public object ThisClone () { return this.Clone (); } // Substring public object SubstringZeroField () { return String.Empty.Substring (0); } public object SubstringOneField () { return String.Empty.Substring (1); } public object SubstringIntInt () { return String.Empty.Substring (0, 0); } public string Substring (int n) { return String.Empty; } public void CallSubstring () { Console.WriteLine (Substring (0)); } } [Test] public void TestLocalString () { AssertRuleFailure ("ToStringOnLocalString", 1); } [Test] public void TestParameter () { AssertRuleFailure ("ToStringOnParameter", 1); AssertRuleFailure ("ToStringOnParameterStatic", 1); } [Test] public void TestStaticField () { AssertRuleFailure ("ToStringOnStaticField", 1); } [Test] public void TestField () { AssertRuleFailure ("ToStringOnField", 1); } [Test] public void TestMethodResult () { AssertRuleFailure ("ToStringOnMethodResult", 1); } [Test] public void TestValidToString () { AssertRuleSuccess ("ValidToString"); } [Test] public void ToStringIFormatProvider () { AssertRuleFailure ("ToStringIFormatProviderField", 1); } [Test] public void ToStringOk () { AssertRuleSuccess ("ToStringBadParameterType"); AssertRuleSuccess ("ThisToString"); } [Test] public void Clone () { AssertRuleFailure ("CloneField", 1); } [Test] public void CloneOk () { AssertRuleSuccess ("ThisClone"); } [Test] public void Substring () { AssertRuleFailure ("SubstringZeroField", 1); } [Test] public void SubstringOk () { AssertRuleSuccess ("SubstringOneField"); AssertRuleSuccess ("SubstringIntInt"); AssertRuleSuccess ("CallSubstring"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnnecessaryOverridesTest.cs0000664000175000017500000001124312413742070034752 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidUnnecessaryOverridesRule // // Authors: // N Lum { private class TestBaseClass { ~TestBaseClass () { Console.WriteLine ("the end"); } public string NonVirtualDoSomething (int i) { return i.ToString (); } public virtual string DoSomething (string s) { return s; } public virtual string DoSomething () { return ":D"; } public virtual void DoNothing () { } } abstract class AbstractTestClass : TestBaseClass { ~AbstractTestClass () { Console.WriteLine ("abstract"); } public abstract void DoSomething (int i); public override void DoNothing () { base.DoNothing (); } } private class TestClassGood : TestBaseClass { public override string DoSomething (string s) { return base.DoSomething (); } [STAThread] public override string DoSomething () { return base.DoSomething (); } [FileIOPermission (SecurityAction.Demand)] public override string ToString () { return base.ToString (); } public override bool Equals (object obj) { if (obj == null) return false; else return base.Equals (obj); } } private class TestClassAlsoGood : ApplicationException { public override bool Equals (object obj) { if (obj.GetType () != typeof (TestClassAlsoGood)) return false; return base.Equals (obj); } } private class TestClassBad : TestBaseClass { public override string ToString () { return base.ToString (); } public override string DoSomething (string s) { return base.DoSomething (s); } public override string DoSomething () { return base.DoSomething (); } } private class TestClassAlsoBad : ApplicationException { public override Exception GetBaseException () { return base.GetBaseException (); } } [Test] public void Good () { AssertRuleSuccess ("DoSomething", new Type [] { typeof (string) }); AssertRuleSuccess ("DoSomething", Type.EmptyTypes); AssertRuleSuccess ("Equals"); AssertRuleSuccess ("ToString"); AssertRuleSuccess ("Equals"); } [Test] public void Bad () { AssertRuleFailure ("ToString", 1); AssertRuleFailure ("DoSomething", new Type [] { typeof (string) }, 1); AssertRuleFailure ("DoSomething", Type.EmptyTypes, 1); AssertRuleFailure ("GetBaseException", 1); AssertRuleFailure ("DoNothing", 1); } [Test] public void DoesNotApply () { AssertRuleDoesNotApply ("NonVirtualDoSomething"); AssertRuleDoesNotApply (".ctor"); AssertRuleDoesNotApply (".ctor"); AssertRuleDoesNotApply ("DoSomething"); } public class BaseClass { public virtual string DoSomething (int i) { return i.ToString(); } } public class GoodClass : BaseClass { public string Property { get; set; } public override string DoSomething (int i) { Property = base.DoSomething (i); return Property; } } [Test] public void Bug663492 () { AssertRuleSuccess ("DoSomething"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/GlobalSuppressions.cs0000664000175000017500000000177012413742070032607 0ustar00directhexdirecthex00000000000000// This file is used by Code Analysis to maintain SuppressMessage // attributes that are applied to this project. // Project-level suppressions either have no target or are given // a specific target and scoped to a namespace, type, member, etc. // // To add a suppression to this file, right-click the message in the // Error List, point to "Suppress Message(s)", and click // "In Project Suppression File". // You do not need to add suppressions to this file manually. [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "count", Scope = "member", Target = "Test.Rules.Performance.AvoidUnusedParametersTest+FxCopTest+ReviewUnusedParameters.#GloballySuppressed(System.Int32)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes", Scope = "type", Target = "Test.Rules.Performance.AvoidUnsealedConcreteAttributesTest+FxCopTest+AvoidUnsealedAttributes+GloballySuppressed")] mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidRepetitiveCastsTest.cs0000664000175000017500000002211512413742070033706 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidRepetitiveCastsRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections; using System.Xml; using Gendarme.Rules.Performance; using Mono.Cecil; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { #pragma warning disable 649 [TestFixture] public class AvoidRepetitiveCastsTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } private void UnneededCast_IsInst (ICollection list) { foreach (object o in list) { if (o is ICollection) { UnneededCast_IsInst ((ICollection) o); } } } private void UnneededCast_CastClass (ICollection list) { foreach (object o in list) { if (o is ICollection) { UnneededCast_CastClass (o as ICollection); } } } private void SingleCast (ICollection list) { foreach (object o in list) { ICollection c = (o as ICollection); if (c != null) { SingleCast (c); } } } [Test] public void AvoidUnneededCast () { AssertRuleFailure ("UnneededCast_IsInst", 1); AssertRuleFailure ("UnneededCast_CastClass", 1); AssertRuleSuccess ("SingleCast"); } private void DifferentCastType (ICollection list) { foreach (object o in list) { if (o is IEnumerable) { DifferentCastType (o as ICollection); } } } [Test] public void DifferentCast () { AssertRuleSuccess ("DifferentCastType"); } private void ArrayCast (object [] list) { foreach (object o in list) { if (o is object[]) { ArrayCast (o as object []); } } } private void ArrayElementCast (object [] list) { if (list [0] is string) { Console.WriteLine (list [0] as string); } } /* This rule now checks subscripts to ensure that they match so code like GoodLoadElement2 below no longer fails. However the rule currently is only able to match constant integer subscript expressions. This means the GoodLoadElement2 will no longer be reported as an error. In order to get this to work we'd have to: 1) Compare expressions for equality which probably would not be too hard for simple cases like the one below. 2) Compare locals and arguments used in the expression. This would be pretty difficult and would likely require a custom dataflow analysis routine to do well. private void ArrayElementAsArrayCast (object [] list, int index) { if (list [index * 2 + 1] is object[]) { ArrayElementAsArrayCast (list [index * 2 + 1] as object [], index); } } */ private void ArrayGood (object [] list) { foreach (object o in list) { object[] array = (o as object []); if (array != null) ArrayCast (array); } string s = (list [0] as string); if (s != null) Console.WriteLine (s); } private object [] results; public string PropertyArrayField { get { return ((string) (this.results [0])); } } [Test] public void Arrays () { AssertRuleFailure ("ArrayCast", 1); AssertRuleFailure ("ArrayElementCast", 1); AssertRuleSuccess ("ArrayGood"); AssertRuleSuccess ("get_PropertyArrayField"); } private void CheckSelf () { if (this is AvoidRepetitiveCastsTest) Console.WriteLine ("of course"); } [Test] [Ignore ("Cast can optimized by the compiler, only change between Success and DoesNotApply")] public void This () { AssertRuleDoesNotApply ("CheckSelf"); } private object GuessWhat () { return "string"; } private void ReturnValue () { if (GuessWhat () is string) Console.WriteLine ("of course"); } private void Foreach (TypeDefinition type) { foreach (MethodDefinition ctor in (IEnumerable)type.Methods) { Console.WriteLine (ctor); } foreach (MethodDefinition method in (IEnumerable)type.Methods) { Console.WriteLine (method); } } [Test] public void Calls () { AssertRuleSuccess ("ReturnValue"); AssertRuleSuccess ("Foreach"); } private ArrayList RefBad (ref IList list) { if (list is ArrayList) { return (list as ArrayList); } return null; } private long RefGood (ref int value) { return (long) value; // actually it's a conversion not a cast } private bool Out (IList list, out IList al) { al = list; return (al is ArrayList); } [Test] public void Arguments () { AssertRuleFailure ("RefBad", 1); // this is a conversion, not a cast AssertRuleDoesNotApply ("RefGood"); AssertRuleSuccess ("Out"); } // from mcs/class/System.Web/System.Web/CapabilitiesLoader.cs private Hashtable data; private string GetParentName () { return (string) (data.Contains ("parent") ? data ["parent"] : null); } [Test] public void Null () { AssertRuleSuccess ("GetParentName"); } private static void FalsePositive5 () { XmlDocument doc = new XmlDocument (); doc.LoadXml (""); foreach (XmlNode node in doc.SelectNodes ("a")) { } foreach (XmlNode node in doc.SelectNodes ("b")) { } foreach (XmlNode node in doc.SelectNodes ("c")) { } foreach (XmlNode node in doc.SelectNodes ("d")) { } } [Test] public void Xml () { AssertRuleSuccess ("FalsePositive5"); } class IndexerResultCastTest { object this [int index] { get { return "Bob"; } } object GetString (int i) { return i.ToString (); } static void Indexers () { IndexerResultCastTest inst = new IndexerResultCastTest (); string a = (string) inst [1]; string b = (string) inst [2]; Console.WriteLine (a, b); } static void Methods () { IndexerResultCastTest inst = new IndexerResultCastTest (); string c = (string) inst.GetString (1); string d = (string) inst.GetString (2); Console.WriteLine (c, d); } static void BadMethods () { IndexerResultCastTest inst = new IndexerResultCastTest (); object c = (string) inst.GetString (1); string d = (string) c; Console.WriteLine (d + c); } } [Test] public void MethodCalls () { AssertRuleSuccess ("Indexers"); AssertRuleSuccess ("Methods"); AssertRuleFailure ("BadMethods"); } private sealed class MyInstruction { public object Operand { get { return null; } } } private object ReuseLocal (MyInstruction o) { MyInstruction i = (MyInstruction) (o.Operand); return (MyInstruction) (i.Operand); } [Test] public void ReuseLocalTest () { AssertRuleSuccess ("ReuseLocal"); } private string GoodLoadElement1 (object[] a1, object[] a2) { string s = (string) a1 [7]; string t = (string) a2 [7]; return s + t; } private string GoodLoadElement2 (object[] a1, object[] a2) { string s = (string) a1 [7]; string t = (string) a1 [8]; return s + t; } private string BadLoadElement (object[] a1, object[] a2) { string s = (string) a1 [7]; string t = (string) a1 [7]; return s + t; } [Test] public void LoadElementTest () { AssertRuleSuccess ("GoodLoadElement1"); AssertRuleSuccess ("GoodLoadElement2"); AssertRuleFailure ("BadLoadElement"); } private object Compute (int x) { return null; } private void MultipleCalls () { Console.WriteLine ((string) Compute (3)); Console.WriteLine ((string) Compute (5)); } [Test] public void MultipleCallsTest () { AssertRuleSuccess ("MultipleCalls"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/UseIsOperatorTest.cs0000664000175000017500000001004012413742070032343 0ustar00directhexdirecthex00000000000000// // Unit tests for UseIsOperatorRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class UseIsOperatorTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } private bool ReturnEqualityBad (object value) { return ((value as UseIsOperatorTest) == null); } private bool ReturnInequalityBad (object value) { return ((value as UseIsOperatorTest) != null); } private bool ReturnEqualityOk (object value) { return (value is UseIsOperatorTest); } private bool ReturnInequalityOk (object value) { return !(value is UseIsOperatorTest); } [Test] public void Return () { AssertRuleFailure ("ReturnEqualityBad", 1); AssertRuleFailure ("ReturnInequalityBad", 1); AssertRuleDoesNotApply ("ReturnEqualityOk"); AssertRuleSuccess ("ReturnInequalityOk"); } private void ConditionIsOk (object value) { if (value is UseIsOperatorTest) { Console.WriteLine ("Ok"); } } private void ConditionAsOk (object value) { UseIsOperatorTest test = (value as UseIsOperatorTest); if (test != null) { // 'is' would not be optimal since we use the 'as' result Console.WriteLine (test.ToString ()); } } [Test] public void Conditions () { AssertRuleDoesNotApply ("ConditionIsOk"); AssertRuleDoesNotApply ("ConditionAsOk"); } private void ConditionSplitBad (object value) { UseIsOperatorTest test = (value as UseIsOperatorTest); // 'test' is unused after the test if (test != null) { Console.WriteLine ("Bad"); } } // [g]mcs compiles this like an 'is', csc does too when compiling with optimizations private void ConditionEqualityBad (object value) { if ((value as UseIsOperatorTest) == null) { Console.WriteLine ("Bad"); } } private void ConditionInequalityBad (object value) { if ((value as UseIsOperatorTest) != null) { Console.WriteLine ("Bad"); } } [Test] [Ignore ("Compiler optimization (default for [g]mcs) can fix this")] public void ConditionsOptimized () { // missed opportunities are less problematic than false positives ;-) AssertRuleFailure ("ConditionEqualityBad", 1); AssertRuleFailure ("ConditionInequalityBad", 1); AssertRuleFailure ("ConditionSplitBad", 1); } private object ReturnEqualityThis (object value) { if ((value as UseIsOperatorTest) == this) return false; return (this == null); } [Test] public void BetterCoverage () { AssertRuleSuccess ("ReturnEqualityThis"); } } } CompareWithStringEmptyEfficientlyTest.cs0000664000175000017500000001670712413742070036352 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for CompareWithEmptyStringEfficientlyRule // // Authors: // Nidhi Rawal // Sebastien Pouliot // // Copyright (c) <2007> Nidhi Rawal // 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; using System.Collections.Specialized; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class CompareWithEmptyStringEfficientlyTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // has no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // has no call to other methods AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public class UsingStringEquals { string s = ""; public static void Main (string [] args) { UsingStringEquals u = new UsingStringEquals (); if (u.s.Equals ("")) { } } } public class UsingStringEqualsEmpty { string s = ""; public static void Main (string [] args) { UsingStringEqualsEmpty u = new UsingStringEqualsEmpty (); if (u.s.Equals (String.Empty)) { } } } public class UsingStringLength { string s = ""; public static void Main (string [] args) { UsingStringLength u = new UsingStringLength (); if (u.s.Length == 0) { } } } public class UsingEqualsWithNonStringArg { int i = 0; public static void Main (string [] args) { UsingEqualsWithNonStringArg u = new UsingEqualsWithNonStringArg (); if (u.i.Equals (1)) { } } } public class AnotherUseOfEqualsWithEmptyString { string s = "abc"; public static void Main (string [] args) { AnotherUseOfEqualsWithEmptyString a = new AnotherUseOfEqualsWithEmptyString (); bool b = a.s.Equals (""); } } public class AnotherUseOfEqualsWithStringEmpty { string s = "abc"; public static void Main (string [] args) { AnotherUseOfEqualsWithStringEmpty a = new AnotherUseOfEqualsWithStringEmpty (); bool b = a.s.Equals (String.Empty); } } public class OneMoreUseOfEqualsWithEmptyString { string s = ""; public static void Main (string [] args) { OneMoreUseOfEqualsWithEmptyString o = new OneMoreUseOfEqualsWithEmptyString (); if (o.s.Equals ("")) { bool b = o.s.Equals (""); } } } public class UsingEqualsWithNonEmptyString { string s = ""; public static void Main (string [] args) { UsingEqualsWithNonEmptyString u = new UsingEqualsWithNonEmptyString (); if (u.s.Equals ("abc")) { } } } [Test] public void MainComparingStrings () { AssertRuleFailure ("Main"); AssertRuleFailure ("Main"); AssertRuleSuccess ("Main"); AssertRuleSuccess ("Main"); AssertRuleFailure ("Main"); AssertRuleFailure ("Main"); AssertRuleFailure ("Main"); AssertRuleSuccess ("Main"); } public bool WrapperLiteral (string s) { return s.Equals (""); } public bool WrapperEmpty (string s) { return s.Equals (String.Empty); } [Test] public void WrapperEqualsString () { AssertRuleFailure ("WrapperLiteral"); AssertRuleFailure ("WrapperEmpty"); } public bool WrapperObjectLiteral (string s) { return s.Equals ((object) String.Empty); } public bool WrapperObjectEmpty (string s) { return s.Equals ((object) ""); } [Test] public void WrapperEqualsObject () { // [g]mcs emit a "callvirt System.Boolean System.String::Equals(System.Object)" // while csc emits "callvirt System.Boolean System.Object::Equals(System.Object)" AssertRuleFailure ("WrapperObjectLiteral"); AssertRuleFailure ("WrapperObjectEmpty"); } public bool OperatorEqualsLiteral (string s) { return (s == ""); } public bool OperatorEqualsStringEmpty (string s) { return (s == String.Empty); } public bool OperatorInequalsLiteral (string s) { return (s != ""); } public bool OperatorInequalsStringEmpty (string s) { return (s != String.Empty); } public bool OperatorEqualsString (string s) { return (s == "gendarme"); } public bool OperatorInequalsString (string s) { return (s != "gendarme"); } [Test] public void Operators () { AssertRuleFailure ("OperatorEqualsLiteral"); AssertRuleFailure ("OperatorEqualsStringEmpty"); AssertRuleFailure ("OperatorInequalsLiteral"); AssertRuleFailure ("OperatorInequalsStringEmpty"); AssertRuleSuccess ("OperatorEqualsString"); AssertRuleSuccess ("OperatorInequalsString"); } public bool TwoParameters () { return Object.Equals ("", String.Empty); } static string static_string; string instance_string; public bool Fields () { return ("".Equals (static_string) || String.Empty.Equals (instance_string)); } public bool NewobjAndEquality () { DateTime dt = new DateTime (); return dt == DateTime.UtcNow; } [Test] public void BetterCoverage () { AssertRuleSuccess ("TwoParameters"); AssertRuleSuccess ("Fields"); AssertRuleSuccess ("NewobjAndEquality"); } static bool CheckString (string val) { return (val.Length % 2 == 0); } static void ThrowValidationException (string a, string b, string c) { } // from mcs/class/System.Web/System.Web/HttpRequest.cs static void ValidateNameValueCollection (string name, NameValueCollection coll) { if (coll == null) return; foreach (string key in coll.Keys) { string val = coll [key]; if (val != null && val != "" && CheckString (val)) ThrowValidationException (name, key, val); } } [Test] public void MultipleChecks () { AssertRuleFailure ("ValidateNameValueCollection", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnusedPrivateFieldsTest.cs0000664000175000017500000001143312413742070034516 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidUnusedPrivateFieldsRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class AvoidUnusedPrivateFieldsTest : TypeRuleTestFixture { [Test] public void Simple () { AssertRuleDoesNotApply (SimpleTypes.Class); // no fields AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleSuccess (SimpleTypes.Structure); // a few public fields } class ClassUnusedStaticPrivateField { private static int x; [DllImport ("libc.so")] private static extern void strncpy (StringBuilder dest, string src, uint n); } [Test] public void Class () { AssertRuleFailure (1); } class ClassUnusedPrivateField { private int x; public int X { get { return 0; } set { ; } } } class ClassPrivateField { private int x; public int X { get { return x; } set { x = value; } } } [Test] public void StaticFields () { AssertRuleFailure (1); AssertRuleSuccess (); } class ClassConstUnused { private const string DefaultRulesFile = "rules.xml"; private const int PdbHiddenLine = 0xFEEFEE; } class ClassConstString { private const string DefaultRulesFile = "rules.xml"; public void Show () { Console.WriteLine (DefaultRulesFile); } } class ClassConstInt { private const int PdbHiddenLine = 0xFEEFEE; public void Show () { Console.WriteLine (PdbHiddenLine); } } class ClassConstSmallInt { // small enough to be changed into Ldc_I4_S const int DefaultAmountOfElements = 13; public void Show () { Console.WriteLine (DefaultAmountOfElements); } } class ClassConstSmallerInt { // small enough to be changed into Ldc_I4_7 const int AssignationRatio = 7; public void Show () { Console.WriteLine (AssignationRatio); } } [Test] public void ConstantFields () { // constant (literals) are ignored since their value is copied // into IL (i.e. the field itself is not used) AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); AssertRuleSuccess (); } class GenericUnused { IList list; } class GenericUsed { IList list; public void Show () { foreach (T t in list) Console.WriteLine (t); } } [Test] public void GenericsFields () { AssertRuleFailure> (1); AssertRuleSuccess> (); } class FieldsUsedInNested { private bool field; private static string staticField; class Nested { public void Foo (FieldsUsedInNested parent) { FieldsUsedInNested.staticField = "bar"; parent.field = true; } } } [Test] public void FieldsUsedInNestedType () { AssertRuleSuccess (); } class CompilerGenerated { public string Name { get; set; } } [Test] public void ClassWithCompilerGeneratedFields () { AssertRuleSuccess (); } class CompilerGeneratedAndUnused { private int number; public string Name { get; set; } } [Test] public void ClassWithCompilerGeneratedFieldsAndUnusedPrivate () { AssertRuleFailure (1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/DontIgnoreMethodResultTest.cs0000664000175000017500000001160412413742070034216 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotIgnoreMethodResultRule // // Authors: // Lukasz Knop // Sebastien Pouliot // // Copyright (C) 2007 Lukasz Knop // 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.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class DoNotIgnoreMethodResultTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no Pop AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); // generated code AssertRuleDoesNotApply (SimpleMethods.GeneratedCodeMethod); } public class Item { public void Violations () { "violationOne".ToUpper(CultureInfo.InvariantCulture); string violationTwo = "MediuM "; violationTwo.ToLower(CultureInfo.InvariantCulture).Trim(); } public static void CreateItem () { new Item (); } // StringBuilder is a special case when the method returns a StringBuilder public string StringBuilderOk () { StringBuilder sb = new StringBuilder (); sb.Append ("test").Insert (2, true).Remove (0, 1).Replace ("oh", "ah"). AppendFormat ("-{0}-", 1).AppendLine (); return sb.ToString (); } public void StringBuilderBad () { StringBuilder sb = new StringBuilder (); sb.Append ("test").Insert (2, true).Remove (0, 1).Replace ("oh", "ah"). AppendFormat ("-{0}-", 1).AppendLine (); // this is not ok sb.ToString (); } public void DirectoryOk () { // the DirectoryInfo this returns may not be needed Directory.CreateDirectory ("mono"); DirectoryInfo di = Directory.CreateDirectory ("2.0"); // the DirectoryInfo this returns may not be needed di.CreateSubdirectory ("gac"); } public void DirectoryBad () { DirectoryInfo di = Directory.CreateDirectory ("mono"); // this is not ok di.GetDirectories (); } public void PermissionSetOk () { PermissionSet set = new PermissionSet (PermissionState.None); // the IPermission this returns may not be needed set.AddPermission (new GacIdentityPermission ()); set.RemovePermission (typeof (GacIdentityPermission)); } public void PermissionSetBad () { PermissionSet set = new PermissionSet (PermissionState.None); // this is not ok set.Union (set); } void TimeoutCallback (object state) { } public void TimerOk () { new Timer (TimeoutCallback, null, 3000, Timeout.Infinite); } public void Stack () { Stack stack = new Stack (); stack.Pop (); } public void StackGenerics () { Stack stack = new Stack (); stack.Pop (); } } [Test] public void TestStringMethods() { AssertRuleFailure ("Violations", 2); } [Test] public void TestConstructor() { AssertRuleFailure ("CreateItem", 1); } [Test] public void TestStringBuilder () { AssertRuleSuccess ("StringBuilderOk"); AssertRuleFailure ("StringBuilderBad", 1); } [Test] public void TestDirectory () { AssertRuleSuccess ("DirectoryOk"); AssertRuleFailure ("DirectoryBad", 1); } [Test] public void TestPermissionSet () { AssertRuleSuccess ("PermissionSetOk"); AssertRuleFailure ("PermissionSetBad", 1); } [Test] public void TestTimer () { AssertRuleSuccess ("TimerOk"); } [Test] public void StackPop () { AssertRuleSuccess ("Stack"); AssertRuleSuccess ("StackGenerics"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/Makefile.am0000664000175000017500000000015612413742070030453 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Performance.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidLocalDataStoreSlotTest.cs0000664000175000017500000001454512413742070034303 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidLocalDataStoreSlotRule // // Authors: // Sebastien Pouliot // // 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; using System.Runtime.Remoting.Contexts; using System.Threading; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class AvoidLocalDataStoreSlotTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no calls to other methods AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } class BadThreadLocalStorage { LocalDataStoreSlot lds; public BadThreadLocalStorage () { lds = Thread.AllocateDataSlot (); } private byte [] Key { get { return (byte []) Thread.GetData (lds); } set { Thread.SetData (lds, value); } } private byte [] GetKeyCopy () { return (byte []) (Thread.GetData (lds) as byte []).Clone (); } } class BadNamedThreadLocalStorage { public BadNamedThreadLocalStorage () { Thread.AllocateNamedDataSlot ("bad"); } ~BadNamedThreadLocalStorage () { Thread.FreeNamedDataSlot ("bad"); } LocalDataStoreSlot GetLocalDataStoreSlot () { return Thread.GetNamedDataSlot ("bad"); } private byte [] Key { get { return (byte []) Thread.GetData (GetLocalDataStoreSlot ()); } set { Thread.SetData (GetLocalDataStoreSlot (), value); } } private byte [] GetKeyCopy () { return (byte []) (Thread.GetData (GetLocalDataStoreSlot ()) as byte []).Clone (); } } class GoodThreadLocalStorage { [ThreadStatic] static byte[] key; private byte [] Key { get { return key; } set { key = (byte[]) value.Clone (); } } private byte [] GetKeyCopy () { return (byte[]) key.Clone (); } } [Test] public void ThreadLocalStorage () { AssertRuleFailure (".ctor"); AssertRuleFailure ("get_Key"); AssertRuleFailure ("set_Key"); AssertRuleFailure ("GetKeyCopy"); AssertRuleFailure (".ctor"); AssertRuleFailure ("Finalize"); AssertRuleFailure ("GetLocalDataStoreSlot"); AssertRuleFailure ("get_Key"); AssertRuleFailure ("set_Key"); AssertRuleFailure ("GetKeyCopy"); // no call AssertRuleDoesNotApply ("get_Key"); AssertRuleSuccess ("set_Key"); AssertRuleSuccess ("GetKeyCopy"); } class BadContextLocalStorage { LocalDataStoreSlot lds; public BadContextLocalStorage () { lds = Context.AllocateDataSlot (); } private byte [] Key { get { return (byte[]) Context.GetData (lds); } set { Context.SetData (lds, value); } } private byte [] GetKeyCopy () { return (byte []) (Context.GetData (lds) as byte []).Clone (); } } class BadNamedContextLocalStorage { public BadNamedContextLocalStorage () { Context.AllocateNamedDataSlot ("bad"); } ~BadNamedContextLocalStorage () { Context.FreeNamedDataSlot ("bad"); } LocalDataStoreSlot GetLocalDataStoreSlot () { return Context.GetNamedDataSlot ("bad"); } private byte [] Key { get { return (byte[]) Context.GetData (GetLocalDataStoreSlot ()); } set { Context.SetData (GetLocalDataStoreSlot (), value); } } private byte [] GetKeyCopy () { return (byte []) (Context.GetData (GetLocalDataStoreSlot ()) as byte []).Clone (); } } class GoodContextLocalStorage { [ContextStatic] static byte [] key; private byte [] Key { get { return key; } set { key = (byte[]) value.Clone (); } } private byte [] GetKeyCopy () { return (byte []) key.Clone (); } } [Test] public void ContextLocalStorage () { AssertRuleFailure (".ctor"); AssertRuleFailure ("get_Key"); AssertRuleFailure ("set_Key"); AssertRuleFailure ("GetKeyCopy"); AssertRuleFailure (".ctor"); AssertRuleFailure ("Finalize"); AssertRuleFailure ("GetLocalDataStoreSlot"); AssertRuleFailure ("get_Key"); AssertRuleFailure ("set_Key"); AssertRuleFailure ("GetKeyCopy"); // no call AssertRuleDoesNotApply ("get_Key"); AssertRuleSuccess ("set_Key"); AssertRuleSuccess ("GetKeyCopy"); } void UsingThread () { Console.WriteLine (Thread.GetDomainID ()); } void UsingContext () { Console.WriteLine (Context.DefaultContext.ContextID); } [Test] public void OtherUsage () { AssertRuleSuccess ("UsingThread"); AssertRuleSuccess ("UsingContext"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnneededUnboxingTest.cs0000664000175000017500000001474312413742070034041 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidUnneededUnboxingRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class AvoidUnneededUnboxingTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no IL for p/invokes AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } // from mcs/class/Managed.Windows.Forms/System.Windows.Forms/Message.cs public struct Message { private int msg; private IntPtr hwnd; private IntPtr lParam; private IntPtr wParam; private IntPtr result; public override bool Equals (object o) { if (!(o is Message)) { return false; } return ((this.msg == ((Message) o).msg) && (this.hwnd == ((Message) o).hwnd) && (this.lParam == ((Message) o).lParam) && (this.wParam == ((Message) o).wParam) && (this.result == ((Message) o).result)); } // other test cases public bool EqualsOk (object o) { if (!(o is Message)) { return false; } Message msg = (Message) o; return ((this.msg == msg.msg) && (this.hwnd == msg.hwnd) && (this.lParam == msg.lParam) && (this.wParam == msg.wParam) && (this.result == msg.result)); } public bool EqualsNone (Message msg) { return ((this.msg == msg.msg) && (this.hwnd == msg.hwnd) && (this.lParam == msg.lParam) && (this.wParam == msg.wParam) && (this.result == msg.result)); } // test static and 2 parameters static public bool StaticEquals (object left, object right) { return ((((Message) left).msg == ((Message) right).msg) && (((Message) left).hwnd == ((Message) right).hwnd) && (((Message) left).lParam == ((Message) right).lParam) && (((Message) left).wParam == ((Message) right).wParam) && (((Message) left).result == ((Message) right).result)); } // a lot of extra parameters to hit the ldarg instruction (not the macros) static public bool StaticEqualsOk (string message, string msgLeft, object left, string msgRight, object right) { Message m1 = (Message) left; Message m2 = (Message) right; return ((m1.msg == m1.msg) && (m1.hwnd == m1.hwnd) && (m1.lParam == m1.lParam) && (m1.wParam == m1.wParam) && (m1.result == m1.result)); } } private object GetMessage () { return new Message (); } private void CompareMessages (Message msg) { object o = GetMessage (); Console.WriteLine (msg.Equals ((Message) o) && ((Message) o).Equals (msg)); } private void CompareMessagesNoVariable (Message msg) { Console.WriteLine (GetMessage ().Equals ((Message) GetMessage())); } private object field_one; private object field_two; private void CompareFields () { Console.WriteLine (field_one.Equals ((Message) field_two) && ((Message) field_one).Equals (field_two)); } private void CompareFieldsTwo () { // field_two is unboxed two times while field_one is always treated as an object Console.WriteLine (field_one.Equals ((Message) field_two) && ((Message) field_two).Equals (field_one)); } private void CompareVariables () { object one = GetMessage (); bool two = (one != null); string three = "result {0}"; object four = GetMessage (); if (two) { bool five = (four != null); Console.WriteLine (three, five && ((Message) four).Equals ((Message) one)); Console.WriteLine (three, !five && ((Message) four).Equals ((Message) four)); Console.WriteLine (three, five && ((Message) one).Equals ((Message) four)); Console.WriteLine (three, !five && ((Message) one).Equals ((Message) one)); } else { object six = GetMessage (); Console.WriteLine (three, ((Message) four).Equals ((Message) six) && ((Message) four).Equals ((Message) one)); Console.WriteLine (three, ((Message) six).Equals ((Message) four) && ((Message) six).Equals ((Message) one)); Console.WriteLine (three, ((Message) one).Equals ((Message) four) && ((Message) one).Equals ((Message) six)); } } [Test] public void TooMuchUnboxing () { // one (parameter) is unboxed 5 times AssertRuleFailure ("Equals", 1); // two parameters are unboxed 5 times AssertRuleFailure ("StaticEquals", 2); // one variable is unboxed 2 times AssertRuleFailure ("CompareMessages", 1); // one field is unboxed 2 times AssertRuleFailure ("CompareFieldsTwo", 1); // three variables are unboxed several times AssertRuleFailure ("CompareVariables", 3); } [Test] public void SingleUnboxing () { // one (parameter) is unboxed 1 time (ok) AssertRuleSuccess ("EqualsOk"); // two parameters are unboxed 1 time (each) AssertRuleSuccess ("StaticEqualsOk"); // two fields are unboxed 1 time (each) AssertRuleSuccess ("CompareFields"); // we can't be sure the same call returns the same value // each time, i.e. the boxing may be required AssertRuleSuccess ("CompareMessagesNoVariable"); } [Test] public void NoUnboxing () { AssertRuleDoesNotApply ("EqualsNone"); AssertRuleDoesNotApply ("GetMessage"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/AvoidUnsealedConcreteAttributesTest.cs0000664000175000017500000000701012413742070036057 0ustar00directhexdirecthex00000000000000// // Unit tests for AvoidUnsealedConcreteAttributesRule // // Authors: // Daniel Abramov // Sebastien Pouliot // // Copyright (C) Daniel Abramov // 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; using System.Diagnostics.CodeAnalysis; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; namespace Test.Rules.Performance { internal class NotAttribute { } internal class AnAttribute : Attribute { } internal sealed class SealedAttributeInheritsAnAttribute : AnAttribute { } internal sealed class SealedAttribute : Attribute { } internal abstract class AbstractAttribute : Attribute { } [TestFixture] public class AvoidUnsealedConcreteAttributesTest : TypeRuleTestFixture { [TestFixtureSetUp] public void SetUp () { Runner.Engines.Subscribe ("Gendarme.Framework.Engines.SuppressMessageEngine"); } [Test] public void TestAbstractAttribute () { AssertRuleSuccess (); } [Test] public void TestAnAttribute () { AssertRuleFailure (1); } [Test] public void TestNotAttribute () { AssertRuleDoesNotApply (); } [Test] public void TestSealedAttribute () { AssertRuleSuccess (); } [Test] public void TestSealedAttributeInheritsAnAttribute () { AssertRuleSuccess (); } public class FxCopTest { // CA1813 public class AvoidUnsealedAttributes { public class Fail : Attribute { } // manually suppressed - no MessageId [SuppressMessage ("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")] public class ManuallySuppressed : Attribute { } // automatically suppressed using VS2010 [System.Diagnostics.CodeAnalysis.SuppressMessage ("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")] public class AutomaticallySuppressed : Attribute { } // automatically suppressed using VS2010 (see GlobalSupressions.cs) public class GloballySuppressed : Attribute { } } } [Test] public void CA1813 () { AssertRuleFailure (1); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); AssertRuleDoesNotApply (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/ReviewLinqMethodTest.cs0000664000175000017500000001730312413742070033036 0ustar00directhexdirecthex00000000000000// // Unit tests for ReviewLinqMethodRule // // Authors: // Jesse Jones // // Copyright (C) 2009 Jesse Jones // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Linq; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public sealed class ReviewLinqMethodTest : MethodRuleTestFixture { private sealed class CanUseProperty { public void Good1 (List sequence) { Console.WriteLine (sequence.Count); // doesn't use the extension method } public void Good2 (IEnumerable sequence) { Console.WriteLine (sequence.Count ()); // can't use a more efficient method } public void Bad1 (List sequence) { Console.WriteLine (sequence.Count ()); } public void Bad2 (string [] sequence) { Console.WriteLine (sequence.Count ()); } } private sealed class CanUseAny { public void Good1 (IEnumerable sequence) { Console.WriteLine (sequence.Count () > 10); // can't use a more efficient method } public void Good2 (IEnumerable sequence) { Console.WriteLine (sequence.Any ()); // the usual workaround } public void Good3 (IEnumerable sequence) { if (sequence.Count () > 10) Console.WriteLine (); } public void Good4 (IEnumerable sequence) { if (sequence.Any ()) Console.WriteLine (); } public void Bad1a (IEnumerable sequence) { Console.WriteLine (sequence.Count () > 0); } public void Bad2a (IEnumerable sequence) { Console.WriteLine (sequence.Count () == 0); } public void Bad3a (IEnumerable sequence) { Console.WriteLine (sequence.Count () != 0); } public void Bad1b (IEnumerable sequence) { Console.WriteLine (0 < sequence.Count ()); } public void Bad2b (IEnumerable sequence) { Console.WriteLine (0 == sequence.Count ()); } public void Bad3b (IEnumerable sequence) { Console.WriteLine (0 != sequence.Count ()); } public void Bad1c (IEnumerable sequence) { if (sequence.Count () > 0) Console.WriteLine (); } public void Bad2c (IEnumerable sequence) { if (sequence.Count () == 0) Console.WriteLine (); } public void Bad3c (IEnumerable sequence) { if (sequence.Count () != 0) Console.WriteLine (); } public void Bad1d (IEnumerable sequence) { if (0 < sequence.Count ()) Console.WriteLine (); } public void Bad2d (IEnumerable sequence) { if (0 == sequence.Count ()) Console.WriteLine (); } public void Bad3d (IEnumerable sequence) { if (0 != sequence.Count ()) Console.WriteLine (); } } private sealed class CanUseSubscript1 { public void Good1 (IEnumerable sequence) { Console.WriteLine (sequence.ElementAt (10)); // can't use a more efficient method } public void Bad1 (List sequence) { Console.WriteLine (sequence.ElementAt (10)); } public void Bad2 (string [] sequence) { Console.WriteLine (sequence.ElementAt (10)); } public void Bad3 (string [] sequence) { Console.WriteLine (sequence.ElementAtOrDefault (10)); } } private sealed class CanUseSubscript2 { public void Good1 (IEnumerable sequence) { Console.WriteLine (sequence.Last ()); // can't use a more efficient method } public void Bad1 (List sequence) { Console.WriteLine (sequence.Last ()); } public void Bad2 (string [] sequence) { Console.WriteLine (sequence.Last ()); } public void Bad3 (string [] sequence) { Console.WriteLine (sequence.LastOrDefault ()); } } private sealed class CanUseSort { public object Good1 (IEnumerable sequence) { return sequence.OrderBy ((string x) => x); // can't use a more efficient method } public object Bad1 (List sequence) { return sequence.OrderBy ((string x) => x); } public object Bad2 (string [] sequence) { return sequence.OrderBy ((string x) => x); } public object Bad3 (string [] sequence) { return sequence.OrderByDescending ((string x) => x); } public object Bad4 (string [] sequence) { return sequence.OrderByDescending ((string x) => x, null); } } public class Bug656790 { public virtual int CanExecute (object data) { return ((IEnumerable) data).Count (); } } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } [Test] public void Cases () { // CanUseProperty AssertRuleSuccess ("Good1"); AssertRuleSuccess ("Good2"); AssertRuleFailure ("Bad1"); AssertRuleFailure ("Bad2"); // CanUseSubscript1 AssertRuleSuccess ("Good1"); AssertRuleFailure ("Bad1"); AssertRuleFailure ("Bad2"); AssertRuleFailure ("Bad3"); // CanUseSubscript2 AssertRuleSuccess ("Good1"); AssertRuleFailure ("Bad1"); AssertRuleFailure ("Bad2"); AssertRuleFailure ("Bad3"); // CanUseAny AssertRuleSuccess ("Good1"); AssertRuleSuccess ("Good2"); AssertRuleSuccess ("Good3"); AssertRuleFailure ("Bad1a"); AssertRuleFailure ("Bad2a"); AssertRuleFailure ("Bad3a"); AssertRuleFailure ("Bad1b"); AssertRuleFailure ("Bad2b"); AssertRuleFailure ("Bad3b"); AssertRuleFailure ("Bad1c"); AssertRuleFailure ("Bad2c"); AssertRuleFailure ("Bad3c"); AssertRuleFailure ("Bad1d"); AssertRuleFailure ("Bad2d"); AssertRuleFailure ("Bad3d"); // CanUseSort AssertRuleSuccess ("Good1"); AssertRuleFailure ("Bad1"); AssertRuleFailure ("Bad2"); AssertRuleFailure ("Bad3"); AssertRuleFailure ("Bad4"); AssertRuleSuccess ("CanExecute"); } class Bug664556 { public int DoSomething (Bug664556 [] ic) { return ic.Count (); } } [Test] public void Array () { AssertRuleFailure ("DoSomething", 1); } } } AvoidRepetitiveCallsToPropertiesTest.cs0000664000175000017500000001673212413742070036200 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for AvoidRepetitiveCallsToPropertiesRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class AvoidRepetitiveCallsToPropertiesTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // method has no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // method does not call any other method AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } class TestCase { // very small this will get inlined public int Integer { get { return 0; } } public virtual string Message { get { return "coucou"; } } public string SingleCalls () { return String.Format ("{0} {1}", Integer, Message); } public string Multiple () { return String.Format ("{0} {1} {2} {3} {4} {5} {6} {7}", Integer, Message, Integer, Message, Integer, Message, Integer, Message); } // make it large enough (by calling GetHashCode) not to be inlined static Version Version { get { return new Version (1.GetHashCode (), 2.GetHashCode (), 3.GetHashCode (), 4.GetHashCode ()); } } static string ShowVersion () { return String.Format ("{0}.{1}.{2}.{3}", Version, Version, Version, Version); } } [Test] public void SingleCall () { AssertRuleSuccess ("SingleCalls"); } [Test] public void MultipleCalls () { // only Message (virtual) will trigger since Integer is small enough to be inlined AssertRuleFailure ("Multiple", 1); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "Medium(2)"); } [Test] public void StaticCalls () { AssertRuleFailure ("ShowVersion", 1); Assert.AreEqual (Severity.Low, Runner.Defects [0].Severity, "Low(2)"); } private string TwoDifferentInstances (TestCase a, TestCase b) { return String.Format ("{0} {1}", a.Message, b.Message); } private string SameInstance (TestCase a) { return String.Format ("{0} {1} {2}", a.Message, a.Message, a.Message); } [Test] public void MultipleInstances () { // same property on two different instances AssertRuleSuccess ("TwoDifferentInstances"); // same property on the same instance AssertRuleFailure ("SameInstance", 1); Assert.AreEqual (Severity.Medium, Runner.Defects [0].Severity, "Medium(3)"); } private int Count (CollectionBase cb) { return cb.Count + cb.Count + cb.Count + cb.Count + cb.Count + cb.Count + cb.Count + cb.Count + cb.Count + cb.Count + cb.Count + cb.Count; } [Test] public void CollectionBaseCountAbuse () { // we can't assume different runtime/version will have a constant code size // so we adjust the inline limit of the rule (above and below) MethodDefinition md = Helpers.DefinitionLoader.GetMethodDefinition ("get_Count"); try { Rule.InlineLimit = md.Body.CodeSize + 1; AssertRuleSuccess ("Count"); Rule.InlineLimit = md.Body.CodeSize - 1; AssertRuleFailure ("Count", 1); Assert.AreEqual (Severity.High, Runner.Defects [0].Severity, "High(6)"); } finally { Rule.InlineLimit = 20; } } public virtual string this [int index] { get { return null; } } void SameIndex () { Console.WriteLine ("{0} {1} {2}", this [0], this [0], this [0]); } void DifferentIndex () { Console.WriteLine ("{0} {1} {2}", this [0], this [1], this [2]); } void CalculatedIndex () { int n = 0; Console.WriteLine ("{0} {1} {2}", this [n++], this [n++], this [n++]); } [Test] public void Indexes () { // note: the rule currently ignore indexed properties AssertRuleSuccess ("SameIndex"); AssertRuleSuccess ("DifferentIndex"); AssertRuleSuccess ("CalculatedIndex"); } // test case distilled from ParameterNamesShouldMatchOverriddenMethodRule bool SameReturnType (MethodReference a, MethodReference b) { return (a.ReturnType.FullName == b.ReturnType.FullName); } [Test] public void Chain () { AssertRuleSuccess ("SameReturnType"); } void UsingDateTime () { Console.WriteLine ("start {0} {1}", DateTime.Now, DateTime.UtcNow); // ... Console.WriteLine ("end {0} {1}", DateTime.Now, DateTime.UtcNow); } void UsingStopwatch () { Stopwatch sw = Stopwatch.StartNew (); Console.WriteLine ("start {0}", sw.Elapsed); // ... Console.WriteLine ("end {0}", sw.Elapsed); } [Test] public void WellKnownUsages () { AssertRuleSuccess ("UsingDateTime"); AssertRuleSuccess ("UsingStopwatch"); } internal static MethodDefinition Current { get { return null; } } internal static MethodDefinition Target { get { return null; } } static bool AreEquivalent (VariableReference source, VariableReference target) { IList cv = Current.Body.Variables; IList tv = Target.Body.Variables; return cv.Count > source.Index && tv.Count > target.Index ? cv [source.Index].VariableType.Equals (tv [target.Index].VariableType) : false; } static bool AreEquivalent2 (ParameterDefinition source, ParameterDefinition target) { if ((source == null) || (target == null)) return false; int ss = source.Index; int ts = target.Index; if ((ss <= 0) || (ts <= 0)) return false; IList cp = Current.Parameters; IList tp = Target.Parameters; return ((cp.Count > ss) && (tp.Count > ts)) ? cp [ss].ParameterType.Equals (tp [ts].ParameterType) : false; } [Test] public void Properties () { AssertRuleSuccess ("AreEquivalent"); AssertRuleSuccess ("AreEquivalent2"); } } } AvoidMethodWithLargeMaximumStackSizeTest.cs0000664000175000017500000000672312413742070036726 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for AvoidMethodWithLargeMaximumStackSizeRule // // Authors: // Jb Evain // // 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 Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class AvoidMethodWithLargeMaximumStackSizeTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); } private void SmallMethod (int a) { int x = a * a - a; Console.WriteLine (x * x); } [Test] public void Small () { AssertRuleSuccess ("SmallMethod"); } public void Bang ( int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20, int a21, int a22, int a23, int a24, int a25, int a26, int a27, int a28, int a29, int a30, int a31, int a32, int a33, int a34, int a35, int a36, int a37, int a38, int a39, int a40, int a41, int a42, int a43, int a44, int a45, int a46, int a47, int a48, int a49, int a50, int a51, int a52, int a53, int a54, int a55, int a56, int a57, int a58, int a59, int a60, int a61, int a62, int a63, int a64, int a65, int a66, int a67, int a68, int a69, int a70, int a71, int a72, int a73, int a74, int a75, int a76, int a77, int a78, int a79, int a80, int a81, int a82, int a83, int a84, int a85, int a86, int a87, int a88, int a89, int a90, int a91, int a92, int a93, int a94, int a95, int a96, int a97, int a98, int a99, int a100, int a101, int a102, int a103, int a104, int a105, int a106, int a107, int a108, int a109, int a110) { } private void MethodWithLargeMaximumStackSize (int a) { Bang ( a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a); } [Test] public void TooLarge () { AssertRuleFailure ("MethodWithLargeMaximumStackSize", 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test/PreferCharOverloadTest.cs0000664000175000017500000002157012413742070033326 0ustar00directhexdirecthex00000000000000// // Unit tests for PreferCharOverloadRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Performance { [TestFixture] public class PreferCharOverloadTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // no call to methods AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); } public bool StringIndexOf_Char (string s) { return (s.IndexOf ('b') >= 0); } public bool StringIndexOf_ShortString (string s) { return (s.IndexOf ("b") >= 0); } public bool StringIndexOf_LongString (string s) { return (s.IndexOf ("bc") >= 0); } public bool StringIndexOf_UnknownString (string s) { return ("abc".IndexOf (s) >= 0); } public bool StringIndexOf_ShortStringInt (string s) { return (s.IndexOf ("b", 1) >= 0); } public bool StringIndexOf_LongStringInt (string s) { return (s.IndexOf ("bc", 2) >= 0); } public bool StringIndexOf_UnknownStringInt (string s) { return ("abc".IndexOf (s, 3) >= 0); } public bool StringIndexOf_ShortStringIntInt (string s) { int pos = "abc".IndexOf ("b", 1, 2); return (s.IndexOf ("a", pos, 1) == -1); } public bool StringIndexOf_LongStringIntInt (string s) { int pos = "abc".IndexOf ("bc", 1, 2); return (s.IndexOf ("ab", pos, 1) == -1); } public bool StringIndexOf_UnknownStringIntInt (string s) { int pos = "abc".IndexOf (s, 1, 2); return (s.IndexOf (s, pos, 1) == -1); } [Test] public void StringIndexOf () { AssertRuleSuccess ("StringIndexOf_Char"); AssertRuleFailure ("StringIndexOf_ShortString", 1); AssertRuleSuccess ("StringIndexOf_LongString"); AssertRuleSuccess ("StringIndexOf_UnknownString"); AssertRuleFailure ("StringIndexOf_ShortStringInt", 1); AssertRuleSuccess ("StringIndexOf_LongStringInt"); AssertRuleSuccess ("StringIndexOf_UnknownStringInt"); AssertRuleFailure ("StringIndexOf_ShortStringIntInt", 2); AssertRuleSuccess ("StringIndexOf_LongStringIntInt"); AssertRuleSuccess ("StringIndexOf_UnknownStringIntInt"); } public bool StringLastIndexOf_Char (string s) { return (s.LastIndexOf ('b') >= 0); } public bool StringLastIndexOf_ShortString (string s) { return (s.LastIndexOf ("b") >= 0); } public bool StringLastIndexOf_LongString (string s) { return (s.LastIndexOf ("bc") >= 0); } public bool StringLastIndexOf_UnknownString (string s) { return ("abc".LastIndexOf (s) >= 0); } public bool StringLastIndexOf_ShortStringInt (string s) { return (s.LastIndexOf ("b", 1) >= 0); } public bool StringLastIndexOf_LongStringInt (string s) { return (s.LastIndexOf ("bc", 2) >= 0); } public bool StringLastIndexOf_UnknownStringInt (string s) { return ("abc".LastIndexOf (s, 3) >= 0); } public bool StringLastIndexOf_ShortStringIntInt (string s) { int pos = "abc".LastIndexOf ("b", 1, 2); return (s.LastIndexOf ("a", pos, 1) == -1); } public bool StringLastIndexOf_LongStringIntInt (string s) { int pos = "abc".LastIndexOf ("bc", 1, 2); return (s.LastIndexOf ("ab", pos, 1) == -1); } public bool StringLastIndexOf_UnknownStringIntInt (string s) { int pos = "abc".LastIndexOf (s, 1, 2); return (s.LastIndexOf (s, pos, 1) == -1); } [Test] public void StringLastIndexOf () { AssertRuleSuccess ("StringLastIndexOf_Char"); AssertRuleFailure ("StringLastIndexOf_ShortString", 1); AssertRuleSuccess ("StringLastIndexOf_LongString"); AssertRuleSuccess ("StringLastIndexOf_UnknownString"); AssertRuleFailure ("StringLastIndexOf_ShortStringInt", 1); AssertRuleSuccess ("StringLastIndexOf_LongStringInt"); AssertRuleSuccess ("StringLastIndexOf_UnknownStringInt"); AssertRuleFailure ("StringLastIndexOf_ShortStringIntInt", 2); AssertRuleSuccess ("StringLastIndexOf_LongStringIntInt"); AssertRuleSuccess ("StringLastIndexOf_UnknownStringIntInt"); } public string ReplaceString_Char (string s) { return s.Replace ('a', 'b'); } public string ReplaceString_ShortString (string s) { return s.Replace ("a", "b"); } public string ReplaceString_LongString (string s) { return s.Replace ("ab", "ba"); } public string ReplaceString_ShortLongString (string s) { return s.Replace ("a", "ba"); } public string ReplaceString_UnknownShortString (string s) { return "abc".Replace (s, "b"); } public string ReplaceString_UnknownLongString (string s) { return "abc".Replace (s, "ba"); } [Test] public void StringReplace () { AssertRuleSuccess ("ReplaceString_Char"); AssertRuleFailure ("ReplaceString_ShortString", 1); AssertRuleSuccess ("ReplaceString_LongString"); AssertRuleSuccess ("ReplaceString_ShortLongString"); AssertRuleSuccess ("ReplaceString_UnknownShortString"); AssertRuleSuccess ("ReplaceString_UnknownLongString"); } public bool StringIndexOf_CurrentCulture (string s) { // a char would be compared as an ordinal value return (s.IndexOf ("a", StringComparison.CurrentCulture) == -1); } public bool LastStringIndexOf_CurrentCultureIgnoreCase (string s) { // a char would be compared as an ordinal value return (s.LastIndexOf ("a", StringComparison.CurrentCultureIgnoreCase) == -1); } public bool StringIndexOf_InvariantCulture (string s) { // a char would be compared as an ordinal value return (s.IndexOf ("a", StringComparison.InvariantCulture) == -1); } public bool LastStringIndexOf_InvariantCultureIgnoreCase (string s) { // a char would be compared as an ordinal value return (s.LastIndexOf ("a", StringComparison.InvariantCultureIgnoreCase) == -1); } public bool StringIndexOf_Ordinal (string s) { // a char would be compared as an ordinal value return (s.IndexOf ("a", StringComparison.Ordinal) == -1); } public bool LastStringIndexOf_OrdinalIgnoreCase (string s) { // a char would be compared as an ordinal value and this string // value is not case sensitive return (s.LastIndexOf ("_", StringComparison.OrdinalIgnoreCase) == -1); } [Test] public void StringComparisonChecks () { AssertRuleSuccess ("StringIndexOf_CurrentCulture"); AssertRuleSuccess ("LastStringIndexOf_CurrentCultureIgnoreCase"); AssertRuleSuccess ("StringIndexOf_InvariantCulture"); AssertRuleSuccess ("LastStringIndexOf_InvariantCultureIgnoreCase"); AssertRuleFailure ("StringIndexOf_Ordinal", 1); AssertRuleFailure ("LastStringIndexOf_OrdinalIgnoreCase", 1); } class String { void LastIndexOf () { } void TestLastIndexOf () { String s = new String (); s.LastIndexOf (); } void Replace (string s) { } void TestReplace () { String s = new String (); s.Replace ("a"); } } [Test] public void SpecialCases () { AssertRuleSuccess ("TestLastIndexOf"); AssertRuleSuccess ("TestReplace"); } } } AvoidUnneededFieldInitializationTest.cs0000664000175000017500000000743612413742070036125 0ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Test// // Unit tests for AvoidUnneededFieldInitializationRule // // Authors: // Sebastien Pouliot // // 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; using Gendarme.Rules.Performance; using NUnit.Framework; using Test.Rules.Fixtures; using Test.Rules.Definitions; namespace Test.Rules.Performance { [TestFixture] public class AvoidUnneededFieldInitializationTest : MethodRuleTestFixture { [Test] public void DoesNotApply () { // no body AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); // not ctor AssertRuleDoesNotApply (SimpleMethods.EmptyMethod); // generated code AssertRuleDoesNotApply (SimpleMethods.GeneratedCodeMethod); } class ClassWithBadStaticCtor { public static int i; static object o; static ClassWithBadStaticCtor () { i = 0; o = null; } public ClassWithBadStaticCtor () { // setting static fields from an instance ctor i = 1; o = null; } } class ClassWithGoodStaticCtor { static string s; static ClassWithGoodStaticCtor () { // leave this alone, it's meaning is *very* unclear ClassWithBadStaticCtor.i = 0; s = String.Empty; } int i = 0; // ignored by csc, but not [g]mcs public ClassWithGoodStaticCtor () { // don't touch 'i' inside ctor } public override string ToString () { return String.Format ("{0}: {1}", s, i); } } struct StructWithBadStaticCtor { static sbyte i; static string s; static StructWithBadStaticCtor () { i = 0; s = null; } public StructWithBadStaticCtor (sbyte sb) { // setting static fields from an instance ctor i = sb; s = String.Empty; } } struct StructWithStatic { static string s; DayOfWeek dow; public StructWithStatic (string str) { // no point in setting a default value to a static string s = null; // however all struct ctor MUST initialize all instance fields dow = DayOfWeek.Sunday; } } struct Struct { string s; DayOfWeek dow; public Struct (string str) { s = str; // all struct ctor MUST initialize all instance fields dow = DayOfWeek.Sunday; } } [Test] public void Bad () { AssertRuleFailure (".cctor", 2); AssertRuleFailure (".ctor", 1); AssertRuleFailure (".cctor", 2); AssertRuleFailure (".ctor", 1); } [Test] public void Good () { AssertRuleSuccess (".cctor"); //AssertRuleSuccess (".ctor"); AssertRuleSuccess (".ctor"); AssertRuleSuccess (".ctor"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/RemoveUnusedLocalVariablesRule.cs0000664000175000017500000001105412413742070034103 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.RemoveUnusedLocalVariablesRule // // Authors: // Sebastien Pouliot // // 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; using System.Collections; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule looks for unused local variables inside methods. This can leads to larger /// code (IL) size and longer JIT time, but note that some optimizing compilers /// can remove the locals so they won't be reported even if you can still see them in /// the source code. This could also be a typo in the source were a value is assigned /// to the wrong variable. /// /// /// Bad example: /// /// bool DualCheck () /// { /// bool b1 = true; /// bool b2 = CheckDetails (); /// if (b2) { /// // typo: a find-replace changed b1 into b2 /// b2 = CheckMoreDetails (); /// } /// return b2 && b2; /// } /// /// /// /// Good example: /// /// bool DualCheck () /// { /// bool b1 = true; /// bool b2 = CheckDetails (); /// if (b2) { /// b1 = CheckMoreDetails (); /// } /// return b1 && b2; /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("This methods contains unused local variables.")] [Solution ("Remove unused variables to reduce the method's size.")] [FxCopCompatibility ("Microsoft.Performance", "CA1804:RemoveUnusedLocals")] public class RemoveUnusedLocalVariablesRule : Rule, IMethodRule { // it does not make sense to allocate less than 16 bytes, 16 * 8 private const int DefaultLength = (16 << 3); private BitArray used; public override void Initialize (IRunner runner) { base.Initialize (runner); // this rule cannot execute if debugging information is not available Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = e.CurrentModule.HasSymbols; }; } public RuleResult CheckMethod (MethodDefinition method) { // rule does not apply to external methods (e.g. p/invokes) // and generated code (by compilers or tools) if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; MethodBody body = method.Body; if (!body.HasVariables) return RuleResult.Success; var variables = body.Variables; int count = variables.Count; if (used == null) { used = new BitArray (Math.Max (DefaultLength, count)); } else if (count > used.Length) { used = new BitArray (count); } used.SetAll (false); foreach (Instruction ins in body.Instructions) { VariableDefinition vd = ins.GetVariable (method); if (vd != null) used [vd.Index] = true; } for (int i = 0; i < count; i++) { if (!used [i]) { // sometimes the compilers generates some locals without really // using them (e.g. assign only a constant). In this case we need // to determine if the variable is "genuine" or a compiler // (*) seen in a while (true) loop over a switch VariableDefinition variable = variables [i]; if (variable.IsGeneratedName ()) continue; string s = String.Format (CultureInfo.InvariantCulture, "Variable '{0}' of type '{1}'", variable.Name, variable.VariableType.GetFullName ()); Runner.Report (method, Severity.Low, Confidence.Normal, s); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/UseTypeEmptyTypesRule.cs0000664000175000017500000000666712413742070032336 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.UseTypeEmptyTypesRule // // Authors: // Jb Evain // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule fires if a zero length array of System.Type is created. /// This value is so often required by the framework API that the System.Type includes /// an EmptyTypes field. Using this field avoids the memory allocation (and GC tracking) /// of your own array. /// /// /// Bad example: /// /// ConstructorInfo ci = type.GetConstructor (new Type[0]); /// /// /// /// Good example: /// /// ConstructorInfo ci = type.GetConstructor (Type.EmptyTypes); /// /// /// This rule is available since Gendarme 2.0 [Problem ("The method creates an empty System.Type array instead of using Type.EmptyTypes.")] [Solution ("Use Type.EmptyTypes instead of creating your own array.")] [EngineDependency (typeof (OpCodeEngine))] public class UseTypeEmptyTypesRule : Rule, IMethodRule { static OpCodeBitmask zero = new OpCodeBitmask (0x180400000, 0x0, 0x0, 0x0); public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; // check if the method creates array (Newarr) OpCodeBitmask bitmask = OpCodeEngine.GetBitmask (method); if (!bitmask.Get (Code.Newarr)) return RuleResult.DoesNotApply; // check if the method loads the 0 constant if (!bitmask.Intersect (zero)) return RuleResult.DoesNotApply; // look for array of Type creation foreach (Instruction ins in method.Body.Instructions) { if (ins.OpCode != OpCodes.Newarr) continue; if (!(ins.Operand as TypeReference).IsNamed ("System", "Type")) continue; if (ins.Previous.IsOperandZero ()) Runner.Report (method, ins, Severity.Medium, Confidence.High); } return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask zero = new OpCodeBitmask (); zero.Set (Code.Ldc_I4); zero.Set (Code.Ldc_I4_S); zero.Set (Code.Ldc_I4_0); Console.WriteLine (zero); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/Makefile.am0000664000175000017500000000555012413742070027537 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ AvoidConcatenatingCharsRule.cs \ AvoidLargeNumberOfLocalVariablesRule.cs \ AvoidLargeStructureRule.cs \ AvoidLocalDataStoreSlotRule.cs \ AvoidMethodWithLargeMaximumStackSizeRule.cs \ AvoidRepetitiveCallsToPropertiesRule.cs \ AvoidRepetitiveCastsRule.cs \ AvoidReturningArraysOnPropertiesRule.cs \ AvoidTypeGetTypeForConstantStringsRule.cs \ AvoidUncalledPrivateCodeRule.cs \ AvoidUninstantiatedInternalClassesRule.cs \ AvoidUnnecessaryOverridesRule.cs \ AvoidUnneededCallsOnStringRule.cs \ AvoidUnneededFieldInitializationRule.cs \ AvoidUnneededUnboxingRule.cs \ AvoidUnsealedConcreteAttributesRule.cs \ AvoidUnsealedUninheritedInternalClassesRule.cs \ AvoidUnusedParametersRule.cs \ AvoidUnusedPrivateFieldsRule.cs \ CompareWithStringEmptyEfficientlyRule.cs \ ConsiderCustomAccessorsForNonVisibleEventsRule.cs \ DontIgnoreMethodResultRule.cs \ EmptyDestructorRule.cs \ IDisposableWithDestructorWithoutSuppressFinalizeRule.cs \ ImplementEqualsTypeRule.cs \ MathMinMaxCandidateRule.cs \ OverrideValueTypeDefaultsRule.cs \ PreferCharOverloadRule.cs \ PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceRule.cs \ PreferLiteralOverInitOnlyFieldsRule.cs \ RemoveUnusedLocalVariablesRule.cs \ ReviewLinqMethodRule.cs \ UseIsOperatorRule.cs \ UseStringEmptyRule.cs \ UseTypeEmptyTypesRule.cs # turn off optimization for tests since gmcs (unlike MS csc) now turns "" into String.Empty when optimizing is on EXTRA_TESTS_OPTIONS += -unsafe -o- -d:CODE_ANALYSIS tests_sources = \ AvoidConcatenatingCharsTest.cs \ AvoidLargeNumberOfLocalVariablesTest.cs \ AvoidLocalDataStoreSlotTest.cs \ AvoidRepetitiveCallsToPropertiesTest.cs \ AvoidUnnecessaryOverridesTest.cs \ AvoidUnneededFieldInitializationTest.cs \ EmptyDestructorTest.cs \ GlobalSuppressions.cs \ IDisposableWithDestructorWithoutSuppressFinalizeTest.cs \ UseStringEmptyTest.cs \ UseTypeEmptyTypesTest.cs \ AvoidUnusedParametersTest.cs \ CompareWithStringEmptyEfficientlyTest.cs \ AvoidMethodWithLargeMaximumStackSizeTest.cs \ AvoidUncalledPrivateCodeTest.cs \ AvoidUnneededCallsOnStringTest.cs \ AvoidUninstantiatedInternalClassesTest.cs \ DontIgnoreMethodResultTest.cs \ AvoidReturningArraysOnPropertiesTest.cs \ AvoidUnsealedConcreteAttributesTest.cs \ UseIsOperatorTest.cs \ AvoidUnsealedUninheritedInternalClassesTest.cs \ OverrideValueTypeDefaultsTest.cs \ ImplementEqualsTypeTest.cs \ MathMinMaxCandidateTest.cs \ AvoidLargeStructureTest.cs \ RemoveUnusedLocalVariablesTest.cs \ AvoidUnneededUnboxingTest.cs \ ConsiderCustomAccessorsForNonVisibleEventsTest.cs \ AvoidTypeGetTypeForConstantStringsTest.cs \ AvoidRepetitiveCastsTest.cs \ AvoidUnusedPrivateFieldsTest.cs \ PreferCharOverloadTest.cs \ PreferInterfaceConstraintOnGenericParameterForPrimitiveInterfaceTest.cs \ PreferLiteralOverInitOnlyFieldsTest.cs \ ReviewLinqMethodTest.cs mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/UseStringEmptyRule.cs0000664000175000017500000000570312413742070031624 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.UseStringEmpty // // Authors: // Sebastien Pouliot // // Copyright (C) 2006-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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; namespace Gendarme.Rules.Performance { /// /// This rule checks for methods that are using the literal "" instead of the /// String.Empty field. You'll get slighly better performance by using /// String.Empty. Note that in some cases, e.g. in a switch/case statement, /// you cannot use a field, so "" must be used instead of String.Empty. /// /// /// Bad example: /// /// string s = ""; /// /// /// /// Good example: /// /// string s = String.Empty; /// /// [Problem ("The method uses literal \"\" instead of String.Empty.")] [Solution ("Replace the empty string literal with String.Empty.")] [EngineDependency (typeof (OpCodeEngine))] public class UseStringEmptyRule : Rule, IMethodRule { public RuleResult CheckMethod (MethodDefinition method) { // rule apply only if the method has a body (e.g. p/invokes, icalls don't) if (!method.HasBody) return RuleResult.DoesNotApply; // check if the method loads some string (Ldstr) if (!OpCodeEngine.GetBitmask (method).Get (Code.Ldstr)) return RuleResult.DoesNotApply; // *** ok, the rule applies! *** // look for string references foreach (Instruction ins in method.Body.Instructions) { switch (ins.OpCode.OperandType) { case OperandType.InlineString: string s = (ins.Operand as string); if (s.Length == 0) Runner.Report (method, ins, Severity.Medium, Confidence.High); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidUnnecessaryOverridesRule.cs0000664000175000017500000001355312413742070034031 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidUnnecessaryOverridesRule // // Authors: // N Lum // // Copyright (C) 2010 N Lum // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Framework; using Gendarme.Framework.Rocks; using Mono.Cecil; using Mono.Cecil.Cil; namespace Gendarme.Rules.Performance { /// /// This rule looks for overriding methods which just call the base method, and don't /// define any additional attributes or security declarations. /// /// /// Bad example: /// /// public override string ToString () /// { /// return base.ToString (); /// } /// /// /// /// Good example (different attributes): /// /// [FileIOPermission (SecurityAction.Demand, @"c:\dir\file")] /// public override string ToString () /// { /// return base.ToString (); /// } /// /// /// /// Good example (remove override): /// /// /*public override string ToString () /// { /// return base.ToString (); /// }*/ /// /// [Problem ("This override of a base class method is unnecessary.")] [Solution ("Remove the override method or extend the functionality of the method.")] public class AvoidUnnecessaryOverridesRule : Rule, IMethodRule { static bool IsBase (MethodReference method, MethodReference mr) { if (mr.Name != method.Name) return false; if (!mr.CompareSignature (method)) return false; TypeReference type = mr.DeclaringType; foreach (TypeDefinition baseType in method.DeclaringType.AllSuperTypes ()) { if (baseType.IsNamed (type.Namespace, type.Name)) return true; } return false; } static bool CompareCustomAttributes (ICustomAttributeProvider a, ICustomAttributeProvider b) { bool ha = a.HasCustomAttributes; bool hb = b.HasCustomAttributes; // if only one of them has custom attributes if (ha != hb) return false; // if both do not have custom attributes if (!ha && !hb) return true; // compare attributes foreach (CustomAttribute attr in a.CustomAttributes) { if (!b.CustomAttributes.Contains (attr)) return false; } return true; } static bool CompareSecurityDeclarations (ISecurityDeclarationProvider a, ISecurityDeclarationProvider b) { bool ha = a.HasSecurityDeclarations; bool hb = b.HasSecurityDeclarations; // if only one of them has custom attributes if (ha != hb) return false; // if both do not have custom attributes if (!ha && !hb) return true; // compare attributes foreach (SecurityDeclaration sd in a.SecurityDeclarations) { if (!b.SecurityDeclarations.Contains (sd)) return false; } return true; } public RuleResult CheckMethod (MethodDefinition method) { // default ctor is non-virtual // static ctor is also not virtual // abstract methods do not have a body if (!method.HasBody || !method.IsVirtual) return RuleResult.DoesNotApply; // We need to check for a simple IL code pattern. // load args (if necessary), call method, return. int i = 0; var instrs = method.Body.Instructions; Instruction ins = null; // prolog - skip over the nops and load arguments. while (i < instrs.Count) { ins = instrs [i++]; if (!ins.Is (Code.Nop) && !ins.IsLoadArgument ()) break; } // If the next instruction is not a call we are good. if (!ins.Is (Code.Call) && !ins.Is (Code.Callvirt)) return RuleResult.Success; MethodReference mr = ins.Operand as MethodReference; // check epilog - all we should have are (maybe) NOPs and RETurn // note: checked before 'base call' since it's an heavier check (that we would like to avoid) while (i < instrs.Count) { ins = instrs [i++]; switch (ins.OpCode.Code) { case Code.Nop: continue; case Code.Ret: break; case Code.Stloc_0: case Code.Br_S: case Code.Ldloc_0: // ignore CSC non-optimized extra (i.e. junk) code continue; default: return RuleResult.Success; } } // Check to make sure the call is to the base class, and the same method name... if (!IsBase (method, mr)) return RuleResult.Success; // If we've gotten this far, that means the code is just a call to the base method. // We need to check for attributes/security declarations that aren't in the // base. MethodDefinition md = mr.Resolve (); // If we can't resolve the definition of the original method, we can't get // the original attributes, so we'll say something with low confidence. if (md == null) { Runner.Report (method, Severity.Medium, Confidence.Low); return RuleResult.Success; } if (!CompareCustomAttributes (method, md) || !CompareSecurityDeclarations (method, md)) return RuleResult.Success; Runner.Report (method, Severity.Medium, Confidence.High); return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/MathMinMaxCandidateRule.cs0000664000175000017500000002051112413742070032454 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.MathMinMaxCandidateRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { // suggestion from https://bugzilla.novell.com/show_bug.cgi?id=373269 /// /// This rule checks methods for code which seems to duplicate Math.Min or /// Math.Max. The JIT can inline these methods and generate /// better code for, at least some types, than it can for a custom inline /// implementation. /// /// /// Bad example: /// /// int max = (a > b) ? a : b; /// /// /// /// Good example: /// /// int max = Math.Max (a, b); /// /// /// This rule is available since Gendarme 2.0 [Problem ("This method seems to include code duplicating Math.Min or Math.Max functionality.")] [Solution ("The JIT can (sometimes) generate better code for Math.Min and Math.Max methods than it can for hand-written versions.")] [EngineDependency (typeof (OpCodeEngine))] public class MathMinMaxCandidateRule : Rule, IMethodRule { // see inactive code to regenerate the bitmask if needed static OpCodeBitmask GreaterOrLesserThan = new OpCodeBitmask (0x787BC00000000000, 0xF, 0x0, 0x0); // note: does not include Ldind_Ref static OpCodeBitmask LoadIndirect = new OpCodeBitmask (0x0, 0x7FE0, 0x0, 0x0); // note: does not include Ldind_Ref static OpCodeBitmask StoreIndirect = new OpCodeBitmask (0x0, 0x7E0000, 0x2000000000000000, 0x0); // Math.[Min|Max] has overloads for Byte, Double, Int16, // Int32, Int64, SByte, Single, UInt16, UInt32 and Uint64 // // Note: an overload also exists for Decimal but it's // unlikely than any JIT inlines it private static bool IsSupported (TypeReference type) { if (type.Namespace != "System") return false; // GetElementType will remove the '&' for references TypeReference tr = type.GetElementType (); switch (tr.Name) { case "Byte": case "Double": case "Int16": case "Int32": case "Int64": case "SByte": case "Single": case "UInt16": case "UInt32": case "UInt64": return true; default: return false; } } // we return strings (instead of instructions) since they will be easier // to compare (ldarg_1 is easy but ldfld would need more checks) private static string GetPrevious (MethodDefinition method, ref Instruction ins) { Code code = ins.OpCode.Code; // if the opcode is a Conv_* or a Ldind_* (except for an object reference) if (OpCodeBitmask.Conversion.Get (code) || LoadIndirect.Get (code)) { ins = ins.Previous; return GetPrevious (method, ref ins); } switch (code) { case Code.Ldarg_0: if (method.HasThis) { ins = ins.Previous; return GetPrevious (method, ref ins); } if (IsSupported (method.Parameters [0].ParameterType)) return ins.OpCode.Name; break; case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: int index = code - (method.HasThis ? Code.Ldarg_1 : Code.Ldarg_0); if (IsSupported (method.Parameters [index].ParameterType)) return ins.OpCode.Name; break; case Code.Ldfld: FieldReference field = (ins.Operand as FieldReference); if (IsSupported (field.FieldType)) return field.Name; break; } return String.Empty; } private static bool IsOk (Instruction ins) { Code code = ins.OpCode.Code; // if the opcode is a Conv_*, a Ldind_* or a Stind_* (except for object references) if (OpCodeBitmask.Conversion.Get (code) || LoadIndirect.Get (code) || StoreIndirect.Get (code)) return IsOk (ins.Next); switch (code) { case Code.Ret: case Code.Stloc: case Code.Stloc_0: case Code.Stloc_1: case Code.Stloc_2: case Code.Stloc_3: case Code.Stloc_S: return true; case Code.Br: case Code.Br_S: return IsOk (ins.Operand as Instruction); default: return false; } } private static string GetNext (MethodDefinition method, Instruction ins) { switch (ins.OpCode.Code) { case Code.Ldarg_0: if (method.HasThis) { return GetNext (method, ins.Next); } if (IsOk (ins.Next)) return ins.OpCode.Name; break; case Code.Ldarg_1: case Code.Ldarg_2: case Code.Ldarg_3: if (IsOk (ins.Next)) return ins.OpCode.Name; break; case Code.Ldfld: FieldReference field = (ins.Operand as FieldReference); if (IsOk (ins.Next)) return field.Name; break; } return String.Empty; } public RuleResult CheckMethod (MethodDefinition method) { // rule applies only if the method has a body if (!method.HasBody) return RuleResult.DoesNotApply; // is there any bge*, bgt*, ble* or blt* instructions in the method ? if (!GreaterOrLesserThan.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction ins in method.Body.Instructions) { // check for specific cases like: '<', '>', '<=', '>=' if (!GreaterOrLesserThan.Get (ins.OpCode.Code)) continue; // find the two values on stack Instruction current = ins.Previous; string op1 = GetPrevious (method, ref current); if (op1.Length == 0) continue; current = current.Previous; string op2 = GetPrevious (method, ref current); if (op2.Length == 0) continue; // check value used immediately on both sides on the branch string next = GetNext (method, ins.Next); string branch = GetNext (method, ins.Operand as Instruction); // if value before and after the branch match then we have a candidate if (((op1 == next) && (op2 == branch)) || ((op2 == next) && (op1 == branch))) { Runner.Report (method, ins, Severity.Medium, Confidence.Normal); } } return Runner.CurrentRuleResult; } #if false public void BuildBitmask () { OpCodeBitmask bitmask = new OpCodeBitmask (); bitmask.Set (Code.Ldind_I); bitmask.Set (Code.Ldind_I1); bitmask.Set (Code.Ldind_I2); bitmask.Set (Code.Ldind_I4); bitmask.Set (Code.Ldind_I8); bitmask.Set (Code.Ldind_R4); bitmask.Set (Code.Ldind_R8); bitmask.Set (Code.Ldind_U1); bitmask.Set (Code.Ldind_U2); bitmask.Set (Code.Ldind_U4); Console.WriteLine ("LoadIndirect = {0}", bitmask); bitmask.ClearAll (); bitmask.Set (Code.Stind_I); bitmask.Set (Code.Stind_I1); bitmask.Set (Code.Stind_I2); bitmask.Set (Code.Stind_I4); bitmask.Set (Code.Stind_I8); bitmask.Set (Code.Stind_R4); bitmask.Set (Code.Stind_R8); Console.WriteLine ("StoreIndirect = {0}", bitmask); bitmask.ClearAll (); bitmask.Set (Code.Bge); bitmask.Set (Code.Bge_S); bitmask.Set (Code.Bge_Un); bitmask.Set (Code.Bge_Un_S); bitmask.Set (Code.Bgt); bitmask.Set (Code.Bgt_S); bitmask.Set (Code.Bgt_Un); bitmask.Set (Code.Bgt_Un_S); bitmask.Set (Code.Ble); bitmask.Set (Code.Ble_S); bitmask.Set (Code.Ble_Un); bitmask.Set (Code.Ble_Un_S); bitmask.Set (Code.Blt); bitmask.Set (Code.Blt_S); bitmask.Set (Code.Blt_Un); bitmask.Set (Code.Blt_Un_S); Console.WriteLine ("GreaterOrLesserThan = {0}", bitmask); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidRepetitiveCastsRule.cs0000664000175000017500000002316012413742070032760 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidRepetitiveCastsRule // // Authors: // Sebastien Pouliot // Jesse Jones // // 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; using System.Collections.Generic; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule fires if multiple casts are done on the same value, for the same type. /// Casts are expensive so reducing them, by changing the logic or caching the /// result, can help performance. /// /// /// Bad example: /// /// foreach (object o in list) { /// // first cast (is) /// if (o is ICollection) { /// // second cast (as) if item implements ICollection /// Process (o as ICollection); /// } /// } /// /// /// /// Good example: /// /// foreach (object o in list) { /// // a single cast (as) per item /// ICollection c = (o as ICollection); /// if (c != null) { /// SingleCast (c); /// } /// } /// /// /// /// Bad example: /// /// // first cast (is): /// if (o is IDictionary) { /// // second cast if item implements IDictionary: /// Process ((IDictionary) o); /// // first cast (is): /// } else if (o is ICollection) { /// // second cast if item implements ICollection: /// Process ((ICollection) o); /// } /// /// /// /// Good example: /// /// // a single cast (as) per item /// IDictionary dict; /// ICollection col; /// if ((dict = o as IDictionary) != null) { /// SingleCast (dict); /// } else if ((col = o as ICollection) != null) { /// SingleCast (col); /// } /// /// /// This rule is available since Gendarme 2.0 [Problem ("The method seems to repeat the same cast operation multiple times.")] [Solution ("Change the logic to ensure the (somewhat expensive) cast is done once.")] [EngineDependency (typeof (OpCodeEngine))] [FxCopCompatibility ("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] public class AvoidRepetitiveCastsRule : Rule, IMethodRule { List casts = new List (); static Instruction GetOrigin (Instruction ins) { Instruction previous = ins.Previous; Instruction origin = previous; if (previous.OpCode.FlowControl == FlowControl.Call) { Instruction next = ins.Next; if (next.IsStoreLocal ()) origin = next; // a duplicate cast which loads this local is an error } // Console.WriteLine("origin of instruction at {0:X4} is at {1:X4}", ins.Offset, origin.Offset); return origin; } static bool LocalsMatch (object operand1, object operand2) { VariableReference v1 = operand1 as VariableReference; VariableReference v2 = operand2 as VariableReference; if (v1 != null && v2 != null) return v1.Index == v2.Index; else if (operand1 != null) return operand1.Equals (operand2); else return operand2 == null; } static bool IndexesMatch (MethodDefinition method, Instruction lhs, Instruction rhs) { bool match = false; if (lhs.OpCode.Code == rhs.OpCode.Code) { switch (lhs.OpCode.Code) { case Code.Ldc_I4_M1: case Code.Ldc_I4_0: case Code.Ldc_I4_1: case Code.Ldc_I4_2: case Code.Ldc_I4_3: case Code.Ldc_I4_4: case Code.Ldc_I4_5: case Code.Ldc_I4_6: case Code.Ldc_I4_7: case Code.Ldc_I4_8: case Code.Ldc_I4_S: case Code.Ldc_I4: object operand1 = lhs.GetOperand (method); object operand2 = rhs.GetOperand (method); match = operand1.Equals (operand2); break; } } return match; } // stack[0] == index // stack[-1] == array static bool LoadElementMatch (MethodDefinition method, Instruction lhs, Instruction rhs) { bool match = false; // We only handle simple cases like: // ldarg.1 // ldc.i4.7 // ldelem.ref Instruction index1 = lhs.Previous; Instruction index2 = rhs.Previous; if (IndexesMatch (method, index1, index2)) { Instruction load1 = index1.Previous; Instruction load2 = index2.Previous; if (load1.IsLoadArgument () && load2.IsLoadArgument ()) match = load1.GetOperand (method).Equals (load2.GetOperand (method)); else if (load1.IsLoadLocal () && load2.IsLoadLocal ()) match = LocalsMatch (load1.GetOperand (method), load2.GetOperand (method)); } return match; } // stack[0] == addr static bool LoadIndirectMatch (MethodDefinition method, Instruction lhs, Instruction rhs) { bool match = false; // We only handle simple cases like: // ldarg.1 // ldind.ref Instruction load1 = lhs.Previous; Instruction load2 = rhs.Previous; if (load1.IsLoadArgument () && load2.IsLoadArgument ()) match = load1.GetOperand (method).Equals (load2.GetOperand (method)); else if (load1.IsLoadLocal () && load2.IsLoadLocal ()) match = LocalsMatch (load1.GetOperand (method), load2.GetOperand (method)); return match; } static bool OriginsMatch (MethodDefinition method, Instruction lhs, Instruction rhs) { bool match = false; object operand1 = lhs.GetOperand (method); object operand2 = rhs.GetOperand (method); if (lhs.OpCode.Code == rhs.OpCode.Code) { if (lhs.IsLoadArgument ()) match = operand1.Equals (operand2); else if (lhs.IsLoadElement ()) match = LoadElementMatch (method, lhs, rhs); else if (lhs.IsLoadIndirect ()) match = LoadIndirectMatch (method, lhs, rhs); else if (lhs.IsLoadLocal ()) match = LocalsMatch (operand1, operand2); } else if (lhs.IsStoreLocal () && rhs.IsLoadLocal ()) match = LocalsMatch (operand1, operand2); else if (lhs.IsLoadLocal () && rhs.IsStoreLocal ()) match = LocalsMatch (operand1, operand2); return match; } private int FindDuplicates (MethodDefinition method, TypeReference type, Instruction origin) { // we already had our first cast if we got here int count = 1; // don't check 0 since it's the one we compare with for (int i = 1; i < casts.Count; i++) { Instruction ins = casts [i]; if (!(ins.Operand as TypeReference).IsNamed (type.Namespace, type.Name)) continue; if (!OriginsMatch(method, origin, GetOrigin (ins))) continue; // we're removing this so we need to adjust the counter // important since we don't want duplicate reports casts.RemoveAt (i); i--; count++; } return count; } static OpCodeBitmask Casts = new OpCodeBitmask (0x0, 0x18000000000000, 0x0, 0x0); public RuleResult CheckMethod (MethodDefinition method) { // rule apply only if the method has a body (e.g. p/invokes, icalls don't) // and was not generated by the compiler or a tool (outside of developer's control) if (!method.HasBody || method.IsGeneratedCode ()) return RuleResult.DoesNotApply; // is there any IsInst or Castclass instructions in the method ? if (!Casts.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; // Console.WriteLine (); // Console.WriteLine ("-----------------------------------------"); // Console.WriteLine (new MethodPrinter(method)); foreach (Instruction ins in method.Body.Instructions) { Code code = ins.OpCode.Code; // IsInst -> if (t is T) ... // -> t = t as T; ... // Castclass -> t = (T) t; ... if ((code == Code.Isinst) || (code == Code.Castclass)) casts.Add (ins); } // if there's only one then it can't be a duplicate cast while (casts.Count > 1) { Instruction ins = casts [0]; TypeReference type = (ins.Operand as TypeReference); Instruction origin = GetOrigin (ins); int count = FindDuplicates (method, type, origin); if (count > 1) { // Console.WriteLine ("found {0} duplicates for {1:X4}", count, ins.Offset); // rare, but it's possible to cast a null value (ldnull) object name = origin.GetOperand (method) ?? "Null"; string msg = String.Format (CultureInfo.InvariantCulture, "'{0}' is casted {1} times for type '{2}'.", name, count, type.GetFullName ()); Runner.Report (method, ins, Severity.Medium, Confidence.Normal, msg); } casts.RemoveAt (0); } casts.Clear (); return Runner.CurrentRuleResult; } #if false public void Bitmask () { OpCodeBitmask casts = new OpCodeBitmask (); casts.Set (Code.Castclass); casts.Set (Code.Isinst); Console.WriteLine (casts); } #endif } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Performance/AvoidLocalDataStoreSlotRule.cs0000664000175000017500000001136012413742070033344 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Performance.AvoidLocalDataStoreSlotRule // // Authors: // Sebastien Pouliot // // 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; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Performance { /// /// This rule warns if a method use LocalDataStoreSlot to store or /// retrieve data from Thread or Context Local Storage. The faster alternative /// is to use [ThreadStatic] or [ContextStatic] attributes to avoid /// extra calls and typecasts. /// Also [ThreadStatic] is available on Silverlight while the /// LocalDataStoreSlot API are not. /// /// /// Bad example (Thread Local Storage): /// /// static void SetSharedKey (byte[] key) /// { /// LocalDataStoreSlot lds = Thread.AllocateNamedDataSlot ("shared-key"); /// lds.SetData (key.Clone ()); /// } /// /// public byte[] SignData (byte[] data) /// { /// LocalDataStoreSlot lds = Thread.GetNamedDataSlot ("shared-key"); /// using (HMACSHA1 hmac = new HMACSHA1 (Thread.GetData (lds) as byte[])) { /// return hmac.ComputeHash (data); /// } /// } /// /// /// /// Good example (Thread Local Storage): /// /// [ThreadStatic] /// static byte[] shared_key; /// /// static void SetSharedKey (byte[] key) /// { /// shared_key = (byte[]) key.Clone (); /// } /// /// public byte[] SignData (byte[] data) /// { /// using (HMACSHA1 hmac = new HMACSHA1 (shared_key)) { /// return hmac.ComputeHash (data); /// } /// } /// /// /// This rule is available since Gendarme 2.8 [Problem ("LocalDataStoreSlot is slower than the [ThreadStatic] or [ContextStatic] alternatives.")] [Solution ("Change your code to use [ThreadStatic] or [ContextStatic] attributes.")] [EngineDependency (typeof (OpCodeEngine))] public class AvoidLocalDataStoreSlotRule : Rule, IMethodRule { public override void Initialize (IRunner runner) { base.Initialize (runner); Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { // if the module does not reference System.LocalDataStoreSlot // then no method inside it will be using it Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System", "LocalDataStoreSlot"); })); }; } public RuleResult CheckMethod (MethodDefinition method) { if (!method.HasBody) return RuleResult.DoesNotApply; if (!OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) return RuleResult.DoesNotApply; foreach (Instruction current in method.Body.Instructions) { switch (current.OpCode.Code) { case Code.Call: case Code.Callvirt: MethodReference mr = (current.Operand as MethodReference); if (mr == null) continue; TypeReference type = mr.DeclaringType; switch (type.Namespace) { case "System.Threading": case "System.Runtime.Remoting.Contexts": break; default: continue; } switch (type.Name) { case "Thread": case "Context": break; default: continue; } switch (mr.Name) { case "AllocateDataSlot": case "AllocateNamedDataSlot": case "FreeNamedDataSlot": case "GetNamedDataSlot": case "GetData": case "SetData": break; default: continue; } Runner.Report (method, current, Severity.High, Confidence.Total); break; } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/0000775000175000017500000000000012642235743025054 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/ChangeLog0000664000175000017500000001561712413742070026630 0ustar00directhexdirecthex000000000000002010-05-01 Sebastien Pouliot * DoNotShortCircuitCertificateCheckRule.cs: Apply AvoidRepetitive CallsToPropertiesRule on MethodDefinition::get_Parameters 2009-08-19 Jesse Jones * StaticConstructorsShouldBePrivateRule.cs: Edited the rule description. 2009-07-07 Jesse Jones * *Rule.cs: Edited most of the rule descriptions. 2008-12-27 Sebastien Pouliot * DoNotShortCircuitCertificateCheckRule.cs: New. Rule to check ICertificatePolicy and RemoteCertificateValidationCallback implementations. * Makefile.am: Add new rule and tests to the build. 2008-12-03 Sebastien Pouliot * ArrayFieldsShouldNotBeReadOnlyRule.cs: Use HasFields * NativeFieldsShouldNotBeVisibleRule.cs: Use HasFields * StaticConstructorsShouldBePrivateRule.cs: Use HasConstructors 2008-11-07 Alan McGovern * Makefile.am: * Gendarme.Rules.Security.mdp: * Gendarme.Rules.Security.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-21 Néstor Salceda * Makefile.am: Removed common stuff in order to reduce duplication with other Makefiles. 2008-10-19 Néstor Salceda * Makefile.am: Added support for generating the documentation files to the build process. 2008-10-19 Néstor Salceda * doc/index.xml, doc/ns-Gendarme.Rules.Security.xml, doc/Gendarme.Rules.Security: With the new code in the Makefiles we don't need to keep the documentation files in the repository. 2008-10-15 Néstor Salceda * doc/: Initial import documentation for the rules which belongs to this category. 2008-09-14 Sebastien Pouliot * ArrayFieldsShouldNotBeReadOnlyRule.cs, NativeFieldsShouldNotBeVisibleRule.cs, StaticConstructorsShouldBePrivateRule.cs: Add XML documentation for the rules (then converted into media wiki format). 2008-08-29 Sebastien Pouliot * ArrayFieldsShouldNotBeReadOnlyRule.cs: Ignore delegates. Use shorter override for Runner.Report. Add [FxCopCompatibility]. * NativeFieldsShouldNotBeVisibleRule.cs: Ignore delegates. Use shorter override for Runner.Report. Add [FxCopCompatibility]. * StaticConstructorsShouldBePrivateRule.cs: Ignore delegates. Use shorter override for Runner.Report. Add [FxCopCompatibility]. 2008-08-25 Sebastien Pouliot * MethodCallWithSubsetLinkDemandRule.cs, NonVirtualMethodWithInheritanceDemandRule.cs, SealedTypeWithInheritanceDemandRule.cs, SecureGetObjectDataOverridesRule.cs, TypeExposeFieldsRule.cs, TypeIsNotSubsetOfMethodSecurityRule.cs, TypeLinkDemandRule.cs: All moved into Gendarme.Rules.Security.Cas * Makefile.am: Remove references to moved files. 2008-07-09 Sebastien Pouliot * Makefile.am: Start using ../common.make 2008-07-08 Sebastien Pouliot * Makefile.am: Rebuild if the framework has changed. 2008-04-08 Sebastien Pouliot * MethodCallWithSubsetLinkDemandRule.cs: Call Resolve before reading the PermissionSet. * SecureGetObjectDataOverridesRule.cs: Call Resolve before reading the PermissionSet. Fix bug #375368 * TypeIsNotSubsetOfMethodSecurityRule.cs: Call Resolve before reading the PermissionSet. * TypeLinkDemandRule.cs: Call Resolve before reading the PermissionSet. * Makefile.am: Add reference to Test.Rules assembly. 2008-04-08 Nestor Salceda * SecureGetObjectDataOverridesRule.cs: Fixed a typo. 2008-02-15 Sebastien Pouliot * ArrayFieldsShouldNotBeReadOnlyRule.cs * MethodCallWithSubsetLinkDemandRule.cs * NativeFieldsShouldNotBeVisibleRule.cs * NonVirtualMethodWithInheritanceDemandRule.cs * SealedTypeWithInheritanceDemandRule.cs * SecureGetObjectDataOverridesRule.cs * StaticConstructorsShouldBePrivateRule.cs * TypeExposeFieldsRule.cs * TypeIsNotSubsetOfMethodSecurityRule.cs * TypeLinkDemandRule.cs: Update rules wrt framework changes. 2008-01-21 Sebastien Pouliot * ArrayFieldsShouldNotBeReadOnlyRule.cs: New. Rule that warns about read-only array fields, since the value inside the array are not read-only [Andreas Noever] * NativeFieldsShouldNotBeVisibleRule.cs: New. Rule that warns about native, non read-only, fields since they can be directly modified [Andreas Noever]. * Gendarme.Rules.Security.xml.in: Add new rules description. * Makefile.am: Add rules/tests to the build. 2008-01-13 Sebastien Pouliot * StaticConstructorsShouldBePrivateRule.cs: New. Rule that checks for non-private static constructor in classes [Daniel Abramov] * Gendarme.Rules.Security.mdp: Add new rule in MD project. * Gendarme.Rules.Security.xml.in: Add new rule description. * Makefile.am: Add rule/test to the build. 2008-01-11 Sebastien Pouliot * MethodCallWithSubsetLinkDemandRule.cs: Use new Location ctors. 2008-01-03 Sebastien Pouliot * MethodCallWithSubsetLinkDemandRule.cs: Change Check method to static to fix warning. *.mdp: MonoDevelop removed the . before filenames :| 2007-12-16 Sebastien Pouliot * MethodCallWithSubsetLinkDemandRule.cs: Actualize one of the oldest rule to return multiple message if appropriate (and update it's use Cecil). 2007-11-30 Sebastien Pouliot * TypeIsNotSubsetOfMethodSecurityRule.cs: Refactor to reduce method size. 2007-10-07 Sebastien Pouliot * Gendarme.Rules.Security.mdp: Update project file. 2006-10-15 Sebastien Pouliot * Gendarme.Rules.Security.xml.in: Update Uri for rules (to generate more useful reports). 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-28 Christian Birkl * Gendarme.Rules.Security.csproj: Included ChangeLog * SealedTypeWithInheritanceDemandRule.cs, SecureGetObjectDataOverridesRule.cs, TypeExposeFieldsRule.cs, TypeIsNotSubsetOfMethodSecurityRule.cs, TypeLinkDemandRule.cs, MethodCallWithSubsetLinkDemandRule.cs, NonVirtualMethodWithInheritanceDemandRule.cs: Migrated untyped IList messages collection to typed MessageCollection class. 2006-09-20 Sebastien Pouliot * SecureGetObjectDataOverridesRule.cs: Update FIXME. 2006-07-31 Sebastien Pouliot * Gendarme.Rules.Security.mdp: New. Project file for MonoDevelop. 2006-06-13 Sebastien Pouliot * Makefile.am: Use -pkg:mono-nunit to reference nunit assemblies. Added self-test target to promote compliance ;-) 2006-03-01 Sebastien Pouliot * Makefile.am: Fix deps on run-test mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Makefile.in0000664000175000017500000006537512642235732027137 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Security ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)$(rules_categorydir)" \ "$(DESTDIR)$(rules_documentationdir)" SCRIPTS = $(rules_category_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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 DATA = $(rules_documentation_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/../../options.make \ $(srcdir)/../common.make $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 SUBDIRS = Test EXTRA_RULES_OPTIONS := $(GENDARME_OPTIONS) EXTRA_TESTS_OPTIONS := $(TESTS_OPTIONS) console_runner = ../../bin/gendarme.exe framework = ../../bin/Gendarme.Framework.dll common_tests = ../Test.Rules/Test.Rules.dll prefixed_rules_category = $(shell expr "$(PWD)" : '.*\(Gendarme.Rules.*\)') rules_category = $(shell echo $(prefixed_rules_category) | cut -c 16-) rules_dll = ../../bin/$(prefixed_rules_category).dll tests_dll = Test.Rules.$(rules_category).dll rules_doc_source = doc/$(prefixed_rules_category).source rules_doc_tree = doc/$(prefixed_rules_category).tree rules_doc_zip = doc/$(prefixed_rules_category).zip rules_categorydir = $(prefix)/lib/gendarme rules_category_SCRIPTS = $(rules_dll) rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = $(rules_doc) rules_sources_in = ../../AssemblyInfo.cs.in rules_generated_sources = $(rules_sources_in:.in=) rules_static = ../../AssemblyStaticInfo.cs rules_static_sources = $(addprefix $(srcdir)/, $(rules_static)) rules_build_sources = $(addprefix $(srcdir)/, $(rules_sources)) \ $(rules_generated_sources) $(rules_static_sources) EXTRA_DIST = $(rules_sources) $(rules_sources_in) $(prefixed_rules_category).csproj CLEANFILES = $(rules_dll) $(rules_dll).mdb $(tests_dll) $(tests_dll).mdb $(rules_doc) $(rules_dll).doc $(tests_dll).config DISTCLEANFILES = Makefile.in $(prefixed_rules_category).xml TestResult.xml rules_doc = $(rules_doc_zip) $(rules_doc_source) $(rules_doc_tree) generated_doc = doc/generated/index.xml tests_build_sources = $(addprefix $(srcdir)/Test/, $(tests_sources)) rules_sources = \ ArrayFieldsShouldNotBeReadOnlyRule.cs \ DoNotShortCircuitCertificateCheckRule.cs \ NativeFieldsShouldNotBeVisibleRule.cs \ StaticConstructorsShouldBePrivateRule.cs tests_sources = \ ArrayFieldsShouldNotBeReadOnlyTest.cs \ DoNotShortCircuitCertificateCheckTest.cs \ NativeFieldsShouldNotBeVisibleTest.cs \ StaticConstructorsShouldBePrivateTest.cs all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../common.make $(srcdir)/../../options.make $(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) --gnu gendarme/rules/Gendarme.Rules.Security/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Security/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; $(srcdir)/../common.make $(srcdir)/../../options.make $(am__empty): $(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-rules_categorySCRIPTS: $(rules_category_SCRIPTS) @$(NORMAL_INSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_categorydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_categorydir)" || 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)$(rules_categorydir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(rules_categorydir)$$dir" || exit $$?; \ } \ ; done uninstall-rules_categorySCRIPTS: @$(NORMAL_UNINSTALL) @list='$(rules_category_SCRIPTS)'; test -n "$(rules_categorydir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(rules_categorydir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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 $(SCRIPTS) $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(rules_categorydir)" "$(DESTDIR)$(rules_documentationdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: -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-recursive clean-am: clean-generic clean-local 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-rules_categorySCRIPTS \ install-rules_documentationDATA 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: uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-local cscopelist-am ctags \ ctags-am 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-rules_categorySCRIPTS install-rules_documentationDATA \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-am uninstall uninstall-am uninstall-rules_categorySCRIPTS \ uninstall-rules_documentationDATA .PRECIOUS: Makefile $(rules_dll): $(rules_build_sources) $(framework) $(MCS) -target:library $(EXTRA_RULES_OPTIONS) -nowarn:1591 -doc:$(rules_dll).doc \ -r:$(CECIL_ASM) -r:$(framework) -out:$@ $(rules_build_sources) $(tests_dll): $(tests_build_sources) $(rules_dll) $(EXTRA_TESTS_DEPS) $(MCS) -target:library $(EXTRA_TESTS_OPTIONS) -r:$(CECIL_ASM) -r:$(framework) \ -r:$(rules_dll) -r:$(common_tests) -pkg:mono-nunit -out:$@ $(tests_build_sources) rule: $(rules_dll) test: $(tests_dll) run-test: test cp ../../bin/gendarme.exe.config $(tests_dll).config MONO_PATH=../../bin/:../Test.Rules/:$(MONO_PATH) $(prefix)/bin/mono $(prefix)/lib/mono/4.0/nunit-console.exe $(tests_dll) self-test: $(rules_dll) mono --debug $(console_runner) $(rules_dll) $(generated_doc): $(rules_dll) mkdir -p doc mdoc update -i $(rules_dll).doc -o doc/generated $(rules_dll) touch $(generated_doc) $(rules_doc_zip): $(generated_doc) mdoc assemble -f ecma -o doc/$(prefixed_rules_category) doc/generated $(rules_doc_tree): $(generated_doc) $(rules_doc_source): echo -e "\n\n\t\n\t\n" > $(rules_doc_source) clean-local: rm -fr doc # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Security/DoNotShortCircuitCertificateCheckRule.cs0000664000175000017500000001731612413742070034722 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Security.DoNotShortCircuitCertificateCheckRule // // Authors: // Sebastien Pouliot // // 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.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; using Gendarme.Framework; using Gendarme.Framework.Engines; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security { /// /// This rule checks for methods that implements pass-through certificate checks. /// I.e. methods that override the framework decision about a certificate validity /// without checking anything specific about the supplied certificate or error code. /// Protocols like TLS/SSL are only secure if the certificates are used correctly. /// /// /// Bad example (ICertificatePolicy): /// /// public class AcceptEverythingCertificatePolicy : ICertificatePolicy { /// public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) /// { /// // this accepts everything making it easy for MITM /// // (Man-in-the-middle) attacks /// return true; /// } /// } /// /// /// /// Good example (ICertificatePolicy): /// /// public class AllowSpecificCertificatePolicy : ICertificatePolicy { /// public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) /// { /// // this accept only a specific certificate, even if others would be ok /// return (certificate.GetCertHashString () == "D62F48D013EE7FB58B79074512670D9C5B3A5DA9"); /// } /// } /// /// /// /// Bad example (RemoteCertificateValidationCallback): /// /// public bool CertificateValidationCallback (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) /// { /// // this accepts everything making it easy for MITM /// // (Man-in-the-middle) attacks /// return true; /// } /// /// SslStream ssl = new SslStream (stream, false, new RemoteCertificateValidationCallback (CertificateValidationCallback), null); /// /// /// /// Good example (RemoteCertificateValidationCallback): /// /// public bool CertificateValidationCallback (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) /// { /// // this accept only a specific certificate, even if others would be ok /// return (certificate.GetCertHashString () == "D62F48D013EE7FB58B79074512670D9C5B3A5DA9"); /// } /// /// SslStream ssl = new SslStream (stream, false, new RemoteCertificateValidationCallback (CertificateValidationCallback), null); /// /// /// This rule is available since Gendarme 2.4 [Problem ("The CheckValidationResult method inside this type looks incomplete or is a 'pass-through'.")] [Solution ("Review the certificate policy as it is likely not secure enough to be used in a public network.")] [EngineDependency (typeof (OpCodeEngine))] public sealed class DoNotShortCircuitCertificateCheckRule : Rule, IMethodRule { static readonly string [] CertificatePolicyParameters = { "System.Net.ServicePoint", "System.Security.Cryptography.X509Certificates.X509Certificate", "System.Net.WebRequest", "System.Int32" }; static readonly string [] RemoteCertificateValidationParameters = { "System.Object", "System.Security.Cryptography.X509Certificates.X509Certificate", "System.Security.Cryptography.X509Certificates.X509Chain", "System.Net.Security.SslPolicyErrors" }; public override void Initialize (IRunner runner) { base.Initialize (runner); // if the module does not reference System.Math then // none of its method is being called with constants Runner.AnalyzeModule += delegate (object o, RunnerEventArgs e) { Active = (e.CurrentAssembly.Name.Name == "mscorlib" || e.CurrentModule.AnyTypeReference ((TypeReference tr) => { return tr.IsNamed ("System.Net", "ICertificatePolicy"); }) ); }; } private RuleResult CheckArguments (MethodDefinition method, bool third) { // if the method loads argument then it could be doing "th right thing" // otherwise we already known the code is suspect if (OpCodeEngine.GetBitmask (method).Intersect (OpCodeBitmask.LoadArgument)) { foreach (Instruction ins in method.Body.Instructions) { if (ins.IsLoadArgument ()) { ParameterDefinition pd = ins.GetParameter (method); if (pd == null) continue; switch (pd.Index) { case 1: case 3: return RuleResult.Success; case 2: if (third) return RuleResult.Success; break; } } } } Runner.Report (method, Severity.High, Confidence.Normal); return RuleResult.Failure; } private RuleResult CheckPolicy (MethodDefinition method) { // since ICertificatePolicy is an interface we need to check its name string name = method.Name; if (name == "CheckValidationResult") { if (!method.DeclaringType.Implements ("System.Net", "ICertificatePolicy")) return RuleResult.Success; } else if (name != "System.Net.ICertificatePolicy.CheckValidationResult") return RuleResult.Success; // the policy is suspect if it does not touch // * the certificate parameter (2nd); and // * the certificateProblem parameter (4th) return CheckArguments (method, false); } private RuleResult CheckCallback (MethodDefinition method) { // the policy is suspect if it does not touch // * the certificate parameter (2nd); and // * the chain parameter (3rd); and // * the certificateProblem parameter (4th) return CheckArguments (method, true); } public RuleResult CheckMethod (MethodDefinition method) { if (method.IsAbstract || !method.HasParameters) return RuleResult.DoesNotApply; IList pdc = method.Parameters; int count = pdc.Count; if ((count != 4) || !method.ReturnType.IsNamed ("System", "Boolean")) return RuleResult.DoesNotApply; // this method could be a candidate for both policy or callback bool policy = true; bool callback = true; // if all the parameters match for (int i = 0; i < count; i++) { TypeReference ptype = pdc [i].ParameterType; if (policy && !ptype.IsNamed (CertificatePolicyParameters [i])) policy = false; if (callback && !ptype.IsNamed (RemoteCertificateValidationParameters [i])) callback = false; } if (policy) return CheckPolicy (method); else if (callback) return CheckCallback (method); return RuleResult.Success; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Gendarme.Rules.Security.csproj0000775000175000017500000001354112413742070032716 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {DBA3E375-ADF4-4CA3-880F-AF02DD8D5E7E} Library Properties Gendarme.Rules.Security Gendarme.Rules.Security 3.5 true v4.0 http://localhost/Gendarme.Rules.Security/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false ..\..\console\bin\Debug\ DEBUG;TRACE prompt 4 ..\..\console\bin\Debug\Gendarme.Rules.Security.xml 1591 1570 AllRules.ruleset pdbonly true ..\..\console\bin\Release\ TRACE;RELEASE prompt 4 1591 1570 ..\..\console\bin\Release\Gendarme.Rules.Security.xml AllRules.ruleset 3.5 AssemblyStaticInfo.cs {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/StaticConstructorsShouldBePrivateRule.cs0000664000175000017500000000531312413742070035066 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Security.StaticConstructorsShouldBePrivateRule // // Authors: // Daniel Abramov // // Copyright (C) 2008 Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security { /// /// This rule will fire if a type's static constructor is not private. This is a problem /// because the static constructor is meant to be called by the runtime but if it is /// not private then other code may call it as well which may lead to security /// vulnerabilities. Note that C# and VB.NET enforce this rule. /// [Problem ("Static constructors must be private because otherwise they may be called multiple times from user code.")] [Solution ("Change the static constructor access to private.")] [FxCopCompatibility ("Microsoft.Security", "CA2121:StaticConstructorsShouldBePrivate")] public class StaticConstructorsShouldBePrivateRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule does not apply to interface, enumerations or delegates if (type.IsInterface || type.IsEnum || !type.HasMethods || type.IsDelegate ()) return RuleResult.DoesNotApply; MethodDefinition private_static_ctor = null; foreach (MethodDefinition method in type.Methods) { if (method.IsStatic && !method.IsPrivate && method.IsConstructor) { private_static_ctor = method; break; // there cannot be two .cctor's so we can stop looking } } if (private_static_ctor == null) return RuleResult.Success; Runner.Report (private_static_ctor, Severity.Critical, Confidence.Total); return RuleResult.Failure; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/0000775000175000017500000000000012642235743025773 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/ChangeLog0000664000175000017500000000717612413742070027550 0ustar00directhexdirecthex000000000000002008-12-27 Sebastien Pouliot * DoNotShortCircuitCertificateCheckTest.cs: New. Unit tests for DoNotShortCircuitCertificateCheckRule. 2008-11-07 Alan McGovern * Tests.Rules.Security.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-08-29 Sebastien Pouliot * ArrayFieldsShouldNotBeReadOnlyTest.cs, NativeFieldsShouldNotBeVisibleTest.cs StaticConstructorsShouldBePrivateTest.cs: Use newer, shorter, syntax for unit tests. A bit more coverage was added. 2008-08-25 Sebastien Pouliot * MethodCallWithSubsetLinkDemandTest.cs, NonVirtualMethodWithInheritanceDemandTest.cs, SealedTypeWithInheritanceDemandTest.cs, SecureGetObjectDataOverridesTest.cs, TypeExposeFieldsTest.cs, TypeIsNotSubsetOfMethodSecurityTest.cs, TypeLinkDemandTest.cs: All moved into Gendarme.Rules.Security.Cas 2008-05-10 Sebastien Pouliot * StaticConstructorsShouldBePrivateTest.cs: Fix test since Clone is not complete enough for TestRunner. * *.cs: Add missing 'using Test.Rules.Helpers;' 2008-04-08 Sebastien Pouliot * SecureGetObjectDataOverridesTest.cs: Updated to new format. Add test cases where the enum/flag based syntax is used with declarative security. * Test.Rules.Security.mdp: Add reference to Test.Rules assembly. 2008-02-16 Sebastien Pouliot * ArrayFieldsShouldNotBeReadOnlyTest.cs: Duplicate test cases for structs. Add test case for interface. * NativeFieldsShouldNotBeVisibleTest.cs: Add test case for interface. * SecureGetObjectDataOverridesTest.cs: Add test case where we inherit from ISerializable but do not override GetObjectData. * StaticConstructorsShouldBePrivateTest.cs: Add test case for interface (no constructor). 2008-02-15 Sebastien Pouliot * ArrayFieldsShouldNotBeReadOnlyTest.cs * MethodCallWithSubsetLinkDemandTest.cs * NativeFieldsShouldNotBeVisibleTest.cs * NonVirtualMethodWithInheritanceDemandTest.cs * SealedTypeWithInheritanceDemandTest.cs * SecureGetObjectDataOverridesTest.cs * StaticConstructorsShouldBePrivateTest.cs * TypeExposeFieldsTest.cs * TypeIsNotSubsetOfMethodSecurityTest.cs * TypeLinkDemandTest.cs: Updated unit tests wrt framework changes. 2008-01-21 Sebastien Pouliot * NativeFieldsShouldNotBeVisibleTest.cs: New. Unit tests by Andreas Noever. * ArrayFieldsShouldNotBeReadOnlyTest.cs: New. Unit tests by Andreas Noever. 2008-01-13 Sebastien Pouliot * StaticConstructorsShouldBePrivateTest.cs: New unit tests by Daniel Abramov. * Test.Rules.Security.mdp: Add new unit tests to MD project. 2007-10-07 Sebastien Pouliot * Test.Rules.Security.mdp: Update project file. 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-20 Jonathan Chambers * Test.Rules.Security.csproj: Make reference to nunit.framework not a specific version for portability. 2006-07-31 Sebastien Pouliot * Test.Rules.Security.mdp: New. Project file for MonoDevelop. * NonVirtualMethodWithInheritanceDemandTest.cs: Made static methods public to avoid compiler warnings. 2006-03-01 Sebastien Pouliot * MethodCallWithSubsetLinkDemandTest.cs, NonVirtualMethodWithInheritanceDemandTest.cs, SealedTypeWithInheritanceDemandTest.cs: Conditions for success/failure were inverted when Gendarme framework was updated. mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/DoNotShortCircuitCertificateCheckTest.cs0000664000175000017500000001743012413742070035646 0ustar00directhexdirecthex00000000000000// // Unit tests for DoNotShortCircuitCertificateCheckRule // // Authors: // Sebastien Pouliot // // 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; using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; using Gendarme.Rules.Security; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Security { [TestFixture] public class DoNotShortCircuitCertificateCheckTest : MethodRuleTestFixture { public void NonBoolReturnValue (int a, int b, int c, int d) { } [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleMethods.ExternalMethod); AssertRuleDoesNotApply ("NonBoolReturnValue"); } // e.g. an application where the local time source cannot be trusted public class AllowExpiredCertificatePolicy : ICertificatePolicy { public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return ((uint) certificateProblem == ((uint) 0x800B0101)); } } // e.g. an application that is specific to a (service using a) specific certificate public class AllowSpecificCertificatePolicy : ICertificatePolicy { bool ICertificatePolicy.CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return (certificate.GetCertHashString () == "D62F48D013EE7FB58B79074512670D9C5B3A5DA9"); } } [Test] public void PolicySuccess () { AssertRuleSuccess ("CheckValidationResult"); AssertRuleSuccess ("System.Net.ICertificatePolicy.CheckValidationResult"); } public class NotImplementedCertificatePolicy : ICertificatePolicy { public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { throw new NotImplementedException (); } } public class NullCertificatePolicy : ICertificatePolicy { public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } } public class DualCertificatePolicy : ICertificatePolicy { public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } bool ICertificatePolicy.CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return (request != null); } } [Test] public void PolicyFailure () { AssertRuleFailure ("CheckValidationResult", 1); AssertRuleFailure ("CheckValidationResult", 1); AssertRuleFailure ("CheckValidationResult", 1); AssertRuleFailure ("System.Net.ICertificatePolicy.CheckValidationResult", 1); } public class DoesNotImplementICertificatePolicy { public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } } public class ImplementICertificatePolicy : ICertificatePolicy { public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } public bool CheckValidationResultFalse (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return false; } } [Test] public void PolicyMisnamed () { AssertRuleSuccess ("CheckValidationResult"); AssertRuleSuccess ("CheckValidationResultFalse"); } public interface IMyPolicy : ICertificatePolicy { string Name { get; } } abstract public class AbstractIndirectPolicy : IMyPolicy { bool result; public AbstractIndirectPolicy (bool value) { result = value; } public string Name { get { return "My Policy"; } } protected bool Result { get { return result; } } abstract public bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem); } public class IndirectPolicy : AbstractIndirectPolicy { public IndirectPolicy () : base (false) { } public override bool CheckValidationResult (ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return Result; } } [Test] public void PolicyIndirect () { AssertRuleDoesNotApply ("CheckValidationResult"); AssertRuleFailure ("CheckValidationResult", 1); } public bool AllowAnyNameRemoteCertificateValidation (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return (sslPolicyErrors == SslPolicyErrors.RemoteCertificateNameMismatch); } public bool AllowExpiredRemoteCertificateValidation (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return (chain.ChainStatus [0].Status == X509ChainStatusFlags.NotTimeValid); } public bool AllowSpecificCertificateValidation (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return (certificate.GetCertHashString () == "D62F48D013EE7FB58B79074512670D9C5B3A5DA9"); } [Test] public void CallbackSuccess () { AssertRuleSuccess ("AllowAnyNameRemoteCertificateValidation"); AssertRuleSuccess ("AllowExpiredRemoteCertificateValidation"); AssertRuleSuccess ("AllowSpecificCertificateValidation"); } public bool NotImplementedRemoteCertificateValidation (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { throw new NotImplementedException (); } public bool NullRemoteCertificateValidation (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } [Test] public void CallbackFailure () { AssertRuleFailure ("NotImplementedRemoteCertificateValidation", 1); AssertRuleFailure ("NullRemoteCertificateValidation", 1); } public bool BoolReturnValue (int a, int b, int c, int d) { return false; } [Test] public void NoneSuccess () { AssertRuleSuccess ("BoolReturnValue"); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/Makefile.in0000664000175000017500000003142612642235732030044 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/rules/Gendarme.Rules.Security/Test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Security.csproj DISTCLEANFILES = Makefile.in 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) --gnu gendarme/rules/Gendarme.Rules.Security/Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/rules/Gendarme.Rules.Security/Test/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: ctags CTAGS: cscope cscopelist: 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: 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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile all: # 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-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/StaticConstructorsShouldBePrivateTest.cs0000664000175000017500000000534712413742070036024 0ustar00directhexdirecthex00000000000000// // Unit tests for StaticConstructorsShouldBePrivateRule // // Authors: // Daniel Abramov // // Copyright (C) Daniel Abramov // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION 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; using Gendarme.Rules.Security; using Gendarme.Framework.Rocks; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; using Test.Rules.Helpers; namespace Test.Rules.Security { internal class NoStaticCtorDefinedClass { } internal class PrivateStaticCtorDefinedClass { static PrivateStaticCtorDefinedClass () { } } internal class NonPrivateStaticCtorDefinedClass { // will be modified using Cecil static NonPrivateStaticCtorDefinedClass () { } } [TestFixture] public class StaticConstructorsShouldBePrivateTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Delegate); } [Test] public void TestNoStaticCtorDefinedClass () { AssertRuleSuccess (); } [Test] public void TestPrivateStaticCtorDefinedClass () { AssertRuleSuccess (); } [Test] public void TestNonPrivateStaticCtorDefinedClass () { TypeDefinition inspectedType = DefinitionLoader.GetTypeDefinition (); MethodDefinition static_ctor = null; foreach (MethodDefinition ctor in inspectedType.Methods) { if (ctor.IsConstructor && ctor.IsStatic) { static_ctor = ctor; break; } } static_ctor.IsPublic = true; // change it from private to public AssertRuleFailure (inspectedType, 1); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/Tests.Rules.Security.csproj0000775000175000017500000001400112413742070033205 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {9E180535-E8B7-48B8-80C0-3BBFDAA67403} Library Properties Tests.Rules.Security Tests.Rules.Security 3.5 true v4.0 http://localhost/Tests.Rules.Security/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset False ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {069148AF-86AB-4EE3-BFB9-429AE722461F} Test.Rules {DBA3E375-ADF4-4CA3-880F-AF02DD8D5E7E} Gendarme.Rules.Security False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/Makefile.am0000664000175000017500000000015212413742070030015 0ustar00directhexdirecthex00000000000000EXTRA_DIST = $(addprefix $(srcdir)/, *.cs) Tests.Rules.Security.csproj DISTCLEANFILES = Makefile.in all: mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/ArrayFieldsShouldNotBeReadOnlyTest.cs0000664000175000017500000000764712413742070035142 0ustar00directhexdirecthex00000000000000// // Unit tests for ArrayFieldsShouldNotBeReadOnlyRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Security; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Security { public class HasStaticPublicReadonlyArray { public static readonly string [] Array; } public class HasPublicReadonlyArray { public readonly string [] Array; } public class HasProtectedReadonlyArray { protected readonly string [] Array; } public class HasInternalReadonlyArray { internal readonly string [] Array; } public class HasPrivateReadonlyArray { private readonly string [] Array; } public class HasNoReadonlyArray { public readonly string NoArray; } public class HasPublicArray { public string [] Array; } public struct StructHasStaticPublicReadonlyArray { public static readonly string [] Array; } public struct StructHasPublicReadonlyArray { public readonly string [] Array; } /* this does not compile public struct StructHasProtectedReadonlyArray { protected readonly string [] Array; } */ public struct StructHasInternalReadonlyArray { internal readonly string [] Array; } public struct StructHasPrivateReadonlyArray { private readonly string [] Array; } public struct StructHasNoReadonlyArray { public readonly string NoArray; } public struct StructHasPublicArray { public string [] Array; } [TestFixture] public class ArrayFieldsShouldNotBeReadOnlyTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Delegate); } [Test] public void TestHasStaticPublicReadonlyArray () { AssertRuleFailure (1); AssertRuleFailure (1); } [Test] public void TestHasPublicReadonlyArray () { AssertRuleFailure (1); AssertRuleFailure (1); } [Test] public void TestHasProtectedReadonlyArray () { AssertRuleFailure (1); } [Test] public void TestHasInternalReadonlyArray () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void TestHasPrivateReadonlyArray () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void TestHasNoReadonlyArray () { AssertRuleSuccess (); AssertRuleSuccess (); } [Test] public void TestHasPublicArray () { AssertRuleSuccess (); AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Test/NativeFieldsShouldNotBeVisibleTest.cs0000664000175000017500000000654512413742070035166 0ustar00directhexdirecthex00000000000000// // Unit tests for NativeFieldsShouldNotBeVisibleRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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 Gendarme.Rules.Security; using NUnit.Framework; using Test.Rules.Definitions; using Test.Rules.Fixtures; namespace Test.Rules.Security { public class HasPublicNativeField { public IntPtr Native; } public class HasProtectedNativeField { protected IntPtr Native; } public class HasInternalNativeField { internal IntPtr Native; } public class HasPublicReadonlyNativeField { public readonly IntPtr Native; } public class HasPublicNativeFieldArray { public IntPtr [] Native; } public class HasPublicReadonlyNativeFieldArray { public IntPtr [] Native; } public class HasPublicNativeFieldArrayArray { public IntPtr [] [] Native; } public class HasPublicNonNativeField { public object Field; } public class HasPrivateNativeField { private IntPtr Native; } [TestFixture] public class NativeFieldsShouldNotBeVisibleTest : TypeRuleTestFixture { [Test] public void DoesNotApply () { AssertRuleDoesNotApply (SimpleTypes.Interface); AssertRuleDoesNotApply (SimpleTypes.Enum); AssertRuleDoesNotApply (SimpleTypes.Delegate); } [Test] public void TestHasPublicNativeField () { AssertRuleFailure (1); } [Test] public void TestHasProtectedNativeField () { AssertRuleFailure (1); } [Test] public void TestHasInternalNativeField () { AssertRuleSuccess (); } [Test] public void TestHasPublicReadonlyNativeField () { AssertRuleSuccess (); } [Test] public void TestHasPublicNativeFieldArray () { AssertRuleFailure (1); } [Test] public void TestHasPublicReadonlyNativeFieldArray () { AssertRuleFailure (1); } [Test] public void TestHasPublicNativeFieldArrayArray () { AssertRuleFailure (1); } [Test] public void TestHasPublicNonNativeField () { AssertRuleSuccess (); } [Test] public void TestHasPrivateNativeField () { AssertRuleSuccess (); } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/ArrayFieldsShouldNotBeReadOnlyRule.cs0000664000175000017500000000643312413742070034203 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Security.ArrayFieldsShouldNotBeReadOnlyRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security { /// /// This rule warns if a type declares a public readonly array field. /// Marking a field readonly only prevents the field from being assigned /// a different value, the object itself can still be changed. This means, that /// the elements inside the array can still be changed. /// /// /// Bad example: /// /// class Bad { /// public readonly string[] Array = new string[] { "A", "B" }; /// } /// /// HasPublicReadonlyArray obj = HasPublicReadonlyArray (); /// obj.Array[0] = "B"; // valid /// /// /// /// Good example: /// /// class Good { /// private readonly string[] array = new string[] { "A", "B" }; /// public string[] GetArray () /// { /// return (string []) array.Clone(); /// } /// } /// /// string[] obj = new HasPublicReadonlyArray ().GetArray (); /// obj [0] = "B"; // valid, but has no effect on other users /// /// [Problem ("This type contains read-only array(s), however elements inside the array(s) are not read-only.")] [Solution ("Replace the array with a method returning a clone of the array or a read-only collection.")] [FxCopCompatibility ("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] public class ArrayFieldsShouldNotBeReadOnlyRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule does not apply to interface, enumerations and delegates or to types without fields if (type.IsInterface || type.IsEnum || !type.HasFields || type.IsDelegate ()) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { //IsInitOnly == readonly if (field.IsInitOnly && field.IsVisible () && field.FieldType.IsArray) { // Medium = this will work as long as no code starts "playing" with the array values Runner.Report (field, Severity.Medium, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/NativeFieldsShouldNotBeVisibleRule.cs0000664000175000017500000000611212413742070034225 0ustar00directhexdirecthex00000000000000// // Gendarme.Rules.Security.NativeFieldsShouldNotBeVisibleRule // // Authors: // Andreas Noever // // (C) 2008 Andreas Noever // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme.Rules.Security { /// /// This rule checks if a class exposes native fields. Native fields should not /// be public because you lose control over their lifetime (other code could free /// the memory or use it after it has been freed). /// /// /// Bad example: /// /// public class HasPublicNativeField { /// public IntPtr NativeField; /// } /// /// /// /// Good example (hide): /// /// class HasPrivateNativeField { /// private IntPtr NativeField; /// public void DoSomethingWithNativeField (); /// } /// /// /// /// Good example (read-only): /// /// class HasReadOnlyNativeField { /// public readonly IntPtr NativeField; /// } /// /// [Problem ("This type exposes native fields that aren't read-only.")] [Solution ("Native fields are best hidden or, if required to be exposed, read-only.")] [FxCopCompatibility ("Microsoft.Security", "CA2111:PointersShouldNotBeVisible")] public class NativeFieldsShouldNotBeVisibleRule : Rule, ITypeRule { public RuleResult CheckType (TypeDefinition type) { // rule does not apply to interface, enumerations and delegates or to types without fields if (type.IsInterface || type.IsEnum || !type.HasFields || type.IsDelegate ()) return RuleResult.DoesNotApply; foreach (FieldDefinition field in type.Fields) { if (!field.IsVisible ()) continue; //not readonly native fields or arrays of native fields if ((field.FieldType.IsNative () && !field.IsInitOnly) || (field.FieldType.IsArray && field.FieldType.GetElementType ().IsNative ())) { Runner.Report (field, Severity.Medium, Confidence.Total); } } return Runner.CurrentRuleResult; } } } mono-tools-4.2/gendarme/rules/Gendarme.Rules.Security/Makefile.am0000664000175000017500000000061712413742070027104 0ustar00directhexdirecthex00000000000000include ../common.make rules_sources = \ ArrayFieldsShouldNotBeReadOnlyRule.cs \ DoNotShortCircuitCertificateCheckRule.cs \ NativeFieldsShouldNotBeVisibleRule.cs \ StaticConstructorsShouldBePrivateRule.cs tests_sources = \ ArrayFieldsShouldNotBeReadOnlyTest.cs \ DoNotShortCircuitCertificateCheckTest.cs \ NativeFieldsShouldNotBeVisibleTest.cs \ StaticConstructorsShouldBePrivateTest.cs mono-tools-4.2/gendarme/AssemblyStaticInfo.cs0000664000175000017500000000125612413742070023367 0ustar00directhexdirecthex00000000000000// // AssemblyStaticInfo.cs for Gendarme // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-2011 Novell, Inc (http://www.novell.com) // using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Permissions; [assembly: AssemblyTitle ("Gendarme")] [assembly: AssemblyDescription ("Rule-based assembly analyzer")] [assembly: AssemblyCopyright ("Copyright (C) 2005-2011 Novell, Inc. and contributors")] [assembly: AssemblyCompany ("Novell, Inc.")] [assembly: CLSCompliant (false)] [assembly: ComVisible (false)] #if RELEASE [assembly: AssemblyVersion ("2.11.0.0")] #endif mono-tools-4.2/gendarme/gd2i.in0000664000175000017500000000013412413742070020444 0ustar00directhexdirecthex00000000000000#!/bin/sh exec @RUNTIME@ $MONO_OPTIONS $MONO_EXTRA_ARGS @prefix@/lib/gendarme/gd2i.exe "$@" mono-tools-4.2/gendarme/wix/0000775000175000017500000000000012642235743020110 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/wix/ChangeLog0000664000175000017500000000034712413742070021656 0ustar00directhexdirecthex000000000000002010-06-18 Sebastien Pouliot * Product.wxs: Fix gd2i.exe entry 2010-06-07 Sebastien Pouliot * Makefile.am: New. Do not build (Windows-only) but include files in distribution mono-tools-4.2/gendarme/wix/Makefile.in0000664000175000017500000003131412642235732022155 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/wix ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ bitmaps = \ Bitmaps/bannrbmp.bmp \ Bitmaps/dlgbmp.bmp \ Bitmaps/gendarme.ico EXTRA_DIST = wix.wixproj Product.wxs license.rtf $(bitmaps) 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) --gnu gendarme/wix/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/wix/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: ctags CTAGS: cscope cscopelist: 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: 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-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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile # Windows only - build nothing on Linux # 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-tools-4.2/gendarme/wix/license.rtf0000664000175000017500000000243312413742070022241 0ustar00directhexdirecthex00000000000000{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}} {\*\generator Msftedit 5.41.21.2508;}\viewkind4\uc1\pard\f0\fs20 Copyright (c) 2005-2011 Novell, Inc and the individuals listed on the ChangeLog entries.\par \par Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\par \par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\par \par THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\par } mono-tools-4.2/gendarme/wix/wix.wixproj0000664000175000017500000000455012413742070022337 0ustar00directhexdirecthex00000000000000 Debug x86 3.0 {5c8243b7-7234-46a6-9dec-5ac6830b5f0d} 2.0 gendarme Package $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets bin\$(Configuration)\ obj\$(Configuration)\ Debug bin\$(Configuration)\ obj\$(Configuration)\ False False False $(WixExtDir)\WixNetFxExtension.dll WixNetFxExtension $(WixExtDir)\WixUIExtension.dll WixUIExtension mono-tools-4.2/gendarme/wix/Product.wxs0000664000175000017500000001640412413742070022270 0ustar00directhexdirecthex00000000000000 INSTALLLOCATION mono-tools-4.2/gendarme/wix/Makefile.am0000664000175000017500000000026712413742070022141 0ustar00directhexdirecthex00000000000000bitmaps = \ Bitmaps/bannrbmp.bmp \ Bitmaps/dlgbmp.bmp \ Bitmaps/gendarme.ico EXTRA_DIST = wix.wixproj Product.wxs license.rtf $(bitmaps) # Windows only - build nothing on Linux mono-tools-4.2/gendarme/wix/Bitmaps/0000775000175000017500000000000012642235743021507 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/wix/Bitmaps/gendarme.ico0000664000175000017500000006152612413742070023767 0ustar00directhexdirecthex00000000000000(f hv  00@@(2.1( wTGDDpwGtDDWDDGtDDDDDwTDDDDGGtDDDDTGTDDDDGwDDDPDDDWpDDGwwwEwTDEwuwwwptDDDptDDDps333p( @upTDptDDGDDDGtDDDDpwDpTDDDDpwTDDpDDDDDGwTDDDDptDDDDDDDDDDDDHtDDDDDDDDDDDDxtDDDDDDDDDDDwwTDDDDDDDDDDGtGTDDDDDDDDDDtDGtDDDDDDDDDGDDGDDDDDDDDDDDD@wDDDDDDDDDDDptDDDDDDDDDDptDDDDDDDDGwwDDDDDDGtDDDDDGwpuDDDDDDDDEtDDDDDDDwwwtDDDDEwuDDDDWtDDDGtDDDDDDwDuwTDDDDDGxTTs333337DDDDDDDGDDDDDDDGDDDDDDDGDDDDDDDHDDDDDDDH33333338wwwwwwwx?????????( xV]hBJe?GL )L )qNU˽hCJL )L )L )P%.ŶousQXgAIW-6zY`L )L )L )L )L )f@HkFMT*3L )L )L )L )qMTiDKL )L )L )L )L )L )L )L )L )L )L ){Zazf@GL )L )L )L )L )L )L )L )L )M!*pv_7?lHO_eR'0L )L )L )L )L )L )L )L )a9AO$-L )vT[v|b;CL )L )L )L )L )L )L )L )L )L )wU\lGOqNUR(0L )L )L )L )L )e?Gou_8@L )L )L )L )L )d=EagpviDLL )L )L )L )V-5mIPtQYuRY{Y`mHPwU\y~yW^L )d>FlIPxV]e?GL )L )L )L )`9ApMTrxzX_`9APrKi{KhxMgvMetNdshq}L )L )L )L )L )L )L )oKR}]cL )L )L )L )L )L )L )pLTV5555666T( @ ѓx}tQXe?Fx}x}c=DL )L )L )mIPlrY19L )L )L )L )Q&/gmS)1L )L )L )L )L )L )qMT~P%.L )L )L )L )L )L )L )S)1zY`kFN`8@M!*̽e?GL )L )L )L )L )L )L )L )L )tQX㢊{ZamIP`9AL )L )L )L )L )uRY}\cL )L )L )L )L )L )L )L )L )L )U+4~^doKR`9AL )L )L )L )L )L )L )L )L )fAHU,4L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )P%.vSZL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )_7?xV]iDKL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )P%.yX^{hCJjpd=EL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )Y09}rNVL )L )uzf@HL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )U+4x}^6>L )L )L )}\bL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )O$-ekQ&/L )L )L )L )ms[2:L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )`8@sPWM!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )jELpv\4FL )L )L )L )L )L )L )L )L )L )L )L )O$-M"+L )L )O#,b;CoKRL )L )L )L )L )L )L )L )L )L )L )L )L )L )Y08iDLlHOmJPsPWx}iCKL )L )L )L )L )L )L )L )L )L )d=EqMUuRYuSYbFL )L )L )L )L )L )L )L )L )L )L )^6>qMUnsǸe?GL )b;BQ&/Q744456677889y˾͙Y/8L )O*5M(3L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )agL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )rNUL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )jELL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )4)))))))))))))))JAB~B~B~B~B~B~B}B}B}B}C}C}C|C|?????????(0`_exV]mHPyX_R(0L )L )L )ag}Y08L )L )L )L )L )X/7{Z`L )L )L )L )L )L )L )L )ekpMTL )L )L )L )L )L )L )L )L )Z2:oKRL )L )L )L )L )L )L )L )L )L )L )hnƭyW^L )L )L )L )L )L )L )L )L )L )L )L )]5=ͿžflxV][2:M!*rxL )L )L )L )L )L )L )L )L )L )L )L )L )L )msŵbhvTZW.6L )L )L )L )L )agR'0L )L )L )L )L )L )L )L )L )L )L )L )L )L )`9Aòy~_esPWT*3L )L )L )L )L )L )L )L )L )iDKvT[L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )qwty|[bpMTR'0L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )]5=mIPP%.L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ousPWL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )~^dM!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )oKRrxL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )vT[Ƿ}\bL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )V,5tzbhZ2:nJRsPWL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )hCJqwZ19L )L )sPWtQXL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )iDKmHPL )L )L )L )sPWwU[L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )bkqpvQ'0L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )[3;}]czƶa:BL )L )L )L )vSZ}bi}vakL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )b;C_fW-5L )L )L )vSZM!*pDzGGPʻM!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L ){ZaL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[bqwL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[a`fL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[bvTZL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[bnJQL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )}\cU+4L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )}\c{///...............-----NQ;\hu\hu\hu]gt]gt^gt^fs_fr_fs_er_eq_eq_dq`dp`dp`dp`co`coacoaboaboabnbbm????(@0٪tzioxV]ÜqNUL )L )L )L )tzd>EL )L )L )L )L )L )`9AĴ²ouM"+L )L )L )L )L )L )L )L )w}jDLL )L )L )L )L )L )L )L )L )L )c=DŵY08L )L )L )L )L )L )L )L )L )L )L )L )zW-5L )L )L )L )L )L )L )L )L )L )L )L )L )fAHɺT*3L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )}W.6L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )jFM̾~ekqNUO#,N#+ɹlGOL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ầ}flnJRM"+L )L )L )L )L )zhnL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )nJQܸ|gmkGNM!*L )L )L )L )L )L )L )L )L )wU\L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ٷ|gmhCJL )L )L )L )L )L )L )L )L )L )L )L )L )L )M"+Ϳd>FL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )qNUֵ|hnd>FL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )v|}L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|hn`9AL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )bhɺd>EL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )b;CzL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )|[bL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )O#,_eU+4L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )[3;puL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )M"+ioóagqwsyL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )_7?祎wU\L )L )hngmL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L ){Za~^dL )L )L )L )djkqL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )msКW-5L )L )L )L )L )cjmsL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )}]cĴpMTL )L )L )L )L )L )L )kqpuL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )sPW^6>L )L )L )L )L )L )L )L )tzrxL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )mHPR(0L )L )L )L )L )L )L )L )L )`gL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )Y09zL )L )L )L )L )L )L )L )L )L )O$-㥎_8@L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )wU\jpM!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )rxf@GL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ĴrwO#,L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )a:BlGOL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )jpȹzR'0L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )sPWL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )yW^˼V,5L )L )L )L )L )L )L )L )L )M!*L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )zY_L )L )L )L )S)1}\b}ekN#+L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )mIPŠflĴhnR(0L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ȞvT[N#+L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )X/8tQX|mHPL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )oKRty²Ĵ˼tyO#,L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )W.6O$-L )L )L )L )L )L )L )L )_fu{L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )S)1O$-L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )R(0ƷrwL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )M!*c=Ddjntououpurwuzv|qwtzȹmsL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )oLSy~yW^T*2L )L )L )L )L )L )L )L )L )L )L )L )L )N#+]5=pMT^egmͿ{L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )P%.~]c|lqZ19L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )uzƶ\4ioL )L )L )L )L )zX_[3;L ):Yw)!&,,./013{4v4r6o7k8gz9bu;^q;Zl=Vg>Qb?N^@JYAETCBPIDQowۤW-5L )L )O$-{Y`L )L )Tgi5@=;;9765421/.,+)('%$"!Tu{{zX_M"+L )L )K",_k]jK",L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ͿP%.L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )pvL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )ekL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )vT[L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )W.6L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )d5t5t5t5u5u5u5u4u4u4u4u4v4v4v4v4v4v4v4v3w3w3w3w3x3x3x3x3x3x3x3x5錺+ !!!!!!!!!!!!!!""""""####""ҙ׉lr|[b|\b|\b}\b}\b}\c}\c}\c}\c}\c}\c}]c}]c}]c}]c~]d~]d~]d~]d~]d~]d~^d~^d~^d~^d~^e~^e^e^e_e_e??mono-tools-4.2/gendarme/wix/Bitmaps/bannrbmp.bmp0000664000175000017500000024761012413742070024010 0ustar00directhexdirecthex00000000000000BMO6(:  ܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿܿ §§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§è²|X[rLQ²§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ijT*3BG#AilƮ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨īĭP%.CI%L )L )K'J'Ĵ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨3ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééůzyK(H$L )L )L )L )L )CŬéééééééééééééééééééééééééééééééééééééééééééééééééééêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêȳnpD J&L )L )L )L )L )L )J&O#,öêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêêĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪ˶hlAK(L )L )L )L )L )L )L )L )A}|ĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪŬȳõǯĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪĪyīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīīŭ||BL )L )L )L )L )L )L )L )L )L )I%Z09˺īīīīīīīīīīīīīƯŵëdfcFzX_koqu˶ϻϻϻϻϻϻϻϻϻϻϻϻϻϻϻϻϻϻϻϻϻлллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллɴG#K(L )L )L )L )L )L )L )L )L )L )I%J&R(1mIOv{ote>EU*3V,5S(1J&E E!G#H$H%H%H%G$E!D DB@@}\bллллллллллллллллллллл}мммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммjDJF"L )L )L )K(J'L )L )J&I%I%a9AzY_jGNfAHX.7F"I%K(K(K(L )L )L )L )L )L )L )L )L(I&F"BI%lIOźмммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммммD K(L )L(P%.X/7E!K$^*/f9?h@GvQXY.6H"I#K%L'L'L(L(L(L(L(L(L(L(L(J'G#E U+3yV[ʵмммммммммммммммммммммммaѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽÉjm@L )K(S(1lryT[vcndUe|P(0G *I!+K#-K",L!+L!*L )L(M'M&M%M$M#N"N!O#M )gAIѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѽѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾxV[AD P%.nIPZ'-XzQ%%(()))**++,,,--+CŽѿѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾѾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾҾū\`iCKX.7FTDTOp?APAHW?L[?O_>Rc=VfFBJ&L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )BʥN"+D L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J'M"*üvRXCH%L )L )L )L )L )L )L )L )J'J'L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )Djm3ʳS)2CK(L )L(J'H%D D U*3]5=N"+L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K'J&ѿĄeiE!AE!R(0hCIquy~}\bP%-K(L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )D zX]ï®txhCIP%.F"K(L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K(J'J'H%CE!ysv^6=H%DH%K(L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )H%E CJ&S)2Y18jEKkn0{Y_H%DI&K(L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L(L )mHOlr}νżĻƳO#,CK(L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L(M!*`9@d=Eb;C`8@Z19U+4R(0P%.Q'0M!*yW]ƦCI%L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J&I&I&I&J&J&I&H%H%G"M"*ĺuĽI&I&L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K(J'J&H$F"E!E!I&P%.W-5X/7S)1d>E<ěBL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K(I&F"E!O#,[2:^6>pLSchgmioioflmsmrdjrxȵüϼǿė{}CL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K(I%E!Q&/cFei}ɶF"K(L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K(G#K(e>Egl|ouvSZ^6>V-5H$E F#I&J&J&J'K'K(K(K(K(L )L(K(K'J'J'J&G$C@>qe?GF#L )L )L )L )L )L )L(L )L )L )L )L )L )J'F"R'0oMSkqflgAGR(0E G#J&J'L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K(H%CG#W-6lp8ŰBL )L )L )L )L )L )K(K(L )L )K'H$H$Y08wU[ekrPVT*2E!I%K'L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K(H$CH$\4B^d}\be=DM )F!K'L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )K'G#CI%`9Aty̹ƾN"+H$L )L )L )CzuyyU[y`jidV;GIJ M"N"N NOOOOOOOOOONN N N!N!M!FL )f@H{}ïG#G#L )L )F"xV\mIP\(-Gp(#*+,-./12~2z3w4s6p7l8h{9dw:`s;]oQb>L\AL\ӿ4ɶY09BB`9AvT[H$HUhh&,++*))('&&%%%%$$###%$ȺzY_R(0J'L'L%/fmcmJ".N M#M$M%M&M'L'L(L )L!*L"+K",K#-K$.K%/J&/J'1J'1J(3J*4H)3H*5V-5G#L )L )L'HIM'L(L(L(L(L(L(L'L'L'L'L'M'M'M'M'M&M&M&M&M&K$Q"+ƾQ&/J'L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J'S(1ҾJ'J(L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J'S(1}ŵDL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J'S)1ºUƚ~CL )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J'S)1Ļ0ʆfkD L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J'S)2ƽ_7?H%L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J&T)2ǾQ&.J'L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )L )J&T)2ǿNNOOOOOOOOOOOOOOOOOOOOOOOOOOOMW 'Ɲ-o4t5t5t4t4t4t4t4t5u5u5u4u4u4u4v4v4v4v4w4w4w4w3w3w3w3w4w4w2v;|T=%}˕puswswswtxtxtxtxtytytxtxuyuyuyuyuyuyuyvzv{wzvzv{vzwzw{x{x{vz|aamono-tools-4.2/gendarme/gendarme.sln0000775000175000017500000006006012413742070021576 0ustar00directhexdirecthex00000000000000 Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Rules", "Rules", "{7AECA932-F2A4-4B4B-8946-BAC2E13836ED}" ProjectSection(SolutionItems) = preProject rules\rules.xml = rules\rules.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Unit Tests", "Unit Tests", "{E83F7555-F98B-48D9-8CD6-1E46895F276D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cecil", "Cecil", "{10772645-2837-44B1-9CFA-51A0A5CAC635}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C8664DD7-3314-4932-ADA1-384C62568B59}" ProjectSection(SolutionItems) = preProject AssemblyInfo.cs.in = AssemblyInfo.cs.in AUTHORS = AUTHORS ChangeLog = ChangeLog MIT.X11 = MIT.X11 NEWS = NEWS README = README TODO = TODO EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Performance", "rules\Gendarme.Rules.Performance\Gendarme.Rules.Performance.csproj", "{7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Security", "rules\Gendarme.Rules.Security\Gendarme.Rules.Security.csproj", "{DBA3E375-ADF4-4CA3-880F-AF02DD8D5E7E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Portability", "rules\Gendarme.Rules.Portability\Gendarme.Rules.Portability.csproj", "{3A220513-3E53-4E13-B25D-2202F79B4C47}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Exceptions", "rules\Gendarme.Rules.Exceptions\Gendarme.Rules.Exceptions.csproj", "{BDDBA1F9-061B-45BE-86B5-98571F7B0383}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Correctness", "rules\Gendarme.Rules.Correctness\Gendarme.Rules.Correctness.csproj", "{732905E1-1FD4-403A-93DD-EC4CF120091E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Concurrency", "rules\Gendarme.Rules.Concurrency\Gendarme.Rules.Concurrency.csproj", "{B8EA91A3-27A0-4732-BA90-7B590280FF9F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Ui", "rules\Gendarme.Rules.Ui\Gendarme.Rules.Ui.csproj", "{949C4D51-4581-402A-AC18-B1B41F395FDA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.BadPractice", "rules\Gendarme.Rules.BadPractice\Gendarme.Rules.BadPractice.csproj", "{7FF6D373-551E-4C6B-98FA-D1D883FD2502}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Design", "rules\Gendarme.Rules.Design\Gendarme.Rules.Design.csproj", "{FC889577-F51A-469C-9F30-E967504E9E24}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Interoperability", "rules\Gendarme.Rules.Interoperability\Gendarme.Rules.Interoperability.csproj", "{C0E9997F-EA91-4C7A-9702-5F8215574BCA}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Naming", "rules\Gendarme.Rules.Naming\Gendarme.Rules.Naming.csproj", "{C57E2A54-3BBF-49D7-B3E5-688EE1F63250}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Smells", "rules\Gendarme.Rules.Smells\Gendarme.Rules.Smells.csproj", "{CC7BB0B5-094F-42F9-9CE7-1C33EF2B8A20}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Serialization", "rules\Gendarme.Rules.Serialization\Gendarme.Rules.Serialization.csproj", "{44885D5E-B99D-4C56-BC85-F652F11DABDC}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Maintainability", "rules\Gendarme.Rules.Maintainability\Gendarme.Rules.Maintainability.csproj", "{8DB890C9-F9B7-4BEA-9ADE-EF32391363C2}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Design.Generic", "rules\Gendarme.Rules.Design.Generic\Gendarme.Rules.Design.Generic.csproj", "{5446570C-A304-418D-B908-91ADA51E4F00}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Design.Linq", "rules\Gendarme.Rules.Design.Linq\Gendarme.Rules.Design.Linq.csproj", "{EEC7B836-DB9D-4CB3-9829-53C223C9411F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Rules.Security.Cas", "rules\Gendarme.Rules.Security.Cas\Gendarme.Rules.Security.Cas.csproj", "{237A273E-BCAF-42DB-9DE5-1697B016C648}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Performance", "rules\Gendarme.Rules.Performance\Test\Tests.Rules.Performance.csproj", "{0C697291-D955-43C8-994E-A03B6A77A21A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Security", "rules\Gendarme.Rules.Security\Test\Tests.Rules.Security.csproj", "{9E180535-E8B7-48B8-80C0-3BBFDAA67403}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Portability", "rules\Gendarme.Rules.Portability\Test\Tests.Rules.Portability.csproj", "{ED4AC7B7-BF77-495E-91F4-720082EDC8E1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Exceptions", "rules\Gendarme.Rules.Exceptions\Test\Tests.Rules.Exceptions.csproj", "{AB493443-CE45-426F-8DE9-0F1D8EBC63AF}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Correctness", "rules\Gendarme.Rules.Correctness\Test\Tests.Rules.Correctness.csproj", "{FFB3FC5E-8CC4-4360-87DB-EADC266F82A5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Concurrency", "rules\Gendarme.Rules.Concurrency\Test\Tests.Rules.Concurrency.csproj", "{77ACB4C1-95E3-42DC-980C-9A6FD506F17D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Ui", "rules\Gendarme.Rules.Ui\Test\Tests.Rules.Ui.csproj", "{D6BDE725-945A-4A16-91E2-F1B16C67D93D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.BadPractice", "rules\Gendarme.Rules.BadPractice\Test\Tests.Rules.BadPractice.csproj", "{C95DBCDA-ED1D-4B77-93CD-E27B37B84577}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Interoperability", "rules\Gendarme.Rules.Interoperability\Test\Tests.Rules.Interoperability.csproj", "{5F87F782-0D2B-48B0-9B44-373DB67D9321}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Naming", "rules\Gendarme.Rules.Naming\Test\Tests.Rules.Naming.csproj", "{B4E97DE7-FF30-485E-A2D8-7A0C596E6851}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Smells", "rules\Gendarme.Rules.Smells\Test\Tests.Rules.Smells.csproj", "{986B9EFB-7494-4410-8B01-56AB42388643}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Serialization", "rules\Gendarme.Rules.Serialization\Test\Tests.Rules.Serialization.csproj", "{558A9250-105A-4C6A-999D-1C1F85F4CB05}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Framework", "framework\Test\Tests.Framework.csproj", "{D47F1ACA-8AA6-4797-9644-57A8AFE2A86B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Design", "rules\Gendarme.Rules.Design\Test\Tests.Rules.Design.csproj", "{BC57A292-B4FC-415F-BF9A-714A5E62E0E1}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.Rules", "rules\Test.Rules\Test.Rules.csproj", "{069148AF-86AB-4EE3-BFB9-429AE722461F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Maintainability", "rules\Gendarme.Rules.Maintainability\Test\Tests.Rules.Maintainability.csproj", "{A2F3E904-8D4E-4C18-A0B9-B2BCBD3A0537}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gendarme", "console\gendarme.csproj", "{E95A3AB9-A303-4859-8BCA-458C79496548}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gendarme.Framework", "framework\Gendarme.Framework.csproj", "{CD6818D5-B398-486C-B180-92A07B143AFD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "..\..\mcs\class\Mono.Cecil\Mono.Cecil.csproj", "{D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "swf-wizard-runner", "swf-wizard-runner\swf-wizard-runner.csproj", "{3C44DF79-3FEA-4F1D-8568-8744AD92E3F9}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Design.Generic", "rules\Gendarme.Rules.Design.Generic\Test\Tests.Rules.Design.Generic.csproj", "{C3BDA065-4C29-48CA-907A-E35CE92F5F87}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6}.Debug|Any CPU.Build.0 = Debug|Any CPU {7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6}.Release|Any CPU.ActiveCfg = Release|Any CPU {7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6}.Release|Any CPU.Build.0 = Release|Any CPU {DBA3E375-ADF4-4CA3-880F-AF02DD8D5E7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DBA3E375-ADF4-4CA3-880F-AF02DD8D5E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU {DBA3E375-ADF4-4CA3-880F-AF02DD8D5E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU {DBA3E375-ADF4-4CA3-880F-AF02DD8D5E7E}.Release|Any CPU.Build.0 = Release|Any CPU {3A220513-3E53-4E13-B25D-2202F79B4C47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3A220513-3E53-4E13-B25D-2202F79B4C47}.Debug|Any CPU.Build.0 = Debug|Any CPU {3A220513-3E53-4E13-B25D-2202F79B4C47}.Release|Any CPU.ActiveCfg = Release|Any CPU {3A220513-3E53-4E13-B25D-2202F79B4C47}.Release|Any CPU.Build.0 = Release|Any CPU {BDDBA1F9-061B-45BE-86B5-98571F7B0383}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BDDBA1F9-061B-45BE-86B5-98571F7B0383}.Debug|Any CPU.Build.0 = Debug|Any CPU {BDDBA1F9-061B-45BE-86B5-98571F7B0383}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDDBA1F9-061B-45BE-86B5-98571F7B0383}.Release|Any CPU.Build.0 = Release|Any CPU {732905E1-1FD4-403A-93DD-EC4CF120091E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {732905E1-1FD4-403A-93DD-EC4CF120091E}.Debug|Any CPU.Build.0 = Debug|Any CPU {732905E1-1FD4-403A-93DD-EC4CF120091E}.Release|Any CPU.ActiveCfg = Release|Any CPU {732905E1-1FD4-403A-93DD-EC4CF120091E}.Release|Any CPU.Build.0 = Release|Any CPU {B8EA91A3-27A0-4732-BA90-7B590280FF9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B8EA91A3-27A0-4732-BA90-7B590280FF9F}.Debug|Any CPU.Build.0 = Debug|Any CPU {B8EA91A3-27A0-4732-BA90-7B590280FF9F}.Release|Any CPU.ActiveCfg = Release|Any CPU {B8EA91A3-27A0-4732-BA90-7B590280FF9F}.Release|Any CPU.Build.0 = Release|Any CPU {949C4D51-4581-402A-AC18-B1B41F395FDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {949C4D51-4581-402A-AC18-B1B41F395FDA}.Debug|Any CPU.Build.0 = Debug|Any CPU {949C4D51-4581-402A-AC18-B1B41F395FDA}.Release|Any CPU.ActiveCfg = Release|Any CPU {949C4D51-4581-402A-AC18-B1B41F395FDA}.Release|Any CPU.Build.0 = Release|Any CPU {7FF6D373-551E-4C6B-98FA-D1D883FD2502}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7FF6D373-551E-4C6B-98FA-D1D883FD2502}.Debug|Any CPU.Build.0 = Debug|Any CPU {7FF6D373-551E-4C6B-98FA-D1D883FD2502}.Release|Any CPU.ActiveCfg = Release|Any CPU {7FF6D373-551E-4C6B-98FA-D1D883FD2502}.Release|Any CPU.Build.0 = Release|Any CPU {FC889577-F51A-469C-9F30-E967504E9E24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FC889577-F51A-469C-9F30-E967504E9E24}.Debug|Any CPU.Build.0 = Debug|Any CPU {FC889577-F51A-469C-9F30-E967504E9E24}.Release|Any CPU.ActiveCfg = Release|Any CPU {FC889577-F51A-469C-9F30-E967504E9E24}.Release|Any CPU.Build.0 = Release|Any CPU {C0E9997F-EA91-4C7A-9702-5F8215574BCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C0E9997F-EA91-4C7A-9702-5F8215574BCA}.Debug|Any CPU.Build.0 = Debug|Any CPU {C0E9997F-EA91-4C7A-9702-5F8215574BCA}.Release|Any CPU.ActiveCfg = Release|Any CPU {C0E9997F-EA91-4C7A-9702-5F8215574BCA}.Release|Any CPU.Build.0 = Release|Any CPU {C57E2A54-3BBF-49D7-B3E5-688EE1F63250}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C57E2A54-3BBF-49D7-B3E5-688EE1F63250}.Debug|Any CPU.Build.0 = Debug|Any CPU {C57E2A54-3BBF-49D7-B3E5-688EE1F63250}.Release|Any CPU.ActiveCfg = Release|Any CPU {C57E2A54-3BBF-49D7-B3E5-688EE1F63250}.Release|Any CPU.Build.0 = Release|Any CPU {CC7BB0B5-094F-42F9-9CE7-1C33EF2B8A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CC7BB0B5-094F-42F9-9CE7-1C33EF2B8A20}.Debug|Any CPU.Build.0 = Debug|Any CPU {CC7BB0B5-094F-42F9-9CE7-1C33EF2B8A20}.Release|Any CPU.ActiveCfg = Release|Any CPU {CC7BB0B5-094F-42F9-9CE7-1C33EF2B8A20}.Release|Any CPU.Build.0 = Release|Any CPU {44885D5E-B99D-4C56-BC85-F652F11DABDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {44885D5E-B99D-4C56-BC85-F652F11DABDC}.Debug|Any CPU.Build.0 = Debug|Any CPU {44885D5E-B99D-4C56-BC85-F652F11DABDC}.Release|Any CPU.ActiveCfg = Release|Any CPU {44885D5E-B99D-4C56-BC85-F652F11DABDC}.Release|Any CPU.Build.0 = Release|Any CPU {8DB890C9-F9B7-4BEA-9ADE-EF32391363C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8DB890C9-F9B7-4BEA-9ADE-EF32391363C2}.Debug|Any CPU.Build.0 = Debug|Any CPU {8DB890C9-F9B7-4BEA-9ADE-EF32391363C2}.Release|Any CPU.ActiveCfg = Release|Any CPU {8DB890C9-F9B7-4BEA-9ADE-EF32391363C2}.Release|Any CPU.Build.0 = Release|Any CPU {5446570C-A304-418D-B908-91ADA51E4F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5446570C-A304-418D-B908-91ADA51E4F00}.Debug|Any CPU.Build.0 = Debug|Any CPU {5446570C-A304-418D-B908-91ADA51E4F00}.Release|Any CPU.ActiveCfg = Release|Any CPU {5446570C-A304-418D-B908-91ADA51E4F00}.Release|Any CPU.Build.0 = Release|Any CPU {EEC7B836-DB9D-4CB3-9829-53C223C9411F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EEC7B836-DB9D-4CB3-9829-53C223C9411F}.Debug|Any CPU.Build.0 = Debug|Any CPU {EEC7B836-DB9D-4CB3-9829-53C223C9411F}.Release|Any CPU.ActiveCfg = Release|Any CPU {EEC7B836-DB9D-4CB3-9829-53C223C9411F}.Release|Any CPU.Build.0 = Release|Any CPU {237A273E-BCAF-42DB-9DE5-1697B016C648}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {237A273E-BCAF-42DB-9DE5-1697B016C648}.Debug|Any CPU.Build.0 = Debug|Any CPU {237A273E-BCAF-42DB-9DE5-1697B016C648}.Release|Any CPU.ActiveCfg = Release|Any CPU {237A273E-BCAF-42DB-9DE5-1697B016C648}.Release|Any CPU.Build.0 = Release|Any CPU {0C697291-D955-43C8-994E-A03B6A77A21A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0C697291-D955-43C8-994E-A03B6A77A21A}.Debug|Any CPU.Build.0 = Debug|Any CPU {0C697291-D955-43C8-994E-A03B6A77A21A}.Release|Any CPU.ActiveCfg = Release|Any CPU {0C697291-D955-43C8-994E-A03B6A77A21A}.Release|Any CPU.Build.0 = Release|Any CPU {9E180535-E8B7-48B8-80C0-3BBFDAA67403}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9E180535-E8B7-48B8-80C0-3BBFDAA67403}.Debug|Any CPU.Build.0 = Debug|Any CPU {9E180535-E8B7-48B8-80C0-3BBFDAA67403}.Release|Any CPU.ActiveCfg = Release|Any CPU {9E180535-E8B7-48B8-80C0-3BBFDAA67403}.Release|Any CPU.Build.0 = Release|Any CPU {ED4AC7B7-BF77-495E-91F4-720082EDC8E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {ED4AC7B7-BF77-495E-91F4-720082EDC8E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {ED4AC7B7-BF77-495E-91F4-720082EDC8E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {ED4AC7B7-BF77-495E-91F4-720082EDC8E1}.Release|Any CPU.Build.0 = Release|Any CPU {AB493443-CE45-426F-8DE9-0F1D8EBC63AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AB493443-CE45-426F-8DE9-0F1D8EBC63AF}.Debug|Any CPU.Build.0 = Debug|Any CPU {AB493443-CE45-426F-8DE9-0F1D8EBC63AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {AB493443-CE45-426F-8DE9-0F1D8EBC63AF}.Release|Any CPU.Build.0 = Release|Any CPU {FFB3FC5E-8CC4-4360-87DB-EADC266F82A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FFB3FC5E-8CC4-4360-87DB-EADC266F82A5}.Debug|Any CPU.Build.0 = Debug|Any CPU {FFB3FC5E-8CC4-4360-87DB-EADC266F82A5}.Release|Any CPU.ActiveCfg = Release|Any CPU {FFB3FC5E-8CC4-4360-87DB-EADC266F82A5}.Release|Any CPU.Build.0 = Release|Any CPU {77ACB4C1-95E3-42DC-980C-9A6FD506F17D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {77ACB4C1-95E3-42DC-980C-9A6FD506F17D}.Debug|Any CPU.Build.0 = Debug|Any CPU {77ACB4C1-95E3-42DC-980C-9A6FD506F17D}.Release|Any CPU.ActiveCfg = Release|Any CPU {77ACB4C1-95E3-42DC-980C-9A6FD506F17D}.Release|Any CPU.Build.0 = Release|Any CPU {D6BDE725-945A-4A16-91E2-F1B16C67D93D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D6BDE725-945A-4A16-91E2-F1B16C67D93D}.Debug|Any CPU.Build.0 = Debug|Any CPU {D6BDE725-945A-4A16-91E2-F1B16C67D93D}.Release|Any CPU.ActiveCfg = Release|Any CPU {D6BDE725-945A-4A16-91E2-F1B16C67D93D}.Release|Any CPU.Build.0 = Release|Any CPU {C95DBCDA-ED1D-4B77-93CD-E27B37B84577}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C95DBCDA-ED1D-4B77-93CD-E27B37B84577}.Debug|Any CPU.Build.0 = Debug|Any CPU {C95DBCDA-ED1D-4B77-93CD-E27B37B84577}.Release|Any CPU.ActiveCfg = Release|Any CPU {C95DBCDA-ED1D-4B77-93CD-E27B37B84577}.Release|Any CPU.Build.0 = Release|Any CPU {5F87F782-0D2B-48B0-9B44-373DB67D9321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5F87F782-0D2B-48B0-9B44-373DB67D9321}.Debug|Any CPU.Build.0 = Debug|Any CPU {5F87F782-0D2B-48B0-9B44-373DB67D9321}.Release|Any CPU.ActiveCfg = Release|Any CPU {5F87F782-0D2B-48B0-9B44-373DB67D9321}.Release|Any CPU.Build.0 = Release|Any CPU {B4E97DE7-FF30-485E-A2D8-7A0C596E6851}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B4E97DE7-FF30-485E-A2D8-7A0C596E6851}.Debug|Any CPU.Build.0 = Debug|Any CPU {B4E97DE7-FF30-485E-A2D8-7A0C596E6851}.Release|Any CPU.ActiveCfg = Release|Any CPU {B4E97DE7-FF30-485E-A2D8-7A0C596E6851}.Release|Any CPU.Build.0 = Release|Any CPU {986B9EFB-7494-4410-8B01-56AB42388643}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {986B9EFB-7494-4410-8B01-56AB42388643}.Debug|Any CPU.Build.0 = Debug|Any CPU {986B9EFB-7494-4410-8B01-56AB42388643}.Release|Any CPU.ActiveCfg = Release|Any CPU {986B9EFB-7494-4410-8B01-56AB42388643}.Release|Any CPU.Build.0 = Release|Any CPU {558A9250-105A-4C6A-999D-1C1F85F4CB05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {558A9250-105A-4C6A-999D-1C1F85F4CB05}.Debug|Any CPU.Build.0 = Debug|Any CPU {558A9250-105A-4C6A-999D-1C1F85F4CB05}.Release|Any CPU.ActiveCfg = Release|Any CPU {558A9250-105A-4C6A-999D-1C1F85F4CB05}.Release|Any CPU.Build.0 = Release|Any CPU {D47F1ACA-8AA6-4797-9644-57A8AFE2A86B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D47F1ACA-8AA6-4797-9644-57A8AFE2A86B}.Debug|Any CPU.Build.0 = Debug|Any CPU {D47F1ACA-8AA6-4797-9644-57A8AFE2A86B}.Release|Any CPU.ActiveCfg = Release|Any CPU {D47F1ACA-8AA6-4797-9644-57A8AFE2A86B}.Release|Any CPU.Build.0 = Release|Any CPU {BC57A292-B4FC-415F-BF9A-714A5E62E0E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BC57A292-B4FC-415F-BF9A-714A5E62E0E1}.Debug|Any CPU.Build.0 = Debug|Any CPU {BC57A292-B4FC-415F-BF9A-714A5E62E0E1}.Release|Any CPU.ActiveCfg = Release|Any CPU {BC57A292-B4FC-415F-BF9A-714A5E62E0E1}.Release|Any CPU.Build.0 = Release|Any CPU {069148AF-86AB-4EE3-BFB9-429AE722461F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {069148AF-86AB-4EE3-BFB9-429AE722461F}.Debug|Any CPU.Build.0 = Debug|Any CPU {069148AF-86AB-4EE3-BFB9-429AE722461F}.Release|Any CPU.ActiveCfg = Release|Any CPU {069148AF-86AB-4EE3-BFB9-429AE722461F}.Release|Any CPU.Build.0 = Release|Any CPU {A2F3E904-8D4E-4C18-A0B9-B2BCBD3A0537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A2F3E904-8D4E-4C18-A0B9-B2BCBD3A0537}.Debug|Any CPU.Build.0 = Debug|Any CPU {A2F3E904-8D4E-4C18-A0B9-B2BCBD3A0537}.Release|Any CPU.ActiveCfg = Release|Any CPU {A2F3E904-8D4E-4C18-A0B9-B2BCBD3A0537}.Release|Any CPU.Build.0 = Release|Any CPU {E95A3AB9-A303-4859-8BCA-458C79496548}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E95A3AB9-A303-4859-8BCA-458C79496548}.Debug|Any CPU.Build.0 = Debug|Any CPU {E95A3AB9-A303-4859-8BCA-458C79496548}.Release|Any CPU.ActiveCfg = Release|Any CPU {E95A3AB9-A303-4859-8BCA-458C79496548}.Release|Any CPU.Build.0 = Release|Any CPU {CD6818D5-B398-486C-B180-92A07B143AFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CD6818D5-B398-486C-B180-92A07B143AFD}.Debug|Any CPU.Build.0 = Debug|Any CPU {CD6818D5-B398-486C-B180-92A07B143AFD}.Release|Any CPU.ActiveCfg = Release|Any CPU {CD6818D5-B398-486C-B180-92A07B143AFD}.Release|Any CPU.Build.0 = Release|Any CPU {D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}.Debug|Any CPU.Build.0 = Debug|Any CPU {D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}.Release|Any CPU.ActiveCfg = Release|Any CPU {D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE}.Release|Any CPU.Build.0 = Release|Any CPU {3C44DF79-3FEA-4F1D-8568-8744AD92E3F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3C44DF79-3FEA-4F1D-8568-8744AD92E3F9}.Debug|Any CPU.Build.0 = Debug|Any CPU {3C44DF79-3FEA-4F1D-8568-8744AD92E3F9}.Release|Any CPU.ActiveCfg = Release|Any CPU {3C44DF79-3FEA-4F1D-8568-8744AD92E3F9}.Release|Any CPU.Build.0 = Release|Any CPU {C3BDA065-4C29-48CA-907A-E35CE92F5F87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C3BDA065-4C29-48CA-907A-E35CE92F5F87}.Debug|Any CPU.Build.0 = Debug|Any CPU {C3BDA065-4C29-48CA-907A-E35CE92F5F87}.Release|Any CPU.ActiveCfg = Release|Any CPU {C3BDA065-4C29-48CA-907A-E35CE92F5F87}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {7A8D4AE7-66FA-42E0-BDCB-400D8E0ECFA6} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {DBA3E375-ADF4-4CA3-880F-AF02DD8D5E7E} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {3A220513-3E53-4E13-B25D-2202F79B4C47} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {BDDBA1F9-061B-45BE-86B5-98571F7B0383} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {732905E1-1FD4-403A-93DD-EC4CF120091E} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {B8EA91A3-27A0-4732-BA90-7B590280FF9F} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {949C4D51-4581-402A-AC18-B1B41F395FDA} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {7FF6D373-551E-4C6B-98FA-D1D883FD2502} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {FC889577-F51A-469C-9F30-E967504E9E24} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {C0E9997F-EA91-4C7A-9702-5F8215574BCA} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {C57E2A54-3BBF-49D7-B3E5-688EE1F63250} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {CC7BB0B5-094F-42F9-9CE7-1C33EF2B8A20} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {44885D5E-B99D-4C56-BC85-F652F11DABDC} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {8DB890C9-F9B7-4BEA-9ADE-EF32391363C2} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {5446570C-A304-418D-B908-91ADA51E4F00} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {EEC7B836-DB9D-4CB3-9829-53C223C9411F} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {237A273E-BCAF-42DB-9DE5-1697B016C648} = {7AECA932-F2A4-4B4B-8946-BAC2E13836ED} {0C697291-D955-43C8-994E-A03B6A77A21A} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {9E180535-E8B7-48B8-80C0-3BBFDAA67403} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {ED4AC7B7-BF77-495E-91F4-720082EDC8E1} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {AB493443-CE45-426F-8DE9-0F1D8EBC63AF} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {FFB3FC5E-8CC4-4360-87DB-EADC266F82A5} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {77ACB4C1-95E3-42DC-980C-9A6FD506F17D} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {D6BDE725-945A-4A16-91E2-F1B16C67D93D} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {C95DBCDA-ED1D-4B77-93CD-E27B37B84577} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {5F87F782-0D2B-48B0-9B44-373DB67D9321} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {B4E97DE7-FF30-485E-A2D8-7A0C596E6851} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {986B9EFB-7494-4410-8B01-56AB42388643} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {558A9250-105A-4C6A-999D-1C1F85F4CB05} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {D47F1ACA-8AA6-4797-9644-57A8AFE2A86B} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {BC57A292-B4FC-415F-BF9A-714A5E62E0E1} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {069148AF-86AB-4EE3-BFB9-429AE722461F} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {A2F3E904-8D4E-4C18-A0B9-B2BCBD3A0537} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {C3BDA065-4C29-48CA-907A-E35CE92F5F87} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {D8F63DFF-5230-43E4-9AB2-DA6E721A1FAE} = {10772645-2837-44B1-9CFA-51A0A5CAC635} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution name = gendarme version = 0.1 StartupItem = rules\Gendarme.Rules.Performance\Gendarme.Rules.Performance.csproj MonoDevelop.ChangeLogAddIn.ChangeLogInfo = $0 $0.policy = UpdateNearestChangeLog EndGlobalSection EndGlobal mono-tools-4.2/gendarme/console/0000775000175000017500000000000012642235743020743 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/console/XmlResultWriter.cs0000664000175000017500000001352012413742070024417 0ustar00directhexdirecthex00000000000000// // XmlResultWriter // // Authors: // Christian Birkl // Sebastien Pouliot // Jb Evain // Eric Zeitler // // Copyright (C) 2006 Christian Birkl // Copyright (C) 2006, 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; using System.Globalization; using System.IO; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Rocks; namespace Gendarme { public class XmlResultWriter : ResultWriter, IDisposable { private const string AssemblySet = "[across all assemblies analyzed]"; XmlWriter writer; public XmlResultWriter (IRunner runner, string fileName) : base (runner, fileName) { writer = XmlWriter.Create ( CreateWriterFor (fileName), new XmlWriterSettings { Indent = true, CloseOutput = true, CheckCharacters = false }); } static TextWriter CreateWriterFor (string fileName) { if (String.IsNullOrEmpty (fileName)) return System.Console.Out; else return new StreamWriter (fileName, false, Encoding.UTF8); } protected override void Start () { writer.WriteStartDocument (); writer.WriteStartElement ("gendarme-output"); writer.WriteAttributeString ("date", DateTime.UtcNow.ToString (CultureInfo.InvariantCulture)); } protected override void Write () { CreateFiles (); CreateRules (); CreateDefects (); } private void CreateFiles () { writer.WriteStartElement ("files"); foreach (AssemblyDefinition assembly in Runner.Assemblies) { writer.WriteStartElement ("file"); writer.WriteAttributeString ("Name", assembly.FullName); writer.WriteString (assembly.MainModule.FullyQualifiedName); writer.WriteEndElement (); } writer.WriteEndElement (); } static string GetRuleType (IRule rule) { if (rule is IAssemblyRule) return "Assembly"; if (rule is ITypeRule) return "Type"; if (rule is IMethodRule) return "Method"; return "Other"; } private void CreateRules () { writer.WriteStartElement ("rules"); foreach (var rule in Runner.Rules) { if (rule.Active) { CreateRule (rule, GetRuleType (rule)); } } writer.WriteEndElement (); } void CreateRule (IRule rule, string type) { writer.WriteStartElement ("rule"); writer.WriteAttributeString ("Name", rule.Name); writer.WriteAttributeString ("Type", type); writer.WriteAttributeString ("Uri", rule.Uri.ToString ()); writer.WriteString (rule.GetType ().FullName); writer.WriteEndElement (); } private void CreateDefects () { var query = from n in Runner.Defects group n by n.Rule into a orderby a.Key.Name select new { Rule = a.Key, Value = from o in a group o by o.Target into r orderby (r.Key.GetAssembly () == null ? String.Empty : r.Key.GetAssembly ().Name.FullName) select new { Target = r.Key, Value = r } }; writer.WriteStartElement ("results"); foreach (var value in query) { writer.WriteStartElement ("rule"); CreateRuleDetails (value.Rule); foreach (var v2 in value.Value) { writer.WriteStartElement ("target"); CreateTargetDetails (v2.Target); foreach (Defect defect in v2.Value) { CreateElement (defect); } writer.WriteEndElement (); } writer.WriteEndElement (); } writer.WriteEndElement (); } void CreateRuleDetails (IRule rule) { writer.WriteAttributeString ("Name", rule.Name); writer.WriteAttributeString ("Uri", rule.Uri.ToString ()); writer.WriteElementString ("problem", rule.Problem); writer.WriteElementString ("solution", rule.Solution); } void CreateTargetDetails (IMetadataTokenProvider target) { AssemblyDefinition assembly = target.GetAssembly (); writer.WriteAttributeString ("Name", target.ToString ()); writer.WriteAttributeString ("Assembly", assembly == null ? AssemblySet : assembly.Name.FullName); } void CreateElement (Defect defect) { writer.WriteStartElement ("defect"); writer.WriteAttributeString ("Severity", defect.Severity.ToString ()); writer.WriteAttributeString ("Confidence", defect.Confidence.ToString ()); writer.WriteAttributeString ("Location", defect.Location.ToString ()); writer.WriteAttributeString ("Source", defect.Source); writer.WriteString (defect.Text); writer.WriteEndElement (); } protected override void Finish () { writer.WriteEndElement (); writer.WriteEndDocument (); writer.Close (); } [ThreadModel (ThreadModel.SingleThread)] protected override void Dispose (bool disposing) { if (!disposing) return; if (writer != null) { (writer as IDisposable).Dispose (); writer = null; } } } } mono-tools-4.2/gendarme/console/ChangeLog0000664000175000017500000003775512413742070022526 0ustar00directhexdirecthex000000000000002010-06-28 Sebastien Pouliot * gendarme.xsl: Update styles to be closer to the current Mono wiki style - which is also closer to Gendarme's logo colors. 2010-06-23 Sebastien Pouliot * TextResultWriter.cs: Apply AvoidRedundancyInMethodNameRule, AvoidRepetitiveCallsToPropertiesRule and AvoidLackOfCohesionOfMethodsRule * XmlResultWriter.cs: Apply AvoidRedundancyInMethodNameRule 2010-06-05 Sebastien Pouliot * IgnoreFileList.cs: Add 'N' tag to ignore defects on namespaces 2010-06-04 Sebastien Pouliot * IgnoreFileList.cs: Apply AvoidUnnecessarySpecializationRule 2010-05-15 Sebastien Pouliot * IgnoreFileList.cs: Adjust for IIgnoreList changes. Avoid iterating across all analyzed code for each target (single pass). Allow * (i.e. all) as a valid value on assembly targets. 2010-05-08 Sebastien Pouliot * ConsoleRunner.cs: Better report warnings if some assembly could not be loaded (invalid format, missing .netmodule ...) 2010-05-06 Sebastien Pouliot * ConsoleRunner.cs: Delay showing results after tear down since rules can add defects at this late stage. Show the time required to tear down. * TextResultWriter.cs: Apply AvoidRepetitiveCallsToPropertiesRule on virtual calls 2010-04-10 Sebastien Pouliot * gendarme.xsl: Add "Mark of the Web" so IE does not popup about security because of our little javascript. Fix bug #594308 2010-01-23 Sebastien Pouliot * Settings.cs: Apply PreferTryParseRule 2010-01-17 Sebastien Pouliot * Options.cs: Update to latest version (2.1) 2009-08-09 Jesse Jones * ConsoleRunner.cs: Edited the --help text. 2009-07-09 Jesse Jones * ResultWriter.cs, TextResultWriter.cs, XmlResultWriter.cs, HtmlResultWriter.cs: Marked finalize and Dispose methods as threaded. 2009-03-19 Jesse Jones * ResultWriter.cs: Throws ObjectDisposedException. Protected Dispose(bool) from being called twice. 2009-02-19 Cedric Vivier * ConsoleRunner.cs: Show defect count and hint about written reports (if any). 2009-02-12 Cedric Vivier * gendarme.xsl: Use user-configured `sans' font and `em' units instead of fixed `pt'. Use a monospace font for code-related text. 2009-02-12 Cedric Vivier * ConsoleRunner.cs: Return 1 to shell if at least one defect has been found. 2009-02-12 Cedric Vivier * ConsoleRunner.cs: Do not show stacktrace and invitation to report a bug when there is an IOException (unless VerbosityLevel > 0) 2008-12-23 Cedric Vivier * gendarme.xsl: Usability improvements to the html report. 2008-12-14 Sebastien Pouliot * XmlResultWriter.cs: Let the XmlWriter encode any non-XML compliant character found in our XText elements (XLinq does not do that). 2008-12-06 Sebastien Pouliot * TextResultWriter.cs: Big memory reduction in the LINQ query by casting the IComparable enum into an IComparable Int32. Even bigger now that the query is ordered on two fields. Not sure if this has the same effect on MS LINQ or just on Mono. 2008-12-04 Jesse Jones * ConsoleRunner.cs: Times and copyright info are are no longer written if --quiet was specified. 2008-12-03 Jesse Jones * ConsoleRunner.cs: --help says "assemblies" instead of assembly. 2008-12-01 Jesse Jones * TextResultWriter.cs: Added a header and a trailer. Sorted defects by severity and then rule name. Include source files. To be consistent with the html "Details: " is now used with the defect text instead of the severity and confidence. 2008-11-22 Jesse Jones * ConsoleRunner.cs: Tweaked the status write lines to be less noisy. 2008-11-14 Jesse Jones * Makefile.am: Uses new options.make 2008-11-07 Sebastien Pouliot * TextResultWriter.cs: : Clearly specify [Serializable] on the ColorScheme enum (self-test) 2008-11-07 Alan McGovern * gendarme.csproj: Activate makefile integration for all the rules projects. Remove the old mdp files as they are no longer needed. 2008-10-21 Sebastien Pouliot * ConsoleRunner.cs: Reset all (loaded) rules as active to be reported correctly (wrt XmlResultWriter changes). The console runner only loads the rules that will be executed which is why we can activate them all before reporting. This is needed because some rules will turn themselves off if they cannot be applied to the current analysis. * XmlResultWriter.cs: Only include active rules in the report (since the wizard loads all rules, then turns off the ones not selected). 2008-10-20 Sebastien Pouliot * XmlResultWriter.cs: Fix case where a defect is reported on a namespace (which is not bound to a single assembly like other metadata objects). 2008-10-12 Sebastien Pouliot * TextResultWriter.cs: Don't initialize fields to default values inside constructors (self-test). 2008-09-15 Sebastien Pouliot * ConsoleRunner.cs: Override Initialize to start counting the time required to analyze an assembly set. This is required since the new engines are taking their time before the old counter. Switch to use Stopwatch instead of DateTime calculations. 2008-08-26 Sebastien Pouliot * ConsoleRunner.cs: Add support for --severity (default to medium+) and --confidence (default to normal+). Update help with new options. * console.mdp: Update MD project file. 2008-08-25 Sebastien Pouliot * ConsoleRunner.cs: Add support for --limit and add support for upcoming rules that will use TearDown. 2008-07-28 Sebastien Pouliot * ConsoleRunner.cs: Better display if no assemblies are specified. Don't throw an exception if the assembly name is not valid. * Settings.cs: Don't throw an exception of we cannot load a rule assembly. 2008-07-14 Sebastien Pouliot * Settings.cs: Use XmlNode over XmlElement (AvoidUnnecessary SpecializationRule) and prefer Assembly.Load to LoadFile (AvoidCallingProblematicMethodsRule). 2008-07-07 Stephane Delcroix * ConsoleRunner.cs: fix a typo 2008-06-13 Sebastien Pouliot * ConsolerRunner.cs: Add support for --version 2008-06-02 Nestor Salceda * Settings.cs: Parse the applyTo xml attribute and sets the mode to the rules. 2008-05-30 Sebastien Pouliot * gendarme.xsl: Make lists and defects collapse/hide to ease results readability. 2008-05-28 Sebastien Pouliot * Helpers.cs: New. Add helper to read files from resources. * HtmlResultWriter.cs: Make use of new helper class. * Settings.cs: Make use of new helper class. * Makefile.am: Update build file. * console.mdp: Update MD project file. 2008-05-27 Nestor Salceda * gendarme.xsd: Added the applyTo section for allowing to apply rules to different visibility scenarios. 2008-05-25 Sebastien Pouliot * XmlResultWriter.cs: Fix sorting 2008-05-18 Sebastien Pouliot * console.mdp: Refer to System.Xml.Linq from GAC (not local). Embed gendarme.xsd as a resource (like the Makefile does). * Settings.cs: Be more explicit if we don't find gendarme.xsd. 2008-05-18 Sebastien Pouliot * TextResultWriter.cs: Use String.IsNullOrEmpty (self-test) * XmlResultWriter.cs: Use String.IsNullOrEmpty (self-test) 2008-05-18 Andres G. Aragoneses * console.mdp: Fix build. 2008-05-16 Sebastien Pouliot * Settings.cs: Change GetXsdStream to static (self-test). 2008-05-14 Jb Evain * XmlResultWriter.cs: use Linq to XML to generate the report. * Makefile.am: reference System.Xml.Linq. 2008-05-11 Sebastien Pouliot * XmlResultWriter.cs: Split large Write method. 2008-05-03 Sebastien Pouliot * TextResultWriter.cs: Split large Write method. Also avoid reporting both target and location when they are identical. 2008-05-02 Sebastien Pouliot * gendarme.csproj: Embed gendarme.xsd as a resource inside the assembly. * gendarme.xsd: Fix typos. 2008-04-25 Sebastien Pouliot * gendarme.xsl: Output HTML as UTF-8 2008-04-21 Nestor Salceda * Settings.cs: Added support for allowing set properties from the XML file. 2008-04-15 Nestor Salceda * Makefile.am: Added gendarme.xsd as resource. * Settings.cs: Added validation against the xsd file. * ConsoleRunner.cs: Report errors produced by the xml configuration file. * gendarme.xsd: New. Added the xsd for validate xml configuration files. 2008-04-12 Sebastien Pouliot * ConsoleRunner.cs: Don't annotate assembly. * XmlResultWriter.cs: We don't need annotations to get the original filename of the assembly. 2008-04-12 Sebastien Pouliot * TextResultWriter.cs: By default add some colors to our display private method is used in its declaring type's nested type(s) [Cedric Vivier]. Original patch modified to a darker scheme (default) for crazy people, like me, with a light background. Change default using GENDARME_COLOR=[dark|light|none] gendarme ... 2008-04-06 Sebastien Pouliot * ConsoleRunner.cs: Report all errors using a byte (instead of an int) to satisfy ExitCodeIsLimitedOnUnixRule. Display a warning if no rule is selected for analysis (instead of displaying nothing). 2008-03-30 Sebastien Pouliot * ConsoleRunner.cs: Fix default value for 'rule_set' so that the --set command line option does not need to be specified (in this case the rule set "default" will be used). * Settings.cs: If not specified look for the "rules.xml" file that resides with the runner. 2008-03-15 Sebastien Pouliot * Options.cs: Update to version 0.2.0 * HtmlResultWriter.cs: Try harder to find the XSLT in the assembly resource files. 2008-03-04 Sebastien Pouliot * HtmlResultWriter.cs, ResultWriter.cs, TextResultWriter.cs, XmlResultWriter.cs: Rework IDisposable to reduce duplication. 2008-02-17 Sebastien Pouliot * ConsoleRunner.cs: Split with Settings and add support for ignoring defects based on a user supplied list. * IgnoreFileList.cs: New. File-based ignore list. * Settings.cs: New. Configuration support for runner. * console.mdp: Update MonoDevelop project file. * Makefile.am: Update build file. 2008-02-16 Sebastien Pouliot * ConsoleRunner.cs: Handle no arguments. Show correct timing for each assembly being processed. * XmlResultWriter.cs: Call Dispose (not Close). 2008-02-15 Sebastien Pouliot * ConsoleRunner.cs: Updated runner for the new framework (still a work in progress). * gendarme.xsl: Updated XSLT to match new XML format. * HtmlResultWriter.cs: Produce HTML reports using gendarme.xsl and the XML writer. * Makefile.am: Updated with changes. * Options.cs: Jonathan Pryor Getopt::Long-inspired option parsing library for C# * ResultWriter.cs: Renamed from IResultWriter. Now an abstract class. * TextResultWriter.cs: Updated for display more information. * XmlResultWriter.cs: Updated xml format for results. 2008-02-03 Sebastien Pouliot * gendarme.xsl: Display the correct message (not the first one) for each location. 2008-01-12 Sebastien Pouliot * ConsoleRunner.cs: Start using Gendarme.Console.Writers namespace. Change a method to static. * HtmlResultWriter.cs: Use 2.0 XslCompiledTransform (XslTransform being obsolete). Move into Gendarme.Console.Writers namespace. * IResultWriter.cs: Move into Gendarme.Console.Writers namespace. * TextResultWriter.cs: Move into Gendarme.Console.Writers namespace. * XmlResultWriter.cs: Move into Gendarme.Console.Writers namespace. * console.mdp: MD removed the "./" before the filenames 2007-11-30 Nestor Salceda * ConsoleRunner.cs: Extracted methods for avoid a long method violation from Main. 2007-11-29 Nestor Salceda * ConsoleRunner.cs: Don't ignore methods result (it fails a rule) in the self-test. 2007-11-29 Nestor Salceda * ConsoleRunner.cs: Added support for set values for some properties in the configuration XML file. 2007-11-21 Sebastien Pouliot * ConsoleRunner.cs: Ensure patterns, like * and ?, works inside the current directory. Return the full path in this case too. 2007-10-08 Sebastien Pouliot * ConsoleRunner.cs: Avoid WriteStaticFieldFromInstanceMethodRule inside runner 2007-10-07 Sebastien Pouliot * console.mdp: Now built with 2.0 rutime. 2006-10-15 Sebastien Pouliot * gendarme.xsl: Create only one new browser-window per rule. 2006-10-09 Sebastien Pouliot * ConsoleRunner.cs: Provide more information with assemblies. Fix some typos. * gendarme.xsl: Add links to mono-project.com for rules. Fix defects count on assemblies. Add defects count on rules. Ensure all defects are reported (even if the location is unknown). Display more details on where the defect are found (assembly, location). * HtmlResultWriter.cs: Update signature for assemblies. * IResultWriter.cs: Update signature for assemblies. * Makefile.am: Rebuild gendarme.exe if the XSLT file changes. * TextResultWriter.cs: Update signature for assemblies. * XmlResultWriter.cs: Add fully-qualified assembly names when outputing aasemblies. Add short-name and Uri when outputing rules. Both enables more useful HTML reports. 2006-09-28 Sebastien Pouliot * Makefile.am: Adjust EXTRA_DIST to include project files in tarballs. 2006-09-28 Christian Birkl * gendarme.csproj: Included ChangeLog * XmlResultWriter.cs, TextResultWriter.cs: Migrated untyped IList messages collection to typed MessageCollection class. 2006-09-17 Sebastien Pouliot * console.mdp: Update MonoDevelop project file * ConsoleRunner.cs: Add new options to the console runner. * HtmlResultWriter.cs: New. Output HTML reports using the XML output and the new XSL transform. * IResultWriter.cs: New. Interface for all reporters. Original code from Christian Birkl adapted/merged with existing code. * Makefile.am: Add new files to the build. * TextResultWriter.cs: New. Output text reports. Original code from Christian Birkl adapted/merged with existing code. * XmlResultWriter.cs: New. Output XML reports. Original code from Christian Birkl adapted/merged with existing code. 2006-09-17 Christian Birkl * gendarme.xsl: New. XSLT file to transform XML output into HTML. 2006-08-28 Sebastien Pouliot * ConsoleRunner.cs: Fix exception when rules.xml contains XML comments. Patch by Christian Birkl. 2006-07-31 Sebastien Pouliot * console.mdp: New. Project file for MonoDevelop. * ConsoleRunner.cs: Adjust header display when Gendarme is compiled from a MD project. 2006-06-13 Sebastien Pouliot * ConsoleRunner.cs: Read the copyright informations from the attribute in AssemblyInfo.cs file. Fix NewLineLiteralRule in LoadConfiguration method (self-test). * Makefile.am: Added self-test to promote compliance ;-) mono-tools-4.2/gendarme/console/HtmlResultWriter.cs0000664000175000017500000000465712413742070024576 0ustar00directhexdirecthex00000000000000// // HtmlResultWriter.cs // // Authors: // Sebastien Pouliot // // Copyright (C) 2006, 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; using System.IO; using System.Reflection; using System.Xml; using System.Xml.Xsl; using Gendarme.Framework; namespace Gendarme { public class HtmlResultWriter : ResultWriter { private string temp_filename; public HtmlResultWriter (IRunner runner, string fileName) : base (runner, fileName) { temp_filename = Path.GetTempFileName (); } protected override void Write() { using (XmlResultWriter writer = new XmlResultWriter (Runner, temp_filename)) { writer.Report (); } } protected override void Finish () { // load XSL file from embedded resource using (Stream s = Helpers.GetStreamFromResource ("gendarme.xsl")) { if (s == null) throw new InvalidDataException ("Could not locate XSL style sheet inside resources."); // process the XML result with the XSL file XslCompiledTransform xslt = new XslCompiledTransform (); using (XmlTextReader xmlReader = new XmlTextReader (s)) xslt.Load (xmlReader); xslt.Transform (temp_filename, FileName); } } [ThreadModel (ThreadModel.SingleThread)] protected override void Dispose (bool disposing) { if (disposing) { if (File.Exists (temp_filename)) File.Delete (temp_filename); } } } } mono-tools-4.2/gendarme/console/gendarme.xsl0000664000175000017500000001657112413742070023257 0ustar00directhexdirecthex00000000000000 : defects

:

  • None

saved from url=(0014)about:internet Gendarme Report

Gendarme Report

Produced on UTC.

Summary

Gendarme found potential defects using rules.

List of assemblies analyzed [show]

List of rules used [show]

Reported Defects

  [hide]

Problem:

Solution:

defect(s) found:

Target: 
Assembly: 

Severity:   Confidence: 
Location: 
Source: 
Details: 
Go to description

mono-tools-4.2/gendarme/console/Options.cs0000664000175000017500000007641412413742070022731 0ustar00directhexdirecthex00000000000000// // Options.cs // // Authors: // Jonathan Pryor // // Copyright (C) 2008 Novell (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. // // Compile With: // gmcs -debug+ -r:System.Core Options.cs -o:NDesk.Options.dll // gmcs -debug+ -d:LINQ -r:System.Core Options.cs -o:NDesk.Options.dll // // The LINQ version just changes the implementation of // OptionSet.Parse(IEnumerable), and confers no semantic changes. // // A Getopt::Long-inspired option parsing library for C#. // // NDesk.Options.OptionSet is built upon a key/value table, where the // key is a option format string and the value is a delegate that is // invoked when the format string is matched. // // Option format strings: // Regex-like BNF Grammar: // name: .+ // type: [=:] // sep: ( [^{}]+ | '{' .+ '}' )? // aliases: ( name type sep ) ( '|' name type sep )* // // Each '|'-delimited name is an alias for the associated action. If the // format string ends in a '=', it has a required value. If the format // string ends in a ':', it has an optional value. If neither '=' or ':' // is present, no value is supported. `=' or `:' need only be defined on one // alias, but if they are provided on more than one they must be consistent. // // Each alias portion may also end with a "key/value separator", which is used // to split option values if the option accepts > 1 value. If not specified, // it defaults to '=' and ':'. If specified, it can be any character except // '{' and '}' OR the *string* between '{' and '}'. If no separator should be // used (i.e. the separate values should be distinct arguments), then "{}" // should be used as the separator. // // Options are extracted either from the current option by looking for // the option name followed by an '=' or ':', or is taken from the // following option IFF: // - The current option does not contain a '=' or a ':' // - The current option requires a value (i.e. not a Option type of ':') // // The `name' used in the option format string does NOT include any leading // option indicator, such as '-', '--', or '/'. All three of these are // permitted/required on any named option. // // Option bundling is permitted so long as: // - '-' is used to start the option group // - all of the bundled options are a single character // - at most one of the bundled options accepts a value, and the value // provided starts from the next character to the end of the string. // // This allows specifying '-a -b -c' as '-abc', and specifying '-D name=value' // as '-Dname=value'. // // Option processing is disabled by specifying "--". All options after "--" // are returned by OptionSet.Parse() unchanged and unprocessed. // // Unprocessed options are returned from OptionSet.Parse(). // // Examples: // int verbose = 0; // OptionSet p = new OptionSet () // .Add ("v", v => ++verbose) // .Add ("name=|value=", v => Console.WriteLine (v)); // p.Parse (new string[]{"-v", "--v", "/v", "-name=A", "/name", "B", "extra"}); // // The above would parse the argument string array, and would invoke the // lambda expression three times, setting `verbose' to 3 when complete. // It would also print out "A" and "B" to standard output. // The returned array would contain the string "extra". // // C# 3.0 collection initializers are supported and encouraged: // var p = new OptionSet () { // { "h|?|help", v => ShowHelp () }, // }; // // System.ComponentModel.TypeConverter is also supported, allowing the use of // custom data types in the callback type; TypeConverter.ConvertFromString() // is used to convert the value option to an instance of the specified // type: // // var p = new OptionSet () { // { "foo=", (Foo f) => Console.WriteLine (f.ToString ()) }, // }; // // Random other tidbits: // - Boolean options (those w/o '=' or ':' in the option format string) // are explicitly enabled if they are followed with '+', and explicitly // disabled if they are followed with '-': // string a = null; // var p = new OptionSet () { // { "a", s => a = s }, // }; // p.Parse (new string[]{"-a"}); // sets v != null // p.Parse (new string[]{"-a+"}); // sets v != null // p.Parse (new string[]{"-a-"}); // sets v == null // using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Globalization; using System.IO; using System.Runtime.Serialization; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; #if LINQ using System.Linq; #endif #if TEST using NDesk.Options; #endif namespace NDesk.Options { public class OptionValueCollection : IList, IList { List values = new List (); OptionContext c; internal OptionValueCollection (OptionContext c) { this.c = c; } #region ICollection void ICollection.CopyTo (Array array, int index) {(values as ICollection).CopyTo (array, index);} bool ICollection.IsSynchronized {get {return (values as ICollection).IsSynchronized;}} object ICollection.SyncRoot {get {return (values as ICollection).SyncRoot;}} #endregion #region ICollection public void Add (string item) {values.Add (item);} public void Clear () {values.Clear ();} public bool Contains (string item) {return values.Contains (item);} public void CopyTo (string[] array, int arrayIndex) {values.CopyTo (array, arrayIndex);} public bool Remove (string item) {return values.Remove (item);} public int Count {get {return values.Count;}} public bool IsReadOnly {get {return false;}} #endregion #region IEnumerable IEnumerator IEnumerable.GetEnumerator () {return values.GetEnumerator ();} #endregion #region IEnumerable public IEnumerator GetEnumerator () {return values.GetEnumerator ();} #endregion #region IList int IList.Add (object value) {return (values as IList).Add (value);} bool IList.Contains (object value) {return (values as IList).Contains (value);} int IList.IndexOf (object value) {return (values as IList).IndexOf (value);} void IList.Insert (int index, object value) {(values as IList).Insert (index, value);} void IList.Remove (object value) {(values as IList).Remove (value);} void IList.RemoveAt (int index) {(values as IList).RemoveAt (index);} bool IList.IsFixedSize {get {return false;}} object IList.this [int index] {get {return this [index];} set {(values as IList)[index] = value;}} #endregion #region IList public int IndexOf (string item) {return values.IndexOf (item);} public void Insert (int index, string item) {values.Insert (index, item);} public void RemoveAt (int index) {values.RemoveAt (index);} private void AssertValid (int index) { if (c.Option == null) throw new InvalidOperationException ("OptionContext.Option is null."); if (index >= c.Option.MaxValueCount) throw new ArgumentOutOfRangeException ("index"); if (c.Option.OptionValueType == OptionValueType.Required && index >= values.Count) throw new OptionException (string.Format ( c.OptionSet.MessageLocalizer ("Missing required value for option '{0}'."), c.OptionName), c.OptionName); } public string this [int index] { get { AssertValid (index); return index >= values.Count ? null : values [index]; } set { values [index] = value; } } #endregion public List ToList () { return new List (values); } public string[] ToArray () { return values.ToArray (); } public override string ToString () { return string.Join (", ", values.ToArray ()); } } public class OptionContext { private Option option; private string name; private int index; private OptionSet set; private OptionValueCollection c; public OptionContext (OptionSet set) { this.set = set; this.c = new OptionValueCollection (this); } public Option Option { get {return option;} set {option = value;} } public string OptionName { get {return name;} set {name = value;} } public int OptionIndex { get {return index;} set {index = value;} } public OptionSet OptionSet { get {return set;} } public OptionValueCollection OptionValues { get {return c;} } } public enum OptionValueType { None, Optional, Required, } public abstract class Option { string prototype, description; string[] names; OptionValueType type; int count; string[] separators; protected Option (string prototype, string description) : this (prototype, description, 1) { } protected Option (string prototype, string description, int maxValueCount) { if (prototype == null) throw new ArgumentNullException ("prototype"); if (prototype.Length == 0) throw new ArgumentException ("Cannot be the empty string.", "prototype"); if (maxValueCount < 0) throw new ArgumentOutOfRangeException ("maxValueCount"); this.prototype = prototype; this.names = prototype.Split ('|'); this.description = description; this.count = maxValueCount; this.type = ParsePrototype (); if (this.count == 0 && type != OptionValueType.None) throw new ArgumentException ( "Cannot provide maxValueCount of 0 for OptionValueType.Required or " + "OptionValueType.Optional.", "maxValueCount"); if (this.type == OptionValueType.None && maxValueCount > 1) throw new ArgumentException ( string.Format ("Cannot provide maxValueCount of {0} for OptionValueType.None.", maxValueCount), "maxValueCount"); if (Array.IndexOf (names, "<>") >= 0 && ((names.Length == 1 && this.type != OptionValueType.None) || (names.Length > 1 && this.MaxValueCount > 1))) throw new ArgumentException ( "The default option handler '<>' cannot require values.", "prototype"); } public string Prototype {get {return prototype;}} public string Description {get {return description;}} public OptionValueType OptionValueType {get {return type;}} public int MaxValueCount {get {return count;}} public string[] GetNames () { return (string[]) names.Clone (); } public string[] GetValueSeparators () { if (separators == null) return new string [0]; return (string[]) separators.Clone (); } protected static T Parse (string value, OptionContext c) { TypeConverter conv = TypeDescriptor.GetConverter (typeof (T)); T t = default (T); try { if (value != null) t = (T) conv.ConvertFromString (value); } catch (Exception e) { throw new OptionException ( string.Format ( c.OptionSet.MessageLocalizer ("Could not convert string `{0}' to type {1} for option `{2}'."), value, typeof (T).Name, c.OptionName), c.OptionName, e); } return t; } internal string[] Names {get {return names;}} internal string[] ValueSeparators {get {return separators;}} static readonly char[] NameTerminator = new char[]{'=', ':'}; private OptionValueType ParsePrototype () { char type = '\0'; List seps = new List (); for (int i = 0; i < names.Length; ++i) { string name = names [i]; if (name.Length == 0) throw new ArgumentException ("Empty option names are not supported.", "prototype"); int end = name.IndexOfAny (NameTerminator); if (end == -1) continue; names [i] = name.Substring (0, end); if (type == '\0' || type == name [end]) type = name [end]; else throw new ArgumentException ( string.Format ("Conflicting option types: '{0}' vs. '{1}'.", type, name [end]), "prototype"); AddSeparators (name, end, seps); } if (type == '\0') return OptionValueType.None; if (count <= 1 && seps.Count != 0) throw new ArgumentException ( string.Format ("Cannot provide key/value separators for Options taking {0} value(s).", count), "prototype"); if (count > 1) { if (seps.Count == 0) this.separators = new string[]{":", "="}; else if (seps.Count == 1 && seps [0].Length == 0) this.separators = null; else this.separators = seps.ToArray (); } return type == '=' ? OptionValueType.Required : OptionValueType.Optional; } private static void AddSeparators (string name, int end, ICollection seps) { int start = -1; for (int i = end+1; i < name.Length; ++i) { switch (name [i]) { case '{': if (start != -1) throw new ArgumentException ( string.Format ("Ill-formed name/value separator found in \"{0}\".", name), "prototype"); start = i+1; break; case '}': if (start == -1) throw new ArgumentException ( string.Format ("Ill-formed name/value separator found in \"{0}\".", name), "prototype"); seps.Add (name.Substring (start, i-start)); start = -1; break; default: if (start == -1) seps.Add (name [i].ToString ()); break; } } if (start != -1) throw new ArgumentException ( string.Format ("Ill-formed name/value separator found in \"{0}\".", name), "prototype"); } public void Invoke (OptionContext c) { OnParseComplete (c); c.OptionName = null; c.Option = null; c.OptionValues.Clear (); } protected abstract void OnParseComplete (OptionContext c); public override string ToString () { return Prototype; } } [Serializable] public class OptionException : Exception { private string option; public OptionException () { } public OptionException (string message, string optionName) : base (message) { this.option = optionName; } public OptionException (string message, string optionName, Exception innerException) : base (message, innerException) { this.option = optionName; } protected OptionException (SerializationInfo info, StreamingContext context) : base (info, context) { this.option = info.GetString ("OptionName"); } public string OptionName { get {return this.option;} } [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)] public override void GetObjectData (SerializationInfo info, StreamingContext context) { base.GetObjectData (info, context); info.AddValue ("OptionName", option); } } public delegate void OptionAction (TKey key, TValue value); public class OptionSet : KeyedCollection { public OptionSet () : this (delegate (string f) {return f;}) { } public OptionSet (Converter localizer) { this.localizer = localizer; } Converter localizer; public Converter MessageLocalizer { get {return localizer;} } protected override string GetKeyForItem (Option item) { if (item == null) throw new ArgumentNullException ("option"); if (item.Names != null && item.Names.Length > 0) return item.Names [0]; // This should never happen, as it's invalid for Option to be // constructed w/o any names. throw new InvalidOperationException ("Option has no names!"); } [Obsolete ("Use KeyedCollection.this[string]")] protected Option GetOptionForName (string option) { if (option == null) throw new ArgumentNullException ("option"); try { return base [option]; } catch (KeyNotFoundException) { return null; } } protected override void InsertItem (int index, Option item) { base.InsertItem (index, item); AddImpl (item); } protected override void RemoveItem (int index) { base.RemoveItem (index); Option p = Items [index]; // KeyedCollection.RemoveItem() handles the 0th item for (int i = 1; i < p.Names.Length; ++i) { Dictionary.Remove (p.Names [i]); } } protected override void SetItem (int index, Option item) { base.SetItem (index, item); RemoveItem (index); AddImpl (item); } private void AddImpl (Option option) { if (option == null) throw new ArgumentNullException ("option"); List added = new List (option.Names.Length); try { // KeyedCollection.InsertItem/SetItem handle the 0th name. for (int i = 1; i < option.Names.Length; ++i) { Dictionary.Add (option.Names [i], option); added.Add (option.Names [i]); } } catch (Exception) { foreach (string name in added) Dictionary.Remove (name); throw; } } public new OptionSet Add (Option option) { base.Add (option); return this; } sealed class ActionOption : Option { Action action; public ActionOption (string prototype, string description, int count, Action action) : base (prototype, description, count) { if (action == null) throw new ArgumentNullException ("action"); this.action = action; } protected override void OnParseComplete (OptionContext c) { action (c.OptionValues); } } public OptionSet Add (string prototype, Action action) { return Add (prototype, null, action); } public OptionSet Add (string prototype, string description, Action action) { if (action == null) throw new ArgumentNullException ("action"); Option p = new ActionOption (prototype, description, 1, delegate (OptionValueCollection v) { action (v [0]); }); base.Add (p); return this; } public OptionSet Add (string prototype, OptionAction action) { return Add (prototype, null, action); } public OptionSet Add (string prototype, string description, OptionAction action) { if (action == null) throw new ArgumentNullException ("action"); Option p = new ActionOption (prototype, description, 2, delegate (OptionValueCollection v) {action (v [0], v [1]);}); base.Add (p); return this; } sealed class ActionOption : Option { Action action; public ActionOption (string prototype, string description, Action action) : base (prototype, description, 1) { if (action == null) throw new ArgumentNullException ("action"); this.action = action; } protected override void OnParseComplete (OptionContext c) { action (Parse (c.OptionValues [0], c)); } } sealed class ActionOption : Option { OptionAction action; public ActionOption (string prototype, string description, OptionAction action) : base (prototype, description, 2) { if (action == null) throw new ArgumentNullException ("action"); this.action = action; } protected override void OnParseComplete (OptionContext c) { action ( Parse (c.OptionValues [0], c), Parse (c.OptionValues [1], c)); } } public OptionSet Add (string prototype, Action action) { return Add (prototype, null, action); } public OptionSet Add (string prototype, string description, Action action) { return Add (new ActionOption (prototype, description, action)); } public OptionSet Add (string prototype, OptionAction action) { return Add (prototype, null, action); } public OptionSet Add (string prototype, string description, OptionAction action) { return Add (new ActionOption (prototype, description, action)); } protected virtual OptionContext CreateOptionContext () { return new OptionContext (this); } #if LINQ public List Parse (IEnumerable arguments) { bool process = true; OptionContext c = CreateOptionContext (); c.OptionIndex = -1; var def = GetOptionForName ("<>"); var unprocessed = from argument in arguments where ++c.OptionIndex >= 0 && (process || def != null) ? process ? argument == "--" ? (process = false) : !Parse (argument, c) ? def != null ? Unprocessed (null, def, c, argument) : true : false : def != null ? Unprocessed (null, def, c, argument) : true : true select argument; List r = unprocessed.ToList (); if (c.Option != null) c.Option.Invoke (c); return r; } #else public List Parse (IEnumerable arguments) { OptionContext c = CreateOptionContext (); c.OptionIndex = -1; bool process = true; List unprocessed = new List (); Option def = Contains ("<>") ? this ["<>"] : null; foreach (string argument in arguments) { ++c.OptionIndex; if (argument == "--") { process = false; continue; } if (!process) { Unprocessed (unprocessed, def, c, argument); continue; } if (!Parse (argument, c)) Unprocessed (unprocessed, def, c, argument); } if (c.Option != null) c.Option.Invoke (c); return unprocessed; } #endif private static bool Unprocessed (ICollection extra, Option def, OptionContext c, string argument) { if (def == null) { extra.Add (argument); return false; } c.OptionValues.Add (argument); c.Option = def; c.Option.Invoke (c); return false; } private readonly Regex ValueOption = new Regex ( @"^(?--|-|/)(?[^:=]+)((?[:=])(?.*))?$"); protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value) { if (argument == null) throw new ArgumentNullException ("argument"); flag = name = sep = value = null; Match m = ValueOption.Match (argument); if (!m.Success) { return false; } flag = m.Groups ["flag"].Value; name = m.Groups ["name"].Value; if (m.Groups ["sep"].Success && m.Groups ["value"].Success) { sep = m.Groups ["sep"].Value; value = m.Groups ["value"].Value; } return true; } protected virtual bool Parse (string argument, OptionContext c) { if (c.Option != null) { ParseValue (argument, c); return true; } string f, n, s, v; if (!GetOptionParts (argument, out f, out n, out s, out v)) return false; Option p; if (Contains (n)) { p = this [n]; c.OptionName = f + n; c.Option = p; switch (p.OptionValueType) { case OptionValueType.None: c.OptionValues.Add (n); c.Option.Invoke (c); break; case OptionValueType.Optional: case OptionValueType.Required: ParseValue (v, c); break; } return true; } // no match; is it a bool option? if (ParseBool (argument, n, c)) return true; // is it a bundled option? if (ParseBundledValue (f, string.Concat (n + s + v), c)) return true; return false; } private void ParseValue (string option, OptionContext c) { if (option != null) foreach (string o in c.Option.ValueSeparators != null ? option.Split (c.Option.ValueSeparators, StringSplitOptions.None) : new string[]{option}) { c.OptionValues.Add (o); } if (c.OptionValues.Count == c.Option.MaxValueCount || c.Option.OptionValueType == OptionValueType.Optional) c.Option.Invoke (c); else if (c.OptionValues.Count > c.Option.MaxValueCount) { throw new OptionException (localizer (string.Format ( "Error: Found {0} option values when expecting {1}.", c.OptionValues.Count, c.Option.MaxValueCount)), c.OptionName); } } private bool ParseBool (string option, string n, OptionContext c) { Option p; string rn; if (n.Length >= 1 && (n [n.Length-1] == '+' || n [n.Length-1] == '-') && Contains ((rn = n.Substring (0, n.Length-1)))) { p = this [rn]; string v = n [n.Length-1] == '+' ? option : null; c.OptionName = option; c.Option = p; c.OptionValues.Add (v); p.Invoke (c); return true; } return false; } private bool ParseBundledValue (string f, string n, OptionContext c) { if (f != "-") return false; for (int i = 0; i < n.Length; ++i) { Option p; string opt = f + n [i].ToString (); string rn = n [i].ToString (); if (!Contains (rn)) { if (i == 0) return false; throw new OptionException (string.Format (localizer ( "Cannot bundle unregistered option '{0}'."), opt), opt); } p = this [rn]; switch (p.OptionValueType) { case OptionValueType.None: Invoke (c, opt, n, p); break; case OptionValueType.Optional: case OptionValueType.Required: { string v = n.Substring (i+1); c.Option = p; c.OptionName = opt; ParseValue (v.Length != 0 ? v : null, c); return true; } default: throw new InvalidOperationException ("Unknown OptionValueType: " + p.OptionValueType); } } return true; } private static void Invoke (OptionContext c, string name, string value, Option option) { c.OptionName = name; c.Option = option; c.OptionValues.Add (value); option.Invoke (c); } private const int OptionWidth = 29; public void WriteOptionDescriptions (TextWriter o) { foreach (Option p in this) { int written = 0; if (!WriteOptionPrototype (o, p, ref written)) continue; if (written < OptionWidth) o.Write (new string (' ', OptionWidth - written)); else { o.WriteLine (); o.Write (new string (' ', OptionWidth)); } List lines = GetLines (localizer (GetDescription (p.Description))); o.WriteLine (lines [0]); string prefix = new string (' ', OptionWidth+2); for (int i = 1; i < lines.Count; ++i) { o.Write (prefix); o.WriteLine (lines [i]); } } } bool WriteOptionPrototype (TextWriter o, Option p, ref int written) { string[] names = p.Names; int i = GetNextOptionIndex (names, 0); if (i == names.Length) return false; if (names [i].Length == 1) { Write (o, ref written, " -"); Write (o, ref written, names [0]); } else { Write (o, ref written, " --"); Write (o, ref written, names [0]); } for ( i = GetNextOptionIndex (names, i+1); i < names.Length; i = GetNextOptionIndex (names, i+1)) { Write (o, ref written, ", "); Write (o, ref written, names [i].Length == 1 ? "-" : "--"); Write (o, ref written, names [i]); } if (p.OptionValueType == OptionValueType.Optional || p.OptionValueType == OptionValueType.Required) { if (p.OptionValueType == OptionValueType.Optional) { Write (o, ref written, localizer ("[")); } Write (o, ref written, localizer ("=" + GetArgumentName (0, p.MaxValueCount, p.Description))); string sep = p.ValueSeparators != null && p.ValueSeparators.Length > 0 ? p.ValueSeparators [0] : " "; for (int c = 1; c < p.MaxValueCount; ++c) { Write (o, ref written, localizer (sep + GetArgumentName (c, p.MaxValueCount, p.Description))); } if (p.OptionValueType == OptionValueType.Optional) { Write (o, ref written, localizer ("]")); } } return true; } static int GetNextOptionIndex (string[] names, int i) { while (i < names.Length && names [i] == "<>") { ++i; } return i; } static void Write (TextWriter o, ref int n, string s) { n += s.Length; o.Write (s); } private static string GetArgumentName (int index, int maxIndex, string description) { if (description == null) return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); string[] nameStart; if (maxIndex == 1) nameStart = new string[]{"{0:", "{"}; else nameStart = new string[]{"{" + index + ":"}; for (int i = 0; i < nameStart.Length; ++i) { int start, j = 0; do { start = description.IndexOf (nameStart [i], j); } while (start >= 0 && j != 0 ? description [j++ - 1] == '{' : false); if (start == -1) continue; int end = description.IndexOf ("}", start); if (end == -1) continue; return description.Substring (start + nameStart [i].Length, end - start - nameStart [i].Length); } return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); } private static string GetDescription (string description) { if (description == null) return string.Empty; StringBuilder sb = new StringBuilder (description.Length); int start = -1; for (int i = 0; i < description.Length; ++i) { switch (description [i]) { case '{': if (i == start) { sb.Append ('{'); start = -1; } else if (start < 0) start = i + 1; break; case '}': if (start < 0) { if ((i+1) == description.Length || description [i+1] != '}') throw new InvalidOperationException ("Invalid option description: " + description); ++i; sb.Append ("}"); } else { sb.Append (description.Substring (start, i - start)); start = -1; } break; case ':': if (start < 0) goto default; start = i + 1; break; default: if (start < 0) sb.Append (description [i]); break; } } return sb.ToString (); } private static List GetLines (string description) { List lines = new List (); if (string.IsNullOrEmpty (description)) { lines.Add (string.Empty); return lines; } int length = 80 - OptionWidth - 2; int start = 0, end; do { end = GetLineEnd (start, length, description); bool cont = false; if (end < description.Length) { char c = description [end]; if (c == '-' || (char.IsWhiteSpace (c) && c != '\n')) ++end; else if (c != '\n') { cont = true; --end; } } lines.Add (description.Substring (start, end - start)); if (cont) { lines [lines.Count-1] += "-"; } start = end; if (start < description.Length && description [start] == '\n') ++start; } while (end < description.Length); return lines; } private static int GetLineEnd (int start, int length, string description) { int end = Math.Min (start + length, description.Length); int sep = -1; for (int i = start; i < end; ++i) { switch (description [i]) { case ' ': case '\t': case '\v': case '-': case ',': case '.': case ';': sep = i; break; case '\n': return i; } } if (sep == -1 || end == description.Length) return end; return sep; } } } mono-tools-4.2/gendarme/console/Helpers.cs0000664000175000017500000000324312413742070022666 0ustar00directhexdirecthex00000000000000// // Gendarme Console Settings // // Authors: // Sebastien Pouliot // // 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; using System.IO; using System.Reflection; namespace Gendarme { static class Helpers { public static Stream GetStreamFromResource (string resourceName) { Assembly executing = Assembly.GetExecutingAssembly (); foreach (string resource in executing.GetManifestResourceNames ()) { if (resource.EndsWith (resourceName, StringComparison.Ordinal)) return executing.GetManifestResourceStream (resource); } return null; } } } mono-tools-4.2/gendarme/console/Makefile.in0000664000175000017500000004247512642235731023021 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/console ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = gendarme.exe.config 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)$(gendarmedir)" SCRIPTS = $(gendarme_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/../options.make $(srcdir)/Makefile.in \ $(srcdir)/gendarme.exe.config.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ # note that we generate mdb files even in release COMMON_OPTIONS := -debug+ -d:TRACE $(if $(DEBUG),-d:DEBUG \ -checked+,-optimize+) -nowarn:1591 # Missing XML comment GENDARME_OPTIONS := $(COMMON_OPTIONS) -warn:4 -warnaserror+ TESTS_OPTIONS := $(COMMON_OPTIONS) -warn:0 gendarmedir = $(prefix)/lib/gendarme gendarme_SCRIPTS = ../bin/gendarme.exe EXTRA_DIST = $(gendarme_sources) $(gendarme_sources_in) $(gendarme_resources) gendarme.csproj CLEANFILES = $(gendarme_SCRIPTS) $(gendarme_SCRIPTS).mdb DISTCLEANFILES = Makefile.in gendarme_sources_in = ../AssemblyInfo.cs.in gendarme_generated_sources = $(gendarme_sources_in:.in=) gendarme_sources = \ ../AssemblyStaticInfo.cs \ ConsoleRunner.cs \ Helpers.cs \ HtmlResultWriter.cs \ IgnoreFileList.cs \ Options.cs \ ResultWriter.cs \ Settings.cs \ TextResultWriter.cs \ XmlResultWriter.cs gendarme_resources = \ gendarme.xsl \ gendarme.xsd gendarme_build_sources = $(addprefix $(srcdir)/, $(gendarme_sources)) \ $(gendarme_generated_sources) gendarme_prefix_resources = $(addprefix $(srcdir)/, $(gendarme_resources)) gendarme_build_resources = $(foreach res,$(gendarme_prefix_resources), $(addprefix -resource:,$(res)),$(notdir $(res))) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../options.make $(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) --gnu gendarme/console/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/console/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; $(srcdir)/../options.make $(am__empty): $(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): gendarme.exe.config: $(top_builddir)/config.status $(srcdir)/gendarme.exe.config.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-gendarmeSCRIPTS: $(gendarme_SCRIPTS) @$(NORMAL_INSTALL) @list='$(gendarme_SCRIPTS)'; test -n "$(gendarmedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(gendarmedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(gendarmedir)" || 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)$(gendarmedir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(gendarmedir)$$dir" || exit $$?; \ } \ ; done uninstall-gendarmeSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(gendarme_SCRIPTS)'; test -n "$(gendarmedir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(gendarmedir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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) installdirs: for dir in "$(DESTDIR)$(gendarmedir)"; 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: 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-gendarmeSCRIPTS 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: uninstall-gendarmeSCRIPTS .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-gendarmeSCRIPTS 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 tags-am uninstall \ uninstall-am uninstall-gendarmeSCRIPTS .PRECIOUS: Makefile ../bin/gendarme.exe: $(gendarme_build_sources) $(gendarme_prefix_resources) $(MCS) $(GENDARME_OPTIONS) -r:$(CECIL_ASM) -r:System.Xml.Linq -r:../bin/Gendarme.Framework.dll \ -out:$@ $(gendarme_build_sources) $(gendarme_build_resources) self-test: ../bin/gendarme.exe mono --debug ../bin/gendarme.exe ../bin/gendarme.exe # 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-tools-4.2/gendarme/console/gendarme.exe.config.in0000664000175000017500000000104712413742070025073 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gendarme/console/ConsoleRunner.cs0000664000175000017500000004311512413742070024062 0ustar00directhexdirecthex00000000000000// // Gendarme Console Runner // // Authors: // Sebastien Pouliot // // Copyright (C) 2005-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.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Xml; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Engines; using NDesk.Options; namespace Gendarme { [EngineDependency (typeof (SuppressMessageEngine))] public class ConsoleRunner : Runner { private string config_file; private string rule_set = "default"; private string html_file; private string log_file; private string xml_file; private string ignore_file; private bool help; private bool quiet; private bool version; private bool console; private List assembly_names; static string [] SplitOptions (string value) { return value.ToUpperInvariant ().Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries); } // parse severity filter // e.g. Audit,High+ == Audit, High and Critical bool ParseSeverity (string filter) { SeverityBitmask.ClearAll (); foreach (string option in SplitOptions (filter)) { Severity severity; switch (option) { case "AUDIT": case "AUDIT+": case "AUDIT-": severity = Severity.Audit; break; case "LOW": case "LOW+": case "LOW-": severity = Severity.Low; break; case "MEDIUM": case "MEDIUM+": case "MEDIUM-": severity = Severity.Medium; break; case "HIGH": case "HIGH+": case "HIGH-": severity = Severity.High; break; case "CRITICAL": case "CRITICAL+": case "CRITICAL-": severity = Severity.Critical; break; case "ALL": case "*": SeverityBitmask.SetAll (); continue; default: string msg = String.Format (CultureInfo.CurrentCulture, "Unknown severity level '{0}'", option); throw new OptionException (msg, "severity"); } char end = option [option.Length - 1]; if (end == '+') { SeverityBitmask.SetDown (severity); } else if (end == '-') { SeverityBitmask.SetUp (severity); } else { SeverityBitmask.Set (severity); } } return true; } bool ParseConfidence (string filter) { ConfidenceBitmask.ClearAll (); foreach (string option in SplitOptions (filter)) { Confidence confidence; switch (option) { case "LOW": case "LOW+": case "LOW-": confidence = Confidence.Low; break; case "NORMAL": case "NORMAL+": case "NORMAL-": confidence = Confidence.Normal; break; case "HIGH": case "HIGH+": case "HIGH-": confidence = Confidence.High; break; case "TOTAL": case "TOTAL+": case "TOTAL-": confidence = Confidence.Total; break; case "ALL": case "*": ConfidenceBitmask.SetAll (); continue; default: string msg = String.Format (CultureInfo.CurrentCulture, "Unknown confidence level '{0}'", option); throw new OptionException (msg, "confidence"); } char end = option [option.Length - 1]; if (end == '+') { ConfidenceBitmask.SetDown (confidence); } else if (end == '-') { ConfidenceBitmask.SetUp (confidence); } else { ConfidenceBitmask.Set (confidence); } } return true; } static string ValidateInputFile (string option, string file) { if (!File.Exists (file)) { string msg = String.Format (CultureInfo.CurrentCulture, "File '{0}' could not be found", file); throw new OptionException (msg, option); } return file; } static string ValidateOutputFile (string option, string file) { string msg = String.Empty; if (file.Length > 0) { string path = Path.GetDirectoryName (file); if (path.Length > 0) { if (path.IndexOfAny (Path.GetInvalidPathChars ()) != -1) msg = String.Format (CultureInfo.CurrentCulture, "Invalid path '{0}'", file); else if (!Directory.Exists (path)) msg = String.Format (CultureInfo.CurrentCulture, "Path '{0}' does not exists", file); } } string fname = Path.GetFileName (file); if ((fname.Length == 0) || (fname.IndexOfAny (Path.GetInvalidFileNameChars ()) != -1)) { msg = String.Format (CultureInfo.CurrentCulture, "Filename '{0}' is not valid", fname); } if (msg.Length > 0) throw new OptionException (msg, option); return file; } static string ValidateRuleSet (string ruleSet) { if (String.IsNullOrEmpty (ruleSet)) { throw new OptionException ("Missing rule set name", "set"); } return ruleSet; } static int ValidateLimit (string limit) { int defects_limit; if (String.IsNullOrEmpty (limit) || !Int32.TryParse (limit, out defects_limit)) { string msg = String.Format (CultureInfo.CurrentCulture, "Invalid value '{0}' to limit defects", limit); throw new OptionException (msg, "limit"); } return defects_limit; } byte Parse (string [] args) { bool severity = false; bool confidence = false; // if supplied, use the user limit on defects (otherwise 2^31 is used) DefectsLimit = Int32.MaxValue; var p = new OptionSet () { { "config=", v => config_file = ValidateInputFile ("config", v) }, { "set=", v => rule_set = ValidateRuleSet (v) }, { "log=", v => log_file = ValidateOutputFile ("log", v) }, { "xml=", v => xml_file = ValidateOutputFile ("xml", v) }, { "html=", v => html_file = ValidateOutputFile ("html", v) }, { "ignore=", v => ignore_file = ValidateInputFile ("ignore", v) }, { "limit=", v => DefectsLimit = ValidateLimit (v) }, { "severity=", v => severity = ParseSeverity (v) }, { "confidence=",v => confidence = ParseConfidence (v) }, { "v|verbose", v => ++VerbosityLevel }, { "console", v => console = v != null }, { "quiet", v => quiet = v != null }, { "version", v => version = v != null }, { "h|?|help", v => help = v != null }, }; try { assembly_names = p.Parse (args); } catch (OptionException e) { Console.WriteLine ("Error parsing option '{0}' : {1}", e.OptionName, e.Message); Console.WriteLine (); return 1; } // by default the runner will ignore Audit and Low severity defects if (!severity) { SeverityBitmask.SetAll (); SeverityBitmask.Clear (Severity.Audit); SeverityBitmask.Clear (Severity.Low); } // by default the runner will ignore Low confidence defects if (!confidence) { ConfidenceBitmask.SetAll (); ConfidenceBitmask.Clear (Confidence.Low); } return (byte) ((assembly_names.Count > 0) ? 0 : 1); } // name can be // - a filename (a single assembly) // - a mask (*, ?) for multiple assemblies // - a special file (@) containing a list of assemblies byte AddFiles (string name) { if (String.IsNullOrEmpty (name)) return 0; if (name.StartsWith ("@", StringComparison.OrdinalIgnoreCase)) { // note: recursive (can contains @, masks and filenames) using (StreamReader sr = File.OpenText (name.Substring (1))) { while (sr.Peek () >= 0) { AddFiles (sr.ReadLine ()); } } } else if (name.IndexOfAny (new char [] { '*', '?' }) >= 0) { string dirname = Path.GetDirectoryName (name); if (dirname.Length == 0) dirname = "."; // assume current directory string [] files = Directory.GetFiles (dirname, Path.GetFileName (name)); foreach (string file in files) { AddAssembly (file); } } else { AddAssembly (name); } return 0; } void AddAssembly (string filename) { string warning = null; try { string assembly_name = Path.GetFullPath (filename); AssemblyDefinition ad = AssemblyDefinition.ReadAssembly ( assembly_name, new ReaderParameters { AssemblyResolver = AssemblyResolver.Resolver }); // this will force cecil to load all the modules, which will throw (like old cecil) a FNFE // if a .netmodule is missing (otherwise this exception will occur later in several places) if (ad.Modules.Count > 0) Assemblies.Add (ad); } catch (BadImageFormatException) { warning = "Invalid assembly format"; } catch (FileNotFoundException fnfe) { // e.g. .netmodules warning = fnfe.Message; } catch (ArgumentException e) { warning = e.ToString (); } // show warning (quiet or not) but continue loading & analyzing assemblies if (warning != null) { Console.Error.WriteLine ("warning: could not load assembly '{0}', reason: {1}{2}", filename, warning, Environment.NewLine); } } byte Report () { // re-activate all loaded (i.e. selected) rules since some of them could have // turned off themselve while executing but we still want them listed in the report foreach (Rule rule in Rules) { rule.Active = true; } // generate text report (default, to console, if xml and html aren't specified) if (console || (log_file != null) || ((xml_file == null) && (html_file == null))) { using (TextResultWriter writer = new TextResultWriter (this, log_file)) { writer.Report (); } } // generate XML report if (xml_file != null) { using (XmlResultWriter writer = new XmlResultWriter (this, xml_file)) { writer.Report (); } } // generate HTML report if (html_file != null) { using (HtmlResultWriter writer = new HtmlResultWriter (this, html_file)) { writer.Report (); } } return (byte) ((0 == Defects.Count) ? 0 : 1); } byte Execute (string [] args) { try { byte result = Parse (args); Header (); if (version) return 0; if ((result != 0) || help) { Help (); return help ? (byte) 0 : result; } // load configuration, including rules Settings config = new Settings (this, config_file, rule_set); // and continue if there's at least one rule to execute if (!config.Load () || (Rules.Count < 1)) { int validationErrorsCounter = 0; foreach (string error in config.ValidationErrors) { Console.WriteLine (error); validationErrorsCounter++; } if (validationErrorsCounter == 0) Console.WriteLine ("Configuration parameters does not match any known rule."); return 3; } foreach (string name in assembly_names) { result = AddFiles (name); if (result != 0) return result; } IgnoreList = new IgnoreFileList (this, ignore_file); // now that all rules and assemblies are know, time to initialize Initialize (); // before analyzing the assemblies with the rules Run (); // and winding down properly TearDown (); return Report (); } catch (IOException e) { if (0 == VerbosityLevel) { Console.Error.WriteLine ("ERROR: {0}", e.Message); return 2; } else { WriteUnhandledExceptionMessage (e); return 4; } } catch (Exception e) { WriteUnhandledExceptionMessage (e); return 4; } } private void WriteUnhandledExceptionMessage (Exception e) { Console.WriteLine (); Console.WriteLine ("An uncaught exception occured. Please fill a bug report at https://bugzilla.novell.com/"); if (CurrentRule != null) Console.WriteLine ("Rule:\t{0}", CurrentRule); if (CurrentTarget != null) Console.WriteLine ("Target:\t{0}", CurrentTarget); Console.WriteLine ("Stack trace: {0}", e); } private Stopwatch total = new Stopwatch (); private Stopwatch local = new Stopwatch (); private static string TimeToString (TimeSpan time) { if (time >= TimeSpan.FromMilliseconds (100)) return String.Format (CultureInfo.CurrentCulture, "{0:0.0} seconds", time.TotalSeconds); else return "<0.1 seconds"; } public override void Initialize () { if (!quiet) { Console.Write ("Initialization"); total.Start (); local.Start (); } base.Initialize (); if (!quiet) { local.Stop (); Console.WriteLine (": {0}", TimeToString (local.Elapsed)); local.Reset (); } } public override void Run () { if (Assemblies.Count == 0) { Console.WriteLine ("No assemblies were specified to be analyzed."); return; } base.Run (); if (!quiet) local.Stop (); } public override void TearDown () { if (!quiet) { Console.WriteLine (": {0}", TimeToString (local.Elapsed)); local.Start (); local.Reset (); } base.TearDown (); if (!quiet) { local.Stop (); total.Stop (); Console.WriteLine ("TearDown: {0}", TimeToString (local.Elapsed)); Console.WriteLine (); if (Assemblies.Count == 1) Console.WriteLine ("One assembly processed in {0}.", TimeToString (total.Elapsed)); else Console.WriteLine ("{0} assemblies processed in {1}.", Assemblies.Count, TimeToString (total.Elapsed)); string hint = string.Empty; if (null != log_file || null != xml_file || null != html_file) { List files = new List (new string [] { log_file, xml_file, html_file }); files.RemoveAll (string.IsNullOrEmpty); hint = String.Format (CultureInfo.CurrentCulture, "Report{0} written to: {1}.", (files.Count > 1) ? "s" : string.Empty, string.Join (",", files.Select (file => String.Format (CultureInfo.CurrentCulture, "`{0}'", file)).ToArray ())); } if (Defects.Count == 0) Console.WriteLine ("No defect found. {0}", hint); else if (Defects.Count == 1) Console.WriteLine ("One defect found. {0}", hint); else Console.WriteLine ("{0} defects found. {1}", Defects.Count, hint); } } protected override void OnAssembly (RunnerEventArgs e) { if (!quiet) { if (local.IsRunning) { local.Stop (); Console.WriteLine (": {0}", TimeToString (local.Elapsed)); local.Reset (); } // next assembly Console.Write (Path.GetFileName (e.CurrentAssembly.MainModule.FullyQualifiedName)); local.Start (); } base.OnAssembly (e); } void Header () { if (quiet) return; Assembly a = Assembly.GetExecutingAssembly (); Version v = a.GetName ().Version; if (v.ToString () != "0.0.0.0") { Console.WriteLine ("Gendarme v{0}", v); } else { Console.WriteLine ("Gendarme - Development Snapshot"); } object [] attr = a.GetCustomAttributes (typeof (AssemblyCopyrightAttribute), false); if (attr.Length > 0) Console.WriteLine (((AssemblyCopyrightAttribute) attr [0]).Copyright); Console.WriteLine (); } private static Assembly runner_assembly; static public Assembly Assembly { get { if (runner_assembly == null) runner_assembly = Assembly.GetExecutingAssembly (); return runner_assembly; } } static void Help () { Console.WriteLine ("Usage: gendarme [--config file] [--set ruleset] [--{log|xml|html} file] assemblies"); Console.WriteLine ("Where"); Console.WriteLine (" --config file\t\tSpecify the rule sets and rule settings. Default is 'rules.xml'."); Console.WriteLine (" --set ruleset\t\tSpecify a rule set from configfile. Default is 'default'."); Console.WriteLine (" --log file\t\tSave the report to the specified file."); Console.WriteLine (" --xml file\t\tSave the report, as XML, to the specified file."); Console.WriteLine (" --html file\t\tSave the report, as HTML, to the specified file."); Console.WriteLine (" --ignore file\t\tDo not report defects listed in the specified file."); Console.WriteLine (" --limit N\t\tStop reporting after N defects are found."); Console.WriteLine (" --severity [all | [[audit | low | medium | high | critical][+|-]]],..."); Console.WriteLine ("\t\t\tFilter defects for the specified severity levels."); Console.WriteLine ("\t\t\tDefault is 'medium+'"); Console.WriteLine (" --confidence [all | [[low | normal | high | total][+|-]],..."); Console.WriteLine ("\t\t\tFilter defects for the specified confidence levels."); Console.WriteLine ("\t\t\tDefault is 'normal+'"); Console.WriteLine (" --console\t\tShow defects on the console even if --log, --xml or --html are specified."); Console.WriteLine (" --quiet\t\tUsed to disable progress and other information which is normally written to stdout."); Console.WriteLine (" --v\t\t\tWhen present additional progress information is written to stdout (can be used multiple times)."); Console.WriteLine (" assemblies\t\tSpecify the assemblies to verify."); Console.WriteLine (); } /// /// /// /// /// 0 for success, /// 1 if some defects are found, /// 2 if some parameters are bad, /// 3 if a problem is related to the xml configuration file /// 4 if an uncaught exception occured static int Main (string [] args) { return new ConsoleRunner ().Execute (args); } } } mono-tools-4.2/gendarme/console/gendarme.xsd0000664000175000017500000000320212413742070023232 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gendarme/console/IgnoreFileList.cs0000664000175000017500000001263212413742070024145 0ustar00directhexdirecthex00000000000000// // IgnoreFileList - Ignore defects based on a file descriptions // // Authors: // Sebastien Pouliot // // Copyright (C) 2008-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.Generic; using System.IO; using Mono.Cecil; using Gendarme.Framework; using Gendarme.Framework.Helpers; using Gendarme.Framework.Rocks; namespace Gendarme { public class IgnoreFileList : BasicIgnoreList { private string current_rule; private Dictionary> assemblies = new Dictionary> (); private Dictionary> types = new Dictionary> (); private Dictionary> methods = new Dictionary> (); private Stack files = new Stack (); public IgnoreFileList (IRunner runner, string fileName) : base (runner) { Push (fileName); Parse (); } private void Push (string fileName) { if (!String.IsNullOrEmpty (fileName) && File.Exists (fileName) && !files.Contains (fileName)) { files.Push (fileName); } } private void Parse () { char [] buffer = new char [4096]; while (files.Count > 0) { string fileName = files.Pop (); using (StreamLineReader sr = new StreamLineReader (fileName)) { while (!sr.EndOfStream) { int length = sr.ReadLine (buffer, 0, buffer.Length); ProcessLine (buffer, length); } } } Resolve (); TearDown (); } static private void Add (IDictionary> list, string rule, string target) { HashSet rules; if (!list.TryGetValue (target, out rules)) { rules = new HashSet (); list.Add (target, rules); } rules.Add (rule); } static string GetString (char [] buffer, int length) { // skip the 'type' + ':' characters when looking for whitespace separator(s) int start = 2; while (Char.IsWhiteSpace (buffer [start]) && (start < buffer.Length)) start++; int end = length; while (Char.IsWhiteSpace (buffer [end]) && (end >= start)) end--; return new string (buffer, start, end - start); } private void ProcessLine (char [] buffer, int length) { if (length < 1) return; switch (buffer [0]) { case '#': // comment break; case 'R': // rule current_rule = GetString (buffer, length); break; case 'A': // assembly - we support Name, FullName and * string target = GetString (buffer, length); if (target == "*") { foreach (AssemblyDefinition assembly in Runner.Assemblies) { Add (assemblies, current_rule, assembly.Name.FullName); } } else { Add (assemblies, current_rule, target); } break; case 'T': // type (no space allowed) Add (types, current_rule, GetString (buffer, length)); break; case 'M': // method Add (methods, current_rule, GetString (buffer, length)); break; case 'N': // namespace - special case (no need to resolve) base.Add (current_rule, NamespaceDefinition.GetDefinition (GetString (buffer, length))); break; case '@': // include file files.Push (GetString (buffer, length)); break; default: Console.Error.WriteLine ("Bad ignore entry : '{0}'", new string (buffer)); break; } } private void AddList (IMetadataTokenProvider metadata, IEnumerable rules) { foreach (string rule in rules) { base.Add (rule, metadata); } } // scan the analyzed code a single time looking for targets private void Resolve () { HashSet rules; foreach (AssemblyDefinition assembly in Runner.Assemblies) { if (assemblies.TryGetValue (assembly.Name.FullName, out rules)) { AddList (assembly, rules); } if (assemblies.TryGetValue (assembly.Name.Name, out rules)) { AddList (assembly, rules); } foreach (ModuleDefinition module in assembly.Modules) { foreach (TypeDefinition type in module.GetAllTypes ()) { if (types.TryGetValue (type.GetFullName (), out rules)) { AddList (type, rules); } if (type.HasMethods) { foreach (MethodDefinition method in type.Methods) { if (methods.TryGetValue (method.GetFullName (), out rules)) { AddList (method, rules); } } } } } } } private void TearDown () { assemblies.Clear (); types.Clear (); methods.Clear (); } } } mono-tools-4.2/gendarme/console/ResultWriter.cs0000664000175000017500000000441512413742070023741 0ustar00directhexdirecthex00000000000000// // ResultWriter base class // // Authors: // Christian Birkl // Sebastien Pouliot // // Copyright (C) 2006 Christian Birkl // Copyright (C) 2006, 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; using Gendarme.Framework; namespace Gendarme { abstract public class ResultWriter : IDisposable { private bool disposed; protected ResultWriter (IRunner runner, string fileName) { Runner = runner; FileName = fileName; } [ThreadModel (ThreadModel.SingleThread)] ~ResultWriter () { if (!disposed) Dispose (false); } protected IRunner Runner { get; private set; } protected string FileName { get; set; } protected virtual void Start () { } protected virtual void Write () { } protected virtual void Finish () { } public void Report () { if (disposed) throw new ObjectDisposedException (GetType ().Name); Start (); Write (); Finish (); } public void Dispose () { if (!disposed) { Dispose (true); GC.SuppressFinalize (this); disposed = true; } } [ThreadModel (ThreadModel.SingleThread)] protected abstract void Dispose (bool disposing); } } mono-tools-4.2/gendarme/console/Settings.cs0000664000175000017500000002050712413742070023066 0ustar00directhexdirecthex00000000000000// // Gendarme Console Settings // // Authors: // Sebastien Pouliot // // Copyright (C) 2008, 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.Globalization; using System.IO; using System.Reflection; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Xml; using System.Xml.Schema; using Gendarme.Framework; namespace Gendarme { public class Settings { private const string DefaultRulesFile = "rules.xml"; private Collection rules; private string config_file; private string rule_set; private IList validation_errors = new List (); public Settings (IRunner runner, string configurationFile, string ruleSet) { if (runner == null) throw new ArgumentNullException ("runner"); rules = runner.Rules; rule_set = ruleSet; if (String.IsNullOrEmpty (configurationFile)) { config_file = GetFullPath (DefaultRulesFile); } else { config_file = configurationFile; } } static string GetFullPath (string filename) { if (Path.GetDirectoryName (filename).Length > 0) return filename; return Path.Combine (Path.GetDirectoryName (ConsoleRunner.Assembly.Location), filename); } static string GetAttribute (XmlNode node, string name, string defaultValue) { XmlAttribute xa = node.Attributes [name]; if (xa == null) return defaultValue; return xa.Value; } private static bool IsContainedInRuleSet (string rule, string mask) { string [] ruleSet = mask.Split ('|'); foreach (string entry in ruleSet) { if (String.Compare (rule, entry.Trim (), StringComparison.OrdinalIgnoreCase) == 0) return true; } return false; } private static bool RuleFilter (Type type, object interfaceName) { return (type.ToString () == (interfaceName as string)); } private static void SetApplicabilityScope (IRule rule, string applicabilityScope) { switch (applicabilityScope) { case "visible": rule.ApplicabilityScope = ApplicabilityScope.Visible; break; case "nonvisible": rule.ApplicabilityScope = ApplicabilityScope.NonVisible; break; case "all": rule.ApplicabilityScope = ApplicabilityScope.All; break; default: //if the scope is not empty, notify if (!String.IsNullOrEmpty (applicabilityScope)) Console.Error.WriteLine ("Unknown scope value '{0}' . Defaulting to 'all'", applicabilityScope); rule.ApplicabilityScope = ApplicabilityScope.All; break; } } private int LoadRulesFromAssembly (string assembly, string includeMask, string excludeMask, string applicabilityScope) { Assembly a = null; try { AssemblyName aname = AssemblyName.GetAssemblyName (Path.GetFullPath (assembly)); a = Assembly.Load (aname); } catch (FileNotFoundException) { Console.Error.WriteLine ("Could not load rules from assembly '{0}'.", assembly); return 0; } int total = 0; foreach (Type t in a.GetTypes ()) { if (t.IsAbstract || t.IsInterface) continue; if (includeMask != "*") if (!IsContainedInRuleSet (t.Name, includeMask)) continue; if ((excludeMask != null) && (excludeMask.Length > 0)) if (IsContainedInRuleSet (t.Name, excludeMask)) continue; if (t.FindInterfaces (new TypeFilter (RuleFilter), "Gendarme.Framework.IRule").Length > 0) { IRule rule = (IRule) Activator.CreateInstance (t); rules.Add (rule); SetApplicabilityScope (rule, applicabilityScope); total++; } } return total; } private void OnValidationErrors (object sender, ValidationEventArgs args) { validation_errors.Add (args.Exception.Message.Replace ("XmlSchema error", String.Format (CultureInfo.CurrentCulture, "Error in the configuration file {0}", config_file))); } private void ValidateXmlDocument () { using (Stream stream = Helpers.GetStreamFromResource ("gendarme.xsd")) { if (stream == null) throw new InvalidDataException ("Could not locate Xml Schema Definition inside resources."); XmlReaderSettings settings = new XmlReaderSettings (); settings.Schemas.Add (XmlSchema.Read (stream, OnValidationErrors)); settings.ValidationType = ValidationType.Schema; settings.ValidationEventHandler += OnValidationErrors; using (XmlReader reader = XmlReader.Create (config_file, settings)) { while (reader.Read ()){} } } } public IEnumerable ValidationErrors { get { return validation_errors; } } private IRule GetRule (string name) { foreach (IRule rule in rules) { if (rule.GetType ().ToString ().Contains (name)) return rule; } return null; } private void SetCustomParameters (XmlNode nodes) { foreach (XmlElement parameter in nodes.SelectNodes ("parameter")) { string ruleName = GetAttribute (parameter, "rule", String.Empty); string propertyName = GetAttribute (parameter, "property", String.Empty); IRule rule = GetRule (ruleName); if (rule == null) throw GetException ("The rule with name {0} doesn't exist", ruleName, String.Empty, String.Empty); PropertyInfo property = rule.GetType ().GetProperty (propertyName); if (property == null) throw GetException ("The property {1} can't be found in the rule {0}", ruleName, propertyName, String.Empty); if (!property.CanWrite) throw GetException ("The property {1} can't be written in the rule {0}", ruleName, propertyName, String.Empty); string value = GetAttribute (parameter, "value", String.Empty); if (String.IsNullOrEmpty (value)) continue; object [] values = new object [1]; switch (Type.GetTypeCode (property.PropertyType)) { case TypeCode.Int32: int i; if (Int32.TryParse (value, out i)) values [0] = i; break; case TypeCode.Double: double d; if (Double.TryParse (value, out d)) values [0] = d; break; case TypeCode.String: values [0] = value; break; } if (values [0] == null) throw GetException ("The value '{2}' could not be converted into the property {1} type for rule {0}", ruleName, propertyName, value); property.GetSetMethod ().Invoke (rule, values); } } static Exception GetException (string message, string ruleName, string propertyName, string value) { return new XmlException (String.Format (CultureInfo.CurrentCulture, message + ". Review your configuration file.", ruleName, propertyName, value)); } public bool Load () { ValidateXmlDocument (); if (validation_errors.Count != 0) return false; XmlDocument doc = new XmlDocument (); doc.Load (config_file); bool result = false; foreach (XmlElement ruleset in doc.DocumentElement.SelectNodes ("ruleset")) { if (ruleset.Attributes ["name"].Value != rule_set) continue; foreach (XmlElement assembly in ruleset.SelectNodes ("rules")) { string include = GetAttribute (assembly, "include", "*"); string exclude = GetAttribute (assembly, "exclude", String.Empty); string from = GetFullPath (GetAttribute (assembly, "from", String.Empty)); string applicabilityScope = GetAttribute (assembly, "applyTo", String.Empty); int n = LoadRulesFromAssembly (from, include, exclude, applicabilityScope); result = (result || (n > 0)); if (result) SetCustomParameters (assembly); } } return result; } } } mono-tools-4.2/gendarme/console/Makefile.am0000664000175000017500000000242512413742070022772 0ustar00directhexdirecthex00000000000000include ../options.make gendarmedir=$(prefix)/lib/gendarme gendarme_SCRIPTS = ../bin/gendarme.exe EXTRA_DIST = $(gendarme_sources) $(gendarme_sources_in) $(gendarme_resources) gendarme.csproj CLEANFILES = $(gendarme_SCRIPTS) $(gendarme_SCRIPTS).mdb DISTCLEANFILES = Makefile.in gendarme_sources_in = ../AssemblyInfo.cs.in gendarme_generated_sources = $(gendarme_sources_in:.in=) gendarme_sources = \ ../AssemblyStaticInfo.cs \ ConsoleRunner.cs \ Helpers.cs \ HtmlResultWriter.cs \ IgnoreFileList.cs \ Options.cs \ ResultWriter.cs \ Settings.cs \ TextResultWriter.cs \ XmlResultWriter.cs gendarme_resources = \ gendarme.xsl \ gendarme.xsd gendarme_build_sources = $(addprefix $(srcdir)/, $(gendarme_sources)) gendarme_build_sources += $(gendarme_generated_sources) gendarme_prefix_resources = $(addprefix $(srcdir)/, $(gendarme_resources)) gendarme_build_resources = $(foreach res,$(gendarme_prefix_resources), $(addprefix -resource:,$(res)),$(notdir $(res))) ../bin/gendarme.exe: $(gendarme_build_sources) $(gendarme_prefix_resources) $(MCS) $(GENDARME_OPTIONS) -r:$(CECIL_ASM) -r:System.Xml.Linq -r:../bin/Gendarme.Framework.dll \ -out:$@ $(gendarme_build_sources) $(gendarme_build_resources) self-test: ../bin/gendarme.exe mono --debug ../bin/gendarme.exe ../bin/gendarme.exe mono-tools-4.2/gendarme/console/TextResultWriter.cs0000664000175000017500000001237012413742070024605 0ustar00directhexdirecthex00000000000000// // TextResultWriter // // Authors: // Christian Birkl // Sebastien Pouliot // // Copyright (C) 2006 Christian Birkl // Copyright (C) 2006, 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; using System.Collections.Generic; using System.IO; using System.Linq; using Mono.Cecil; using Gendarme.Framework; namespace Gendarme { public class TextResultWriter : ResultWriter, IDisposable { [Serializable] enum ColorScheme { None, Light, Dark } private TextWriter writer; private ColorScheme color_scheme; public TextResultWriter (IRunner runner, string fileName) : base (runner, fileName) { if (String.IsNullOrEmpty (fileName)) { writer = System.Console.Out; string color_override = Environment.GetEnvironmentVariable ("GENDARME_COLOR") ?? "dark"; switch (color_override.ToLowerInvariant ()) { case "none": break; case "light": color_scheme = ColorScheme.Light; break; case "dark": default: color_scheme = ColorScheme.Dark; break; } } else { writer = new StreamWriter (fileName); } } protected override void Write () { // casting to Severity int saves a ton of memory since IComparable can be used instead of IComparable var query = from n in Runner.Defects orderby (int) n.Severity, n.Rule.Name select n; WriteHeader (); int num = 0; if (query.Any ()) { string name = string.Empty; string delimiter = new string ('-', 60); foreach (Defect defect in query) { string rname = defect.Rule.Name; if (rname != name) { writer.WriteLine (delimiter); name = rname; } WriteEntry (++num, defect); } } WriteTrailer (num); } private void WriteHeader () { writer.WriteLine ("Produced on {0} for:", DateTime.UtcNow); foreach (AssemblyDefinition assembly in Runner.Assemblies) writer.WriteLine (" {0}", assembly.Name.Name); writer.WriteLine (); } private void WriteEntry (int index, Defect defect) { IRule rule = defect.Rule; BeginColor ( (Severity.Critical == defect.Severity || Severity.High == defect.Severity) ? ConsoleColor.DarkRed : ConsoleColor.DarkYellow); writer.WriteLine ("{0}. {1}", index, rule.Name); writer.WriteLine (); EndColor (); BeginColor (ConsoleColor.DarkRed); writer.Write ("Problem: "); EndColor (); writer.Write (rule.Problem); writer.WriteLine (); writer.WriteLine ("* Severity: {0}, Confidence: {1}", defect.Severity, defect.Confidence); writer.WriteLine ("* Target: {0}", defect.Target); if (defect.Location != defect.Target) writer.WriteLine ("* Location: {0}", defect.Location); string source = defect.Source; if (!String.IsNullOrEmpty (source)) writer.WriteLine ("* Source: {0}", source); if (!String.IsNullOrEmpty (defect.Text)) writer.WriteLine ("* Details: {0}", defect.Text); writer.WriteLine (); BeginColor (ConsoleColor.DarkGreen); writer.Write ("Solution: "); EndColor (); writer.Write (rule.Solution); writer.WriteLine (); writer.WriteLine ("More info available at: {0}", rule.Uri.ToString ()); writer.WriteLine (); writer.WriteLine (); } private void WriteTrailer (int numDefects) { int num_rules = Runner.Rules.Count; if (num_rules == 1) writer.Write ("Processed one rule"); else writer.Write ("Processed {0} rules", num_rules); if (numDefects == 0) writer.Write (" and found no defects"); // we don't print the number of defects here because it is listed with the defect writer.WriteLine ("."); } [ThreadModel (ThreadModel.SingleThread)] protected override void Dispose (bool disposing) { if (disposing) { if (writer != Console.Out) { writer.Dispose (); } } } private void BeginColor (ConsoleColor color) { switch (color_scheme) { case ColorScheme.Dark: Console.ForegroundColor = color; break; case ColorScheme.Light: Console.ForegroundColor = (ConsoleColor) color + 8; break; } } private void EndColor () { switch (color_scheme) { case ColorScheme.Dark: case ColorScheme.Light: Console.ResetColor (); break; } } } } mono-tools-4.2/gendarme/console/gendarme.csproj0000775000175000017500000001510412413742070023743 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {E95A3AB9-A303-4859-8BCA-458C79496548} Exe Properties Gendarme gendarme 3.5 true v4.0 false gendarme.snk http://localhost/gendarme/ true Web true Foreground 7 Days false false true 0 1.0.0.%2a false true true full false bin\Debug\ TRACE;DEBUG prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE;RELEASE prompt 4 AllRules.ruleset 3.5 3.5 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil {63E6915C-7EA4-4D76-AB28-0D7191EEA626} Mono.Cecil.Pdb {CD6818D5-B398-486C-B180-92A07B143AFD} Gendarme.Framework {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD} Mono.Cecil.Mdb False .NET Framework 3.5 SP1 Client Profile false False false False false False false False .NET Framework 3.5 SP1 false mono-tools-4.2/gendarme/Makefile.am0000664000175000017500000000770512413742070021336 0ustar00directhexdirecthex00000000000000TESTDIRS = framework rules SUBDIRS = $(TESTDIRS) console swf-wizard-runner man wix tools bin_SCRIPTS = gendarme gendarme-wizard gd2i EXTRA_DIST = gendarme.in gendarme-wizard.in AssemblyInfo.cs.in MIT.X11 gendarme.sln self-test.ignore mono-options.ignore gendarme.svg options.make CLEANFILES = gendarme gendarme-wizard bin/rules.xml pixmapdir = $(datadir)/pixmaps pixmap_DATA = gendarme.svg DISTCLEANFILES = \ AssemblyInfo.cs \ Makefile.in wdir = $(shell pwd) # Note that PHONY is required on os-x because a directory exists with # that name. .PHONY: console console: cd framework && make ../bin/Gendarme.Framework.dll cd $(wdir)/console && make ../bin/gendarme.exe cd $(wdir)/rules && make rules bin: console cd $(wdir)/swf-wizard-runner && make ../bin/gendarme-wizard.exe test: list='$(TESTDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) test) ; \ done; run-test: bin/gendarme.exe.config list='$(TESTDIRS)'; for d in $$list ; do \ (cd $$d && $(MAKE) run-test) ; \ done; self-test: all bin/gendarme.exe.config rm -f gendarme.log; \ mono --debug bin/gendarme.exe --config rules/rules.xml --set self-test --xml bin/self-test.xml --html bin/self-test.html \ --ignore=self-test.ignore --severity=all --confidence=all bin/gendarme.exe bin/gendarme-wizard.exe bin/Gendarme.*.dll check-test: all bin/gendarme.exe.config test mono --debug bin/gendarme.exe --config rules/rules.xml --set unit-test --xml bin/unit-test.xml --html bin/unit-test.html \ --ignore=unit-test.ignore --severity=all --confidence=all @unit-test.list test-regress: all mono --debug bin/gendarme.exe --config rules/rules.xml --set self-test --log regress.log \ --severity=all --confidence=all testcases/*.dll testcases/*.exe TEST1 ?= AvoidVisibleConstantFieldTest test1_file = $(shell find rules -name "\.svn" -prune -o -name "*$(TEST1)*" -print) test1_name = $(strip $(shell echo "$(test1_file)" | grep -oE "Gendarme\.Rules\.[^\\/]+")) test1_namespace = $(strip $(shell echo "$(test1_name)" | sed "s/Gendarme/Test/")) test1: bin/gendarme.exe.config cd framework && make test cd $(wdir)/rules/Test.Rules && make test cd $(wdir)/rules/$(test1_name) && make test rm -f $(wdir)/gendarme.log cp $(wdir)/bin/gendarme.exe.config $(wdir)/rules/$(test1_name)/$(test1_namespace).dll.config cd $(wdir)/rules/$(test1_name) && MONO_PATH=$(wdir)/bin/:$(wdir)/rules/Test.Rules/:$(MONO_PATH) \ nunit-console2 -fixture=$(test1_namespace).$(TEST1) -nologo $(test1_namespace).dll bin/gendarme.exe.config: cp console/gendarme.exe.config bin/gendarme.exe.config help: @echo "The targets are:" @echo "all - build everything, including documentation" @echo "bin - build all binaries needed to run gendarme" @echo "console - build everything to execute the console runner" @echo "test - build the unit test dlls" @echo "run-test - build and run the unit tests" @echo "self-test - run gendarme on itself, bin/self-test.html will have the results" @echo "test1 - build and run a single unit test named TEST1" @echo "zip-bin - build then create a ZIP file of the binaries needed to run gendarme" @echo " " @echo "Variables include:" @echo "DEBUG - compile a debug version of the assemblies" @echo "TEST1 - used with test1 target, should be a unit test class name" # note: we take care to bundle the version of Mono.Cecil.dll that we compiled against extra-bin: mkdir -p extra; \ cp -u $(CECIL_ASM) extra; # note: this does not bundle Mono.Cecil.Mdb.dll and Mono.Cecil.Pdb.dll (not built outside Windows) # unless they are previously (and manually) copied into the extra/ directory zip-bin: bin extra-bin mkdir gendarme.$(GENDARME_VERSION); \ cd gendarme.$(GENDARME_VERSION); \ cp ../bin/*.exe .; \ cp ../bin/*.dll .; \ cp ../rules/rules.xml .; \ cp ../man/gendarme.1 .; \ cp ../man/gendarme.5 .; \ cp ../AUTHORS ../README ../MIT.X11 ../NEWS .; \ cp ../extra/* .; \ zip gendarme-$(GENDARME_VERSION)-bin.zip *; \ mv *.zip ..; \ cd ..; \ rm -rf gendarme.$(GENDARME_VERSION); mono-tools-4.2/gendarme/MIT.X110000664000175000017500000000213212413742070020213 0ustar00directhexdirecthex00000000000000Copyright (c) 2005-2011 Novell, Inc and the individuals listed on the ChangeLog entries. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 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-tools-4.2/gendarme/man/0000775000175000017500000000000012642235743020054 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gendarme/man/ChangeLog0000664000175000017500000000337312413742070021624 0ustar00directhexdirecthex000000000000002010-03-13 Sebastien Pouliot * gendarme.1.in: Added exit code descriptions 2008-09-20 Sebastien Pouliot * gendarme.1.in: Moved file format informations to gendarme.5.in * gendarme.5.in: New. Contains the information about file formats * Makefile.am: Update for gendarme.5.in 2008-08-09 Jesse Jones * gendarme.1.in: Edited. Added sections for ignore and rules files. 2009-01-27 Jonathan Pryor * . (svn:ignore): Ignore generated files. * gendarme.source: Added; Adds the gendarme man page under monodoc's 'Commands and Files/Gendarme' node. * gendarme.config: Added; mdoc-assemble config file to generate gendarme.tree, gendarme.zip (containing gendarme.1). * Makefile.am: Build and install man pages for monodoc. 2008-11-17 Jesse Jones * gendarme.1.in: Document config file. 2008-08-26 Sebastien Pouliot * gendarme.1.in: Document --severity and --confidence options. 2008-08-25 Sebastien Pouliot * gendarme.1.in: Document --limit option. 2008-08-24 Sebastien Pouliot * gendarme.1.in: Document --ignore and --version options. 2008-04-12 Sebastien Pouliot * gendarme.1.in: Document GENDARME_COLOR environment variable. 2008-02-15 Sebastien Pouliot * gendarme.1.in: Update description and mailing-list. Change --debug to -v 2008-02-11 Sebastien Pouliot * gendarme.1.in: Fix version number (from Mono version to Gendarme) 2006-09-17 Sebastien Pouliot * gendarme.1.in: Added documentation for new options (--quiet, --log, --xml and --html). mono-tools-4.2/gendarme/man/gendarme.5.in0000664000175000017500000000557212413742070022332 0ustar00directhexdirecthex00000000000000.\" .\" Gendarme manual page. .\" .\" Authors: .\" Sebastien Pouliot .\" Jesse Jones .\" .\" Copyright (C) 2005-2006,2008-2009 Novell, Inc (http://www.novell.com) .\" .de Sp .if t .sp .5v .if n .sp .. .TH Gendarme "Gendarme @GENDARME_VERSION@" .SH NAME Gendarme \- Rule-based code analysis for Mono. .SH FILE FORMATS .TP .I ignore-file This file is used to filter out defects from gendarme reports. It uses a line oriented file format where the first characters of the line control the interpretation of the line: .RS # - means that the line is a comment. .RE .RS R: - if the full name of a rule to be filtered. .RE .RS A: - is used to filter out an assembly (the extension can be omitted). .RE .RS T: - is used to filter out a namespace qualified type name. .RE .RS M: - is used to filter out a method. It must contain the full method name as it appears in the report. .RE An ignore-file can be generated automatically (using gd2i) from a XML defect list produced by \fIGendarme\fP. .TP .I rules.xml This file is used in conjunction with the --set option to control and configure the rules used by Gendarme. It contains a set of named rules (rule sets) and each rule set contains a list of rules. Rules have required from and include attributes, optional exclude and applyTo attributes, and optional parameter child elements. The from attribute is the path of a dll to load ("Gendarme.Rules.BadPractice.dll"). Relative paths are relative to the gendarme executable. The include attribute may be "*" to match every rule in the dll or a list of rule names separated by '|' ("WhizBangRule | MyRule"). The exclude attribute is a list of rule names separated by '|' ("IckyRule"). These will override any rules matched by the include attribute. The applyTo attribute may be "all", "visible", or "nonvisible". If it is all (the default) then all types in the assemblies are checked, if it is visible then only the externally visible types are checked, if it is nonvisible then only the internally visible types are checked. The parameter child element is used to customize the behavior of a rule within a dll. It has three required attributes: rule, property, and value. rule is the name of the applicable rule ("AvoidSmallNamespaceRule"), property is the name of a public property in the rule ("Minimum"), value is the value to assign to the property ("10"). .TP .I gendarme.exe.config Used by debug versions of Gendarme to enable logging for rules. A config file will be generated automatically by the make file. To enable logging for a rule edit the config file, add a switch using the rule's name, and set the value to 1. .SH COPYRIGHT Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com) .SH MAILING LISTS Mailing lists are listed at the http://groups.google.com/group/gendarme .SH WEB SITE http://www.mono-project.com/Gendarme .SH SEE ALSO .BR gendarme(1), gd2i(1) mono-tools-4.2/gendarme/man/gendarme.config0000664000175000017500000000027712413742070023023 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gendarme/man/gendarme.1.in0000664000175000017500000001064212413742070022320 0ustar00directhexdirecthex00000000000000.\" .\" Gendarme manual page. .\" .\" Authors: .\" Sebastien Pouliot .\" Jesse Jones .\" .\" Copyright (C) 2005-2006,2008-2010 Novell, Inc (http://www.novell.com) .\" .de Sp .if t .sp .5v .if n .sp .. .TH Gendarme "Gendarme @GENDARME_VERSION@" .SH NAME Gendarme \- Rule-based code analysis for Mono. .SH SYNOPSIS .PP .B gendarme [--config configfile] [--set ruleset] [--log file | --xml file | --html file] [options] assemblies ... .SH DESCRIPTION \fIGendarme\fP is a extensible rule-based tool used to find problems in .NET applications and libraries. Gendarme inspects programs and libraries that contain code in ECMA CIL format (Mono and .NET) and looks for common problems with the code, problems that compilers do not typically check or have historically not checked. .SH OPTIONS .TP .I "--config configfile" Specify the rule sets and rule settings. Default is 'rules.xml'. .TP .I "--set ruleset" Specify a rule set from configfile. Defaults to 'default'. .TP .I "--log file" Save the report, as a text file, to the specified file. .TP .I "--xml file" Save the report, formatted as XML, to the specified file. .TP .I "--html file" Save the report, formatted as HTML, to the specified file. .TP .I "--console" Write the defects on stdout. This is the default (implicit) behavior if none of --log, --xml, or --html options are specified. If (explicitely) specified then the defects will be shown on both stdout and inside text/xml/html report(s). .TP .I "--ignore ignore-file" Do not report defects listed in the specified file. .TP .I "--limit N" Stop reporting after N defects are found. .TP .I "--severity [all | audit[+] | low[+|-] | medium[+|-] | high[+|-] | critical[-]],... Filter the reported defects to include the specified severity levels. Default is 'medium+' (i.e. low and audit levels are ignored). .TP .I "--confidence [all | low[+] | normal[+|-] | high[+|-] | total[-]],... Filter the reported defects to include the specified confidence levels. Default is 'normal+' (i.e. low level is ignored). .TP .I "--quiet" Used to disable progress and other information which is normally written to stdout. .TP .I "--v|verbose" When present additional progress information is written to stdout. May be used more than once to write even more info. .TP .I "--version" Display Gendarme's version number. This will match the Mono version number that this copy of Gendarme was released with. .TP .I "assemblies ..." Specify the assemblies to verify. You can specify multiple filenames, including masks (? and *). You can also provide a file that lists several assemblies (one per line) by prefixing the filename with @ on the command line. .SH FILES .TP .I ignore-file This file is used to filter out defects from gendarme reports. .TP .I rules.xml This file is used in conjunction with the --set option to control and configure the rules used by Gendarme. It contains a set of named rules (rule sets) and each rule set contains a list of rules. .TP .I gendarme.exe.config Used by debug versions of Gendarme to enable logging for rules. It is useful for Gendarme's developers (i.e. not meant for end-users). .SH ENVIRONMENT VARIABLES .TP .I GENDARME_COLOR The runner will use colors when displaying defects on the console. By default colors are dark in order to display correctly on any background. You can change this default to "light" (lighter colors looks nice on a dark background, or "none" so no colors will be used. E.g. .nf GENDARME_COLOR=none gendarme ... .fi .SH EXIT STATUS .TP .I 0 The runner returns 0 when no error has occurred. If some code was analyzed then this also means that no defects were found and reported. .TP .I 1 The runner execution was successful but either some defects where found or no assembly was specified. .TP .I 2 The runner execution was interrupted by I/O errors (e.g. missing files). .TP .I 3 The runner founds errors in the (default or user supplied) configuration files. Specific error messages should be printed on the console. .TP .I 4 The runner execution was interrupted by a non-handled exception. This is likely a bug inside Gendarme and should be reported on Novell's bugzilla (http://bugzilla.novell.com) or on the mailing-list. .SH COPYRIGHT Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com) .SH MAILING LISTS Mailing lists are listed at the http://groups.google.com/group/gendarme .SH WEB SITE http://www.mono-project.com/Gendarme .SH SEE ALSO .BR gendarme(5), gd2i(1), mono(1) mono-tools-4.2/gendarme/man/Makefile.in0000664000175000017500000004672512642235731022134 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gendarme/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = gendarme.1 gendarme.5 gd2i.1 CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 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; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" \ "$(DESTDIR)$(rules_documentationdir)" man5dir = $(mandir)/man5 NROFF = nroff MANS = $(man_MANS) DATA = $(rules_documentation_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/gd2i.1.in \ $(srcdir)/gendarme.1.in $(srcdir)/gendarme.5.in ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ man_MANS = gendarme.1 gendarme.5 gd2i.1 EXTRA_DIST = gendarme.1.in gendarme.5.in gd2i.1.in gendarme.config gendarme.source DISTCLEANFILES = Makefile.in gendarme.1 gendarme.5 gd2i.1 CLEANFILES = gendarme.tree gendarme.zip rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = gendarme.source gendarme.tree gendarme.zip 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) --gnu gendarme/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gendarme/man/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): gendarme.1: $(top_builddir)/config.status $(srcdir)/gendarme.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gendarme.5: $(top_builddir)/config.status $(srcdir)/gendarme.5.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ gd2i.1: $(top_builddir)/config.status $(srcdir)/gd2i.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 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-man5: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man5dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man5dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man5dir)" || 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 '/\.5[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,^[^5][0-9a-z]*$$,5,;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)$(man5dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$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)$(man5dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man5dir)" || exit $$?; }; \ done; } uninstall-man5: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man5dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.5[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man5dir)'; $(am__uninstall_files_from_dir) install-rules_documentationDATA: $(rules_documentation_DATA) @$(NORMAL_INSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(rules_documentationdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(rules_documentationdir)" || 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)$(rules_documentationdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(rules_documentationdir)" || exit $$?; \ done uninstall-rules_documentationDATA: @$(NORMAL_UNINSTALL) @list='$(rules_documentation_DATA)'; test -n "$(rules_documentationdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(rules_documentationdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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 $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(rules_documentationdir)"; 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: 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-man install-rules_documentationDATA 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-man1 install-man5 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-man uninstall-rules_documentationDATA uninstall-man: uninstall-man1 uninstall-man5 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-man1 install-man5 \ install-pdf install-pdf-am install-ps install-ps-am \ install-rules_documentationDATA install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am uninstall-man \ uninstall-man1 uninstall-man5 \ uninstall-rules_documentationDATA .PRECIOUS: Makefile all: gendarme.tree gendarme.zip gendarme.zip : gendarme.tree gendarme.tree: gendarme.config Makefile mdoc assemble -o gendarme -f man $< # 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-tools-4.2/gendarme/man/gendarme.source0000664000175000017500000000033612413742070023052 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gendarme/man/Makefile.am0000664000175000017500000000075012413742070022102 0ustar00directhexdirecthex00000000000000man_MANS = gendarme.1 gendarme.5 gd2i.1 EXTRA_DIST = gendarme.1.in gendarme.5.in gd2i.1.in gendarme.config gendarme.source DISTCLEANFILES = Makefile.in gendarme.1 gendarme.5 gd2i.1 CLEANFILES = gendarme.tree gendarme.zip rules_documentationdir = $(prefix)/lib/monodoc/sources rules_documentation_DATA = gendarme.source gendarme.tree gendarme.zip all: gendarme.tree gendarme.zip gendarme.zip : gendarme.tree gendarme.tree: gendarme.config Makefile mdoc assemble -o gendarme -f man $< mono-tools-4.2/gendarme/man/gd2i.1.in0000664000175000017500000000373612413742070021371 0ustar00directhexdirecthex00000000000000.\" .\" gd2i manual page. .\" .\" Authors: .\" Sebastien Pouliot .\" .\" Copyright (C) 2010 Novell, Inc (http://www.novell.com) .\" .de Sp .if t .sp .5v .if n .sp .. .TH gd2i "Gendarme @GENDARME_VERSION@" .SH NAME Gendarme Defect To Ignore List .SH SYNOPSIS .PP .B gd2i defects.xml list.ignore [--extra-check] [--syntax-check] [--quiet] [--version] [--help] .SH DESCRIPTION \fIgd2i\fP is small tool to help you create, or update, an ignore-list baseline from an XML list of defects (generated by \fIGendarme\fP). .SH OPTIONS .TP .I "defects.xml" The, XML formatted, list of defects produced by Gendarme on your project. .TP .I "list.ignore" The, text, file listing ignored defects entries for your project. If the file does not already exists (i.e. an update) then it will be created. See gendarme(5) for the format of this file. .TP .I "--extra-check" Report ignore entries, from an existing 'list.ignore' file, that does not match any defect, from the 'defects.xml' file. .TP .I "--syntax-check" Report syntax error found when processing an existing 'list.ignore' file. .TP .I "--quiet" Used to disable progress and other information which is normally written to stdout. .TP .I "--version" Display the tool's version number. This will match the Mono version number that this copy of Gendarme was released with. .TP .I "--help" Show help about the command-line options. .SH EXIT STATUS .TP .I 0 The tool returns 0 when no error has occurred. .TP .I 1 The tool returns 1 if some command-line parameter were not valid. .TP .I 2 The tool execution was interrupted by a non-handled exception. This is likely a bug inside the tool and should be reported on Novell's bugzilla (http://bugzilla.novell.com) or on the mailing-list. .SH COPYRIGHT Copyright (C) 2010 Novell, Inc (http://www.novell.com) .SH MAILING LISTS Mailing lists are listed at the http://groups.google.com/group/gendarme .SH WEB SITE http://www.mono-project.com/Gendarme .SH SEE ALSO .BR gendarme(1), gendarme(5), mono(1) mono-tools-4.2/gui-compare/0000775000175000017500000000000012642235741017725 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gui-compare/ChangeLog0000664000175000017500000006214712413742070021503 0ustar00directhexdirecthex000000000000002010-07-22 Marek Habersack * MasterMetadata.cs: added code to show values of enums in the extra info box. 2010-06-22 Marek Safar * Metadata.cs, CompareContext.cs, Masterinfo.cs: Compare correctly generic and non-generic method overloads. 2010-06-04 Marek Habersack * MainWindow.cs: don't crash when comparison failed. 2010-04-26 Alan McGovern * InfoManager.cs: When setting the title of the window, switch the order of the arguments so that the text is 'foo.dll to foo.xml'. This makes the title consistent with how the data is interpreted - a '+' means foo.dll has something which foo.xml does not. 2010-04-22 Jb Evain * InfoManager.cs: update with .net 4.0 RTM and SL 4.0 RTW infos. 2010-04-02 Jeffrey Stedfast * InfoManager.cs (Ensure): Don't combine 'tar' and its arguments together for the pi.FileName. This doesn't work. Set the arguments on pi.Arguments like we're supposed to instead. 2010-02-27 Rodrigo Kumpera * gtk-gui/GuiCompare.CustomCompare.cs: Make custom compares work again. Someone should fix the stetic file cuz I don't have the skills for it. 2010-02-24 Rolf Bjarne Kvinge * InfoManager.cs: Add support for SL4 beta. 2010-02-12 Marek Habersack * Comparison.cs: added ExtraInfo field and a new constructor which takes extra info as one of the parameters. * Masterinfo.cs: exposed property collections in the XMLAttributeProperties and XMLAttributes classes. * gui-compare.in: added $MONO_OPTIONS to the mono command line * Makefile.am (guicompare_DATA): install .mdb as well * InfoManager.cs: CompareDefinition.Title now includes the framework profile name. Profiles with no entries aren't added to the Compare menu. * Metadata.cs: added ExtraInfo property. * CecilMetadata.cs, MasterMetadata.cs: added support for reading type forwarders (the TypeForwardedTo attribute). Added support for gathering and displaying information about custom attribute properties. * MainWindow.cs: summary label replaced with a TextView. Added Pango markup to TextView tags conversion method. 2010-02-10 Marek Safar * MasterMetadata.cs: Ignore ComVisible. 2010-01-26 Gonzalo Paniagua Javier * CecilMetadata.cs: add 2 missing operators and avoid a nullref. 2010-01-25 Sebastien Pouliot * InfoManager.cs: Add missing System.ServiceModel.Web.dll for Silverlight profile (and re-sort) 2010-01-20 Jonathan Pryor * MainWindow.cs, Main.cs: Fix build break; rename MainWindow.Compare(string,string) to MainWindow.ComparePaths(string,string). 2010-01-16 Miguel de Icaza * Add support to compare assemblies from the command line. 2009-10-21 Atsushi Enomoto * InfoManager.cs : it never worked fine with 3.0 assemblies. 2009-10-19 Marek Safar * InfoManager.cs, MasterMetadata.cs: Update 4.0 beta 2. 2009-07-15 Jb Evain * InfoManager.cs: add a Silverlight 3.0 profile. 2009-06-10 Marek Safar * Metadata.cs, CecilMetadata.cs, InfoManager.cs, CompareContext.cs, MasterMetadata.cs, Masterinfo.cs: Some work on generic type parameter comparison and sealed/abstract/static type modifiers. 2009-06-03 Marek Safar * InfoManager.cs: Added 4.0 profile assemblies. Look for assemblies in MONO_PATH when specified. 2009-06-03 Jb Evain * InfoManager.cs: refactor the code to retrieve masterinfos considering. 2009-04-30 Rodrigo Kumpera * gtk-gui/GuiCompare.CustomCompare.cs: Make custom compares work again. 2009-04-20 Rolf Bjarne Kvinge * CecilMetadata.cs: GetLiteralValue: don't crash on null literal values. 2009-04-08 Gonzalo Paniagua Javier * Comparison.cs: added a Reset() so we're able to recalculate the counts after modifying the tree. 2009-04-07 Rolf Bjarne Kvinge * InfoManager.cs: Look up the Moonlight assemblies in the correct plugin directory. 2009-04-06 Gonzalo Paniagua Javier * Comparison.cs: add properties used by the DB backend of the web application. 2009-04-02 Gonzalo Paniagua Javier * CompareContext.cs: * MasterMetadata.cs: deal with errors loading the masterinfo file or any other by raising the Error event and calling Finish. 2009-04-02 Sebastien Pouliot * InfoManager.cs: Look up the Moonlight assemblies in the plugin directory. 2009-02-26 Marek Habersack * Comparison.cs: better handling of links generation for comparison types other than method, attribute and delegate. 2009-02-25 Marek Habersack * MainWindow.cs, CecilMetadata.cs, Metadata.cs, CompareContext.cs, Comparison.cs: added support for MSDN documentation URLs attached to the tree nodes. URLs can be opened in the user's browser by double-clicking on the nodes which, when selected, show an MSDN URL in the status bar. Added a legend. 2009-01-29 Jb Evain * Makefile.am: reference directly cecil from the gac as gendarme does instead of copying it locally. 2009-01-28 Jb Evain * AssemblyResolver.cs, CecilMetadata.cs: use directly the new Resolve methods that Cecil now provides. 2009-01-06 Jb Evain * CecilMetadata.cs: support some more operators. 2008-12-25 Chris Toshok * CompareContext.cs: Make sure we compare attributes in CompareTypeLists too, otherwise we drop missing attribute nodes if the type is present. 2008-12-25 Chris Toshok * CompareContext.cs: split out the comparison of base types into a separate method. Also, if we're adding a missing type, add a tree node for the base type. 2008-12-19 Jb Evain * InfoManager.cs: add SL2SDK assemblies: System.Xml.Linq, System.Windows.Controls and System.Windows.Controls.Data. 2008-12-17 Jb Evain * CecilMetadata.cs: in the process of fixing our interface story. Always include all the interfaces for a type, by walking down its hierarchy. mono-api-info does the same as well now. This make it easier to compare interface implementation. 2008-12-17 Jb Evain * MainWindow.cs * InfoManager.cs * CompareContext.cs: Avoid defining our own delegate when we can use Func and Action. 2008-12-17 Jb Evain * MainWindow.cs * Metadata.cs * Comparison.cs * CompareContext.cs: PascalCase public fields in Comparison. 2008-12-17 Jb Evain * CecilMetadata.cs: treat Finalizers as an implementation detail and ignore it for the comparison. 2008-12-16 Jb Evain * CecilMetadata.cs: fix the comparison of the definition of System.Delegate and System.MulticastDelegate. 2008-12-05 Jb Evain * CecilMetadata.cs * CompareContext.cs * Comparison.cs * Main.cs * MasterMetadata.cs * Masterinfo.cs * Metadata.cs: add license and copyright information. 2008-12-05 Jb Evain * CecilMetadata.cs * CompareContext.cs * Comparison.cs * MasterMetadata.cs * Metadata.cs: cleanup usings. 2008-12-04 Jb Evain * CompareContext.cs * MainWindow.cs: move the Gtk dependant code from the CompareContext to the MainWindow, so that CompareContext can be used in a non Gtk application. 2008-12-04 Jb Evain * AssemblyResolver.cs: update. 2008-12-02 Chris Toshok * CecilMetadata.cs: fix TODO attribute handling. they aren't public, so we need to handle them before we check for public/private. 2008-11-21 Jb Evain * CecilMetadata.cs: improve pretty printing of Cecil types. * InfoManager.cs: update masterinfos uri to point to the new files. * MasterMetadata.cs, Masterinfo.cs: adjust to the mono-api-info format changes, which add a generic-parameters group to every generic method or type, and which can have a generic-parameter-constraints subgroup. 2008-08-15 Chris Toshok * MasterMetadata.cs (MasterUtils.ShouldSkipAttribute): we can't just use a string comparison here for CodeAnalysis attributes - they contains lots of info in the name string, we only cafe if it starts with "System.Diagnostics.CodeAnalysis.SuppressMessageAttribute". 2008-08-13 Chris Toshok * CecilMetadata.cs: go back to ignoring all private methods. if there are missing methods due to this, we need to fix the .xml generation. 2008-08-11 Sebastien Pouliot * CecilMetadata.cs: PrettyPrint nullable types correctly. 2008-08-08 Sebastien Pouliot * CecilMetadata.cs: Don't recurse on BaseType when looking at interfaces, otherwise we end up with a lot of extras (compared to the XML definition). Process private methods that are implementing an explicit interface requirement. Add NotSerialized to the FieldAttributes mask. * MasterMetadata.cs: Add NonSerializedAttribute to ShouldSkipAttribute since this pseudo-attribute is part of the XML definition. Add FamORAssem checks (replace by Family) since this introduce false errors in the reports (we don't care about the internal/assembly part) * Masterinfo.cs: Fix bad check with FamORAssem that turned private stuff into Family. 2008-06-04 Jb Evain * CecilMetadata.cs (CecilUtils.GetCustomAttributes): don't crash if the custom attribute constructor's declaring type can not be resolved. 2008-06-04 Jb Evain * InfoManager.cs: System.Xml.Core is renamed to System.Xml in SL 2.0b. 2008-02-10 Chris Toshok [ Fix a couple of bugs reported by jpobst ] * CecilMetadata.cs (CecilProperty.ctor): we can't just use the name - multiple "Item" properties were screwing things up. (CecilProperty.FormatName): format the name for display and for comparison against the masterinfo. Masterinfo version is "Type Name [ param-types ]", and display version if "Name [ param-types]" (including the type in the display version made it a little hard to actually see what the name of the property was.) (CecilField.GetMemberAccess): convert FamORAssem to just Family. (CecilMethod.GetMemberAccess): same. * MasterMetadata.cs (MasterProperty.ctor): we need to format the name based on the key, not on the name attribute alone. (MasterProperty.FormatName): format the name to match up with CecilProperty.FormatName. 2008-02-07 Stephane Delcroix * MainWindow.cs: move the LoadConfiguration part at the end of the ctor. 2008-02-01 Andrew Jorgensen * Makefile.am: gui-compare is generated by autotools 2008-01-16 Chris Toshok * configure: pointless update from generating makefiles... * Metadata.cs: assemblies are attribute containers. * MasterMetadata.cs: create the list of assembly attributes. * CecilMetadata.cs: get the list of assembly attributes. * CompareContext.cs: compare the attributes on reference/target assemblies. * Masterinfo.cs: make attributes on assemblies public. 2008-01-15 Chris Toshok * MainWindow.cs: add a history entry for the current CompareDefinition, if the counts are different than the previous one. * InfoManager.cs: when doing a preset compare, set the title to be the assemblyname. * MasterMetadata.cs: Skip over MS's CodeAnalysis attributes. * CecilMetadata.cs: skip over MS's CodeAnalysis attributes. * CompareContext.cs: add Constructors as missing * Config.cs: Add CompareHistory class, which is just a timestamped class containing all the counts from a comparison run. Add an array of them to CompareDefinition. Also, fix AddRecent to look for an existing entry in the Recent array (by using the new CompareDefinition.GetKey), moving it to the top. This pretty much removes the need for MoveToTop, as it could be folded in here, but leave it for now. 2008-01-14 Chris Toshok * MainWindow.cs: hide the progress bar when we're done, and implement the OnShowNotImplementedToggled method * InfoManager.cs: fix the remote file downloading. can't believe the bugs this thing has had... * gtk-gui/MainWindow.cs: add Show Notimplemented menu item and signal handler * gtk-gui/gui.stetic: add ShowNotImplemented action * Config.cs: add ShowNotImplemented 2008-01-14 Chris Toshok * MainWindow.cs: add the niex counts to the counts column * gui-compare.mdp: add the mn.png resource * cm/mn.png: steal jpobst's NIEX icon * CompareContext.cs: set throws_niex instead of adding an error. * gtk-gui/MainWindow.cs: add the ShowNotImplemented action * Comparison.cs: count NIEX's 2008-01-14 Chris Toshok * Metadata.cs: add GetLiteralValue() abstract method to CompField. * InfoManager.cs: wex might be null here since we're in the else branch, so don't look in it. * MasterMetadata.cs: implement MasterField.GetLiteralField. * CecilMetadata.cs: Implement CecilField.GetLiteralValue. * CompareContext.cs: check literal field values (fixes enum comparing) 2008-01-13 Chris Toshok * InfoManager.cs: fix this obvious brokenness. 2008-01-13 Chris Toshok * CecilMetadata.cs: only include the generic parameters of the method in the beautified version of the method name. 2008-01-11 Chris Toshok * CecilMetadata.cs: Fix explicit interface definitions of events. 2008-01-11 Chris Toshok * InfoManager.cs: add support for IfModifiedSince to the download logic, so we'll redownload a masterinfo .tar.gz file automatically if there's a newer one on the server. 2008-01-11 Chris Toshok * MasterMetadata.cs: deal with a null masterinfo. * Masterinfo.cs: deal with empty masterinfo files (with no assemblies) correctly. 2008-01-03 Miguel de Icaza * InfoManager.cs: For people that are abusing XDG_DATA_HOME, ignore their setting. 2008-01-09 Chris Toshok * Metadata.cs: add abstract bool ThrowsNotImplementedException method to CompMethod. * MasterMetadata.cs: always return false from ThrowsNotImplementedException, since we have no idea (but can assume it doesn't, since most of our masterinfos are generated from MS source). * CecilMetadata.cs: Copy MoMA's implementation of ThrowsNotImplementedException * CompareContext.cs: for two methods, check to see if the target throws NotImplementedException when the reference doesn't. 2008-01-03 Miguel de Icaza * CecilMetadata.cs: Ignore internal attributes applies to public classes; Fixes the warnings in System.Drawing 2008-01-03 Miguel de Icaza * MainWindow.cs: SetComparedefinition allow setting target/reference on a single call fro mthe CompareDefinition * CustomCompare.cs: New dialog box for custom compares. * InfoManager.cs: Refactor code, move body to MainWindow * ProviderSelector.cs: Spice this up. * gtk-gui/gui.stetic: Widget to pick XML files or assemblies. * Config.cs: Add new ToString override that formats the comparison for consistent titles 2008-01-02 Chris Toshok * MainWindow.cs: move the "summary.Visible = false" to StartCompare() so that regardless of how we start a new run, the summary goes away. * CompareContext.cs: rename master -> reference and assembly -> target. 2008-01-02 Chris Toshok * Metadata.cs: make the class, interface, delegate, and enum classes implement ICompHasBaseType, and add DisplayName to CompNamed, which we'll use instead of Name to populate the tree. * CecilMetadata.cs: Add type prettification to set the DisplayName on the comparison nodes (show the actual operator, type name replacement for system types, etc). Also, implement the GetBaseType stuff. * CompareContext.cs: compare base types. use ComparisonNode.AddError * MasterMetadata.cs: implement all the GetBaseType methods. * Masterinfo.cs: remove tons of stuff from corcompare that we no longer need. * Comparison.cs: add ComparisonNode.AddError which sets the status and adds the message. 2008-01-02 Miguel de Icaza * MainWindow.cs: Load defauls from the configuration file * InfoManager.cs: Track recently used comparisons * Config.cs: Add new API to manage our recently used list 2008-01-02 Miguel de Icaza 2008-01-02 Miguel de Icaza * CompareContext.cs: Provide some hints, not a great way of doing it. 2008-01-02 Miguel de Icaza 2008-01-02 Chris Toshok * MainWindow.cs: hide the summary when we start refreshing * CecilMetadata.cs: add generic parameters to the method name, and remove all those Replace('/','+')'s from everywhere and stick them in CecilUtils.FormatTypeLikeCorCompare. * gtk-gui/MainWindow.cs: add a separator to the file menu 2008-01-01 Chris Toshok * MainWindow.cs: Remove the checks of the Show* actions in our populate code. limitting display is done via the filter logic, not when populating the tree. Also, fill in and show/hide the summary label when we need to. * CecilMetadata.cs: Fix the interface comparisons - walk the hierarchy, collecting a list. just for kicks, due it in the least efficient way possible. also find the TODO attributes and remember their messages. Make sure to grab the list of attributes in the appropriate constructor, instead of in GetAttributes, because if we do it there, it's already too late to register the counts with the proper comparison nodes. Also, only check certain field/property/method attributes. mask them to what corcompare seems to generate. * Metadata.cs: add a todo list that we can fill in via the CecilMetadata code. also, add abstract GetMemberAccess method. * CompareContext.cs: Make sure to GetComparisonNode from the assembly_list if we can help it, since that node will contain all the MonoTODO's. Also, compare constructors. * MasterMetadata.cs: fill in our attributes and method/field/property access. * AssemblyResolver.cs: steal this code from the linker * gtk-gui/gui.stetic: add in a summary label that we auto show/hide, and get rid of that toolbar. move Refresh under the File menu. * Masterinfo.cs: make the various ConvertToString methods public instead of protected. * Comparison.cs: keep track of a list of error messages and todo's, and propagate the todo count properly. 2007-12-28 Chris Toshok * MainWindow.cs: change the line foreground based on the node's status. also, add Todo stats. * CecilMetadata.cs: lot of changes. copy some code from the linker, and use it to walk up the hierarchy adding interfaces so we match corcompare. Don't ignore the "op_" methods. Also, make sure we flag System.Delegate and System.MulticastDelegate as delegates. Do a similar fudging for System.Enum. Also, if we initialize a CecilInterface from a TypeReference, don't include the attributes on it. Lastly, include the return type of methods in their name so we can correctly sort them. * Metadata.cs: add GetMemberType() to CompMember. * CompareContext.cs: start listing errors. if the types of the members differ, it's an error. also, add missing attributes in AddMissing. * MasterMetadata.cs: lot of changes. add return types to MasterMethod, and add that to the name. handle nested types, and duplicate the CecilMetadata PopulateTypeLists. * gtk-gui/MainWindow.cs, gtk-gui/gui.stetic: add "Show Todo" action * Masterinfo.cs: make the field stuff public. * Comparison.cs: tally up the errors properly. 2007-12-28 Miguel de Icaza * CompareWindow.cs: Add the 3.5 assemblies to the list; With 3.5 replacing 2.0 assemblies to effectively be an SP1, should we deprecate 2.0? 2007-12-27 Chris Toshok * MainWindow.cs: rework the "Show {present, missing, extra, etc}" stuff using a gtk treemodelfilter. It's slower than recreating the tree, but it maintains expanded state and selection across changes, which is nice. * CompareContext.cs: add more missing elements to the tree, and also keep track of the counts from the reference assembly so we can give *some* indication of progress, 2007-12-27 Chris Toshok * cm/*.gif: make all these transparent as a first pass at making them not look like ass. 2007-12-27 Chris Toshok * CecilMetadata.cs: rename Utils to CecilUtils. Also, fix the broken logic that was resulting in private properties being included in the list of properties (and therefore showing up as extras). * MasterMetadata.cs: abstract out a lot of the list creation stuff into a Utils class, like we do in CecilMetadata.cs Call it MasterUtils. 2007-12-27 Chris Toshok * CecilMetadata.cs: add a ctor for CecilMetadata that takes a TypeDefinition (along with one that takes a TypeReference). in the type_def case, we populate the member lists just as we would for a class, so we can check them. currently they all show up as extra, since the MasterMetadata doesn't populate its interfaces properly yet. 2007-12-27 Chris Toshok * CecilMetadata.cs: factor out all the duplicate attribute list handling code. also, make it deal with MonoTODO attributes. * CompareContext.cs: fix progress message 2007-12-27 Chris Toshok * MainWindow.cs: add handling for the refresh button. also, remove the counts of various things if the View menu has them disabled. * gtk-gui/MainWindow.cs, gtk-gui/gui.stetic: add a refresh button to re-run the current comparison. this is a stopgap for the planned inotify/fam/whatever based code that will notice when the assembly changes and will automatically refresh. 2007-12-27 Chris Toshok * MainWindow.cs: repopulate the model if any of the View actions change. also, take into account the view actions when populating the tree model. * gtk-gui/MainWindow.cs, gtk-gui/gui.stetic: add a View menu for showing errors/missing/extra/present items 2007-12-27 Chris Toshok * CecilMetadata.cs: skip special named fields, and start dealing with attributes. * Metadata.cs: kinda gross, but make CompProperty subclass from ICompMemberContainer so that we can reuse all the code to check if the methods (set_*/get_*) match. Also, add CompAttribute * CompareContext.cs: duplicate some code to deal with attribute comparisons (need to factor this out somehow). * MasterMetadata.cs: start dealing with attributes * Masterinfo.cs: make more stuff public. 2007-12-26 Chris Toshok * CecilMetadata.cs: populate the property/event lists, and add CecilProperty/CecilEvent. return the enum list properly. * MasterMetadata.cs: more stuff added * Masterinfo.cs: make more things public 2007-12-26 Miguel de Icaza * CecilMetadata.cs: Do not crash on empty type_def.BaseType (happens for System.Object). (CecilAssembly): skip over nested types, and ignore NotPublic types as well. (PopulateTypeLists): Do not insert NestedPrivate and NestedAssembly as public APIs either. 2007-12-18 Miguel de Icaza * InfoManager.cs: 2007-12-18 Miguel de Icaza * MainWindow.cs: New file, from MonoDevelop, copy mot of the code from CompareWindow here. * Main.cs: new file, generated by MonoDevelop * InfoManager.cs: New file, this tracks and downloads new masterinfos if required on demand. * CompareContext.cs: Now the CompareContext uses two delegates of type LoadCompAssembly to do the comparison. 2007-12-07 Chris Toshok * Metadata.cs (CompClass): add GetNestedClass() method. * Masterinfo.cs (XMLClass): make nested public. * CompareWindow.cs (PerformCompare): abstract out what was in the body of SetAssemblyPath, so we can restart a comparison whenever we want -- when a new masterinfo is available, when the .dll has changed, etc. * CompareContext.cs (CompareThread): comment out call to DumpComparison. (CompareClassLists): abstract out the body of CompareClasses so it can be reused for nested classes as well as toplevel. Call CompareClassLists recursively to handle nested classes. Also, fix an &&/|| thinko. (CompareTypes): just call CompareClassLists. (CompareMethods): start implementation. (AddExtraMethod, AddMissingMethod): implement. * MasterMetadata.cs (MasterClass.GetMethods, MasterClass.GetConstructors): don't throw NIE. instead return an empty list. this causes all methods to show up as extra, but it keeps us from crashing. (MasterClass.GetNestedClasses): implement. * CecilMetadata.cs (CecilClass.GetConstructors): return empty list, don't throw NIE. (CecilClass.GetNestedClasses): implement. mono-tools-4.2/gui-compare/Config.cs0000664000175000017500000001233012413742070021452 0ustar00directhexdirecthex00000000000000// Config.cs // // Copyright (c) 2008 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 System.IO; using System.Xml; using System.Xml.Serialization; namespace GuiCompare { public class CompareHistory { public DateTime CompareTime; public int Errors; public int Missing; public int Extras; public int Todos; public int Niexs; } public class CompareDefinition { public bool ReferenceIsInfo = true; public string ReferencePath = String.Empty; public bool TargetIsInfo = true; public string TargetPath = String.Empty; public bool IsCustom = false; public string Title = String.Empty; [XmlElement ("History", typeof (CompareHistory))] public CompareHistory [] History; public CompareDefinition () { } public CompareDefinition (bool referenceIsInfo, string rpath, bool targetIsInfo, string tpath) { ReferenceIsInfo = referenceIsInfo; ReferencePath = rpath; TargetIsInfo = targetIsInfo; TargetPath = tpath; History = new CompareHistory[0]; } public string GetKey () { return String.Format ("{0}->{1}", ReferencePath, TargetPath); } // Returns a suitable title public override string ToString () { return (Title == "" ? String.Format ("{2}{0} -> {1}", Path.GetFileName (ReferencePath), Path.GetFileName (TargetPath), IsCustom ? "Custom: ": "") : Title); } public override bool Equals (object o) { if (!(o is CompareDefinition)) return false; CompareDefinition cd = (CompareDefinition)o; return (ReferencePath == cd.ReferencePath && ReferenceIsInfo == cd.ReferenceIsInfo && TargetPath == cd.TargetPath && TargetIsInfo == cd.TargetIsInfo); } public override int GetHashCode () { return GetKey().GetHashCode(); } public void AddHistoryEntry (CompareHistory history) { CompareHistory[] new_history = new CompareHistory[History == null ? 1 : History.Length + 1]; if (History != null) History.CopyTo (new_history, 0); new_history[new_history.Length - 1] = history; History = new_history; } } public class Config { public bool ShowErrors = true; public bool ShowMissing = true; public bool ShowExtra = true; public bool ShowTodo = true; public bool ShowPresent = true; public bool ShowNotImplemented = true; [XmlElement ("Recent", typeof (CompareDefinition))] public CompareDefinition [] Recent; static string config_dir, settings_file; static XmlSerializer serializer = new XmlSerializer (typeof (Config)); static Config () { config_dir = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); try { Directory.CreateDirectory (config_dir); } catch { } settings_file = System.IO.Path.Combine (config_dir, "guicompare.xml"); } public static Config GetConfig () { if (File.Exists (settings_file)){ try { return (Config) serializer.Deserialize (new XmlTextReader (settings_file)); } catch { return new Config (); } } else return new Config (); } public void Save () { try { Directory.CreateDirectory (config_dir); } catch {} try { File.Delete (settings_file); } catch {} try { using (FileStream fs = File.Create (settings_file)){ serializer.Serialize (fs, this); } } catch (Exception e){ Console.WriteLine ("Saving {0}", e); } } public void MoveToTop (CompareDefinition cd) { CompareDefinition [] copy = new CompareDefinition [Recent.Length]; copy [0] = cd; for (int i = 0, j = 0; j < Recent.Length; j++){ if (Recent [j] == cd) continue; i++; copy [i] = Recent [j]; } Recent = copy; } public void AddRecent (CompareDefinition cd) { if (Recent != null) { for (int i = 0; i < Recent.Length; i ++) { if (Recent[i].GetKey() == cd.GetKey()) { MoveToTop (Recent[i]); return; } } } if (Recent == null || Recent.Length < 15){ CompareDefinition [] copy = new CompareDefinition [Recent == null ? 1 : Recent.Length+1]; copy [0] = cd; if (Recent != null) Recent.CopyTo (copy, 1); Recent = copy; } else { Array.Copy (Recent, 0, Recent, 1, Recent.Length - 1); Recent[0] = cd; } } } } mono-tools-4.2/gui-compare/InfoManager.cs0000664000175000017500000006121512413742070022441 0ustar00directhexdirecthex00000000000000// InfoManager.cs // // Copyright (c) 2007 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 System.IO; using System.Net; using System.Diagnostics; using System.Threading; using Gtk; namespace GuiCompare { public class InfoManager { // base directory where we store all of our profile information, // this is usually ~/.local/share/mono-gui-compare static string infos; // The base directory where Mono stores its profile assemblies string monodir; // The base directory where the Moonlight plugin stores its profile assemblies string moondir; // A handle to our container window MainWindow main; // The handle to the Recent Comparisons Menu Menu recentmenu; string [] api_1_1 = { "mscorlib", "System", "System.Data", "System.Data.OracleClient", "System.DirectoryServices", "System.Drawing", "System.Runtime.Remoting", "System.Runtime.Serialization.Formatters.Soap", "System.Security", "System.ServiceProcess", "System.Web", "System.Web.Services", "System.Windows.Forms", "System.Xml", "cscompmgd", "Microsoft.VisualBasic", "", "System.Configuration.Install", "System.Design", "System.Drawing.Design", "System.EnterpriseServices", "System.Management", "System.Messaging" }; string [] api_2_0 = { "mscorlib", "System", "System.Configuration", "System.Data", "System.Data.OracleClient", "System.DirectoryServices", "System.Drawing", "System.Runtime.Remoting", "System.Runtime.Serialization.Formatters.Soap", "System.Security", "System.ServiceProcess", "System.Transactions", "System.Web", "System.Web.Services", "System.Windows.Forms", "System.Xml", "cscompmgd", "Microsoft.VisualBasic", "", "Microsoft.Build.Engine", "Microsoft.Build.Framework", "Microsoft.Build.Tasks", "Microsoft.Build.Utilities", "", "System.Configuration.Install", "System.Design", "System.Drawing.Design", "System.EnterpriseServices", "System.Management", "System.Messaging", }; string [] api_3_0 = { "PresentationCore", "PresentationFramework", "System.Speech", "WindowsBase", "", "System.IdentityModel", "System.IdentityModel.Selectors", "System.IO.Log", "System.Runtime.Serialization", "System.ServiceModel", "", "System.Workflow.Activities", "System.Workflow.ComponentModel", "System.Workflow.Runtime", "", "PresentationBuildTasks", "", "PresentationFramework.Aero", "PresentationFramework.Classic", "PresentationFramework.Luna", "PresentationFramework.Royale", "ReachFramework", "System.Printing", //"UIAutomationClient", //"UIAutomationClientsideProviders", //"UIAutomationProvider", //"UIAutomationTypes", //"WindowsFormsIntegration", }; string [] api_sl2 = { "mscorlib", "System", "System.Core", "System.Net", "System.Runtime.Serialization", "System.ServiceModel", "System.ServiceModel.Web", "System.Windows", "System.Windows.Browser", "System.Xml", "Microsoft.VisualBasic", "", // sdk assemblies: "System.Xml.Linq", "System.Windows.Controls", "System.Windows.Controls.Data", }; string [] api_sl4 = { "mscorlib", "System", "System.Core", "System.Net", "System.Runtime.Serialization", "System.ServiceModel", "System.ServiceModel.Web", "System.Windows", "System.Windows.Browser", "System.Xml", "Microsoft.VisualBasic", "", // sdk assemblies: "Microsoft.CSharp", "System.ComponentModel.Composition", "System.ComponentModel.Composition.Initialization", "System.ComponentModel.DataAnnotations", "System.Data.Services.Client", "System.Json", "System.Numerics", "System.Runtime.Serialization.Json", "System.ServiceModel.Extensions", "System.ServiceModel.NetTcp", "System.ServiceModel.PollingDuplex", "System.ServiceModel.Syndication", "System.ServiceModel.Web.Extensions", "System.Windows.Controls.Data", "System.Windows.Controls.Data.Input", "System.Windows.Controls", "System.Windows.Controls.Input", "System.Windows.Controls.Navigation", "System.Windows.Data", "System.Xml.Linq", "System.Xml.Serialization", "System.Xml.Utils", "System.Xml.XPath" }; string [] api_3_5 = { "mscorlib", "System", "System.AddIn", "System.AddIn.Contract", "System.Configuration", "System.ComponentModel.DataAnnotations", "System.Core", // "System.Configuration.Install", "System.Data", "System.Data.Linq", "System.Data.OracleClient", "System.DirectoryServices", // "System.DirectoryServices.AccountManagement", // "System.DirectoryServices.Protocols", "System.Drawing", "System.Net", "System.Runtime.Remoting", "System.Security", "System.ServiceProcess", "System.Transactions", "System.Web", "System.Web.Extensions", // "System.Web.Extensions.Design", // "System.Web.Mobile", // "System.Web.RegularExpressions", // "System.Web.Services", "System.Windows.Forms", "System.Xml", "System.Xml.Linq", "", "System.Runtime.Serialization.Formatters.Soap", "cscompmgd", "Microsoft.VisualBasic", "", "Microsoft.Build.Engine", "Microsoft.Build.Framework", "Microsoft.Build.Tasks", "Microsoft.Build.Utilities", "Microsoft.Build.Conversion.v3.5", "Microsoft.Build.Utilities.v3.5", "", "System.Configuration.Install", "System.Design", "System.Drawing.Design", "System.EnterpriseServices", "System.Management", // "System.Management.Instrumentation", "System.Messaging", }; string [] api_4_0 = { "mscorlib", "System.Activities", "System.Activities.Core.Presentation", "System.Activities.DurableInstancing", "System.Activities.Design", "System.AddIn.Contract", "System.AddIn", "System.ComponentModel.Composition", "System.ComponentModel.DataAnnotations", "System.configuration", // "System.Configuration.Install", "System.Core", "System.Data.DataSetExtensions", "System.Data", "System.Data.Entity.Design", "System.Data.Entity", "System.Data.Linq", "System.Data.OracleClient", "System.Data.Services.Client", "System.Data.Services.Design", "System.Data.Services", "System.Data.SqlXml", "System.Deployment", "System.Design", "System.Device", // "System.DirectoryServices.AccountManagement", "System.DirectoryServices", // "System.DirectoryServices.Protocols", "System", "System.Drawing.Design", "System.Drawing", "System.Dynamic", "System.EnterpriseServices", "System.EnterpriseServices.Thunk", "System.EnterpriseServices.Wrapper", "System.IdentityModel", "System.IdentityModel.Selectors", "System.IO.Log", "System.Management", // "System.Management.Instrumentation", "System.Messaging", "System.Net", "System.Numerics", "System.Printing", "System.Runtime.Caching", "System.Runtime.Remoting", "System.Runtime.Serialization", "System.Runtime.Serialization.Formatters.Soap", "System.Security", "System.ServiceModel.Activation", "System.ServiceModel.Activities", "System.ServiceModel.Channels", "System.ServiceModel.Discovery", "System.ServiceModel", "System.ServiceModel.Routing", "System.ServiceModel.Web", "System.ServiceProcess", "System.Speech", "System.Transactions", "System.Web.Abstractions", "System.Web.ApplicationServices", "System.Web.DataVisualization.Design", "System.Web.DataVisualization", "System.Web", "System.Web.DynamicData.Design", "System.Web.DynamicData", "System.Web.Entity.Design", "System.Web.Entity", // "System.Web.Extensions.Design", "System.Web.Extensions", // "System.Web.Mobile", // "System.Web.RegularExpressions", "System.Web.Routing", "System.Web.Services", "System.Windows.Forms.DataVisualization.Design", "System.Windows.Forms.DataVisualization", "System.Windows.Forms", "System.Windows.Presentation", "System.Workflow.Activities", "System.Workflow.ComponentModel", "System.Workflow.Runtime", "System.WorkflowServices", "System.Xaml", "System.Xaml.Hosting", "System.Xml", "System.Xml.Linq", "Microsoft.Build.Conversion.v4.0", "Microsoft.Build", "Microsoft.Build.Engine", "Microsoft.Build.Framework", "Microsoft.Build.Tasks.v4.0", "Microsoft.Build.Utilities.v4.0", "Microsoft.CSharp", "Microsoft.JScript", "Microsoft.VisualBasic.Compatibility.Data", "Microsoft.VisualBasic.Compatibility", "Microsoft.VisualBasic", "PresentationBuildTasks", "PresentationCore", "PresentationFramework.Aero", "PresentationFramework.Classic", "PresentationFramework", "PresentationFramework.Luna", "PresentationFramework.Royale", "PresentationUI", "ReachFramework", "WindowsBase", // "XamlBuildTask" }; string [] api_4_5 = { "mscorlib", "System.Activities", "System.Activities.Core.Presentation", "System.Activities.DurableInstancing", "System.Activities.Design", "System.AddIn.Contract", "System.AddIn", "System.ComponentModel.Composition", "System.ComponentModel.DataAnnotations", "System.configuration", // "System.Configuration.Install", "System.Core", "System.Data.DataSetExtensions", "System.Data", "System.Data.Entity.Design", "System.Data.Entity", "System.Data.Linq", "System.Data.OracleClient", "System.Data.Services.Client", "System.Data.Services.Design", "System.Data.Services", "System.Data.SqlXml", "System.Deployment", "System.Design", "System.Device", // "System.DirectoryServices.AccountManagement", "System.DirectoryServices", // "System.DirectoryServices.Protocols", "System", "System.Drawing.Design", "System.Drawing", "System.Dynamic", "System.EnterpriseServices", "System.EnterpriseServices.Thunk", "System.EnterpriseServices.Wrapper", "System.IdentityModel", "System.IdentityModel.Selectors", "System.IO.Log", "System.IO.Compression", "System.IO.Compression.FileSystem", "System.Management", // "System.Management.Instrumentation", "System.Messaging", "System.Net", "System.Net.Http", "System.Net.Http.WebRequest", "System.Numerics", "System.Printing", "System.Runtime.Caching", "System.Runtime.Remoting", "System.Runtime.Serialization", "System.Runtime.Serialization.Formatters.Soap", "System.Security", "System.ServiceModel.Activation", "System.ServiceModel.Activities", "System.ServiceModel.Channels", "System.ServiceModel.Discovery", "System.ServiceModel", "System.ServiceModel.Routing", "System.ServiceModel.Web", "System.ServiceProcess", "System.Speech", "System.Threading.Tasks.Dataflow", "System.Transactions", "System.Web.Abstractions", "System.Web.ApplicationServices", "System.Web.DataVisualization.Design", "System.Web.DataVisualization", "System.Web", "System.Web.DynamicData.Design", "System.Web.DynamicData", "System.Web.Entity.Design", "System.Web.Entity", // "System.Web.Extensions.Design", "System.Web.Extensions", // "System.Web.Mobile", // "System.Web.RegularExpressions", "System.Web.Routing", "System.Web.Services", "System.Windows.Forms.DataVisualization.Design", "System.Windows.Forms.DataVisualization", "System.Windows.Forms", "System.Windows.Presentation", "System.Workflow.Activities", "System.Workflow.ComponentModel", "System.Workflow.Runtime", "System.WorkflowServices", "System.Xaml", "System.Xaml.Hosting", "System.Xml", "System.Xml.Linq", "Microsoft.Build.Conversion.v4.0", "Microsoft.Build", "Microsoft.Build.Engine", "Microsoft.Build.Framework", "Microsoft.Build.Tasks.v4.0", "Microsoft.Build.Utilities.v4.0", "Microsoft.CSharp", "Microsoft.JScript", "Microsoft.VisualBasic.Compatibility.Data", "Microsoft.VisualBasic.Compatibility", "Microsoft.VisualBasic", "PresentationBuildTasks", "PresentationCore", "PresentationFramework.Aero", "PresentationFramework.Classic", "PresentationFramework", "PresentationFramework.Luna", "PresentationFramework.Royale", "PresentationUI", "ReachFramework", "WindowsBase", // "XamlBuildTask" }; const string masterinfos_version = "2.8"; static Uri GetMasterInfoUri (string file) { return new Uri (string.Format ("http://go-mono.com/masterinfos/{0}/{1}", masterinfos_version, file)); } public static void Init () { string xdg_data_home = Environment.GetEnvironmentVariable ("XDG_DATA_HOME"); if (xdg_data_home == null || xdg_data_home == String.Empty || xdg_data_home.IndexOf (':') != -1){ xdg_data_home = Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData); } infos = Path.Combine (xdg_data_home, "mono-gui-compare"); Directory.CreateDirectory (infos); } // // Ensures that masterinfo file for assembly name @file in @prof profile // is downloaded; On success, executes the given callback // public void Ensure (string prof, string assemblyname, Action done) { string pdir = Path.Combine (infos, prof); if (!Directory.Exists (pdir)){ Directory.CreateDirectory (pdir); } string target = Path.Combine (infos, "masterinfos-" + prof + ".tar.gz"); string masterinfo = Path.Combine (pdir, assemblyname) + ".xml"; Uri u = null; switch (prof){ case "1.0": u = GetMasterInfoUri ("masterinfos-1.1.tar.gz"); break; case "2.0": u = GetMasterInfoUri ("masterinfos-2.0.tar.gz"); break; case "3.0": u = GetMasterInfoUri ("masterinfos-3.0.tar.gz"); break; case "3.5": u = GetMasterInfoUri ("masterinfos-3.5.tar.gz"); break; case "4.0": u = GetMasterInfoUri ("masterinfos-4.0.tar.gz"); break; case "4.5": u = GetMasterInfoUri ("masterinfos-4.5.tar.gz"); break; case "SL2": u = GetMasterInfoUri ("masterinfos-SL2.tar.gz"); break; case "SL3": u = GetMasterInfoUri ("masterinfos-SL3.tar.gz"); break; case "SL4": u = GetMasterInfoUri ("masterinfos-SL4.tar.gz"); break; default: main.Status = "Profile is unknown"; return; } //check to see if the online news file has been modified since it was last downloaded Thread async_thread = new Thread (delegate (object state) { HttpWebRequest request = (HttpWebRequest) WebRequest.Create (u); FileInfo targetInfo = new FileInfo (target); if (targetInfo.Exists) request.IfModifiedSince = targetInfo.CreationTime; try { HttpWebResponse response = (HttpWebResponse)request.GetResponse (); if (response.StatusCode == HttpStatusCode.OK) { Application.Invoke (delegate { main.Status = "Downloading masterinfo file..."; }); Stream responseStream = response.GetResponseStream (); using (FileStream fs = File.Create (target)) { int position = 0; int readBytes = -1; byte[] buffer = new byte[4096]; while (position < response.ContentLength) { readBytes = responseStream.Read (buffer, 0, buffer.Length); if (readBytes > 0) { position += readBytes; fs.Write (buffer, 0, readBytes); if (response.ContentLength > 0) { Application.Invoke (delegate { main.Progress = ((double)position / response.ContentLength) * 100; }); } } } } Application.Invoke (delegate { main.Status = "Unpacking masterinfo file...s"; }); ProcessStartInfo pi = new ProcessStartInfo(); pi.WorkingDirectory = pdir; pi.UseShellExecute = true; pi.FileName = "tar"; pi.Arguments = "xzf " + target + " --strip-components=1"; Process p = Process.Start (pi); p.WaitForExit (); Application.Invoke (delegate { main.Progress = 0; main.Status = "Download complete"; if (done != null) done (masterinfo); }); } } catch (System.Net.WebException wex) { if (wex != null && wex.Response != null && ((HttpWebResponse)wex.Response).StatusCode == HttpStatusCode.NotModified) { Console.WriteLine ("remote file not modified since we downloaded it"); Application.Invoke (delegate { main.Progress = 0; main.Status = ""; if (done != null) done (masterinfo); }); } else { Application.Invoke (delegate { main.Progress = 0; FileInfo masterinfoInfo = new FileInfo (masterinfo); if (masterinfoInfo.Exists) { main.Status = "Download failed, reusing cached (possibly out of date) masterinfo"; if (done != null) done (masterinfo); } else main.Status = "Download failed"; }); } } catch (Exception e) { Console.WriteLine (e); Application.Invoke (delegate { main.Progress = 0; FileInfo masterinfoInfo = new FileInfo (masterinfo); if (masterinfoInfo.Exists) { main.Status = "Download failed, reusing cached (possibly out of date) masterinfo"; if (done != null) done (masterinfo); } else main.Status = "Download failed"; }); } }); Console.WriteLine ("Downloading {0} to {1}", u, target); async_thread.Start (); } /// /// Starts a preset compare. /// /// /// The full path to a system installed assembly (/mono/lib/mono/1.0/mscorlib.dll) /// /// /// The profile, for example "1.0" /// /// /// The name of the assembly to compare, in this case "mscorlib" /// void StartPresetCompare (string assemblyfile, string profile, string assemblyname, string groupName) { Ensure (profile, assemblyname, delegate (string masterinfo){ CompareDefinition cd = new CompareDefinition (true, masterinfo, false, assemblyfile); cd.Title = assemblyname + " (" + groupName + ")"; main.Config.AddRecent (cd); PopulateRecent (); main.Config.Save (); main.SetReference (delegate { return new MasterAssembly (masterinfo); }); main.SetTarget (delegate { return new CecilAssembly (assemblyfile); }); main.StartCompare (delegate { main.Title = String.Format ("{0} to {1}", assemblyfile, masterinfo); }); }); main.SetComparedProfile (profile); } void Populate (Menu container, string caption, string pdir, string collection, string [] elements) { string profiledir = System.IO.Path.Combine (monodir, pdir); string MONO_GAC_PREFIX = Environment.GetEnvironmentVariable ("MONO_GAC_PREFIX"); string[] gac_prefixes = null; if (!string.IsNullOrEmpty (MONO_GAC_PREFIX)) gac_prefixes = MONO_GAC_PREFIX.Split (':'); MenuItem item = new MenuItem (caption); Menu sub = new Menu (); item.Submenu = sub; MenuItem child = null; foreach (string e in elements){ if (e == String.Empty){ // Avoid inserting separators twice if (child is SeparatorMenuItem || sub.Children.Length == 0) continue; child = new SeparatorMenuItem (); } else { string assemblyfile = null; bool found = false; if (gac_prefixes == null) { assemblyfile = System.IO.Path.Combine (profiledir, e + ".dll"); found = System.IO.File.Exists (assemblyfile); } else { foreach (string prefix in gac_prefixes) { assemblyfile = System.IO.Path.Combine ( System.IO.Path.Combine ( System.IO.Path.Combine ( System.IO.Path.Combine (prefix, "lib"), "mono"), pdir), e + ".dll"); found = System.IO.File.Exists (assemblyfile); if (found) break; } } if (!found) { assemblyfile = System.IO.Path.Combine (moondir, e + ".dll"); found = System.IO.File.Exists (assemblyfile); } if (!found) { Console.WriteLine ("Skipping {0} for profile {1}, could not locate it in profile dir or MONO_GAC_PREFIX", e, pdir); continue; } string element = e; child = new MenuItem (e); child.Activated += delegate { StartPresetCompare (assemblyfile, collection, element, caption); }; } sub.Add (child); } if (sub.Children.Length > 0) { item.ShowAll (); container.Add (item); } } /// /// Populates the "RecentComparison" sub menu from File /// public void PopulateRecent () { foreach (MenuItem mi in recentmenu.AllChildren) recentmenu.Remove (mi); if (main.Config.Recent == null || main.Config.Recent.Length == 0){ MenuItem empty = new MenuItem ("(Empty)"); empty.Sensitive = false; recentmenu.Add (empty); } else { foreach (CompareDefinition cdd in main.Config.Recent){ CompareDefinition cd = cdd; if (cd == null) throw new Exception ("FGGG"); MenuItem c = new MenuItem (cd.ToString ()); c.Activated += delegate { main.SetCompareDefinition (cd); main.StartCompare (delegate { main.Title = cd.ToString ();}); main.Config.MoveToTop (cd); PopulateRecent (); main.Config.Save (); }; recentmenu.Add (c); } } recentmenu.ShowAll (); } // // Constructor // public InfoManager (MainWindow main, string profilePath) { this.main = main; if (profilePath == null) { string corlibdir = System.IO.Path.GetDirectoryName (typeof (int).Assembly.Location); monodir = System.IO.Path.GetFullPath (System.IO.Path.Combine (corlibdir, "..")); } else { monodir = profilePath; } moondir = System.IO.Path.Combine (monodir, @"../moonlight/plugin"); // Work around limitation in Stetic, there is no way // of getting a handle on the menu (!!!) // Populate File/Recent Comparisons, this would be so much // easier if Stetic had any support for this. recentmenu = new Menu (); MenuItem filemenuitem = (main.MenuBar.Children [0]) as MenuItem; Menu filesub = (Menu) filemenuitem.Submenu; MenuItem recentmenuitem = new MenuItem ("Recent Comparisons"); recentmenuitem.Submenu = recentmenu; recentmenuitem.ShowAll (); filesub.Insert (recentmenuitem, 0); MenuItem sep = new MenuItem (); sep.ShowAll (); filesub.Insert (sep, 1); PopulateRecent (); // Populate the list of profile comparisons Menu sub = null; foreach (MenuItem mi in main.MenuBar.AllChildren){ AccelLabel a = mi.Child as AccelLabel; if (a == null || a.LabelProp != "_Compare") continue; if (a.LabelProp == "Recent Comparisons"){ } sub = (Menu) mi.Submenu; break; } if (sub == null){ Console.WriteLine ("Unable to found Compare submenu"); return; } MenuItem separator = new SeparatorMenuItem (); separator.ShowAll (); sub.Add (separator); Populate (sub, "API 1.1", GetVersionPath ("1.0", "net_1_1"), "1.0", api_1_1); Populate (sub, "API 2.0 sp2", GetVersionPath ("2.0", "net_2_0"), "2.0", api_2_0); Populate (sub, "API 3.0 sp1", GetVersionPath ("2.0", "net_2_0"), "3.0", api_3_0); Populate (sub, "API 3.5 sp1", GetVersionPath ("2.0", "net_2_0"), "3.5", api_3_5); Populate (sub, "API 4.0", GetVersionPath ("4.0", "net_4_0"), "4.0", api_4_0); Populate (sub, "API 4.5", GetVersionPath ("4.5", "net_4_5"), "4.5", api_4_5); // Populate (sub, "Silverlight 2.0", GetVersionPath ("2.1", "net_2_1"), "SL2", api_sl2); // Populate (sub, "Silverlight 3.0", GetVersionPath ("2.1", "net_2_1"), "SL3", api_sl2); Populate (sub, "Silverlight 4.0", GetVersionPath ("2.1", "net_2_1"), "SL4", api_sl4); } string GetVersionPath (string version, string profile) { if (!monodir.Contains (Path.Combine ("mcs", "class", "lib"))) return version; // Developer's version pointing to /mcs/class/lib// return profile; } } } mono-tools-4.2/gui-compare/Main.cs0000664000175000017500000000375712413742070021146 0ustar00directhexdirecthex00000000000000// // Main.cs // // (C) 2007 - 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; using Gtk; using System.IO; namespace GuiCompare { class MainClass { public static void Main (string[] args) { Application.Init (); try { InfoManager.Init (); } catch (Exception e) { Dialog d = new Dialog ("Error", null, DialogFlags.Modal, new object [] { "OK", ResponseType.Ok }); d.VBox.Add (new Label ("There was a problem while trying to initialize the InfoManager\n\n" + e.ToString ())); d.VBox.ShowAll (); d.Run (); return; } string profile_path = null; if (args.Length != 0 && args[0].StartsWith ("--profile-path=")) profile_path = args[0].Substring (15); MainWindow win = new MainWindow (profile_path); win.Show (); if (args.Length == 2 && File.Exists (args [0]) && File.Exists (args [1])){ win.ComparePaths (args [0], args [1]); } Application.Run (); } } } mono-tools-4.2/gui-compare/gui-compare.in0000664000175000017500000000027012413742070022456 0ustar00directhexdirecthex00000000000000#!/bin/sh export DYLD_FALLBACK_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib:/usr/lib exec mono $MONO_OPTIONS "@prefix@/lib/gui-compare/gui-compare.exe" "$@" mono-tools-4.2/gui-compare/MasterMetadata.cs0000664000175000017500000006215612413742070023154 0ustar00directhexdirecthex00000000000000// // MasterMetadata.cs // // (C) 2007 - 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; using System.Collections.Generic; using System.Text; namespace GuiCompare { static class MasterUtils { public static void PopulateMethodList (XMLMethods methods, List method_list) { foreach (object key in methods.keys.Keys) { XMLMethods.SignatureFlags signatureFlags = (methods.signatureFlags != null && methods.signatureFlags.ContainsKey (key) ? (XMLMethods.SignatureFlags) methods.signatureFlags [key] : XMLMethods.SignatureFlags.None); XMLParameters parameters = (methods.parameters == null ? null : (XMLParameters)methods.parameters[key]); XMLGenericParameters genericParameters = (methods.genericParameters == null ? null : (XMLGenericParameters)methods.genericParameters[key]); XMLAttributes attributes = (methods.attributeMap == null ? null : (XMLAttributes)methods.attributeMap[key]); string returnType = (methods.returnTypes == null ? null : (string)methods.returnTypes[key]); method_list.Add (new MasterMethod ((string)methods.keys[key], signatureFlags, returnType, parameters, genericParameters, methods.ConvertToString (Int32.Parse ((string)methods.access[key])), attributes)); } } public static void PopulateMemberLists (XMLClass xml_cls, List interface_list, List constructor_list, List method_list, List property_list, List field_list, List event_list) { if (interface_list != null && xml_cls.interfaces != null) { foreach (object i in xml_cls.interfaces.keys.Keys) { interface_list.Add (new MasterInterface ((string)xml_cls.interfaces.keys[i])); } } if (constructor_list != null && xml_cls.constructors != null) { PopulateMethodList (xml_cls.constructors, constructor_list); } if (method_list != null && xml_cls.methods != null) { PopulateMethodList (xml_cls.methods, method_list); } if (property_list != null && xml_cls.properties != null) { foreach (object key in xml_cls.properties.keys.Keys) { XMLAttributes attributes = (xml_cls.properties.attributeMap == null ? null : (XMLAttributes)xml_cls.properties.attributeMap[key]); property_list.Add (new MasterProperty ((string)key, xml_cls.properties.ConvertToString (Int32.Parse ((string)xml_cls.properties.access[key])), (XMLMethods)xml_cls.properties.nameToMethod[key], attributes)); } } if (field_list != null && xml_cls.fields != null) { foreach (object key in xml_cls.fields.keys.Keys) { string type = (xml_cls.fields.fieldTypes == null || !xml_cls.fields.fieldTypes.ContainsKey(key)) ? null : (string)xml_cls.fields.fieldTypes[key]; string fvalue = (xml_cls.fields.fieldValues == null || !xml_cls.fields.fieldValues.ContainsKey(key)) ? null : (string)xml_cls.fields.fieldValues[key]; XMLAttributes attributes = (xml_cls.fields.attributeMap == null ? null : (XMLAttributes)xml_cls.fields.attributeMap[key]); field_list.Add (new MasterField ((string)xml_cls.fields.keys[key], type, fvalue, xml_cls.fields.ConvertToString(Int32.Parse ((string)xml_cls.fields.access[key])), attributes)); } } if (event_list != null && xml_cls.events != null) { foreach (object key in xml_cls.events.keys.Keys) { XMLAttributes attributes = (xml_cls.events.attributeMap == null ? null : (XMLAttributes)xml_cls.events.attributeMap[key]); event_list.Add (new MasterEvent ((string)xml_cls.events.keys[key], (string)xml_cls.events.eventTypes[key], xml_cls.events.ConvertToString (Int32.Parse ((string)xml_cls.events.access[key])), attributes)); } } } public static void PopulateTypeLists (XMLClass fromDef, List class_list, List enum_list, List delegate_list, List interface_list, List struct_list) { if (fromDef.nested == null) return; foreach (XMLClass cls in fromDef.nested) { if (cls.type == "class") class_list.Add (new MasterClass (cls, CompType.Class)); else if (cls.type == "enum") enum_list.Add (new MasterEnum (cls)); else if (cls.type == "delegate") delegate_list.Add (new MasterDelegate (cls)); else if (cls.type == "interface") interface_list.Add (new MasterInterface (cls)); else if (cls.type == "struct") struct_list.Add (new MasterClass (cls, CompType.Struct)); } } public static bool IsImplementationSpecificAttribute (string name) { if (name.IndexOf (';') > 0) { if (name.StartsWith ("System.Runtime.CompilerServices.InternalsVisibleToAttribute")) return true; } switch (name) { case "System.Diagnostics.CodeAnalysis.SuppressMessageAttribute": case "System.NonSerializedAttribute": case "System.Runtime.CompilerServices.CompilerGeneratedAttribute": case "System.Security.SecuritySafeCriticalAttribute": case "System.Security.SecurityCriticalAttribute": case "System.Diagnostics.DebuggerHiddenAttribute": case "System.Diagnostics.DebuggerStepThroughAttribute": case "System.Runtime.CompilerServices.InternalsVisibleToAttribute": case "System.Runtime.TargetedPatchingOptOutAttribute": case "System.Runtime.InteropServices.ComVisibleAttribute": case "System.Runtime.AssemblyTargetedPatchBandAttribute": case "System.Diagnostics.DebuggableAttribute": return true; } return false; } public static List GetAttributes (XMLAttributes attributes) { List rv = new List(); if (attributes != null) { XMLAttributeProperties properties; foreach (string key in attributes.keys.Keys) { if (IsImplementationSpecificAttribute (key)) continue; if (!attributes.Properties.TryGetValue (key, out properties)) properties = null; rv.Add (new MasterAttribute ((string)attributes.keys[key], properties)); } } return rv; } public static List GetTypeParameters (XMLGenericParameters gparams) { if (gparams == null) return null; var list = new List (); foreach (string key in gparams.keys.Keys) { XMLAttributes attributes = gparams.attributeMap == null ? null : (XMLAttributes) gparams.attributeMap [key]; var constraints = gparams.constraints [key]; list.Add (new MasterGenericTypeParameter (key, constraints, attributes)); } return list; } public static List GetParameters (XMLParameters parameters) { var list = new List (); foreach (XMLParameter key in parameters.keys.Values) { list.Add (new MasterParameter (key.Name, key.type, key.isOptional, key.attributes)); } return list; } } public class MasterAssembly : CompAssembly { public MasterAssembly (string path) : base (path) { masterinfo = XMLAssembly.CreateFromFile (path); if (masterinfo == null) throw new ArgumentException ("Error loading masterinfo from " + path); attributes = MasterUtils.GetAttributes (masterinfo.attributes); } public override List GetNamespaces () { List namespaces = new List(); if (masterinfo != null && masterinfo.namespaces != null) { foreach (XMLNamespace ns in masterinfo.namespaces) namespaces.Add (new MasterNamespace (ns)); } return namespaces; } public override List GetAttributes () { return attributes; } XMLAssembly masterinfo; List attributes; } public class MasterNamespace : CompNamespace { public MasterNamespace (XMLNamespace ns) : base (ns.name) { this.ns = ns; delegate_list = new List(); enum_list = new List(); class_list = new List(); struct_list = new List(); interface_list = new List(); foreach (XMLClass cls in ns.types) { if (cls.type == "class") class_list.Add (new MasterClass (cls, CompType.Class)); else if (cls.type == "enum") enum_list.Add (new MasterEnum (cls)); else if (cls.type == "delegate") delegate_list.Add (new MasterDelegate (cls)); else if (cls.type == "interface") interface_list.Add (new MasterInterface (cls)); else if (cls.type == "struct") struct_list.Add (new MasterClass (cls, CompType.Struct)); } } public override List GetNestedClasses () { return class_list; } public override List GetNestedInterfaces () { return interface_list; } public override List GetNestedStructs () { return struct_list; } public override List GetNestedEnums () { return enum_list; } public override List GetNestedDelegates () { return delegate_list; } XMLNamespace ns; List delegate_list; List enum_list; List class_list; List struct_list; List interface_list; } public class MasterInterface : CompInterface { public MasterInterface (XMLClass xml_cls) : base (FormatName (xml_cls)) { this.xml_cls = xml_cls; interfaces = new List(); constructors = new List(); methods = new List(); properties = new List(); fields = new List(); events = new List(); MasterUtils.PopulateMemberLists (xml_cls, interfaces, constructors, methods, properties, fields, events); attributes = MasterUtils.GetAttributes (xml_cls.attributes); } public MasterInterface (string name) : base (name) { interfaces = new List(); constructors = new List(); methods = new List(); properties = new List(); fields = new List(); events = new List(); attributes = new List(); } static string FormatName (XMLClass iface) { string name = iface.name; return name; } public override string GetBaseType() { return xml_cls == null ? null : xml_cls.baseName; } public override List GetInterfaces () { return interfaces; } public override List GetMethods () { return methods; } public override List GetConstructors () { return constructors; } public override List GetProperties() { return properties; } public override List GetFields() { return fields; } public override List GetEvents() { return events; } public override List GetAttributes () { return attributes; } public override List GetTypeParameters () { return xml_cls.GetTypeParameters (); } XMLClass xml_cls; List interfaces; List constructors; List methods; List properties; List fields; List events; List attributes; } public class MasterDelegate : CompDelegate { public MasterDelegate (XMLClass cls) : base (cls.name) { xml_cls = cls; } public override List GetAttributes () { return MasterUtils.GetAttributes (xml_cls.attributes); } public override List GetConstructors () { List ctor_list = new List (); MasterUtils.PopulateMethodList (xml_cls.constructors, ctor_list); return ctor_list; } public override List GetMethods () { List method_list = new List (); MasterUtils.PopulateMethodList (xml_cls.methods, method_list); return method_list; } public override string GetBaseType () { return xml_cls.baseName; } public override List GetTypeParameters () { return xml_cls.GetTypeParameters (); } XMLClass xml_cls; } public class MasterEnum : CompEnum { public MasterEnum (XMLClass cls) : base (cls.name) { xml_cls = cls; fields = new List(); MasterUtils.PopulateMemberLists (xml_cls, null, null, null, null, fields, null); if (fields == null || fields.Count == 0) return; List masterFields = new List (); foreach (CompNamed f in fields) { MasterField field = f as MasterField; if (field == null) continue; masterFields.Add (field); } if (masterFields.Count == 0) return; masterFields.Sort ((MasterField left, MasterField right) => { if (left == null && right == null) return 0; if (left == null) return 1; if (right == null) return -1; return String.Compare (left.GetLiteralValue (), right.GetLiteralValue (), StringComparison.Ordinal); }); StringBuilder sb = new StringBuilder (); sb.Append ("Members:\n"); foreach(MasterField field in masterFields) sb.AppendFormat ("\t\t{0} = {1}\n", field.Name, field.GetLiteralValue ()); ExtraInfo = sb.ToString (); } public override string GetBaseType() { return xml_cls.baseName; } public override List GetFields() { return fields; } public override List GetAttributes () { return MasterUtils.GetAttributes (xml_cls.attributes); } List fields; XMLClass xml_cls; } public class MasterClass : CompClass { public MasterClass (XMLClass cls, CompType type) : base (cls.name, type) { xml_cls = cls; interfaces = new List(); constructors = new List(); methods = new List(); properties = new List(); fields = new List(); events = new List(); MasterUtils.PopulateMemberLists (xml_cls, interfaces, constructors, methods, properties, fields, events); delegate_list = new List(); enum_list = new List(); class_list = new List(); struct_list = new List(); interface_list = new List(); MasterUtils.PopulateTypeLists (xml_cls, class_list, enum_list, delegate_list, interface_list, struct_list); } public override string GetBaseType () { return xml_cls.baseName; } public override bool IsSealed { get { return xml_cls.isSealed; } } public override bool IsAbstract { get { return xml_cls.isAbstract; } } public override List GetInterfaces () { return interfaces; } public override List GetMethods() { return methods; } public override List GetConstructors() { return constructors; } public override List GetProperties() { return properties; } public override List GetFields() { return fields; } public override List GetEvents() { return events; } public override List GetAttributes () { return MasterUtils.GetAttributes (xml_cls.attributes); } public override List GetNestedClasses() { return class_list; } public override List GetNestedInterfaces () { return interface_list; } public override List GetNestedStructs () { return struct_list; } public override List GetNestedEnums () { return enum_list; } public override List GetNestedDelegates () { return delegate_list; } public override List GetTypeParameters () { return xml_cls.GetTypeParameters (); } XMLClass xml_cls; List interfaces; List constructors; List methods; List properties; List fields; List events; List delegate_list; List enum_list; List class_list; List struct_list; List interface_list; } public class MasterEvent : CompEvent { public MasterEvent (string name, string eventType, string eventAccess, XMLAttributes attributes) : base (name) { this.eventType = eventType; this.eventAccess = eventAccess; this.attributes = attributes; } public override string GetMemberType () { return eventType; } public override string GetMemberAccess () { return eventAccess; } public override List GetAttributes () { return MasterUtils.GetAttributes (attributes); } string eventType; string eventAccess; XMLAttributes attributes; } public class MasterField : CompField { public MasterField (string name, string fieldType, string fieldValue, string fieldAccess, XMLAttributes attributes) : base (name) { this.fieldType = fieldType; this.fieldValue = fieldValue; // we don't care about the Assembly (internal) part this.fieldAccess = fieldAccess.Replace ("FamORAssem", "Family"); this.attributes = attributes; } public override string GetMemberType () { return fieldType; } public override string GetMemberAccess () { return fieldAccess; } public override List GetAttributes () { return MasterUtils.GetAttributes (attributes); } public override string GetLiteralValue () { return fieldValue; } string fieldType; string fieldValue; string fieldAccess; XMLAttributes attributes; } public class MasterProperty : CompProperty { public MasterProperty (string key, string propertyAccess, XMLMethods xml_methods, XMLAttributes attributes) : base (FormatName (key)) { string[] keyparts = key.Split(new char[] {':'}, 3); this.propertyType = keyparts[1]; this.propertyAccess = propertyAccess; methods = new List(); MasterUtils.PopulateMethodList (xml_methods, methods); this.attributes = attributes; } public override List GetAttributes () { return MasterUtils.GetAttributes (attributes); } public override string GetMemberType() { return propertyType; } public override string GetMemberAccess() { return propertyAccess; } public override List GetMethods() { return methods; } static string FormatName (string key) { string[] keyparts = key.Split(new char[] {':'}, 3); StringBuilder sb = new StringBuilder (); sb.Append (keyparts[1]); sb.Append (" "); sb.Append (keyparts[0]); if (keyparts[2] != "") sb.AppendFormat ("[{0}]", keyparts[2]); return sb.ToString (); } List methods; XMLAttributes attributes; string propertyType; string propertyAccess; } public class MasterMethod : CompMethod { public MasterMethod (string name, XMLMethods.SignatureFlags signatureFlags, string returnType, XMLParameters parameters, XMLGenericParameters genericParameters, string methodAccess, XMLAttributes attributes) : base (String.Format ("{0} {1}", returnType, name)) { this.signatureFlags = signatureFlags; this.returnType = returnType; this.parameters = parameters; this.genericParameters = genericParameters; // we don't care about the Assembly (internal) part this.methodAccess = methodAccess.Replace ("FamORAssem", "Family"); this.attributes = attributes; } public override string GetMemberType() { return returnType; } public override bool ThrowsNotImplementedException () { return false; } public override string GetMemberAccess() { return methodAccess; } public override List GetAttributes () { return MasterUtils.GetAttributes (attributes); } public override List GetTypeParameters () { return MasterUtils.GetTypeParameters (genericParameters); } public override List GetParameters () { return MasterUtils.GetParameters (parameters); } XMLMethods.SignatureFlags signatureFlags; string returnType; XMLParameters parameters; XMLGenericParameters genericParameters; string methodAccess; XMLAttributes attributes; } public class MasterAttribute : CompAttribute { string FormatStringValue (string value) { if (value == null) return "null"; return "\"" + value + "\""; } public MasterAttribute (string name, XMLAttributeProperties properties) : base(name) { var sb = new StringBuilder (); if (properties == null) return; IDictionary props = properties.Properties; if (props.Count == 0) return; foreach (var entry in props) Properties.Add (entry.Key, entry.Value); if (name == "System.Runtime.CompilerServices.TypeForwardedToAttribute") { string dest; if (props.TryGetValue ("Destination", out dest) && !String.IsNullOrEmpty (dest)) sb.AppendFormat ("[assembly: TypeForwardedToAttribute (typeof ({0}))]", dest); } else { sb.Append ("Properties:\n"); foreach (var prop in props) sb.AppendFormat ("\t\t{0} == {1}\n", prop.Key, FormatStringValue (prop.Value)); sb.Append ('\n'); } ExtraInfo = sb.ToString (); } } public class MasterParameter : CompParameter { XMLAttributes attributes; public MasterParameter (string name, string type, bool optional, XMLAttributes attributes) : base (name, type, optional) { this.attributes = attributes; } public override List GetAttributes () { return MasterUtils.GetAttributes (attributes); } } public class MasterGenericTypeParameter : CompGenericParameter { XMLGenericParameterConstraints constraints; XMLAttributes attributes; public MasterGenericTypeParameter (string name, XMLGenericParameterConstraints constraints, XMLAttributes attributes) : base (name, (Mono.Cecil.GenericParameterAttributes)Enum.Parse (typeof (Mono.Cecil.GenericParameterAttributes), constraints.attributes)) { this.constraints = constraints; this.attributes = attributes; } public override bool HasConstraints { get { return constraints.keys != null; } } public override List GetAttributes () { return MasterUtils.GetAttributes (attributes); } } } mono-tools-4.2/gui-compare/Makefile.in0000664000175000017500000004475712642235732022013 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = gui-compare ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = gui-compare 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)$(guicomparedir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(guicompare_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/gui-compare.in \ ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ guicomparedir = $(prefix)/lib/gui-compare bin_SCRIPTS = gui-compare guicompare_DATA = gui-compare.exe gui-compare.exe.mdb CLEANFILES = gui-compare.exe gui-compare.exe.mdb gui-compare gui_compare_sources = \ $(srcdir)/gtk-gui/generated.cs \ $(srcdir)/MainWindow.cs \ $(srcdir)/gtk-gui/MainWindow.cs \ $(srcdir)/Main.cs \ $(srcdir)/AssemblyInfo.cs \ $(srcdir)/InfoManager.cs \ $(srcdir)/CompareContext.cs \ $(srcdir)/Comparison.cs \ $(srcdir)/Metadata.cs \ $(srcdir)/MasterMetadata.cs \ $(srcdir)/Masterinfo.cs \ $(srcdir)/CecilMetadata.cs \ $(srcdir)/ProviderSelector.cs \ $(srcdir)/gtk-gui/guicompare.ProviderSelector.cs\ $(srcdir)/Config.cs \ $(srcdir)/CustomCompare.cs \ $(srcdir)/gtk-gui/GuiCompare.CustomCompare.cs gui_compare_resources = \ $(srcdir)/gtk-gui/gui.stetic \ $(srcdir)/cm/c.gif \ $(srcdir)/cm/d.gif \ $(srcdir)/cm/e.gif \ $(srcdir)/cm/en.gif \ $(srcdir)/cm/f.gif \ $(srcdir)/cm/i.gif \ $(srcdir)/cm/m.gif \ $(srcdir)/cm/n.gif \ $(srcdir)/cm/p.gif \ $(srcdir)/cm/r.gif \ $(srcdir)/cm/s.gif \ $(srcdir)/cm/sc.gif \ $(srcdir)/cm/se.gif \ $(srcdir)/cm/sm.gif \ $(srcdir)/cm/st.gif \ $(srcdir)/cm/sx.gif \ $(srcdir)/cm/tb.gif \ $(srcdir)/cm/tm.gif \ $(srcdir)/cm/tp.gif \ $(srcdir)/cm/w.gif \ $(srcdir)/cm/y.gif \ $(srcdir)/gtk-gui/objects.xml \ $(srcdir)/cm/mn.png EXTRA_DIST = $(gui_compare_sources) $(gui_compare_resources) gui-compare.mds gui-compare.mdp gui-compare.in packages = -pkg:gtk-sharp-2.0 -pkg:glib-sharp-2.0 -pkg:glade-sharp-2.0 -r:$(CECIL_ASM) assemblies = -r:System -r:System.Core -r:Mono.Posix -r:System.Xml ress = $(foreach res,$(gui_compare_resources), $(addprefix -resource:,$(res)),$(notdir $(res))) 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) --gnu gui-compare/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu gui-compare/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): gui-compare: $(top_builddir)/config.status $(srcdir)/gui-compare.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-guicompareDATA: $(guicompare_DATA) @$(NORMAL_INSTALL) @list='$(guicompare_DATA)'; test -n "$(guicomparedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(guicomparedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(guicomparedir)" || 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)$(guicomparedir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(guicomparedir)" || exit $$?; \ done uninstall-guicompareDATA: @$(NORMAL_UNINSTALL) @list='$(guicompare_DATA)'; test -n "$(guicomparedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(guicomparedir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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)$(guicomparedir)"; 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) 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-guicompareDATA 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-guicompareDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-guicompareDATA \ 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 tags-am \ uninstall uninstall-am uninstall-binSCRIPTS \ uninstall-guicompareDATA .PRECIOUS: Makefile gui-compare.exe: $(gui_compare_sources) $(gui_compare_resources) $(DMCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG -target:exe -out:gui-compare.exe $(gui_compare_sources) $(ress) $(packages) $(assemblies) # 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-tools-4.2/gui-compare/CecilMetadata.cs0000664000175000017500000012243012413742070022730 0ustar00directhexdirecthex00000000000000// // CecilMetadata.cs // // (C) 2007 - 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; using System.Collections; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.IO; using System.Linq; using System.Text; using System.Globalization; using Mono.Cecil; using Mono.Cecil.Cil; namespace GuiCompare { static class CecilUtils { public static string PrettyType (TypeReference type) { var gen_instance = type as GenericInstanceType; if (gen_instance != null) { if (gen_instance.ElementType.FullName == "System.Nullable`1") return PrettyType (gen_instance.GenericArguments [0]) + "?"; var signature = new StringBuilder (); signature.Append (PrettyType (gen_instance.ElementType)); signature.Append ("<"); for (int i = 0; i < gen_instance.GenericArguments.Count; i++) { if (i > 0) signature.Append (","); signature.Append (PrettyType (gen_instance.GenericArguments [i])); } signature.Append (">"); return signature.ToString (); } var array = type as ArrayType; if (array != null) return PrettyType (array.ElementType) + "[]"; var reference = type as ByReferenceType; if (reference != null) return PrettyType (reference.ElementType) + "&"; var pointer = type as PointerType; if (pointer != null) return PrettyType (pointer.ElementType) + "*"; switch (type.FullName) { case "System.Boolean": return "bool"; case "System.Byte": return "byte"; case "System.Char": return "char"; case "System.Decimal": return "decimal"; case "System.Double": return "double"; case "System.Int16": return "short"; case "System.Int32": return "int"; case "System.Int64": return "long"; case "System.Object": return "object"; case "System.SByte": return "sbyte"; case "System.Single": return "float"; case "System.String": return "string"; case "System.UInt16": return "ushort"; case "System.UInt32": return "uint"; case "System.UInt64": return "ulong"; case "System.Void": return "void"; } return type.Name; } public static string PrettyTypeDefinition (TypeDefinition td) { if (td.GenericParameters.Count > 0) { int arity_start = td.Name.IndexOf ('`'); if (arity_start > 0) { var sb = new StringBuilder (td.Name); sb.Remove (arity_start, td.Name.Length - arity_start); sb.Append ("<"); bool first_gp = true; foreach (GenericParameter gp in td.GenericParameters) { if (!first_gp) sb.Append (','); first_gp = false; sb.Append (gp.Name); } sb.Append (">"); return sb.ToString (); } } return td.Name; } // the corcompare xml output uses a different formatting than Cecil. // Cecil uses / for nested classes, ala: // Namespace.Class/NestedClass // while corcompare uses: // Namespace.Class+NestedClass // also, generic methods are done differently as well. // cecil: Foo // corcompare: Foo[T] // // so let's just convert everything to corcompare's way of thinking for comparisons. // public static string FormatTypeLikeCorCompare (TypeReference type) { return type.FullName.Replace ('/', '+') .Replace ('<', '[') .Replace ('>', ']'); } public static void PopulateMemberLists (TypeDefinition fromDef, List interface_list, List constructor_list, List method_list, List property_list, List field_list, List event_list) { if (interface_list != null) { foreach (TypeReference ifc in GetInterfaces (fromDef)) { TypeDefinition ifc_def = ifc.Resolve (); if (ifc_def == null || ifc_def.IsNotPublic) continue; interface_list.Add (new CecilInterface (ifc)); } } if (constructor_list != null) { foreach (MethodDefinition md in fromDef.Methods.Where (m => m.IsConstructor)) { if (md.IsPrivate || md.IsAssembly) continue; constructor_list.Add (new CecilMethod (md)); } } if (method_list != null) { foreach (MethodDefinition md in fromDef.Methods.Where (m => !m.IsConstructor)) { if (md.IsSpecialName) { if (!md.Name.StartsWith("op_")) continue; } if (IsFinalizer (md)) { string name = md.DeclaringType.Name; int arity = name.IndexOf ('`'); if (arity > 0) name = name.Substring (0, arity); md.Name = "~" + name; } if (md.IsPrivate || md.IsAssembly) continue; method_list.Add (new CecilMethod (md)); } } if (property_list != null) { foreach (PropertyDefinition pd in fromDef.Properties) { bool include_set = true; bool include_get = true; if (pd.SetMethod == null || (pd.SetMethod.IsPrivate || pd.SetMethod.IsAssembly)) include_set = false; if (pd.GetMethod == null || (pd.GetMethod.IsPrivate || pd.GetMethod.IsAssembly)) include_get = false; if (include_set || include_get) property_list.Add (new CecilProperty (pd)); } } if (field_list != null) { foreach (FieldDefinition fd in fromDef.Fields) { if (fd.IsSpecialName) continue; if (fd.IsPrivate || fd.IsAssembly){ //Console.WriteLine (" Skipping over {0}.{1} {2}", fromDef.Namespace, fromDef.Name, fd.Name); continue; } //Console.WriteLine (" Adding {0}.{1} {2}", fromDef.Namespace, fromDef.Name, fd.Name); field_list.Add (new CecilField (fd)); } } if (event_list != null) { foreach (EventDefinition ed in fromDef.Events) { if (ed.IsSpecialName) continue; if (ed.AddMethod == null || ed.AddMethod.IsPrivate || ed.AddMethod.IsAssembly) continue; event_list.Add (new CecilEvent (ed)); } } } static IEnumerable WalkHierarchy (TypeReference type) { for (var definition = type.Resolve (); definition != null; definition = GetBaseType (definition)) yield return definition; } static TypeDefinition GetBaseType (TypeDefinition type) { if (type.BaseType == null) return null; return type.BaseType.Resolve (); } static IEnumerable GetInterfaces (TypeReference type) { var cache = new Dictionary (); foreach (var definition in WalkHierarchy (type)) foreach (TypeReference iface in definition.Interfaces) cache [iface.FullName] = iface; return cache.Values; } static bool IsFinalizer (MethodDefinition method) { if (method.Name != "Finalize") return false; if (!method.IsVirtual) return false; if (method.Parameters.Count != 0) return false; return true; } public static void PopulateTypeLists (TypeDefinition fromDef, List class_list, List enum_list, List delegate_list, List interface_list, List struct_list) { foreach (TypeDefinition type_def in fromDef.NestedTypes) { //Console.WriteLine ("Got {0}.{1} => {2}", type_def.Namespace, type_def.Name, type_def.Attributes & TypeAttributes.VisibilityMask); if (type_def.IsNestedPrivate || type_def.IsNestedAssembly || type_def.IsNotPublic){ continue; } if (type_def.IsValueType) { if (type_def.IsEnum) { enum_list.Add (new CecilEnum (type_def)); } else { struct_list.Add (new CecilClass (type_def, CompType.Struct)); } } else if (type_def.IsInterface) { interface_list.Add (new CecilInterface (type_def)); } else if (type_def.BaseType.FullName == "System.MulticastDelegate") { delegate_list.Add (new CecilDelegate (type_def)); } else { class_list.Add (new CecilClass (type_def, CompType.Class)); } } } public static string GetTODOText (CustomAttribute ca) { StringBuilder sb = new StringBuilder(); bool first = true; foreach (var argument in ca.ConstructorArguments) { if (!first) sb.Append (", "); first = false; sb.Append (argument.Value.ToString()); } return sb.ToString(); } public static bool IsTODOAttribute (TypeDefinition typedef) { if (typedef == null) return false; if (typedef.Name == "MonoTODOAttribute") return true; if (typedef.BaseType == null) return false; return IsTODOAttribute (GetBaseType (typedef)); } public static List GetCustomAttributes (ICustomAttributeProvider provider, List todos) { List rv = new List(); foreach (CustomAttribute ca in provider.CustomAttributes) { TypeDefinition resolved = ca.Constructor.DeclaringType.Resolve (); if (resolved != null) { if (IsTODOAttribute (resolved)) { todos.Add (String.Format ("[{0} ({1})]", ca.Constructor.DeclaringType.Name, CecilUtils.GetTODOText (ca))); continue; } if (resolved.IsNotPublic) continue; } if (!MasterUtils.IsImplementationSpecificAttribute (ca.Constructor.DeclaringType.FullName)) rv.Add (new CecilAttribute (ca)); } return rv; } public static List GetTypeParameters (IGenericParameterProvider provider) { if (provider.GenericParameters.Count == 0) return null; var l = new List (); var gparameters = provider.GenericParameters; foreach (GenericParameter gp in gparameters) { l.Add (new CecilGenericParameter (gp)); } return l; } public static List GetParameters (IMethodSignature provider) { var l = new List (); foreach (ParameterDefinition pd in provider.Parameters) { l.Add (new CecilParameter (pd)); } return l; } public static readonly IAssemblyResolver Resolver = new DefaultAssemblyResolver(); } public class CecilAssembly : CompAssembly { public CecilAssembly (string path) : base(Path.GetFileName (path)) { var namespaces = new Dictionary> (); var assembly = AssemblyDefinition.ReadAssembly (path, new ReaderParameters { AssemblyResolver = CecilUtils.Resolver }); foreach (TypeDefinition t in assembly.MainModule.Types) { if (t.Name == "") continue; if (t.IsNotPublic) continue; if (t.IsSpecialName || t.IsRuntimeSpecialName) continue; if (CecilUtils.IsTODOAttribute (t)) continue; Dictionary ns; if (!namespaces.TryGetValue (t.Namespace, out ns)) { ns = new Dictionary (); namespaces.Add (t.Namespace, ns); } ns[t.Name] = t; } namespace_list = new List (); foreach (string ns_name in namespaces.Keys) namespace_list.Add (new CecilNamespace (ns_name, namespaces[ns_name])); attributes = CecilUtils.GetCustomAttributes (assembly, todos); // TypeForwardedToAttributes are created by checking if assembly contains // extern forwarder types and using them to construct fake custom attributes foreach (ExportedType t in assembly.MainModule.ExportedTypes) { if (t.IsForwarder) attributes.Add (new PseudoCecilAttribute (t)); } } public override List GetNamespaces() { return namespace_list; } public override List GetAttributes () { return attributes; } List namespace_list; List attributes; } public class CecilNamespace : CompNamespace { public CecilNamespace (string name, Dictionary type_mapping) : base (name) { class_list = new List(); enum_list = new List(); delegate_list = new List(); interface_list = new List(); struct_list = new List(); MemberName = name; foreach (string type_name in type_mapping.Keys) { TypeDefinition type_def = type_mapping[type_name]; if (type_def.IsNotPublic) continue; if (type_def.IsValueType) { if (type_def.IsEnum) { enum_list.Add (new CecilEnum (type_def)); } else { if (type_def.FullName == "System.Enum") class_list.Add (new CecilClass (type_def, CompType.Class)); else struct_list.Add (new CecilClass (type_def, CompType.Struct)); } } else if (type_def.IsInterface) { interface_list.Add (new CecilInterface (type_def)); } else if (type_def.BaseType != null && type_def.BaseType.FullName == "System.MulticastDelegate") { delegate_list.Add (new CecilDelegate (type_def)); } else { class_list.Add (new CecilClass (type_def, CompType.Class)); } } } public override List GetNestedClasses() { return class_list; } public override List GetNestedInterfaces () { return interface_list; } public override List GetNestedStructs () { return struct_list; } public override List GetNestedEnums () { return enum_list; } public override List GetNestedDelegates () { return delegate_list; } List class_list; List interface_list; List struct_list; List delegate_list; List enum_list; } public class CecilInterface : CompInterface { public CecilInterface (TypeDefinition type_def) : base (type_def.Name) { this.type_def = type_def; DisplayName = CecilUtils.PrettyTypeDefinition (type_def); interfaces = new List(); constructors = new List(); methods = new List(); properties = new List(); fields = new List(); events = new List(); if (!type_def.IsNotPublic || type_def.IsPublic || type_def.IsNestedPublic || type_def.IsNestedFamily || type_def.IsNestedFamilyAndAssembly || type_def.IsNestedFamilyOrAssembly) MemberName = type_def.FullName; CecilUtils.PopulateMemberLists (type_def, interfaces, constructors, methods, properties, fields, events); attributes = CecilUtils.GetCustomAttributes (type_def, todos); tparams = CecilUtils.GetTypeParameters (type_def); } public CecilInterface (TypeReference type_ref) : base (CecilUtils.FormatTypeLikeCorCompare (type_ref)) { interfaces = new List(); constructors = new List(); methods = new List(); properties = new List(); fields = new List(); events = new List(); attributes = new List(); tparams = new List(); } public override string GetBaseType () { return (type_def == null || type_def.BaseType == null) ? null : CecilUtils.FormatTypeLikeCorCompare (type_def.BaseType); } public override List GetInterfaces () { return interfaces; } public override List GetMethods () { return methods; } public override List GetConstructors () { return constructors; } public override List GetProperties() { return properties; } public override List GetFields() { return fields; } public override List GetEvents() { return events; } public override List GetAttributes () { return attributes; } public override List GetTypeParameters () { return tparams; } List interfaces; List constructors; List methods; List properties; List fields; List events; List attributes; List tparams; TypeDefinition type_def; } public class CecilDelegate : CompDelegate { public CecilDelegate (TypeDefinition type_def) : base (type_def.Name) { this.type_def = type_def; DisplayName = CecilUtils.PrettyTypeDefinition (type_def); if (!type_def.IsNotPublic || type_def.IsPublic || type_def.IsNestedPublic || type_def.IsNestedFamily || type_def.IsNestedFamilyAndAssembly || type_def.IsNestedFamilyOrAssembly) MemberName = type_def.FullName; attributes = CecilUtils.GetCustomAttributes (type_def, todos); } public override List GetAttributes () { return attributes; } public override string GetBaseType () { return type_def.BaseType == null ? null : CecilUtils.FormatTypeLikeCorCompare (type_def.BaseType); } public override List GetConstructors () { List l = new List (); foreach (MethodDefinition md in type_def.Methods) { if (md.IsConstructor) l.Add (new CecilMethod (md)); } return l; } public override List GetMethods () { List l = new List (); foreach (MethodDefinition md in type_def.Methods) { if (!md.IsConstructor) l.Add (new CecilMethod (md)); } return l; } public override List GetTypeParameters () { return CecilUtils.GetTypeParameters (type_def); } TypeDefinition type_def; List attributes; } public class CecilEnum : CompEnum { public CecilEnum (TypeDefinition type_def) : base (type_def.Name) { this.type_def = type_def; fields = new List(); if (!type_def.IsNotPublic || type_def.IsPublic || type_def.IsNestedPublic || type_def.IsNestedFamily || type_def.IsNestedFamilyAndAssembly || type_def.IsNestedFamilyOrAssembly) MemberName = type_def.FullName; CecilUtils.PopulateMemberLists (type_def, null, null, null, null, fields, null); attributes = CecilUtils.GetCustomAttributes (type_def, todos); } public override string GetBaseType () { return type_def.BaseType == null ? null : CecilUtils.FormatTypeLikeCorCompare (type_def.BaseType); } public override List GetFields() { return fields; } public override List GetAttributes () { return attributes; } TypeDefinition type_def; List fields; List attributes; } public class CecilClass : CompClass { public CecilClass (TypeDefinition type_def, CompType type) : base (type_def.Name, type) { this.type_def = type_def; DisplayName = CecilUtils.PrettyTypeDefinition (type_def); nested_classes = new List(); nested_enums = new List(); nested_delegates = new List(); nested_interfaces = new List(); nested_structs = new List(); CecilUtils.PopulateTypeLists (type_def, nested_classes, nested_enums, nested_delegates, nested_interfaces, nested_structs); interfaces = new List(); constructors = new List(); methods = new List(); properties = new List(); fields = new List(); events = new List(); if (!type_def.IsNotPublic || type_def.IsPublic || type_def.IsNestedPublic || type_def.IsNestedFamily || type_def.IsNestedFamilyAndAssembly || type_def.IsNestedFamilyOrAssembly) MemberName = type_def.FullName; CecilUtils.PopulateMemberLists (type_def, interfaces, constructors, methods, properties, fields, events); attributes = CecilUtils.GetCustomAttributes (type_def, todos); } public override string GetBaseType () { return type_def.BaseType == null ? null : CecilUtils.FormatTypeLikeCorCompare (type_def.BaseType); } public override bool IsAbstract { get { return type_def.IsAbstract; } } public override bool IsSealed { get { return type_def.IsSealed; } } public override List GetInterfaces () { return interfaces; } public override List GetMethods () { return methods; } public override List GetConstructors () { return constructors; } public override List GetProperties() { return properties; } public override List GetFields() { return fields; } public override List GetEvents() { return events; } public override List GetAttributes () { return attributes; } public override List GetNestedClasses() { return nested_classes; } public override List GetNestedInterfaces () { return nested_interfaces; } public override List GetNestedStructs () { return nested_structs; } public override List GetNestedEnums () { return nested_enums; } public override List GetNestedDelegates () { return nested_delegates; } public override List GetTypeParameters () { return CecilUtils.GetTypeParameters (type_def); } TypeDefinition type_def; List nested_classes; List nested_interfaces; List nested_structs; List nested_delegates; List nested_enums; List interfaces; List constructors; List methods; List properties; List fields; List events; List attributes; } public class CecilField : CompField { public CecilField (FieldDefinition field_def) : base (field_def.Name) { this.field_def = field_def; this.attributes = CecilUtils.GetCustomAttributes (field_def, todos); if (field_def.IsPublic || field_def.IsFamily || field_def.IsFamilyAndAssembly || field_def.IsFamilyOrAssembly) { TypeDefinition declType = field_def.DeclaringType; if (declType != null) MemberName = declType.FullName + "." + field_def.Name; } } public override string GetMemberType () { return CecilUtils.FormatTypeLikeCorCompare (field_def.FieldType); } const FieldAttributes masterInfoFieldMask = (FieldAttributes.FieldAccessMask | FieldAttributes.Static | FieldAttributes.InitOnly | FieldAttributes.Literal | FieldAttributes.HasDefault | FieldAttributes.HasFieldMarshal | FieldAttributes.NotSerialized ); public override string GetMemberAccess () { FieldAttributes fa = field_def.Attributes & masterInfoFieldMask; // remove the Assem from FamORAssem if ((fa & FieldAttributes.FamORAssem) == FieldAttributes.FamORAssem) fa = (fa & ~(FieldAttributes.FamORAssem)) | (FieldAttributes.Family); return fa.ToString(); } public override List GetAttributes () { return attributes; } public override string GetLiteralValue () { if (field_def.IsLiteral && field_def.Constant != null) { if (field_def.Constant is char) return string.Format (CultureInfo.InvariantCulture, (char) field_def.Constant < 0x80 ? "\\x{0:X02}" : "\\u{0:X04}", (int)(char) field_def.Constant); return Convert.ToString (field_def.Constant, CultureInfo.InvariantCulture); } return null; } FieldDefinition field_def; List attributes; } public class CecilMethod : CompMethod { public CecilMethod (MethodDefinition method_def) : base (FormatName (method_def, false)) { this.method_def = method_def; this.attributes = CecilUtils.GetCustomAttributes (method_def, todos); DisplayName = FormatName (method_def, true); if (method_def.IsFamily || method_def.IsFamilyAndAssembly || method_def.IsFamilyOrAssembly || method_def.IsPublic) { TypeReference declType = method_def.DeclaringType; if (declType != null) MemberName = declType.FullName + "." + method_def.Name; } } public override string GetMemberType () { if (method_def.IsConstructor) return null; return CecilUtils.FormatTypeLikeCorCompare (method_def.ReturnType); } public override bool ThrowsNotImplementedException () { if (method_def.Body != null) foreach (Instruction i in method_def.Body.Instructions) if (i.OpCode == OpCodes.Throw) if (i.Previous.Operand != null && i.Previous.Operand.ToString ().StartsWith ("System.Void System.NotImplementedException")) return true; return false; } const MethodAttributes masterInfoMethodMask = (MethodAttributes.MemberAccessMask | MethodAttributes.Virtual | MethodAttributes.Final | MethodAttributes.Static | MethodAttributes.Abstract | MethodAttributes.HideBySig | // MethodAttributes.HasSecurity | MethodAttributes.SpecialName); public override string GetMemberAccess () { MethodAttributes ma = method_def.Attributes & masterInfoMethodMask; // remove the Assem from FamORAssem if ((ma & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem) ma = (ma & ~(MethodAttributes.FamORAssem)) | (MethodAttributes.Family); return ma.ToString(); } public override List GetAttributes () { return attributes; } public override List GetTypeParameters () { return CecilUtils.GetTypeParameters (method_def); } public override List GetParameters () { return CecilUtils.GetParameters (method_def); } static string FormatName (MethodDefinition method_def, bool beautify) { StringBuilder sb = new StringBuilder (); if (!method_def.IsConstructor) sb.Append (beautify ? CecilUtils.PrettyType (method_def.ReturnType) : CecilUtils.FormatTypeLikeCorCompare (method_def.ReturnType)); sb.Append (" "); if (beautify) { if (method_def.IsSpecialName && method_def.Name.StartsWith ("op_")) { switch (method_def.Name) { case "op_Explicit": sb.Append ("operator explicit"); break; case "op_Implicit": sb.Append ("operator implicit"); break; case "op_Equality": sb.Append ("operator =="); break; case "op_Inequality": sb.Append ("operator !="); break; case "op_Addition": sb.Append ("operator +"); break; case "op_Subtraction": sb.Append ("operator -"); break; case "op_Division": sb.Append ("operator /"); break; case "op_Multiply": sb.Append ("operator *"); break; case "op_Modulus": sb.Append ("operator %"); break; case "op_GreaterThan": sb.Append ("operator >"); break; case "op_GreaterThanOrEqual": sb.Append ("operator >="); break; case "op_LessThan": sb.Append ("operator <"); break; case "op_LessThanOrEqual": sb.Append ("operator <="); break; case "op_UnaryNegation": sb.Append ("operator -"); break; case "op_UnaryPlus": sb.Append ("operator +"); break; case "op_Decrement": sb.Append ("operator --"); break; case "op_Increment": sb.Append ("operator ++"); break; case "op_BitwiseAnd": sb.Append ("operator &"); break; case "op_BitwiseOr": sb.Append ("operator |"); break; case "op_ExclusiveOr": sb.Append ("operator ^"); break; case "op_LogicalNot": sb.Append ("operator !"); break; case "op_OnesComplement": sb.Append ("operator ~"); break; case "op_True": sb.Append ("operator true"); break; case "op_False": sb.Append ("operator false"); break; case "op_LeftShift": sb.Append ("operator <<"); break; case "op_RightShift": sb.Append ("operator >>"); break; default: Console.WriteLine ("unhandled operator named {0}", method_def.Name); sb.Append (method_def.Name); break; } } else { sb.Append (method_def.Name); } } else { sb.Append (method_def.Name); } if (beautify && method_def.GenericParameters.Count > 0) { sb.Append ("<"); bool first_gp = true; foreach (GenericParameter gp in method_def.GenericParameters) { if (!first_gp) sb.Append (','); first_gp = false; sb.Append (gp.Name); } sb.Append (">"); } sb.Append ('('); bool first_p = true; foreach (ParameterDefinition p in method_def.Parameters) { TypeReference paramType = p.ParameterType; if (!first_p) sb.Append (", "); first_p = false; if (p.IsIn) sb.Append ("in "); else if (paramType.IsByReference) { if (beautify) { sb.Append (p.IsOut ? "out " : "ref "); paramType = paramType.GetElementType (); } else if (p.IsOut) { sb.Append ("out "); } } else if (p.IsOut) { sb.Append ("out "); } sb.Append (beautify ? CecilUtils.PrettyType (paramType) : CecilUtils.FormatTypeLikeCorCompare (p.ParameterType)); if (beautify) { sb.Append (" "); sb.Append (p.Name); } } sb.Append (')'); return sb.ToString(); } MethodDefinition method_def; List attributes; } public class CecilProperty : CompProperty { public CecilProperty (PropertyDefinition pd) : base (FormatName (pd, false)) { this.pd = pd; this.attributes = CecilUtils.GetCustomAttributes (pd, todos); this.DisplayName = FormatName (pd, true); MethodDefinition getMethod = pd.GetMethod, setMethod = pd.SetMethod; if (getMethod != null || setMethod != null) { bool interesting = false; if (getMethod != null && (getMethod.IsPublic || getMethod.IsFamily || getMethod.IsFamilyAndAssembly || getMethod.IsFamilyOrAssembly)) interesting = true; else if (setMethod != null && (setMethod.IsPublic || setMethod.IsFamily || setMethod.IsFamilyAndAssembly || setMethod.IsFamilyOrAssembly)) interesting = true; if (interesting) { TypeDefinition declType = pd.DeclaringType; if (declType != null) MemberName = declType.FullName + "." + pd.Name; } } } public override string GetMemberType() { return CecilUtils.FormatTypeLikeCorCompare (pd.PropertyType); } public override string GetMemberAccess() { return pd.Attributes == 0 ? null : pd.Attributes.ToString(); } public override List GetAttributes () { return attributes; } public override List GetMethods() { List rv = new List(); if (pd.GetMethod != null && !pd.GetMethod.IsPrivate && !pd.GetMethod.IsAssembly) rv.Add (new CecilMethod (pd.GetMethod)); if (pd.SetMethod != null && !pd.SetMethod.IsPrivate && !pd.SetMethod.IsAssembly) rv.Add (new CecilMethod (pd.SetMethod)); return rv; } static string FormatName (PropertyDefinition pd, bool beautify) { StringBuilder sb = new StringBuilder (); #if INCLUDE_TYPE_IN_PROPERTY_DISPLAYNAME sb.Append (beautify ? CecilUtils.PrettyType (pd.PropertyType) : CecilUtils.FormatTypeLikeCorCompare (pd.PropertyType)); sb.Append (" "); #else if (!beautify) { sb.Append (CecilUtils.FormatTypeLikeCorCompare (pd.PropertyType)); sb.Append (" "); } #endif sb.Append (pd.Name); if (pd.Parameters.Count > 0) { sb.Append ('['); bool first_p = true; foreach (ParameterDefinition p in pd.Parameters) { if (!first_p) sb.Append (", "); first_p = false; sb.Append (beautify ? CecilUtils.PrettyType (p.ParameterType) : CecilUtils.FormatTypeLikeCorCompare (p.ParameterType)); if (beautify) { sb.Append (" "); sb.Append (p.Name); } } sb.Append (']'); } return sb.ToString (); } PropertyDefinition pd; List attributes; } public class CecilEvent : CompEvent { public CecilEvent (EventDefinition ed) : base (ed.Name) { this.ed = ed; this.attributes = CecilUtils.GetCustomAttributes (ed, todos); MethodDefinition addMethod = ed.AddMethod, removeMethod = ed.RemoveMethod; if (addMethod != null || removeMethod != null) { bool interesting = false; if (addMethod != null && (addMethod.IsPublic || addMethod.IsFamily || addMethod.IsFamilyAndAssembly || addMethod.IsFamilyOrAssembly)) interesting = true; else if (removeMethod != null && (removeMethod.IsPublic || removeMethod.IsFamily || removeMethod.IsFamilyAndAssembly || removeMethod.IsFamilyOrAssembly)) interesting = true; if (interesting) { TypeDefinition declType = ed.DeclaringType; if (declType != null) MemberName = declType.FullName + "." + ed.Name; } } } public override string GetMemberType() { return CecilUtils.FormatTypeLikeCorCompare (ed.EventType); } public override string GetMemberAccess() { return ed.Attributes == 0 ? "None" : ed.Attributes.ToString(); } public override List GetAttributes () { return attributes; } EventDefinition ed; List attributes; } public class CecilAttribute : CompAttribute { public CecilAttribute (CustomAttribute ca) : base (ca.Constructor.DeclaringType.FullName) { Dictionary attribute_mapping = CreateAttributeMapping (ca); foreach (string name in attribute_mapping.Keys) { if (name == "TypeId") continue; object o = attribute_mapping[name]; Properties.Add (name, o == null ? "null" : o.ToString ()); } } static Dictionary CreateAttributeMapping (CustomAttribute attribute) { var mapping = new Dictionary (); PopulateMapping (mapping, attribute); var constructor = attribute.Constructor.Resolve (); if (constructor == null || constructor.Parameters.Count == 0) return mapping; PopulateMapping (mapping, constructor, attribute); return mapping; } static void PopulateMapping (Dictionary mapping, CustomAttribute attribute) { foreach (var named_argument in attribute.Properties) { var name = named_argument.Name; var arg = named_argument.Argument; if (arg.Value is CustomAttributeArgument) arg = (CustomAttributeArgument) arg.Value; mapping.Add (name, GetArgumentValue (arg.Type, arg.Value)); } } static Dictionary CreateArgumentFieldMapping (MethodDefinition constructor) { Dictionary field_mapping = new Dictionary (); int? argument = null; foreach (Instruction instruction in constructor.Body.Instructions) { switch (instruction.OpCode.Code) { case Code.Ldarg_1: argument = 1; break; case Code.Ldarg_2: argument = 2; break; case Code.Ldarg_3: argument = 3; break; case Code.Ldarg: case Code.Ldarg_S: argument = ((ParameterDefinition) instruction.Operand).Index + 1; break; case Code.Stfld: FieldReference field = (FieldReference) instruction.Operand; if (field.DeclaringType.FullName != constructor.DeclaringType.FullName) continue; if (!argument.HasValue) break; if (!field_mapping.ContainsKey (field)) field_mapping.Add (field, (int) argument - 1); argument = null; break; } } return field_mapping; } static Dictionary CreatePropertyFieldMapping (TypeDefinition type) { Dictionary property_mapping = new Dictionary (); foreach (PropertyDefinition property in type.Properties) { if (property.GetMethod == null) continue; if (!property.GetMethod.HasBody) continue; foreach (Instruction instruction in property.GetMethod.Body.Instructions) { if (instruction.OpCode.Code != Code.Ldfld) continue; FieldReference field = (FieldReference) instruction.Operand; if (field.DeclaringType.FullName != type.FullName) continue; property_mapping.Add (property, field); break; } } return property_mapping; } static void PopulateMapping (Dictionary mapping, MethodDefinition constructor, CustomAttribute attribute) { if (!constructor.HasBody) return; if (constructor.DeclaringType.FullName == "System.Runtime.CompilerServices.DecimalConstantAttribute") { var ca = attribute.ConstructorArguments; var dca = constructor.Parameters[2].ParameterType == constructor.Module.TypeSystem.Int32 ? new DecimalConstantAttribute ((byte) ca[0].Value, (byte) ca[1].Value, (int) ca[2].Value, (int) ca[3].Value, (int) ca[4].Value) : new DecimalConstantAttribute ((byte) ca[0].Value, (byte) ca[1].Value, (uint) ca[2].Value, (uint) ca[3].Value, (uint) ca[4].Value); mapping.Add ("Value", dca.Value); return; } var field_mapping = CreateArgumentFieldMapping (constructor); var property_mapping = CreatePropertyFieldMapping ((TypeDefinition) constructor.DeclaringType); foreach (var pair in property_mapping) { int argument; if (!field_mapping.TryGetValue (pair.Value, out argument)) continue; var ca_arg = attribute.ConstructorArguments[argument]; if (ca_arg.Value is CustomAttributeArgument) ca_arg = (CustomAttributeArgument) ca_arg.Value; mapping[pair.Key.Name] = GetArgumentValue (ca_arg.Type, ca_arg.Value); } } static object GetArgumentValue (TypeReference reference, object value) { var type = reference.Resolve (); if (type == null) return value; if (type.IsEnum) { if (IsFlaggedEnum (type)) return GetFlaggedEnumValue (type, value); return GetEnumValue (type, value); } return value; } static bool IsFlaggedEnum (TypeDefinition type) { if (!type.IsEnum) return false; if (type.CustomAttributes.Count == 0) return false; foreach (CustomAttribute attribute in type.CustomAttributes) if (attribute.Constructor.DeclaringType.FullName == "System.FlagsAttribute") return true; return false; } static object GetFlaggedEnumValue (TypeDefinition type, object value) { long flags = Convert.ToInt64 (value); var signature = new StringBuilder (); for (int i = type.Fields.Count - 1; i >= 0; i--) { FieldDefinition field = type.Fields[i]; if (!field.HasConstant) continue; long flag = Convert.ToInt64 (field.Constant); if (flag == 0) continue; if ((flags & flag) == flag) { if (signature.Length != 0) signature.Append (", "); signature.Append (field.Name); flags -= flag; } } return signature.ToString (); } static object GetEnumValue (TypeDefinition type, object value) { foreach (FieldDefinition field in type.Fields) { if (!field.HasConstant) continue; if (Comparer.Default.Compare (field.Constant, value) == 0) return field.Name; } return value; } } public class PseudoCecilAttribute : CompAttribute { public PseudoCecilAttribute (ExportedType type) : base (typeof (TypeForwardedToAttribute).FullName) { ExtraInfo = "[assembly: TypeForwardedToAttribute (typeof (" + type.ToString () + "))]"; } } public class CecilGenericParameter : CompGenericParameter { List attributes; IList constraints; public CecilGenericParameter (GenericParameter gp) : base (gp.Name, gp.Attributes) { attributes = CecilUtils.GetCustomAttributes (gp, todos); var constraints = gp.Constraints; if (constraints.Count == 0) return; // TODO: finish constraints loading this.constraints = constraints; } public override bool HasConstraints { get { return constraints != null; } } public override List GetAttributes () { return attributes; } } public class CecilParameter : CompParameter { List attributes; public CecilParameter (ParameterDefinition pd) : base (pd.Name, CecilUtils.FormatTypeLikeCorCompare (pd.ParameterType), pd.IsOptional) { attributes = CecilUtils.GetCustomAttributes (pd, todos); } public override List GetAttributes () { return attributes; } } } mono-tools-4.2/gui-compare/Masterinfo.cs0000664000175000017500000006546012413742070022370 0ustar00directhexdirecthex00000000000000// // Masterinfo.cs // // Authors: // Gonzalo Paniagua Javier (gonzalo@ximian.com) // Marek Safar (marek.safar@gmail.com) // // (C) 2003 - 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; using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Text; using System.Xml; namespace GuiCompare { public class Counters { public int Present; public int PresentTotal; public int Missing; public int MissingTotal; public int Todo; public int TodoTotal; public int Extra; public int ExtraTotal; public int Warning; public int WarningTotal; public int ErrorTotal; public Counters () { } public void AddPartialToPartial (Counters other) { Present += other.Present; Extra += other.Extra; Missing += other.Missing; Todo += other.Todo; Warning += other.Warning; AddPartialToTotal (other); } public void AddPartialToTotal (Counters other) { PresentTotal += other.Present; ExtraTotal += other.Extra; MissingTotal += other.Missing; TodoTotal += other.Todo; WarningTotal += other.Warning; } public void AddTotalToPartial (Counters other) { Present += other.PresentTotal; Extra += other.ExtraTotal; Missing += other.MissingTotal; Todo += other.TodoTotal; Warning += other.WarningTotal; AddTotalToTotal (other); } public void AddTotalToTotal (Counters other) { PresentTotal += other.PresentTotal; ExtraTotal += other.ExtraTotal; MissingTotal += other.MissingTotal; TodoTotal += other.TodoTotal; WarningTotal += other.WarningTotal; ErrorTotal += other.ErrorTotal; } public int Total { get { return Present + Missing; } } public int AbsTotal { get { return PresentTotal + MissingTotal; } } public int Ok { get { return Present - Todo; } } public int OkTotal { get { return PresentTotal - TodoTotal - ErrorTotal; } } public override string ToString () { StringWriter sw = new StringWriter (); sw.WriteLine ("Present: {0}", Present); sw.WriteLine ("PresentTotal: {0}", PresentTotal); sw.WriteLine ("Missing: {0}", Missing); sw.WriteLine ("MissingTotal: {0}", MissingTotal); sw.WriteLine ("Todo: {0}", Todo); sw.WriteLine ("TodoTotal: {0}", TodoTotal); sw.WriteLine ("Extra: {0}", Extra); sw.WriteLine ("ExtraTotal: {0}", ExtraTotal); sw.WriteLine ("Warning: {0}", Warning); sw.WriteLine ("WarningTotal: {0}", WarningTotal); sw.WriteLine ("ErrorTotal: {0}", ErrorTotal); sw.WriteLine ("--"); return sw.GetStringBuilder ().ToString (); } } public abstract class XMLData { protected XmlDocument document; protected Counters counters; bool haveWarnings; public XMLData () { counters = new Counters (); } public virtual void LoadData (XmlNode node) { } protected object [] LoadRecursive (XmlNodeList nodeList, Type type) { ArrayList list = new ArrayList (); foreach (XmlNode node in nodeList) { XMLData data = (XMLData) Activator.CreateInstance (type); data.LoadData (node); list.Add (data); } return (object []) list.ToArray (type); } public static bool IsMonoTODOAttribute (string s) { if (s == null) return false; if (//s.EndsWith ("MonoTODOAttribute") || s.EndsWith ("MonoDocumentationNoteAttribute") || s.EndsWith ("MonoExtensionAttribute") || // s.EndsWith ("MonoInternalNoteAttribute") || s.EndsWith ("MonoLimitationAttribute") || s.EndsWith ("MonoNotSupportedAttribute")) return true; return s.EndsWith ("TODOAttribute"); } protected void AddAttribute (XmlNode node, string name, string value) { XmlAttribute attr = document.CreateAttribute (name); attr.Value = value; node.Attributes.Append (attr); } public Counters Counters { get { return counters; } } } public abstract class XMLNameGroup : XMLData { protected XmlNode group; public System.Collections.Specialized.ListDictionary keys; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != GroupName) throw new FormatException (String.Format ("Expecting <{0}>", GroupName)); keys = new System.Collections.Specialized.ListDictionary (); foreach (XmlNode n in node.ChildNodes) { string name = n.Attributes ["name"].Value; if (CheckIfAdd (name, n)) { string key = GetNodeKey (name, n); if (keys.Contains (key)) { if ((string) keys[key] != name) throw new NotImplementedException ("Attribute with same name but diffent value"); } else { keys.Add (key, name); } LoadExtraData (key, n); } } } protected virtual bool CheckIfAdd (string value, XmlNode node) { return true; } protected virtual void LoadExtraData (string name, XmlNode node) { } public virtual string GetNodeKey (string name, XmlNode node) { return name; } public virtual bool HasKey (string key, Hashtable other) { return other.ContainsKey (key); } public abstract string GroupName { get; } public abstract string Name { get; } } public class XMLAssembly : XMLData { public XMLAttributes attributes; public XMLNamespace [] namespaces; string name; string version; public static XMLAssembly CreateFromFile (string file) { XmlDocument doc = new XmlDocument (); doc.Load (File.OpenRead (file)); XmlNode node = doc.SelectSingleNode ("/assemblies/assembly"); if (node != null) { XMLAssembly result = new XMLAssembly (); try { result.LoadData (node); } catch (Exception e) { Console.Error.WriteLine ("Error loading {0}: {1}\n{2}", file, e.Message, e); return null; } return result; } return null; } public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); name = node.Attributes ["name"].Value; version = node.Attributes ["version"].Value; XmlNode atts = node.FirstChild; attributes = new XMLAttributes (); if (atts.Name == "attributes") { attributes.LoadData (atts); atts = atts.NextSibling; } if (atts == null || atts.Name != "namespaces") { Console.Error.WriteLine ("Warning: no namespaces found!"); return; } namespaces = (XMLNamespace []) LoadRecursive (atts.ChildNodes, typeof (XMLNamespace)); } static Hashtable CreateHash (XMLNamespace [] other) { Hashtable result = new Hashtable (); if (other != null) { int i = 0; foreach (XMLNamespace n in other) { result [n.Name] = i++; } } return result; } } public class XMLNamespace : XMLData { public string name; public XMLClass [] types; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != "namespace") throw new FormatException ("Expecting "); name = node.Attributes ["name"].Value; XmlNode classes = node.FirstChild; if (classes == null) { Console.Error.WriteLine ("Warning: no classes for {0}", node.Attributes ["name"]); return; } if (classes.Name != "classes") throw new FormatException ("Expecting . Got <" + classes.Name + ">"); types = (XMLClass []) LoadRecursive (classes.ChildNodes, typeof (XMLClass)); } static Hashtable CreateHash (XMLClass [] other) { Hashtable result = new Hashtable (); if (other != null) { int i = 0; foreach (XMLClass c in other) { result [c.Name] = i++; } } return result; } public string Name { get { return name; } } } public class XMLClass : XMLData { public string name; public string type; public string baseName; public bool isSealed; bool isSerializable; public bool isAbstract; string charSet; string layout; public XMLAttributes attributes; public XMLInterfaces interfaces; XMLGenericParameters genericParameters; public XMLFields fields; public XMLConstructors constructors; public XMLProperties properties; public XMLEvents events; public XMLMethods methods; public XMLClass [] nested; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); name = node.Attributes ["name"].Value; type = node.Attributes ["type"].Value; XmlAttribute xatt = node.Attributes ["base"]; if (xatt != null) baseName = xatt.Value; xatt = node.Attributes ["sealed"]; isSealed = (xatt != null && xatt.Value == "true"); xatt = node.Attributes ["abstract"]; isAbstract = (xatt != null && xatt.Value == "true"); xatt = node.Attributes["serializable"]; isSerializable = (xatt != null && xatt.Value == "true"); xatt = node.Attributes["charset"]; if (xatt != null) charSet = xatt.Value; xatt = node.Attributes["layout"]; if (xatt != null) layout = xatt.Value; XmlNode child = node.FirstChild; if (child == null) { // Console.Error.WriteLine ("Empty class {0} {1}", name, type); return; } if (child.Name == "attributes") { attributes = new XMLAttributes (); attributes.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "interfaces") { interfaces = new XMLInterfaces (); interfaces.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "generic-parameters") { genericParameters = new XMLGenericParameters (); genericParameters.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "fields") { fields = new XMLFields (); fields.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "constructors") { constructors = new XMLConstructors (); constructors.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "properties") { properties = new XMLProperties (); properties.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "events") { events = new XMLEvents (); events.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "methods") { methods = new XMLMethods (); methods.LoadData (child); child = child.NextSibling; } if (child == null) return; if (child.Name != "classes") { Console.WriteLine ("name: {0} type: {1} {2}", name, type, child.NodeType); throw new FormatException ("Expecting . Got <" + child.Name + ">"); } nested = (XMLClass []) LoadRecursive (child.ChildNodes, typeof (XMLClass)); } static Hashtable CreateHash (XMLClass [] other) { Hashtable result = new Hashtable (); if (other != null) { int i = 0; foreach (XMLClass c in other) { result [c.Name] = i++; } } return result; } public List GetTypeParameters () { return MasterUtils.GetTypeParameters (genericParameters); } public string Name { get { return name; } } public string Type { get { return type; } } } public class XMLParameter : XMLData { public string name; public string type; public string attrib; public string direction; public bool isUnsafe; public bool isOptional; public string defaultValue; public XMLAttributes attributes; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != "parameter") throw new ArgumentException ("Expecting "); name = node.Attributes["name"].Value; type = node.Attributes["type"].Value; attrib = node.Attributes["attrib"].Value; if (node.Attributes ["direction"] != null) direction = node.Attributes["direction"].Value; if (node.Attributes["unsafe"] != null) isUnsafe = bool.Parse (node.Attributes["unsafe"].Value); if (node.Attributes["optional"] != null) isOptional = bool.Parse (node.Attributes["optional"].Value); if (node.Attributes["defaultValue"] != null) defaultValue = node.Attributes["defaultValue"].Value; XmlNode child = node.FirstChild; if (child == null) return; if (child.Name == "attributes") { attributes = new XMLAttributes (); attributes.LoadData (child); child = child.NextSibling; } } public string Name { get { return name; } } } public class XMLAttributeProperties: XMLNameGroup { SortedDictionary properties; static XMLAttributeProperties () { } string attribute; public XMLAttributeProperties () : this (null) {} public XMLAttributeProperties (string attribute) { this.attribute = attribute; } public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.ChildNodes == null) return; foreach (XmlNode n in node.ChildNodes) { string name = n.Attributes["name"].Value; if (n.Attributes["null"] != null) { Properties.Add (name, null); continue; } Properties.Add (name, n.Attributes ["value"].Value); } } public IDictionary Properties { get { if (properties == null) properties = new SortedDictionary (); return properties; } } public override string GroupName { get { return "properties"; } } public override string Name { get { return ""; } } } public class XMLAttributes : XMLNameGroup { bool isTodo; string comment; SortedDictionary properties; protected override bool CheckIfAdd (string value, XmlNode node) { if (IsMonoTODOAttribute (value)) { isTodo = true; XmlNode pNode = node.SelectSingleNode ("properties"); if (pNode != null && pNode.ChildNodes.Count > 0 && pNode.ChildNodes [0].Attributes ["value"] != null) { comment = pNode.ChildNodes [0].Attributes ["value"].Value; } return false; } if (MasterUtils.IsImplementationSpecificAttribute (value)) return false; return true; } public override string GetNodeKey (string name, XmlNode node) { string key = null; // if multiple attributes with the same name (type) exist, then we // cannot be sure which attributes correspond, so we must use the // name of the attribute (type) and the name/value of its properties // as key XmlNodeList attributes = node.ParentNode.SelectNodes("attribute[@name='" + name + "']"); if (attributes.Count > 1) { ArrayList keyParts = new ArrayList (); XmlNodeList properties = node.SelectNodes ("properties/property"); foreach (XmlNode property in properties) { XmlAttributeCollection attrs = property.Attributes; if (attrs["value"] != null) { keyParts.Add (attrs["name"].Value + "=" + attrs["value"].Value); } else { keyParts.Add (attrs["name"].Value + "="); } } // sort properties by name, as order of properties in XML is // undefined keyParts.Sort (); // insert name (type) of attribute keyParts.Insert (0, name); StringBuilder sb = new StringBuilder (); foreach (string value in keyParts) { sb.Append (value); sb.Append (';'); } key = sb.ToString (); } else { key = name; } return key; } protected override void LoadExtraData (string name, XmlNode node) { XmlNode pNode = node.SelectSingleNode ("properties"); if (IsMonoTODOAttribute (name)) { isTodo = true; if (pNode.ChildNodes [0].Attributes ["value"] != null) { comment = pNode.ChildNodes [0].Attributes ["value"].Value; } return; } if (MasterUtils.IsImplementationSpecificAttribute (name)) return; if (pNode != null) { XMLAttributeProperties p = new XMLAttributeProperties (name); p.LoadData (pNode); IDictionary properties = Properties; if (properties.ContainsKey (name)) properties [name] = p; else properties.Add (name, p); } } public IDictionary Properties { get { if (properties == null) properties = new SortedDictionary (); return properties; } } public override string GroupName { get { return "attributes"; } } public override string Name { get { return "attribute"; } } public bool IsTodo { get { return isTodo; } } public string Comment { get { return comment; } } } public class XMLInterfaces : XMLNameGroup { public override string GroupName { get { return "interfaces"; } } public override string Name { get { return "interface"; } } } public class XMLGenericParameters : XMLMember { public Dictionary constraints = new Dictionary (); public override string GroupName { get { return "generic-parameters"; } } public override string Name { get { return "generic-parameter"; } } protected override void LoadExtraData (string name, XmlNode node) { var attributes = ((XmlElement) node).GetAttribute ("attributes"); var xml_constraints = new XMLGenericParameterConstraints (attributes); constraints.Add (name, xml_constraints); XmlNode orig = node; var child = node.FirstChild; if (child != null && child.Name == "generic-parameter-constraints") { xml_constraints.LoadData (child); } base.LoadExtraData (name, orig); } } public class XMLGenericParameterConstraints : XMLNameGroup { public string attributes; public XMLGenericParameterConstraints (string attributes) { this.attributes = attributes; } public override string GroupName { get { return "generic-parameter-constraints"; } } public override string Name { get { return "generic-parameter-constraint"; } } } public abstract class XMLMember : XMLNameGroup { public Hashtable attributeMap; public Hashtable access = new Hashtable (); protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["attrib"]; if (xatt != null) access [name] = xatt.Value; XmlNode orig = node; node = node.FirstChild; while (node != null) { if (node != null && node.Name == "attributes") { XMLAttributes a = new XMLAttributes (); a.LoadData (node); if (attributeMap == null) attributeMap = new Hashtable (); attributeMap [name] = a; break; } node = node.NextSibling; } base.LoadExtraData (name, orig); } public virtual string ConvertToString (int att) { return null; } } public class XMLFields : XMLMember { public Hashtable fieldTypes; public Hashtable fieldValues; protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["fieldtype"]; if (xatt != null) { if (fieldTypes == null) fieldTypes = new Hashtable (); fieldTypes [name] = xatt.Value; } xatt = node.Attributes ["value"]; if (xatt != null) { if (fieldValues == null) fieldValues = new Hashtable (); fieldValues[name] = xatt.Value; } base.LoadExtraData (name, node); } public override string ConvertToString (int att) { FieldAttributes fa = (FieldAttributes) att; return fa.ToString (); } public override string GroupName { get { return "fields"; } } public override string Name { get { return "field"; } } } public class XMLParameters : XMLNameGroup { public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != GroupName) throw new FormatException (String.Format ("Expecting <{0}>", GroupName)); keys = new System.Collections.Specialized.ListDictionary (); foreach (XmlNode n in node.ChildNodes) { string name = n.Attributes["name"].Value; string key = GetNodeKey (name, n); XMLParameter parm = new XMLParameter (); parm.LoadData (n); keys.Add (key, parm); LoadExtraData (key, n); } } public override string GroupName { get { return "parameters"; } } public override string Name { get { return "parameter"; } } public override string GetNodeKey (string name, XmlNode node) { return node.Attributes["position"].Value; } } public class XMLProperties : XMLMember { public Hashtable nameToMethod = new Hashtable (); protected override void LoadExtraData (string name, XmlNode node) { XmlNode orig = node; node = node.FirstChild; while (node != null) { if (node != null && node.Name == "methods") { XMLMethods m = new XMLMethods (); XmlNode parent = node.ParentNode; string key = GetNodeKey (name, parent); m.LoadData (node); nameToMethod [key] = m; break; } node = node.NextSibling; } base.LoadExtraData (name, orig); } public override string GetNodeKey (string name, XmlNode node) { XmlAttributeCollection atts = node.Attributes; return String.Format ("{0}:{1}:{2}", atts ["name"].Value, atts ["ptype"].Value, atts ["params"] == null ? "" : atts ["params"].Value); } public override string GroupName { get { return "properties"; } } public override string Name { get { return "property"; } } } public class XMLEvents : XMLMember { public Hashtable eventTypes; protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["eventtype"]; if (xatt != null) { if (eventTypes == null) eventTypes = new Hashtable (); eventTypes [name] = xatt.Value; } base.LoadExtraData (name, node); } public override string ConvertToString (int att) { EventAttributes ea = (EventAttributes) att; return ea.ToString (); } public override string GroupName { get { return "events"; } } public override string Name { get { return "event"; } } } public class XMLMethods : XMLMember { public Hashtable returnTypes; public Hashtable parameters; public Hashtable genericParameters; public Hashtable signatureFlags; [Flags] public enum SignatureFlags { None = 0, Abstract = 1, Virtual = 2, Static = 4, Final = 8, } protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["returntype"]; if (xatt != null) { if (returnTypes == null) returnTypes = new Hashtable (); returnTypes [name] = xatt.Value; } SignatureFlags flags = SignatureFlags.None; if (((XmlElement) node).GetAttribute ("abstract") == "true") flags |= SignatureFlags.Abstract; if (((XmlElement) node).GetAttribute ("static") == "true") flags |= SignatureFlags.Static; if (((XmlElement) node).GetAttribute ("virtual") == "true") flags |= SignatureFlags.Virtual; if (((XmlElement) node).GetAttribute ("final") == "true") flags |= SignatureFlags.Final; if (flags != SignatureFlags.None) { if (signatureFlags == null) signatureFlags = new Hashtable (); signatureFlags [name] = flags; } XmlNode parametersNode = node.SelectSingleNode ("parameters"); if (parametersNode != null) { if (parameters == null) parameters = new Hashtable (); XMLParameters parms = new XMLParameters (); parms.LoadData (parametersNode); parameters[name] = parms; } XmlNode genericNode = node.SelectSingleNode ("generic-parameters"); if (genericNode != null) { if (genericParameters == null) genericParameters = new Hashtable (); XMLGenericParameters gparams = new XMLGenericParameters (); gparams.LoadData (genericNode); genericParameters [name] = gparams; } base.LoadExtraData (name, node); } public override string GetNodeKey (string name, XmlNode node) { XmlNode genericNode = node.SelectSingleNode ("generic-parameters"); if (genericNode != null) { name = name + "`" + genericNode.ChildNodes.Count; } // for explicit/implicit operators we need to include the return // type in the key to allow matching; as a side-effect, differences // in return types will be reported as extra/missing methods // // for regular methods we do not need to take into account the // return type for matching methods; differences in return types // will be reported as a warning on the method if (name.StartsWith ("op_")) { XmlAttribute xatt = node.Attributes ["returntype"]; string returnType = xatt != null ? xatt.Value + " " : string.Empty; return returnType + name; } return name; } public override string ConvertToString (int att) { MethodAttributes ma = (MethodAttributes) att; // ignore ReservedMasks ma &= ~ MethodAttributes.ReservedMask; ma &= ~ MethodAttributes.VtableLayoutMask; if ((ma & MethodAttributes.FamORAssem) == MethodAttributes.FamORAssem) ma = (ma & ~ MethodAttributes.FamORAssem) | MethodAttributes.Family; // ignore the HasSecurity attribute for now if ((ma & MethodAttributes.HasSecurity) != 0) ma = (MethodAttributes) (att - (int) MethodAttributes.HasSecurity); // ignore the RequireSecObject attribute for now if ((ma & MethodAttributes.RequireSecObject) != 0) ma = (MethodAttributes) (att - (int) MethodAttributes.RequireSecObject); // we don't care if the implementation is forwarded through PInvoke if ((ma & MethodAttributes.PinvokeImpl) != 0) ma = (MethodAttributes) (att - (int) MethodAttributes.PinvokeImpl); return ma.ToString (); } public override string GroupName { get { return "methods"; } } public override string Name { get { return "method"; } } } public class XMLConstructors : XMLMethods { public override string GroupName { get { return "constructors"; } } public override string Name { get { return "constructor"; } } } /* public class XmlNodeComparer : IComparer { public static XmlNodeComparer Default = new XmlNodeComparer (); public int Compare (object a, object b) { XmlNode na = (XmlNode) a; XmlNode nb = (XmlNode) b; return String.Compare (na.Attributes ["name"].Value, nb.Attributes ["name"].Value); } } */ } mono-tools-4.2/gui-compare/CompareContext.cs0000664000175000017500000006567112413742070023220 0ustar00directhexdirecthex00000000000000// // CompareContext.cs // // (C) 2007 - 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; using System.Collections.Generic; using System.Threading; using System.Linq; namespace GuiCompare { public class CompareContext { Func reference_loader, target_loader; public CompareContext (Func reference, Func target) { reference_loader = reference; target_loader = target; } public ComparisonNode Comparison { get { return comparison; } } public void Compare () { if (t != null) throw new InvalidOperationException ("compare already running"); t = new Thread (CompareThread); t.Start (); } public void StopCompare () { } bool TryLoad (ref CompAssembly assembly, Func loader) { try { assembly = loader (); return true; } catch (Exception e) { OnError (e.ToString ()); return false; } } void CompareThread () { try { ProgressChange (Double.NaN, "Loading reference..."); if (!TryLoad (ref reference, reference_loader)) return; ProgressChange (Double.NaN, "Loading target..."); if (!TryLoad (ref target, target_loader)) return; ProgressChange (0.0, "Comparing..."); comparison = target.GetComparisonNode (); List ref_namespaces = reference.GetNamespaces(); total_comparisons = CountComparisons (ref_namespaces); comparisons_performed = 0; CompareTypeLists (comparison, reference.GetNamespaces(), target.GetNamespaces()); CompareAttributes (comparison, reference, target); } catch (Exception exc) { OnError (exc.Message); } finally { Finish (); } } int total_comparisons; int comparisons_performed; int CountComparisons (List list) { int rv = 0; foreach (CompNamed l in list) { rv += CountComparisons (l); } return rv; } int CountComparisons (CompNamed named) { int rv = 1; if (named is ICompMemberContainer) { ICompMemberContainer container = (ICompMemberContainer)named; rv += CountComparisons (container.GetInterfaces()); rv += CountComparisons (container.GetConstructors()); rv += CountComparisons (container.GetMethods()); rv += CountComparisons (container.GetProperties()); rv += CountComparisons (container.GetFields()); } if (named is ICompTypeContainer) { ICompTypeContainer container = (ICompTypeContainer)named; rv += CountComparisons (container.GetNestedInterfaces()); rv += CountComparisons (container.GetNestedClasses()); rv += CountComparisons (container.GetNestedStructs()); rv += CountComparisons (container.GetNestedEnums()); rv += CountComparisons (container.GetNestedDelegates()); } if (named is ICompAttributeContainer) { rv += CountComparisons (((ICompAttributeContainer)named).GetAttributes()); } return rv; } void CompareNestedTypes (ComparisonNode parent, ICompTypeContainer reference_container, ICompTypeContainer target_container) { CompareTypeLists (parent, reference_container.GetNestedInterfaces(), target_container.GetNestedInterfaces()); CompareTypeLists (parent, reference_container.GetNestedClasses(), target_container.GetNestedClasses()); CompareTypeLists (parent, reference_container.GetNestedStructs(), target_container.GetNestedStructs()); CompareTypeLists (parent, reference_container.GetNestedEnums(), target_container.GetNestedEnums()); CompareTypeLists (parent, reference_container.GetNestedDelegates(), target_container.GetNestedDelegates()); } void CompareBaseTypes (ComparisonNode parent, ICompHasBaseType reference_type, ICompHasBaseType target_type) { if (reference_type.GetBaseType() != target_type.GetBaseType()) { parent.AddError (String.Format ("Expected base class of {0} but found {1}", reference_type.GetBaseType(), target_type.GetBaseType())); } if (reference_type.IsAbstract != target_type.IsAbstract) { string ref_mod = (reference_type.IsAbstract && reference_type.IsSealed) ? "static" : "abstract"; string tar_mod = (target_type.IsAbstract && target_type.IsSealed) ? "static" : "abstract"; parent.AddError (String.Format ("reference is {0} {2}, is {1} {3}", reference_type.IsAbstract ? null : "not", target_type.IsAbstract ? null : "not", ref_mod, tar_mod)); } else if (reference_type.IsSealed != target_type.IsSealed) { string ref_mod = (reference_type.IsAbstract && reference_type.IsSealed) ? "static" : "sealed"; string tar_mod = (target_type.IsAbstract && target_type.IsSealed) ? "static" : "sealed"; parent.AddError (String.Format ("reference is {0} {2}, target is {1} {3}", reference_type.IsSealed ? null : "not", target_type.IsSealed ? null : "not", ref_mod, tar_mod)); } } void CompareParameters (ComparisonNode parent, ICompParameters reference, ICompParameters target) { var r = reference.GetParameters (); var t = target.GetParameters (); if (r.Count != t.Count) { throw new NotImplementedException (string.Format ("Should never happen with valid data ({0} != {1})", r.Count, t.Count)); } for (int i = 0; i < r.Count; ++i) { var r_i = r [i]; var t_i = t [i]; if (r_i.TypeReference != t_i.TypeReference) { parent.AddError (string.Format ("Parameter `{0}' type mismatch", t_i.Name)); } if (r_i.Name != t_i.Name) { parent.AddError (string.Format ("Parameter name `{0}' should be `{1}'", t_i.Name, r_i.Name)); } if (r_i.IsOptional != t_i.IsOptional) { if (r_i.IsOptional) parent.AddError (string.Format ("Parameter `{0}' is missing a default value", t_i.Name)); else parent.AddError (string.Format ("Parameter `{0}' should not have a default value", t_i.Name)); } CompareAttributes (parent, r_i, t_i); } } void CompareTypeParameters (ComparisonNode parent, ICompGenericParameter reference, ICompGenericParameter target) { var r = reference.GetTypeParameters (); var t = target.GetTypeParameters (); if (r == null && t == null || (r == null && t != null) || (r != null && t == null)) return; for (int i = 0; i < r.Count; ++i) { var r_i = r [i]; var t_i = t [i]; if (r_i.GenericAttributes != t_i.GenericAttributes) { parent.AddError (string.Format ("Expected type parameter {2} with {0} generic attributes but found type parameter {3} with {1} generic attributes", CompGenericParameter.GetGenericAttributeDesc (r_i.GenericAttributes), CompGenericParameter.GetGenericAttributeDesc (t_i.GenericAttributes), r_i.Name, t_i.Name)); } // TODO: Compare constraints properly if (r_i.HasConstraints != t_i.HasConstraints) { parent.AddError (string.Format ("Type parameter `{0}' constraints mismatch", r_i.Name)); } CompareAttributes (parent, r_i, t_i); } } void CompareTypeLists (ComparisonNode parent, List reference_list, List target_list) { int m = 0, a = 0; reference_list.Sort (CompNamed.Compare); target_list.Sort (CompNamed.Compare); while (m < reference_list.Count || a < target_list.Count) { if (m == reference_list.Count) { AddExtra (parent, target_list[a]); a++; continue; } else if (a == target_list.Count) { AddMissing (parent, reference_list[m]); m++; continue; } int c = String.Compare (reference_list[m].Name, target_list[a].Name); comparisons_performed ++; if (c == 0) { ProgressChange ((double)comparisons_performed / total_comparisons * 100.0, String.Format ("Comparing {0} {1}", reference_list[m].Type, reference_list[m].Name)); /* the names match, further investigation is required */ ComparisonNode comparison = target_list[a].GetComparisonNode(); parent.AddChild (comparison); // compare base types if (reference_list[m] is ICompHasBaseType && target_list[a] is ICompHasBaseType) { CompareBaseTypes (comparison, (ICompHasBaseType)reference_list[m], (ICompHasBaseType)target_list[a]); } // compares generic type parameters if (reference_list[m] is ICompGenericParameter && target_list[a] is ICompGenericParameter) { CompareTypeParameters (comparison, (ICompGenericParameter)reference_list[m], (ICompGenericParameter)target_list[a]); } // compare nested types if (reference_list[m] is ICompTypeContainer && target_list[a] is ICompTypeContainer) { CompareNestedTypes (comparison, (ICompTypeContainer)reference_list[m], (ICompTypeContainer)target_list[a]); } if (reference_list[m] is ICompMemberContainer && target_list[a] is ICompMemberContainer) { CompareMembers (comparison, (ICompMemberContainer)reference_list[m], (ICompMemberContainer)target_list[a]); } if (reference_list[m] is ICompAttributeContainer && target_list[a] is ICompAttributeContainer) { CompareAttributes (comparison, (ICompAttributeContainer)reference_list[m], (ICompAttributeContainer)target_list[a]); } m++; a++; } else if (c < 0) { /* reference name is before target name, reference name is missing from target */ AddMissing (parent, reference_list[m]); m++; } else { /* reference name is after target name, target name is extra */ AddExtra (parent, target_list[a]); a++; } } } void CompareAttributes (ComparisonNode parent, ICompAttributeContainer reference_container, ICompAttributeContainer target_container) { int m = 0, a = 0; List reference_attrs = reference_container.GetAttributes (); List target_attrs = target_container.GetAttributes (); Comparison comp = (x, y) => { var r = CompNamed.Compare (x, y); if (r != 0) return r; var xa = ((CompAttribute)x).Properties.Values.ToList (); var ya = ((CompAttribute)y).Properties.Values.ToList (); for (int i = 0; i < Math.Min (xa.Count, ya.Count); ++i) { r = xa[i].CompareTo (ya[i]); if (r != 0) return r; } return 0; }; reference_attrs.Sort (comp); target_attrs.Sort (comp); while (m < reference_attrs.Count || a < target_attrs.Count) { if (m == reference_attrs.Count) { switch (target_attrs[a].Name) { case "System.Diagnostics.DebuggerDisplayAttribute": case "System.Runtime.CompilerServices.AsyncStateMachineAttribute": case "System.Runtime.CompilerServices.IteratorStateMachineAttribute": case "System.Diagnostics.DebuggerBrowsableAttribute": // Ignore extra attributes in Mono source code break; default: AddExtra (parent, target_attrs[a]); break; } a++; continue; } else if (a == target_attrs.Count) { AddMissing (parent, reference_attrs[m]); m++; continue; } int c = String.Compare (reference_attrs[m].Name, target_attrs[a].Name); comparisons_performed ++; if (c == 0) { /* the names match, further investigation is required */ ComparisonNode comparison = target_attrs[a].GetComparisonNode(); parent.AddChild (comparison); CompareAttributeArguments (comparison, (CompAttribute)reference_attrs[m], (CompAttribute)target_attrs[a]); m++; a++; } else if (c < 0) { /* reference name is before target name, reference name is missing from target */ AddMissing (parent, reference_attrs[m]); m++; } else { /* reference name is after target name, target name is extra */ AddExtra (parent, target_attrs[a]); a++; } } } void CompareAttributeArguments (ComparisonNode parent, CompAttribute referenceAttribute, CompAttribute actualAttribute) { // Ignore all parameter differences for some attributes switch (referenceAttribute.Name) { case "System.Diagnostics.DebuggerDisplayAttribute": case "System.Diagnostics.DebuggerTypeProxyAttribute": case "System.Runtime.CompilerServices.CompilationRelaxationsAttribute": case "System.Reflection.AssemblyFileVersionAttribute": case "System.Reflection.AssemblyCompanyAttribute": case "System.Reflection.AssemblyCopyrightAttribute": case "System.Reflection.AssemblyProductAttribute": case "System.Reflection.AssemblyTrademarkAttribute": case "System.Reflection.AssemblyInformationalVersionAttribute": case "System.Reflection.AssemblyKeyFileAttribute": // Don't care about these for now case "System.ComponentModel.EditorAttribute": case "System.ComponentModel.DesignerAttribute": return; } foreach (var entry in referenceAttribute.Properties) { if (!actualAttribute.Properties.ContainsKey (entry.Key)) { // // Ignore missing value difference for default values // switch (referenceAttribute.Name) { case "System.AttributeUsageAttribute": // AllowMultiple defaults to false if (entry.Key == "AllowMultiple" && entry.Value == "False") continue; // Inherited defaults to true if (entry.Key == "Inherited" && entry.Value == "True") continue; break; case "System.ObsoleteAttribute": if (entry.Key == "IsError" && entry.Value == "False") continue; if (entry.Key == "Message") continue; break; } parent.AddError (String.Format ("Property `{0}' value is not set. Expected value: {1}", entry.Key, entry.Value)); parent.Status = ComparisonStatus.Error; continue; } var target_value = actualAttribute.Properties[entry.Key]; var entry_value = entry.Value; switch (referenceAttribute.Name) { case "System.Runtime.CompilerServices.TypeForwardedFromAttribute": if (entry.Key == "AssemblyFullName") target_value = target_value.Replace ("neutral", "Neutral"); break; case "System.Runtime.InteropServices.GuidAttribute": if (entry.Key == "Value") { target_value = target_value.ToUpperInvariant (); entry_value = entry_value.ToUpperInvariant (); } break; case "System.ObsoleteAttribute": if (entry.Key == "Message") continue; break; } if (target_value != entry_value) { parent.AddError (String.Format ("Expected value `{0}' for attribute property `{1}' but found `{2}'", entry_value, entry.Key, target_value)); parent.Status = ComparisonStatus.Error; } } if (referenceAttribute.Properties.Count != actualAttribute.Properties.Count) { foreach (var entry in actualAttribute.Properties) { if (!referenceAttribute.Properties.ContainsKey (entry.Key)) { parent.AddError (String.Format ("Property `{0}' should not be set", entry.Key)); parent.Status = ComparisonStatus.Error; break; } } } return; } void CompareMembers (ComparisonNode parent, ICompMemberContainer reference_container, ICompMemberContainer target_container) { bool is_sealed = reference_container.IsSealed; CompareMemberLists (parent, reference_container.GetInterfaces(), target_container.GetInterfaces(), is_sealed); CompareMemberLists (parent, reference_container.GetConstructors(), target_container.GetConstructors(), is_sealed); CompareMemberLists (parent, reference_container.GetMethods(), target_container.GetMethods(), is_sealed); CompareMemberLists (parent, reference_container.GetProperties(), target_container.GetProperties(), is_sealed); CompareMemberLists (parent, reference_container.GetFields(), target_container.GetFields(), is_sealed); CompareMemberLists (parent, reference_container.GetEvents(), target_container.GetEvents(), is_sealed); } void CompareMemberLists (ComparisonNode parent, List reference_list, List target_list, bool isSealed) { int m = 0, a = 0; reference_list.Sort (CompNamed.Compare); target_list.Sort (CompNamed.Compare); while (m < reference_list.Count || a < target_list.Count) { if (m == reference_list.Count) { AddExtra (parent, target_list[a]); a++; continue; } else if (a == target_list.Count) { AddMissing (parent, reference_list[m]); m++; continue; } int c = CompNamed.Compare (reference_list[m], target_list[a]); comparisons_performed ++; if (c == 0) { /* the names match, further investigation is required */ // Console.WriteLine ("method {0} is in both, doing more comparisons", reference_list[m].Name); ComparisonNode comparison = target_list[a].GetComparisonNode(); parent.AddChild (comparison); if (reference_list[m] is CompMember && target_list[a] is CompMember) { string reference_type = ((CompMember)reference_list[m]).GetMemberType(); string target_type = ((CompMember)target_list[a]).GetMemberType(); if (reference_type != target_type) { comparison.AddError (String.Format ("reference type is {0}, target type is {1}", reference_type, target_type)); } string reference_access = ((CompMember)reference_list[m]).GetMemberAccess(); string target_access = ((CompMember)target_list[a]).GetMemberAccess(); if (reference_access != target_access) { // Try to give some hints to the developer, best we can do with // strings. string extra_msg = ""; if (reference_access.IndexOf ("Private, Final, Virtual, HideBySig") != -1 && target_access.IndexOf ("Public, HideBySig") != -1){ extra_msg = "\n\t\tHint: reference uses an explicit interface implementation, target doesn't"; } comparison.AddError (String.Format ("reference access is '{0}', target access is '{1}'{2}", reference_access, target_access, extra_msg)); comparison.Status = ComparisonStatus.Error; } } var r_method = reference_list[m] as CompMethod; if (r_method != null) { var t_method = (CompMethod)target_list[a]; if (t_method.ThrowsNotImplementedException () && !r_method.ThrowsNotImplementedException ()) { comparison.ThrowsNIE = true; } CompareTypeParameters (comparison, r_method, t_method); CompareParameters (comparison, r_method, t_method); } else if (reference_list[m] is CompProperty) { var m1 = ((CompProperty) reference_list[m]).GetMethods (); var m2 = ((CompProperty) target_list[a]).GetMethods (); if (m1.Count != m2.Count) { comparison.AddError (String.Format ("Expected {0} accessors but found {1}", m1.Count, m2.Count)); comparison.Status = ComparisonStatus.Error; } else { for (int i = 0; i < m1.Count; ++i) { string reference_access = ((CompMember) m1[i]).GetMemberAccess(); string target_access = ((CompMember) m2[i]).GetMemberAccess(); if (reference_access != target_access) { // Try to give some hints to the developer, best we can do with // strings. string extra_msg = ""; if (reference_access.IndexOf ("Private, Final, Virtual, HideBySig") != -1 && target_access.IndexOf ("Public, HideBySig") != -1){ extra_msg = "\n\t\tHint: reference uses an explicit interface implementation, target doesn't"; } comparison.AddError (String.Format ("reference access is '{0}', target access is '{1}'{2}", reference_access, target_access, extra_msg)); comparison.Status = ComparisonStatus.Error; break; } } if (m1[0].Name[0] == m2[0].Name[0]) { CompareAttributes (comparison, (ICompAttributeContainer)m1[0], (ICompAttributeContainer)m2[0]); if (m1.Count > 1) CompareAttributes (comparison, (ICompAttributeContainer)m1[1], (ICompAttributeContainer)m2[1]); } else { CompareAttributes (comparison, (ICompAttributeContainer)m1[0], (ICompAttributeContainer)m2[1]); if (m1.Count > 1) CompareAttributes (comparison, (ICompAttributeContainer)m1[1], (ICompAttributeContainer)m2[0]); } } // Compare indexer parameters if (m1.Count == m2.Count) CompareParameters (comparison, (ICompParameters) m1[0], (ICompParameters) m2[0]); } if (reference_list[m] is CompField) { var v_ref = ((CompField)reference_list[m]).GetLiteralValue(); var v_tar = ((CompField)target_list[a]).GetLiteralValue(); if (v_ref != v_tar) { comparison.AddError (String.Format ("Expected field value {0} but found value {1}", v_ref, v_tar)); comparison.Status = ComparisonStatus.Error; } } if (reference_list[m] is ICompAttributeContainer) { //Console.WriteLine ("Comparing attributes for {0}", reference_list[m].Name); CompareAttributes (comparison, (ICompAttributeContainer)reference_list[m], (ICompAttributeContainer)target_list[a]); } if (reference_list[m] is ICompMemberContainer) { CompareMembers (comparison, (ICompMemberContainer)reference_list[m], (ICompMemberContainer)target_list[a]); } //CompareParameters (comparison, reference_list[m], target_namespace [target_list[a]]); m++; a++; } else if (c < 0) { if (isSealed && reference_list[m].Name.Contains ("~")) { // Ignore finalizer differences in sealed classes } else { /* reference name is before target name, reference name is missing from target */ AddMissing (parent, reference_list[m]); } m++; } else { if (isSealed && target_list[a].Name.Contains ("~")) { // Ignore finalizer differences in sealed classes } else { /* reference name is after target name, target name is extra */ AddExtra (parent, target_list[a]); } a++; } } } void AddExtra (ComparisonNode parent, CompNamed item) { ComparisonNode node = item.GetComparisonNode (); parent.AddChild (node); node.Status = ComparisonStatus.Extra; if (item is ICompTypeContainer) { ICompTypeContainer c = (ICompTypeContainer)item; foreach (CompNamed ifc in c.GetNestedInterfaces ()) AddExtra (node, ifc); foreach (CompNamed cls in c.GetNestedClasses()) AddExtra (node, cls); foreach (CompNamed cls in c.GetNestedStructs()) AddExtra (node, cls); foreach (CompNamed en in c.GetNestedEnums()) AddExtra (node, en); } } void AddMissing (ComparisonNode parent, CompNamed item) { ComparisonNode node = item.GetComparisonNode (); parent.AddChild (node); node.Status = ComparisonStatus.Missing; comparisons_performed ++; if (item is ICompHasBaseType) { string baseTypeName = ((ICompHasBaseType)item).GetBaseType(); if (!string.IsNullOrEmpty (baseTypeName)) { ComparisonNode baseTypeNode = new ComparisonNode (CompType.Class, string.Format ("BaseType: {0}", baseTypeName), baseTypeName); baseTypeNode.Status = ComparisonStatus.Missing; node.AddChild (baseTypeNode); } } if (item is ICompTypeContainer) { ICompTypeContainer c = (ICompTypeContainer)item; foreach (CompNamed ifc in c.GetNestedInterfaces ()) AddMissing (node, ifc); foreach (CompNamed cls in c.GetNestedClasses()) AddMissing (node, cls); foreach (CompNamed cls in c.GetNestedStructs()) AddMissing (node, cls); foreach (CompNamed en in c.GetNestedEnums()) AddMissing (node, en); } if (item is ICompMemberContainer) { ICompMemberContainer c = (ICompMemberContainer)item; foreach (CompNamed ifc in c.GetInterfaces()) AddMissing (node, ifc); foreach (CompNamed m in c.GetConstructors()) AddMissing (node, m); foreach (CompNamed m in c.GetMethods()) AddMissing (node, m); foreach (CompNamed p in c.GetProperties()) AddMissing (node, p); foreach (CompNamed f in c.GetFields()) AddMissing (node, f); foreach (CompNamed e in c.GetEvents()) AddMissing (node, e); } if (item is ICompAttributeContainer) { ICompAttributeContainer c = (ICompAttributeContainer)item; foreach (CompNamed attr in c.GetAttributes()) AddMissing (node, attr); } } // This is the reference assembly that we will be comparing to. CompAssembly reference; // This is the new API. CompAssembly target; void ProgressChange (double progress, string message) { if (ProgressChanged != null) ProgressChanged (this, new CompareProgressChangedEventArgs (message, progress)); } void OnError (string message) { if (Error != null) Error (this, new CompareErrorEventArgs (message)); } void Finish () { if (Finished != null) Finished (this, EventArgs.Empty); } public event CompareProgressChangedEventHandler ProgressChanged; public event CompareErrorEventHandler Error; public event EventHandler Finished; ComparisonNode comparison; Thread t; } public delegate void CompareProgressChangedEventHandler (object sender, CompareProgressChangedEventArgs args); public delegate void CompareErrorEventHandler (object sender, CompareErrorEventArgs args); public class CompareProgressChangedEventArgs : EventArgs { public CompareProgressChangedEventArgs (string message, double progress) { this.message = message; this.progress = progress; } public string Message { get { return message; } } public double Progress { get { return progress; } } string message; double progress; } public class CompareErrorEventArgs : EventArgs { public CompareErrorEventArgs (string message) { this.message = message; } public string Message { get { return message; } } string message; } } mono-tools-4.2/gui-compare/AssemblyInfo.cs0000664000175000017500000000205312413742070022641 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-tools-4.2/gui-compare/ProviderSelector.cs0000664000175000017500000000423612413742070023546 0ustar00directhexdirecthex00000000000000// ProviderSelector.cs // // Copyright (c) 2007 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; namespace guicompare { public partial class ProviderSelector : Gtk.Bin { public ProviderSelector() { this.Build(); } protected virtual void OnRadiobutton1Toggled (object sender, System.EventArgs e) { filechooserbutton2.Sensitive = false; filechooserbutton1.Sensitive = true; } protected virtual void OnRadiobutton2Toggled (object sender, System.EventArgs e) { filechooserbutton1.Sensitive = false; filechooserbutton2.Sensitive = true; } protected virtual void OnFilechooserbutton2Focused (object o, Gtk.FocusedArgs args) { Console.WriteLine ("Got focus"); } protected virtual void OnFilechooserbutton2FocusChildSet (object o, Gtk.FocusChildSetArgs args) { radiobutton2.Active = true; } // true if this is an XML description, false if its an assembly public bool IsInfo { get { return radiobutton1.Active; } } public string File { get { if (IsInfo) return filechooserbutton1.Filename; else return filechooserbutton2.Filename; } } } } mono-tools-4.2/gui-compare/Metadata.cs0000664000175000017500000002502412413742070021771 0ustar00directhexdirecthex00000000000000// // Metadata.cs // // (C) 2007 - 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; using System.Collections.Generic; namespace GuiCompare { public enum CompType { Assembly, Namespace, Attribute, Interface, Class, Struct, Enum, Method, Property, Field, Delegate, Event, GenericParameter, Parameter } public interface ICompAttributeContainer { List GetAttributes (); } public interface ICompHasBaseType { string GetBaseType (); bool IsSealed { get; } bool IsAbstract { get; } } public interface ICompTypeContainer { List GetNestedClasses(); List GetNestedInterfaces (); List GetNestedStructs (); List GetNestedEnums (); List GetNestedDelegates (); } public interface ICompMemberContainer { bool IsSealed { get; } List GetInterfaces (); List GetConstructors(); List GetMethods(); List GetProperties(); List GetFields(); List GetEvents(); } public interface ICompGenericParameter { List GetTypeParameters (); } public interface ICompParameters { List GetParameters (); } public abstract class CompNamed { public CompNamed (string name, CompType type) { this.DisplayName = null; this.name = name; this.type = type; this.todos = new List(); } public string MemberName { set { memberName = value; } get { return memberName; } } public string Name { set { name = value; } get { return name; } } public string DisplayName { set { displayName = value; } get { return displayName == null ? name : displayName; } } public string ExtraInfo { set { extraInfo = value; } get { return extraInfo; } } public CompType Type { set { type = value; } get { return type; } } public ComparisonNode GetComparisonNode () { ComparisonNode node = new ComparisonNode (type, DisplayName, MemberName, ExtraInfo); node.Todos.AddRange (todos); return node; } public static int Compare (CompNamed x, CompNamed y) { var x_g = x as CompMethod; var y_g = y as CompMethod; if (x_g == null || y_g == null) return string.Compare (x.Name, y.Name); var x_tp = x_g.GetTypeParameters (); if (x_tp != null && x_tp.Count == 0) x_tp = null; var y_tp = y_g.GetTypeParameters (); if (y_tp != null && y_tp.Count == 0) y_tp = null; if (x_tp == null && y_tp != null) return -1; if (x_tp != null && y_tp == null) return 1; if (x_tp != null && y_tp != null) { var res = x_tp.Count.CompareTo (y_tp.Count); if (res != 0) return res; } return string.Compare (x.Name, y.Name); } string displayName; string name; string memberName; string extraInfo; CompType type; public List todos; } public abstract class CompAssembly : CompNamed, ICompAttributeContainer { public CompAssembly (string name) : base (name, CompType.Assembly) { } public abstract List GetNamespaces (); public abstract List GetAttributes (); } public abstract class CompNamespace : CompNamed, ICompTypeContainer { public CompNamespace (string name) : base (name, CompType.Namespace) { } // ICompTypeContainer implementation public abstract List GetNestedClasses(); public abstract List GetNestedInterfaces (); public abstract List GetNestedStructs (); public abstract List GetNestedEnums (); public abstract List GetNestedDelegates (); } public abstract class CompInterface : CompNamed, ICompAttributeContainer, ICompMemberContainer, ICompHasBaseType, ICompGenericParameter { public CompInterface (string name) : base (name, CompType.Interface) { } public abstract List GetAttributes (); public abstract List GetInterfaces (); public abstract List GetConstructors(); public abstract List GetMethods(); public abstract List GetProperties(); public abstract List GetFields(); public abstract List GetEvents(); public abstract string GetBaseType(); public bool IsSealed { get { return false; } } public bool IsAbstract { get { return false; } } public abstract List GetTypeParameters (); } public abstract class CompEnum : CompNamed, ICompAttributeContainer, ICompMemberContainer, ICompHasBaseType { public CompEnum (string name) : base (name, CompType.Enum) { } public List GetInterfaces () { return new List(); } public List GetConstructors() { return new List(); } public List GetMethods() { return new List(); } public List GetProperties() { return new List(); } public List GetEvents() { return new List(); } public abstract List GetFields(); public abstract List GetAttributes (); public abstract string GetBaseType(); public bool IsSealed { get { return true; } } public bool IsAbstract { get { return false; } } } public abstract class CompDelegate : CompNamed, ICompAttributeContainer, ICompHasBaseType, ICompGenericParameter, ICompMemberContainer { public CompDelegate (string name) : base (name, CompType.Delegate) { } public List GetFields() { return new List(); } public List GetInterfaces () { return new List(); } public List GetProperties() { return new List(); } public List GetEvents() { return new List(); } public abstract List GetConstructors(); public abstract List GetMethods(); public abstract List GetAttributes (); public abstract string GetBaseType(); public bool IsSealed { get { return true; } } public bool IsAbstract { get { return false; } } public abstract List GetTypeParameters (); } public abstract class CompClass : CompNamed, ICompAttributeContainer, ICompTypeContainer, ICompMemberContainer, ICompHasBaseType, ICompGenericParameter { public CompClass (string name, CompType type) : base (name, type) { } public abstract List GetInterfaces(); public abstract List GetConstructors(); public abstract List GetMethods(); public abstract List GetProperties(); public abstract List GetFields(); public abstract List GetEvents(); public abstract List GetAttributes (); public abstract List GetNestedClasses(); public abstract List GetNestedInterfaces (); public abstract List GetNestedStructs (); public abstract List GetNestedEnums (); public abstract List GetNestedDelegates (); public abstract string GetBaseType(); public abstract bool IsSealed { get; } public abstract bool IsAbstract { get; } public abstract List GetTypeParameters (); } public abstract class CompMember : CompNamed, ICompAttributeContainer { public CompMember (string name, CompType type) : base (name, type) { } public abstract string GetMemberAccess(); public abstract string GetMemberType(); public abstract List GetAttributes (); } public abstract class CompMethod : CompMember, ICompGenericParameter, ICompParameters { public CompMethod (string name) : base (name, CompType.Method) { } public abstract bool ThrowsNotImplementedException (); public abstract List GetParameters (); public abstract List GetTypeParameters (); } public abstract class CompProperty : CompMember { public CompProperty (string name) : base (name, CompType.Property) { } public abstract List GetMethods(); } public abstract class CompField : CompMember { public CompField (string name) : base (name, CompType.Field) { } public abstract string GetLiteralValue (); } public abstract class CompEvent : CompMember { public CompEvent (string name) : base (name, CompType.Event) { } } public abstract class CompAttribute : CompNamed { public CompAttribute (string typename) : base (typename, CompType.Attribute) { Properties = new SortedDictionary (); } public IDictionary Properties { get; private set; } } public abstract class CompGenericParameter : CompNamed, ICompAttributeContainer { public readonly Mono.Cecil.GenericParameterAttributes GenericAttributes; public CompGenericParameter (string name, Mono.Cecil.GenericParameterAttributes attr) : base (name, CompType.GenericParameter) { GenericAttributes = attr; } public abstract bool HasConstraints { get; } public abstract List GetAttributes (); public static string GetGenericAttributeDesc (Mono.Cecil.GenericParameterAttributes ga) { return ga.ToString (); } } public abstract class CompParameter : CompNamed, ICompAttributeContainer { bool optional; string type; public CompParameter (string name, string type, bool optional) : base (name, CompType.Parameter) { this.type = type; this.optional = optional; } public bool IsOptional { get { return optional; } } public string TypeReference { get { return type; } } public abstract List GetAttributes (); } } mono-tools-4.2/gui-compare/Comparison.cs0000664000175000017500000001177312413742070022371 0ustar00directhexdirecthex00000000000000// // Comparison.cs // // (C) 2007 - 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; using System.Collections.Generic; using System.Text; namespace GuiCompare { public enum ComparisonStatus { None, Missing, Extra, Error } public class ComparisonNode { public ComparisonNode (CompType type, string displayName) : this (type, displayName, null) { } public ComparisonNode (CompType type, string displayName, string typeName) : this (type, displayName, typeName, null) { } public ComparisonNode (CompType type, string displayName, string typeName, string extraInfo) { Type = type; Name = displayName; TypeName = typeName; ExtraInfo = extraInfo; Children = new List (); Messages = new List (); Todos = new List (); } public void AddChild (ComparisonNode node) { Children.Add (node); node.Parent = this; } public void PropagateCounts () { Todo = Todos.Count; Niex = ThrowsNIE ? 1 : 0; foreach (ComparisonNode n in Children) { n.PropagateCounts (); Extra += n.Extra + (n.Status == ComparisonStatus.Extra ? 1 : 0); Missing += n.Missing + (n.Status == ComparisonStatus.Missing ? 1 : 0); Present += n.Present; // XXX Todo += n.Todo; Niex += n.Niex; Warning += n.Warning + (n.Status == ComparisonStatus.Error ? 1 : 0); } } public void ResetCounts () { foreach (ComparisonNode n in Children) n.ResetCounts (); Todo = 0; Niex = 0; Extra = 0; Missing = 0; Present = 0; Warning = 0; } public void AddError (string msg) { Status = ComparisonStatus.Error; Messages.Add (msg); } // TODO: detect user's locale and reflect that in the url public string MSDNUrl { get { if (msdnUrl != null) return msdnUrl; if (String.IsNullOrEmpty (TypeName)) { msdnUrl = ConstructMSDNUrl (); return msdnUrl; } if (msdnUrl == null) msdnUrl = MSDN_BASE_URL + TypeName.ToLower () + ".aspx"; return msdnUrl; } } string FormatMyName () { string name = Name; int start = name.IndexOf (' ') + 1; int end = name.IndexOf ('('); switch (Type) { case CompType.Method: case CompType.Attribute: case CompType.Delegate: break; default: if (end < 0) end = name.Length; break; } int len = end - start; if (len <= 0) return name; return name.Substring (start, end - start).Trim (); } string ConstructMSDNUrl () { ComparisonNode n = Parent; List segments = new List (); string name = FormatMyName (); if (Type == CompType.Method && Parent.Type == CompType.Property && (name.StartsWith ("get_") || name.StartsWith ("set_"))) return null; else if (Type == CompType.Method && Parent.Type == CompType.Event && (name.StartsWith ("add_") || name.StartsWith ("remove_"))) return null; segments.Add ("aspx"); segments.Insert (0, name.ToLower ()); n = Parent; while (n != null) { name = n.Name.ToLower (); if (name.EndsWith (".dll")) break; segments.Insert (0, n.Name.ToLower ()); n = n.Parent; } string[] path = segments.ToArray (); return MSDN_BASE_URL + String.Join (".", path); } public ComparisonStatus Status; public readonly CompType Type; public ComparisonNode Parent; public readonly string Name; public readonly string TypeName; public readonly string ExtraInfo; public readonly List Messages; public readonly List Todos; public bool ThrowsNIE; public int Extra; public int Missing; public int Present; public int Warning; public int Todo; public int Niex; public readonly List Children; public bool HasChildren; // This is set when lazy-loading from the DB public bool HasMessages; // This is set when lazy-loading from the DB public object InternalID; string msdnUrl; const string MSDN_BASE_URL = "http://msdn.microsoft.com/en-us/library/"; } } mono-tools-4.2/gui-compare/cm/0000775000175000017500000000000012642235741020324 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gui-compare/cm/sm.gif0000664000175000017500000000013212413742070021420 0ustar00directhexdirecthex00000000000000GIF89a !, 8,"8dBF 5܂O(N;mono-tools-4.2/gui-compare/cm/d.gif0000664000175000017500000000021012413742070021221 0ustar00directhexdirecthex00000000000000GIF89a!,MxԾPA++DqdiWPkm*<,OUgKjb ( q6@sRY4pUup:;mono-tools-4.2/gui-compare/cm/y.gif0000664000175000017500000000015212413742070021253 0ustar00directhexdirecthex00000000000000GIF89a!,/80ɀDx2a1s닚pH);mono-tools-4.2/gui-compare/cm/sc.gif0000664000175000017500000000012412413742070021407 0ustar00directhexdirecthex00000000000000GIF89a !, 8M@%eNM5k;mono-tools-4.2/gui-compare/cm/tp.gif0000664000175000017500000000010312413742070021422 0ustar00directhexdirecthex00000000000000GIF89a Xx!, ;ʁ{[xqtR;mono-tools-4.2/gui-compare/cm/s.gif0000664000175000017500000000023212413742070021244 0ustar00directhexdirecthex00000000000000GIF89a!,Gɉ s9[7i`!pY™~kzl @˜!1'1!$ɩyLVb;mono-tools-4.2/gui-compare/cm/p.gif0000664000175000017500000000016612413742070021247 0ustar00directhexdirecthex00000000000000GIF89a!,;x9Oou 5 XDkآ`aC '(bpItJ$;mono-tools-4.2/gui-compare/cm/se.gif0000664000175000017500000000011112413742070021405 0ustar00directhexdirecthex00000000000000GIF89a !,  ܋-<"a Q;mono-tools-4.2/gui-compare/cm/e.gif0000664000175000017500000000153512413742070021235 0ustar00directhexdirecthex00000000000000GIF89a3f3333f333ff3fffff3f3f̙3f3333f3333333333f3333333f3f33ff3f3f3f3333f3333333f3̙333333f333ff3ffffff3f33f3ff3f3f3ffff3fffffffffff3fffffff3fff̙ffff3fffff3f̙3333f33̙3ff3ffff̙f3f̙3f̙̙3f̙3f3333f333ff3fffff̙̙3̙f̙̙̙3f̙3f3f3333f333ff3fffff3f3f̙3f!,: HX0@"pQ'RaBB -nx1E$K,˗0;mono-tools-4.2/gui-compare/cm/w.gif0000664000175000017500000000012112413742070021245 0ustar00directhexdirecthex00000000000000GIF89aQQQccc! ,H0IÐg^;mono-tools-4.2/gui-compare/cm/st.gif0000664000175000017500000000014512413742070021433 0ustar00directhexdirecthex00000000000000GIF89a !, *x'BPr\\@AES]i  ,+}^ !;mono-tools-4.2/gui-compare/cm/mn.png0000664000175000017500000000122012413742070021431 0ustar00directhexdirecthex00000000000000PNG  IHDRagAMA7tEXtSoftwareAdobe ImageReadyqe<"IDAT;HayWfXhW$*2%# !\ۚli/[ *ji"KӴr(|S AH;CN 9sk3 517\sUQ3+sGҞ#=UВc= EFbCk*U<[\hgNFT503GQ7괵6Dw" BA $"!&)wCTIڪ2% jJA!$^byn}T>'DFܜU"D" $P.vQ{"3% fh~oѰ q-nfFJU"}ys<ĵ71ﳏ*Qp5@Dy-,Ѱ̀J[Y\e`f Ⳬ4ڏ_V+$q!j&XmsAy~{N$5x4zaK׷'=-/{V?d+h_q3 7q3p_H.%#IENDB`mono-tools-4.2/gui-compare/cm/sx.gif0000664000175000017500000000011112413742070021430 0ustar00directhexdirecthex00000000000000GIF89a !, +lR{ }V _;mono-tools-4.2/gui-compare/cm/i.gif0000664000175000017500000000015012413742070021231 0ustar00directhexdirecthex00000000000000GIF89a!,-80Aw`(na(4+ 0 4NupH,N;mono-tools-4.2/gui-compare/cm/r.gif0000664000175000017500000000013612413742070021246 0ustar00directhexdirecthex00000000000000GIF89a! ,#806AŪѷuҁ3ᕞjܚވIx$;mono-tools-4.2/gui-compare/cm/tb.gif0000664000175000017500000000006112413742070021407 0ustar00directhexdirecthex00000000000000GIF89a !, O;mono-tools-4.2/gui-compare/cm/c.gif0000664000175000017500000000022612413742070021227 0ustar00directhexdirecthex00000000000000GIF89a!,Cw򘊯6[7} pcGpy 4}@: E2)ڡ0Mb٦R;mono-tools-4.2/gui-compare/cm/n.gif0000664000175000017500000000011712413742070021241 0ustar00directhexdirecthex00000000000000GIF89a! , ˽dtMvi^ {;mono-tools-4.2/gui-compare/cm/m.gif0000664000175000017500000000015512413742070021242 0ustar00directhexdirecthex00000000000000GIF89a! ,2x0E&u!]A*yϦ %!bB֊B̤Ftr;mono-tools-4.2/gui-compare/cm/tm.gif0000664000175000017500000000010012413742070021414 0ustar00directhexdirecthex00000000000000GIF89a Xx!, ;^ X;e;mono-tools-4.2/gui-compare/cm/en.gif0000664000175000017500000000015712413742070021412 0ustar00directhexdirecthex00000000000000GIF89a!,4xI"=CuYQtJn䡁 ddl:;mono-tools-4.2/gui-compare/cm/f.gif0000664000175000017500000000015012413742070021226 0ustar00directhexdirecthex00000000000000GIF89a!,-H0ʩׁ0Bt2(޹)k+[ť eH$;mono-tools-4.2/gui-compare/CustomCompare.cs0000664000175000017500000000424312413742070023032 0ustar00directhexdirecthex00000000000000// CustomCompare.cs // // Copyright (c) 2008 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; using System.IO; namespace GuiCompare { public partial class CustomCompare : Gtk.Dialog { public CustomCompare() { this.Build(); } CompareDefinition Error (string format, params string [] args) { MessageDialog md = new MessageDialog (this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, String.Format (format, args)); md.Run (); md.Destroy (); return null; } public CompareDefinition GetCompare () { if (String.IsNullOrEmpty (reference.File)) return Error ("No reference file was provided"); if (String.IsNullOrEmpty (target.File)) return Error ("No target file was provided"); if (!File.Exists (reference.File)) return Error ("Reference file {0} does not exist", reference.File); if (!File.Exists (target.File)) return Error ("Target file {0} does not exist", target.File); CompareDefinition cd = new CompareDefinition (reference.IsInfo, reference.File, target.IsInfo, target.File); cd.IsCustom = true; return cd; } } } mono-tools-4.2/gui-compare/MainWindow.cs0000664000175000017500000006247512413742070022340 0ustar00directhexdirecthex00000000000000// MainWindow.cs // // Copyright (c) 2007 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 System.Collections.Generic; using System.Reflection; using System.Net; using Gtk; using GLib; using System.Threading; using System.Text; using System.Text.RegularExpressions; using GuiCompare; public partial class MainWindow: Gtk.Window { InfoManager info_manager; Func reference_loader, target_loader; CompareContext context; string active_profile; static readonly Regex markupRegex = new Regex (@"<(?:[^""']+?|.+?(?:""|').*?(?:""|')?.*?)*?>", RegexOptions.Compiled | RegexOptions.IgnoreCase); static Gdk.Pixbuf classPixbuf, delegatePixbuf, enumPixbuf; static Gdk.Pixbuf eventPixbuf, fieldPixbuf, interfacePixbuf; static Gdk.Pixbuf methodPixbuf, namespacePixbuf, propertyPixbuf; static Gdk.Pixbuf attributePixbuf, structPixbuf, assemblyPixbuf; static Gdk.Pixbuf okPixbuf, errorPixbuf, niexPixbuf; static Gdk.Pixbuf missingPixbuf, todoPixbuf, extraPixbuf; static Gdk.Color green, red, black; Gtk.TreeStore treeStore; Gtk.TreeModelFilter treeFilter; enum TreeCol : int { Name, TypeIcon, StatusIcon, MissingIcon, MissingText, ExtraIcon, ExtraText, ErrorIcon, ErrorText, TodoIcon, TodoText, NiexIcon, NiexText, Node, Foreground }; public GuiCompare.Config Config; static MainWindow () { Assembly ta = typeof (MainWindow).Assembly; classPixbuf = new Gdk.Pixbuf (ta, "c.gif"); delegatePixbuf = new Gdk.Pixbuf (ta, "d.gif"); enumPixbuf = new Gdk.Pixbuf (ta, "en.gif"); eventPixbuf = new Gdk.Pixbuf (ta, "e.gif"); fieldPixbuf = new Gdk.Pixbuf (ta, "f.gif"); interfacePixbuf = new Gdk.Pixbuf (ta, "i.gif"); methodPixbuf = new Gdk.Pixbuf (ta, "m.gif"); namespacePixbuf = new Gdk.Pixbuf (ta, "n.gif"); propertyPixbuf = new Gdk.Pixbuf (ta, "p.gif"); attributePixbuf = new Gdk.Pixbuf (ta, "r.gif"); structPixbuf = new Gdk.Pixbuf (ta, "s.gif"); assemblyPixbuf = new Gdk.Pixbuf (ta, "y.gif"); okPixbuf = new Gdk.Pixbuf (ta, "sc.gif"); errorPixbuf = new Gdk.Pixbuf (ta, "se.gif"); niexPixbuf = new Gdk.Pixbuf (ta, "mn.png"); missingPixbuf = new Gdk.Pixbuf (ta, "sm.gif"); todoPixbuf = new Gdk.Pixbuf (ta, "st.gif"); extraPixbuf = new Gdk.Pixbuf (ta, "sx.gif"); Gdk.Color.Parse ("#ff0000", ref red); Gdk.Color.Parse ("#00ff00", ref green); Gdk.Color.Parse ("#000000", ref black); } public MainWindow (string profilePath) : base(Gtk.WindowType.Toplevel) { Build (); notebook1.Page = 1; Config = GuiCompare.Config.GetConfig (); // // Configure the GUI // info_manager = new InfoManager (this, profilePath); treeStore = new Gtk.TreeStore (typeof (string), // Name typeof (Gdk.Pixbuf), typeof (Gdk.Pixbuf), // TypeIcon, StatusIcon typeof (Gdk.Pixbuf), typeof (string), // MissingIcon, MissingText typeof (Gdk.Pixbuf), typeof (string), // ExtraIcon, ExtraText typeof (Gdk.Pixbuf), typeof (string), // ErrorIcon, ErrorText typeof (Gdk.Pixbuf), typeof (string), // TodoIcon, TodoText typeof (Gdk.Pixbuf), typeof (string), // NiexIcon, NiexText typeof (ComparisonNode), typeof (string)); // Node, Foreground treeFilter = new Gtk.TreeModelFilter (treeStore, null); treeFilter.VisibleFunc = FilterTree; tree.Model = treeFilter; // Create a column for the node name Gtk.TreeViewColumn nameColumn = new Gtk.TreeViewColumn (); nameColumn.Title = "Name"; nameColumn.Resizable = true; Gtk.CellRendererText nameCell = new Gtk.CellRendererText (); Gtk.CellRendererPixbuf typeCell = new Gtk.CellRendererPixbuf (); Gtk.CellRendererPixbuf statusCell = new Gtk.CellRendererPixbuf (); nameColumn.PackStart (statusCell, false); nameColumn.PackStart (typeCell, false); nameColumn.PackStart (nameCell, true); tree.AppendColumn (nameColumn); nameColumn.AddAttribute (nameCell, "text", (int)TreeCol.Name); nameColumn.AddAttribute (nameCell, "foreground", (int)TreeCol.Foreground); nameColumn.AddAttribute (typeCell, "pixbuf", (int)TreeCol.TypeIcon); nameColumn.AddAttribute (statusCell, "pixbuf", (int)TreeCol.StatusIcon); // Create a column for the status counts Gtk.TreeViewColumn countsColumn = new Gtk.TreeViewColumn (); countsColumn.Title = "Counts"; countsColumn.Resizable = true; Gtk.CellRendererPixbuf missingPixbufCell = new Gtk.CellRendererPixbuf (); Gtk.CellRendererText missingTextCell = new Gtk.CellRendererText (); Gtk.CellRendererPixbuf extraPixbufCell = new Gtk.CellRendererPixbuf (); Gtk.CellRendererText extraTextCell = new Gtk.CellRendererText (); Gtk.CellRendererPixbuf errorPixbufCell = new Gtk.CellRendererPixbuf (); Gtk.CellRendererText errorTextCell = new Gtk.CellRendererText (); Gtk.CellRendererPixbuf todoPixbufCell = new Gtk.CellRendererPixbuf (); Gtk.CellRendererText todoTextCell = new Gtk.CellRendererText (); Gtk.CellRendererPixbuf niexPixbufCell = new Gtk.CellRendererPixbuf (); Gtk.CellRendererText niexTextCell = new Gtk.CellRendererText (); countsColumn.PackStart (missingPixbufCell, false); countsColumn.PackStart (missingTextCell, false); countsColumn.PackStart (extraPixbufCell, false); countsColumn.PackStart (extraTextCell, false); countsColumn.PackStart (errorPixbufCell, false); countsColumn.PackStart (errorTextCell, false); countsColumn.PackStart (todoPixbufCell, false); countsColumn.PackStart (todoTextCell, false); countsColumn.PackStart (niexPixbufCell, false); countsColumn.PackStart (niexTextCell, false); tree.AppendColumn (countsColumn); countsColumn.AddAttribute (missingPixbufCell, "pixbuf", (int)TreeCol.MissingIcon); countsColumn.AddAttribute (missingTextCell, "text", (int)TreeCol.MissingText); countsColumn.AddAttribute (extraPixbufCell, "pixbuf", (int)TreeCol.ExtraIcon); countsColumn.AddAttribute (extraTextCell, "text", (int)TreeCol.ExtraText); countsColumn.AddAttribute (errorPixbufCell, "pixbuf", (int)TreeCol.ErrorIcon); countsColumn.AddAttribute (errorTextCell, "text", (int)TreeCol.ErrorText); countsColumn.AddAttribute (todoPixbufCell, "pixbuf", (int)TreeCol.TodoIcon); countsColumn.AddAttribute (todoTextCell, "text", (int)TreeCol.TodoText); countsColumn.AddAttribute (niexPixbufCell, "pixbuf", (int)TreeCol.NiexIcon); countsColumn.AddAttribute (niexTextCell, "text", (int)TreeCol.NiexText); CreateTags (AdditionalInfoText.Buffer); tree.Selection.Changed += delegate (object sender, EventArgs e) { Gtk.TreeIter iter; if (tree.Selection.GetSelected (out iter)) { List msgs = null; ComparisonNode n = tree.Model.GetValue (iter, (int)TreeCol.Node) as ComparisonNode; TextBuffer buffer = AdditionalInfoText.Buffer; bool showInfo = false; TextIter textIter = TextIter.Zero; buffer.Clear (); if (!String.IsNullOrEmpty (n.ExtraInfo)) { showInfo = true; textIter = buffer.StartIter; buffer.InsertWithTagsByName (ref textIter, "Additional information:\n", "bold"); InsertWithMarkup (buffer, ref textIter, "\t" + n.ExtraInfo + "\n"); } if (n != null) msgs = n.Messages; if (msgs != null && msgs.Count > 0) { if (!showInfo) { showInfo = true; textIter = buffer.StartIter; } buffer.InsertWithTagsByName (ref textIter, "Errors:\n", "red", "bold"); for (int i = 0; i < msgs.Count; i ++) { buffer.InsertWithTagsByName (ref textIter, String.Format ("\t{0}: ", i + 1), "bold"); InsertWithMarkup (buffer, ref textIter, msgs [i]); } } if (n != null) msgs = n.Todos; if (msgs != null && msgs.Count > 0) { if (!showInfo) { showInfo = true; textIter = buffer.StartIter; } buffer.InsertWithTagsByName (ref textIter, "TODO:\n", "green", "bold"); for (int i = 0; i < msgs.Count; i ++) { buffer.InsertWithTagsByName (ref textIter, String.Format ("\t{0}: ", i + 1), "bold"); buffer.Insert (ref textIter, msgs [i]); } } if (showInfo) AdditionalInfoWindow.Visible = true; else AdditionalInfoWindow.Visible = false; string msdnUrl = n != null ? n.MSDNUrl : null; if (!String.IsNullOrEmpty (msdnUrl)) Status = GetMSDNVersionedUrl (msdnUrl); else Status = String.Empty; } }; tree.RowActivated += delegate (object sender, RowActivatedArgs args) { Gtk.TreeIter iter; if (!tree.Model.GetIter (out iter, args.Path)) return; ComparisonNode n = tree.Model.GetValue (iter, (int)TreeCol.Node) as ComparisonNode; if (n == null || String.IsNullOrEmpty (n.MSDNUrl)) return; System.Diagnostics.Process browser = new System.Diagnostics.Process (); browser.StartInfo.FileName = GetMSDNVersionedUrl (n.MSDNUrl); browser.StartInfo.UseShellExecute = true; browser.Start (); }; // // Load configuration // ShowMissing.Active = Config.ShowMissing; ShowErrors.Active = Config.ShowErrors; ShowExtra.Active = Config.ShowExtra; ShowPresent.Active = Config.ShowPresent; ShowTodo.Active = Config.ShowTodo; // // Legend // legendImageOK.Pixbuf = okPixbuf; legendImageError.Pixbuf = errorPixbuf; legendImageNIEX.Pixbuf = niexPixbuf; legendImageMissing.Pixbuf = missingPixbuf; legendImageTODO.Pixbuf = todoPixbuf; legendImageExtra.Pixbuf = extraPixbuf; } // A handle to our menu bar public MenuBar MenuBar { get { return menubar1; } } // Used to set the status from other classes int count = 0; public string Status { set { if (count-- > 0) statusbar1.Pop (0); count++; statusbar1.Push (0, value); } } // Used to update the progressbar public double Progress { get { return progressbar1.Adjustment.Value; } set { progressbar1.Adjustment.Value = value; } } void CreateTags (TextBuffer buffer) { var tag = new TextTag ("bold"); tag.Weight = Pango.Weight.Bold; buffer.TagTable.Add (tag); tag = new TextTag ("red"); tag.Foreground = "darkred"; buffer.TagTable.Add (tag); tag = new TextTag ("green"); tag.Foreground = "darkgreen"; buffer.TagTable.Add (tag); tag = new TextTag ("italic"); tag.Style = Pango.Style.Italic; buffer.TagTable.Add (tag); tag = new TextTag ("big"); tag.Scale = Pango.Scale.Large; buffer.TagTable.Add (tag); tag = new TextTag ("small"); tag.Scale = Pango.Scale.Small; buffer.TagTable.Add (tag); tag = new TextTag ("strikethrough"); tag.Strikethrough = true; buffer.TagTable.Add (tag); tag = new TextTag ("sub"); tag.Rise = -5000; buffer.TagTable.Add (tag); tag = new TextTag ("sup"); tag.Rise = 5000; buffer.TagTable.Add (tag); tag = new TextTag ("monospace"); tag.Family = "monospace"; buffer.TagTable.Add (tag); tag = new TextTag ("underline"); tag.Underline = Pango.Underline.Single; buffer.TagTable.Add (tag); } string GetMSDNVersionedUrl (string url) { switch (active_profile) { case "2.0": return url.Replace (".aspx", "(v=VS.80).aspx"); case "3.0": return url.Replace (".aspx", "(v=VS.90).aspx"); case "4.0": return url.Replace (".aspx", "(v=VS.100).aspx"); case "4.5": return url.Replace (".aspx", "(v=VS.110).aspx"); default: return url; } } void InsertWithMarkup (TextBuffer buffer, ref TextIter iter, string text) { Match match = markupRegex.Match (text); if (!match.Success) { buffer.Insert (ref iter, text); return; } int start = 0, len, idx; var tags = new List (); while (match.Success) { len = match.Index - start; if (len > 0) buffer.InsertWithTagsByName (ref iter, text.Substring (start, len), tags.ToArray ()); switch (match.Value.ToLowerInvariant ()) { case "": if (!tags.Contains ("italic")) tags.Add ("italic"); break; case "": idx = tags.IndexOf ("italic"); if (idx > -1) tags.RemoveAt (idx); break; case "": if (!tags.Contains ("bold")) tags.Add ("bold"); break; case "": idx = tags.IndexOf ("bold"); if (idx > -1) tags.RemoveAt (idx); break; case "": if (!tags.Contains ("big")) tags.Add ("big"); break; case "": idx = tags.IndexOf ("big"); if (idx > -1) tags.RemoveAt (idx); break; case "": if (!tags.Contains ("strikethrough")) tags.Add ("strikethrough"); break; case "": idx = tags.IndexOf ("strikethrough"); if (idx > -1) tags.RemoveAt (idx); break; case "": if (!tags.Contains ("sub")) tags.Add ("sub"); break; case "": idx = tags.IndexOf ("sub"); if (idx > -1) tags.RemoveAt (idx); break; case "": if (!tags.Contains ("sup")) tags.Add ("sup"); break; case "": idx = tags.IndexOf ("sup"); if (idx > -1) tags.RemoveAt (idx); break; case "": if (!tags.Contains ("small")) tags.Add ("small"); break; case "": idx = tags.IndexOf ("small"); if (idx > -1) tags.RemoveAt (idx); break; case "": if (!tags.Contains ("monospace")) tags.Add ("monospace"); break; case "": idx = tags.IndexOf ("monospace"); if (idx > -1) tags.RemoveAt (idx); break; case "": if (!tags.Contains ("underline")) tags.Add ("underline"); break; case "": idx = tags.IndexOf ("underline"); if (idx > -1) tags.RemoveAt (idx); break; } start = match.Index + match.Length; match = match.NextMatch (); } if (start < text.Length) buffer.InsertWithTagsByName (ref iter, text.Substring (start), tags.ToArray ()); } public void SetTarget (Func target) { target_loader = target; } public void SetReference (Func reference) { reference_loader = reference; } public void SetCompareDefinition (CompareDefinition cd) { if (cd.ReferenceIsInfo) SetReference (delegate { return new MasterAssembly (cd.ReferencePath); }); else SetReference (delegate { return new CecilAssembly (cd.ReferencePath); }); if (cd.TargetIsInfo) SetTarget (delegate { return new MasterAssembly (cd.TargetPath); }); else SetTarget (delegate { return new CecilAssembly (cd.TargetPath); }); } public void SetComparedProfile (string profile) { active_profile = profile; } public void StartCompare (WaitCallback done) { AdditionalInfoWindow.Visible = false; progressbar1.Visible = true; progressbar1.Adjustment.Lower = 0; progressbar1.Adjustment.Upper = 100; // clear our existing content if (context != null) context.StopCompare (); // Go to the actual tree page. notebook1.Page = 0; // now generate new content asynchronously context = new CompareContext (reference_loader, target_loader); context.ProgressChanged += delegate (object sender, CompareProgressChangedEventArgs e) { Application.Invoke (delegate { Status = e.Message; Progress = e.Progress; }); }; context.Error += delegate (object sender, CompareErrorEventArgs e) { Application.Invoke (delegate { Console.WriteLine ("ERROR: {0}", e.Message); MessageDialog md = new MessageDialog (this, 0, MessageType.Error, ButtonsType.Ok, false, e.Message); md.Response += delegate (object s, ResponseArgs ra) { md.Hide (); }; md.Show(); Status = String.Format ("Comparison failed at {0}", DateTime.Now); Progress = 0.0; progressbar1.Visible = false; }); }; context.Finished += delegate (object sender, EventArgs e) { Application.Invoke (delegate { DateTime finish_time = DateTime.Now; if (context.Comparison != null) { Status = String.Format ("Comparison completed at {0}", finish_time); context.Comparison.PropagateCounts (); PopulateTreeFromComparison (context.Comparison); Progress = 0.0; CompareHistory[] history = Config.Recent[0].History; if (history == null || history.Length == 0 || (history[history.Length-1].Extras != context.Comparison.Extra || history[history.Length-1].Errors != context.Comparison.Warning || history[history.Length-1].Missing != context.Comparison.Missing || history[history.Length-1].Niexs != context.Comparison.Niex || history[history.Length-1].Todos != context.Comparison.Todo)) { CompareHistory history_entry = new CompareHistory(); history_entry.CompareTime = finish_time; history_entry.Extras = context.Comparison.Extra; history_entry.Errors = context.Comparison.Warning; history_entry.Missing = context.Comparison.Missing; history_entry.Niexs = context.Comparison.Niex; history_entry.Todos = context.Comparison.Todo; Config.Recent[0].AddHistoryEntry (history_entry); Config.Save (); } } else Status = "Comparison not completed - no data returned."; done (this); progressbar1.Visible = false; }); }; treeStore.Clear (); context.Compare (); } Gdk.Pixbuf TypePixbufFromComparisonNode (ComparisonNode node) { switch (node.Type) { case CompType.Assembly: return assemblyPixbuf; case CompType.Namespace: return namespacePixbuf; case CompType.Attribute: return attributePixbuf; case CompType.Interface: return interfacePixbuf; case CompType.Class: return classPixbuf; case CompType.Struct: return structPixbuf; case CompType.Delegate: return delegatePixbuf; case CompType.Enum: return enumPixbuf; case CompType.Method: return methodPixbuf; case CompType.Property: return propertyPixbuf; case CompType.Field: return fieldPixbuf; case CompType.Event: return eventPixbuf; } return null; } Gdk.Pixbuf StatusPixbufFromComparisonNode (ComparisonNode node) { switch (node.Status) { case ComparisonStatus.None: return okPixbuf; case ComparisonStatus.Missing: return missingPixbuf; case ComparisonStatus.Extra: return extraPixbuf; case ComparisonStatus.Error: return errorPixbuf; } return null; } string StatusForegroundFromComparisonNode (ComparisonNode node) { switch (node.Status) { case ComparisonStatus.Missing: return "darkred"; case ComparisonStatus.Extra: return "green"; case ComparisonStatus.Error: return "red"; case ComparisonStatus.None: default: if (String.IsNullOrEmpty (node.MSDNUrl)) return "black"; else return "navyblue"; } } bool StatusUnderlineFromComparisonNode (ComparisonNode node) { if (String.IsNullOrEmpty (node.MSDNUrl)) return false; return true; } void PopulateTreeFromComparison (ComparisonNode root) { Gtk.TreeIter iter = treeStore.AppendValues (root.Name, TypePixbufFromComparisonNode (root), StatusPixbufFromComparisonNode (root), root.Missing == 0 ? null : missingPixbuf, root.Missing == 0 ? null : String.Format (":{0}", root.Missing), root.Extra == 0 ? null : extraPixbuf, root.Extra == 0 ? null : String.Format (":{0}", root.Extra), root.Warning == 0 ? null : errorPixbuf, root.Warning == 0 ? null : String.Format (":{0}", root.Warning), root.Todo == 0 ? null : todoPixbuf, root.Todo == 0 ? null : String.Format (":{0}", root.Todo), root.Niex == 0 ? null : niexPixbuf, root.Niex == 0 ? null : String.Format (":{0}", root.Niex), root, StatusForegroundFromComparisonNode (root)); Gtk.TreePath path = treeStore.GetPath (iter); foreach (ComparisonNode n in root.Children) { PopulateTreeFromComparison (iter, n); } tree.ExpandRow (path, false); } void PopulateTreeFromComparison (Gtk.TreeIter iter, ComparisonNode node) { Gtk.TreeIter citer = treeStore.AppendValues (iter, node.Name, TypePixbufFromComparisonNode (node), StatusPixbufFromComparisonNode (node), node.Missing == 0 ? null : missingPixbuf, node.Missing == 0 ? null : String.Format (":{0}", node.Missing), node.Extra == 0 ? null : extraPixbuf, node.Extra == 0 ? null : String.Format (":{0}", node.Extra), node.Warning == 0 ? null : errorPixbuf, node.Warning == 0 ? null : String.Format (":{0}", node.Warning), node.Todo == 0 ? null : todoPixbuf, node.Todo == 0 ? null : String.Format (":{0}", node.Todo), node.Niex == 0 ? null : niexPixbuf, node.Niex == 0 ? null : ((node.Niex == 1 && node.ThrowsNIE) ? null : String.Format (":{0}", node.Niex)), node, StatusForegroundFromComparisonNode (node)); foreach (ComparisonNode n in node.Children) { PopulateTreeFromComparison (citer, n); } } private bool FilterTree (Gtk.TreeModel model, Gtk.TreeIter iter) { //string node_name = model.GetValue(iter, 0) as string; //Console.WriteLine ("filtering {0}, node = {1}", node_name, model.GetValue(iter, 9) == null ? "null" : model.GetValue(iter,9).GetType().ToString()); ComparisonNode n = model.GetValue (iter, (int)TreeCol.Node) as ComparisonNode; if (n == null) return false; if ((ShowMissing.Active && (n.Status == ComparisonStatus.Missing || n.Missing > 0)) || (ShowExtra.Active && (n.Status == ComparisonStatus.Extra || n.Extra > 0)) || (ShowErrors.Active && (n.Status == ComparisonStatus.Error || n.Warning > 0)) || (ShowTodo.Active && (n.Todo > 0)) || (ShowNotImplemented.Active && (n.Niex > 0)) || ShowPresent.Active && n.Status == ComparisonStatus.None) return true; else return false; } protected void OnDeleteEvent (object sender, DeleteEventArgs a) { Application.Quit (); a.RetVal = true; } protected virtual void OnQuitActivated (object sender, System.EventArgs e) { Application.Quit (); } protected virtual void OnShowErrorsToggled (object sender, System.EventArgs e) { treeFilter.Refilter(); Config.ShowErrors = ShowErrors.Active; Config.Save (); } protected virtual void OnShowMissingToggled (object sender, System.EventArgs e) { treeFilter.Refilter(); Config.ShowMissing = ShowMissing.Active; Config.Save (); } protected virtual void OnShowPresentToggled (object sender, System.EventArgs e) { treeFilter.Refilter(); Config.ShowPresent = ShowPresent.Active; Config.Save (); } protected virtual void OnShowExtraToggled (object sender, System.EventArgs e) { treeFilter.Refilter(); Config.ShowPresent = ShowPresent.Active; Config.Save (); } protected virtual void OnShowTodoToggled (object sender, System.EventArgs e) { treeFilter.Refilter(); Config.ShowTodo = ShowTodo.Active; Config.Save (); } protected virtual void OnShowNotImplementedToggled (object sender, System.EventArgs e) { treeFilter.Refilter(); Config.ShowTodo = ShowTodo.Active; Config.Save (); } protected virtual void OnRefreshActivated (object sender, System.EventArgs e) { StartCompare (delegate {}); } public void ComparePaths (string reference, string target) { var cd = new CompareDefinition (false, reference, false, target); SetCompareDefinition (cd); StartCompare (delegate { Title = cd.ToString (); }); Config.AddRecent (cd); Config.Save (); info_manager.PopulateRecent (); } protected virtual void OnCustomActivated (object sender, System.EventArgs e) { CustomCompare cc = new CustomCompare (); ResponseType code = (ResponseType) cc.Run (); if (code == ResponseType.None) return; if (code == ResponseType.Ok){ CompareDefinition cd = cc.GetCompare (); if (cd != null){ SetCompareDefinition (cd); StartCompare (delegate { Title = cd.ToString ();}); Config.AddRecent (cd); Config.Save (); info_manager.PopulateRecent (); } } cc.Destroy (); } protected virtual void OnToggleRowExpansion (object sender, System.EventArgs e) { Gtk.TreeIter iter; if (tree.Selection.GetSelected (out iter)) { Gtk.TreePath path = tree.Model.GetPath(iter); if (path != null) { if (tree.GetRowExpanded (path)) tree.CollapseRow (path); else tree.ExpandRow (path, false); } } } } mono-tools-4.2/gui-compare/gtk-gui/0000775000175000017500000000000012642235741021274 5ustar00directhexdirecthex00000000000000mono-tools-4.2/gui-compare/gtk-gui/GuiCompare.CustomCompare.cs0000664000175000017500000001167412413742070026441 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace GuiCompare { public partial class CustomCompare { private global::Gtk.HBox hbox1; private global::Gtk.Frame frame1; private global::Gtk.Alignment GtkAlignment2; private global::guicompare.ProviderSelector reference; private global::Gtk.Label GtkLabel4; private global::Gtk.Frame frame2; private global::Gtk.Alignment GtkAlignment3; private global::guicompare.ProviderSelector target; private global::Gtk.Label GtkLabel9; private global::Gtk.Button buttonCancel; private global::Gtk.Button buttonOk; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget GuiCompare.CustomCompare this.Name = "GuiCompare.CustomCompare"; this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Internal child GuiCompare.CustomCompare.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.hbox1 = new global::Gtk.HBox (); this.hbox1.Name = "hbox1"; this.hbox1.Spacing = 12; this.hbox1.BorderWidth = ((uint)(4)); // Container child hbox1.Gtk.Box+BoxChild this.frame1 = new global::Gtk.Frame (); this.frame1.Name = "frame1"; this.frame1.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child frame1.Gtk.Container+ContainerChild this.GtkAlignment2 = new global::Gtk.Alignment (0F, 0F, 1F, 1F); this.GtkAlignment2.Name = "GtkAlignment2"; this.GtkAlignment2.LeftPadding = ((uint)(12)); // Container child GtkAlignment2.Gtk.Container+ContainerChild this.reference = new guicompare.ProviderSelector(); this.reference.Events = ((Gdk.EventMask)(256)); this.reference.Name = "reference"; this.GtkAlignment2.Add (this.reference); this.frame1.Add (this.GtkAlignment2); this.GtkLabel4 = new global::Gtk.Label (); this.GtkLabel4.Name = "GtkLabel4"; this.GtkLabel4.LabelProp = global::Mono.Unix.Catalog.GetString ("Reference:"); this.GtkLabel4.UseMarkup = true; this.frame1.LabelWidget = this.GtkLabel4; this.hbox1.Add (this.frame1); global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.frame1])); w4.Position = 0; w4.Padding = ((uint)(4)); // Container child hbox1.Gtk.Box+BoxChild this.frame2 = new global::Gtk.Frame (); this.frame2.Name = "frame2"; this.frame2.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child frame2.Gtk.Container+ContainerChild this.GtkAlignment3 = new global::Gtk.Alignment (0F, 0F, 1F, 1F); this.GtkAlignment3.Name = "GtkAlignment3"; this.GtkAlignment3.LeftPadding = ((uint)(12)); // Container child GtkAlignment3.Gtk.Container+ContainerChild this.target = new guicompare.ProviderSelector(); this.target.Events = ((Gdk.EventMask)(256)); this.target.Name = "target"; this.GtkAlignment3.Add (this.target); this.frame2.Add (this.GtkAlignment3); this.GtkLabel9 = new global::Gtk.Label (); this.GtkLabel9.Name = "GtkLabel9"; this.GtkLabel9.LabelProp = global::Mono.Unix.Catalog.GetString ("Target:"); this.GtkLabel9.UseMarkup = true; this.frame2.LabelWidget = this.GtkLabel9; this.hbox1.Add (this.frame2); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.frame2])); w7.Position = 1; w7.Padding = ((uint)(4)); w1.Add (this.hbox1); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox1])); w8.Position = 0; // Internal child GuiCompare.CustomCompare.ActionArea global::Gtk.HButtonBox w9 = this.ActionArea; w9.Name = "dialog1_ActionArea"; w9.Spacing = 6; w9.BorderWidth = ((uint)(5)); w9.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 w10 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w9 [this.buttonCancel])); w10.Expand = false; w10.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"; this.AddActionWidget (this.buttonOk, -5); global::Gtk.ButtonBox.ButtonBoxChild w11 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w9 [this.buttonOk])); w11.Position = 1; w11.Expand = false; w11.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 578; this.DefaultHeight = 273; this.Show (); } } } mono-tools-4.2/gui-compare/gtk-gui/objects.xml0000664000175000017500000000004312413742070023436 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gui-compare/gtk-gui/guicompare.ProviderSelector.cs0000664000175000017500000001014212413742070027240 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace guicompare { public partial class ProviderSelector { private global::Gtk.Table table2; private global::Gtk.FileChooserButton filechooserbutton1; private global::Gtk.FileChooserButton filechooserbutton2; private global::Gtk.Label label2; private global::Gtk.RadioButton radiobutton1; private global::Gtk.RadioButton radiobutton2; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget guicompare.ProviderSelector global::Stetic.BinContainer.Attach (this); this.Name = "guicompare.ProviderSelector"; // Container child guicompare.ProviderSelector.Gtk.Container+ContainerChild this.table2 = new global::Gtk.Table (((uint)(4)), ((uint)(2)), false); this.table2.Name = "table2"; this.table2.RowSpacing = ((uint)(6)); this.table2.ColumnSpacing = ((uint)(6)); this.table2.BorderWidth = ((uint)(4)); // Container child table2.Gtk.Table+TableChild this.filechooserbutton1 = new global::Gtk.FileChooserButton (global::Mono.Unix.Catalog.GetString ("Select A File"), ((global::Gtk.FileChooserAction)(0))); this.filechooserbutton1.Name = "filechooserbutton1"; this.table2.Add (this.filechooserbutton1); global::Gtk.Table.TableChild w1 = ((global::Gtk.Table.TableChild)(this.table2 [this.filechooserbutton1])); w1.TopAttach = ((uint)(1)); w1.BottomAttach = ((uint)(2)); w1.LeftAttach = ((uint)(1)); w1.RightAttach = ((uint)(2)); w1.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table2.Gtk.Table+TableChild this.filechooserbutton2 = new global::Gtk.FileChooserButton (global::Mono.Unix.Catalog.GetString ("Select A File"), ((global::Gtk.FileChooserAction)(0))); this.filechooserbutton2.Name = "filechooserbutton2"; this.table2.Add (this.filechooserbutton2); global::Gtk.Table.TableChild w2 = ((global::Gtk.Table.TableChild)(this.table2 [this.filechooserbutton2])); w2.TopAttach = ((uint)(3)); w2.BottomAttach = ((uint)(4)); w2.LeftAttach = ((uint)(1)); w2.RightAttach = ((uint)(2)); w2.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table2.Gtk.Table+TableChild this.label2 = new global::Gtk.Label (); this.label2.Name = "label2"; this.label2.Xpad = 8; this.table2.Add (this.label2); global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table2 [this.label2])); w3.TopAttach = ((uint)(1)); w3.BottomAttach = ((uint)(2)); w3.XOptions = ((global::Gtk.AttachOptions)(4)); w3.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table2.Gtk.Table+TableChild this.radiobutton1 = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("API Description")); this.radiobutton1.CanFocus = true; this.radiobutton1.Name = "radiobutton1"; this.radiobutton1.Active = true; this.radiobutton1.DrawIndicator = true; this.radiobutton1.UseUnderline = true; this.radiobutton1.Group = new global::GLib.SList (global::System.IntPtr.Zero); this.table2.Add (this.radiobutton1); global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table2 [this.radiobutton1])); w4.RightAttach = ((uint)(2)); w4.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table2.Gtk.Table+TableChild this.radiobutton2 = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Assembly")); this.radiobutton2.CanFocus = true; this.radiobutton2.Name = "radiobutton2"; this.radiobutton2.DrawIndicator = true; this.radiobutton2.UseUnderline = true; this.radiobutton2.Group = this.radiobutton1.Group; this.table2.Add (this.radiobutton2); global::Gtk.Table.TableChild w5 = ((global::Gtk.Table.TableChild)(this.table2 [this.radiobutton2])); w5.TopAttach = ((uint)(2)); w5.BottomAttach = ((uint)(3)); w5.RightAttach = ((uint)(2)); w5.YOptions = ((global::Gtk.AttachOptions)(4)); this.Add (this.table2); if ((this.Child != null)) { this.Child.ShowAll (); } this.Show (); this.filechooserbutton2.FocusChildSet += new global::Gtk.FocusChildSetHandler (this.OnFilechooserbutton2FocusChildSet); } } } mono-tools-4.2/gui-compare/gtk-gui/generated.cs0000664000175000017500000000356512413742070023564 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 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-tools-4.2/gui-compare/gtk-gui/gui.stetic0000664000175000017500000011635712413742070023304 0ustar00directhexdirecthex00000000000000 ../../gui-compare 2.12 Action _File File Action _Quit _Quit gtk-quit Action _Compare Compare Action Custom... Custom... Action a a Action b b Action _View View Toggle Show missing Show missing False True Toggle Show extra Show extra False True Toggle Show present Show present False True Toggle Show errors Show errors False True Action <Control>r Refresh Refresh gtk-refresh Toggle Show Todo Show Todo False True Action Recent Comparisons Recent Comparisons Toggle Show NotImplemented Show NotImplemented False True Action <Mod2>space Toggle Row Expansion Toggle Row Expansion GUI CorCompare CenterOnParent 6 0 True False False True 1 False False In True True page1 tab 20 20 This tool allows you to compare the API of assemblies. To initiate a comparison, use the "Compare" menu and use one of the presets based on the assemblies you have installed on your system and some popular profiles, or use "Custom" to define your own comparison True 1 page2 tab 1 True False In True True False 2 False False True 3 5 6 6 1 Missing 1 2 3 4 True Fill Fill False True False False True False 1 TODO 2 3 True Fill Fill False True False False True False 1 Extra 2 3 3 4 True Fill Fill False True False False True False 1 Not implemented 1 2 True Fill Fill False True False False True False 1 No errors Center False Fill Fill False True False False True False 1 Error 3 4 True Fill Fill False True False False True False 4 5 True Fill Fill False True False False True False 2 3 4 5 True Fill Fill False True False False True False 1 2 4 5 True Fill Fill False True False False True False 1 2 1 2 True Fill Fill False True False False True False 1 2 True Fill Fill False True False False True False 2 3 1 2 True Fill Fill False True False False True False 2 3 True Fill Fill False True False False True False 1 2 2 3 True Fill Fill False True False False True False 2 3 2 3 True Fill Fill False True False False True False Legend True label_item 3 False False 6 2 True 4 True False False 4 2 6 6 4 1 2 1 2 True Fill True True False False True False 3 4 1 2 True Fill True True False False True False 8 1 2 True Fill Fill False True False False True False True API Description True True True True group1 2 True Fill True True False False True False True Assembly True True True group1 2 3 2 True Fill True True False False True False CenterOnParent 2 False 2 12 4 In 0 0 12 ButtonPressMask <b>Reference:</b> True label_item 0 False 4 In 0 0 12 ButtonPressMask <b>Target:</b> True label_item 1 False 4 0 False 6 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 mono-tools-4.2/gui-compare/gtk-gui/MainWindow.cs0000664000175000017500000005146112413742070023700 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. public partial class MainWindow { private global::Gtk.UIManager UIManager; private global::Gtk.Action File; private global::Gtk.Action quit; private global::Gtk.Action Compare; private global::Gtk.Action Custom; private global::Gtk.Action a; private global::Gtk.Action b; private global::Gtk.Action View; private global::Gtk.ToggleAction ShowMissing; private global::Gtk.ToggleAction ShowExtra; private global::Gtk.ToggleAction ShowPresent; private global::Gtk.ToggleAction ShowErrors; private global::Gtk.Action Refresh; private global::Gtk.ToggleAction ShowTodo; private global::Gtk.Action RecentComparisonsAction; private global::Gtk.ToggleAction ShowNotImplemented; private global::Gtk.Action ToggleRowExpansionAction; private global::Gtk.VBox vbox1; private global::Gtk.MenuBar menubar1; private global::Gtk.Notebook notebook1; private global::Gtk.ScrolledWindow GtkScrolledWindow; private global::Gtk.TreeView tree; private global::Gtk.Label label1; private global::Gtk.Label label3; private global::Gtk.Label label2; private global::Gtk.ScrolledWindow AdditionalInfoWindow; private global::Gtk.TextView AdditionalInfoText; private global::Gtk.Expander expander1; private global::Gtk.Table table1; private global::Gtk.Label label4; private global::Gtk.Label label5; private global::Gtk.Label label6; private global::Gtk.Label label7; private global::Gtk.Label label8; private global::Gtk.Label label9; private global::Gtk.Image legendImageError; private global::Gtk.Image legendImageExtra; private global::Gtk.Image legendImageMissing; private global::Gtk.Image legendImageNIEX; private global::Gtk.Image legendImageOK; private global::Gtk.Image legendImageTODO; private global::Gtk.VSeparator vseparator1; private global::Gtk.VSeparator vseparator2; private global::Gtk.VSeparator vseparator3; private global::Gtk.Label GtkLabel4; private global::Gtk.Statusbar statusbar1; private global::Gtk.ProgressBar progressbar1; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget MainWindow this.UIManager = new global::Gtk.UIManager (); global::Gtk.ActionGroup w1 = new global::Gtk.ActionGroup ("Default"); this.File = new global::Gtk.Action ("File", global::Mono.Unix.Catalog.GetString ("_File"), null, null); this.File.ShortLabel = global::Mono.Unix.Catalog.GetString ("File"); w1.Add (this.File, null); this.quit = new global::Gtk.Action ("quit", global::Mono.Unix.Catalog.GetString ("_Quit"), null, "gtk-quit"); this.quit.ShortLabel = global::Mono.Unix.Catalog.GetString ("_Quit"); w1.Add (this.quit, null); this.Compare = new global::Gtk.Action ("Compare", global::Mono.Unix.Catalog.GetString ("_Compare"), null, null); this.Compare.ShortLabel = global::Mono.Unix.Catalog.GetString ("Compare"); w1.Add (this.Compare, null); this.Custom = new global::Gtk.Action ("Custom", global::Mono.Unix.Catalog.GetString ("Custom..."), null, null); this.Custom.ShortLabel = global::Mono.Unix.Catalog.GetString ("Custom..."); w1.Add (this.Custom, null); this.a = new global::Gtk.Action ("a", global::Mono.Unix.Catalog.GetString ("a"), null, null); this.a.ShortLabel = global::Mono.Unix.Catalog.GetString ("a"); w1.Add (this.a, null); this.b = new global::Gtk.Action ("b", global::Mono.Unix.Catalog.GetString ("b"), null, null); this.b.ShortLabel = global::Mono.Unix.Catalog.GetString ("b"); w1.Add (this.b, null); this.View = new global::Gtk.Action ("View", global::Mono.Unix.Catalog.GetString ("_View"), null, null); this.View.ShortLabel = global::Mono.Unix.Catalog.GetString ("View"); w1.Add (this.View, null); this.ShowMissing = new global::Gtk.ToggleAction ("ShowMissing", global::Mono.Unix.Catalog.GetString ("Show missing"), null, null); this.ShowMissing.Active = true; this.ShowMissing.ShortLabel = global::Mono.Unix.Catalog.GetString ("Show missing"); w1.Add (this.ShowMissing, null); this.ShowExtra = new global::Gtk.ToggleAction ("ShowExtra", global::Mono.Unix.Catalog.GetString ("Show extra"), null, null); this.ShowExtra.Active = true; this.ShowExtra.ShortLabel = global::Mono.Unix.Catalog.GetString ("Show extra"); w1.Add (this.ShowExtra, null); this.ShowPresent = new global::Gtk.ToggleAction ("ShowPresent", global::Mono.Unix.Catalog.GetString ("Show present"), null, null); this.ShowPresent.Active = true; this.ShowPresent.ShortLabel = global::Mono.Unix.Catalog.GetString ("Show present"); w1.Add (this.ShowPresent, null); this.ShowErrors = new global::Gtk.ToggleAction ("ShowErrors", global::Mono.Unix.Catalog.GetString ("Show errors"), null, null); this.ShowErrors.Active = true; this.ShowErrors.ShortLabel = global::Mono.Unix.Catalog.GetString ("Show errors"); w1.Add (this.ShowErrors, null); this.Refresh = new global::Gtk.Action ("Refresh", global::Mono.Unix.Catalog.GetString ("Refresh"), null, "gtk-refresh"); this.Refresh.ShortLabel = global::Mono.Unix.Catalog.GetString ("Refresh"); w1.Add (this.Refresh, "r"); this.ShowTodo = new global::Gtk.ToggleAction ("ShowTodo", global::Mono.Unix.Catalog.GetString ("Show Todo"), null, null); this.ShowTodo.Active = true; this.ShowTodo.ShortLabel = global::Mono.Unix.Catalog.GetString ("Show Todo"); w1.Add (this.ShowTodo, null); this.RecentComparisonsAction = new global::Gtk.Action ("RecentComparisonsAction", global::Mono.Unix.Catalog.GetString ("Recent Comparisons"), null, null); this.RecentComparisonsAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Recent Comparisons"); w1.Add (this.RecentComparisonsAction, null); this.ShowNotImplemented = new global::Gtk.ToggleAction ("ShowNotImplemented", global::Mono.Unix.Catalog.GetString ("Show NotImplemented"), null, null); this.ShowNotImplemented.Active = true; this.ShowNotImplemented.ShortLabel = global::Mono.Unix.Catalog.GetString ("Show NotImplemented"); w1.Add (this.ShowNotImplemented, null); this.ToggleRowExpansionAction = new global::Gtk.Action ("ToggleRowExpansionAction", global::Mono.Unix.Catalog.GetString ("Toggle Row Expansion"), null, null); this.ToggleRowExpansionAction.ShortLabel = global::Mono.Unix.Catalog.GetString ("Toggle Row Expansion"); w1.Add (this.ToggleRowExpansionAction, "space"); this.UIManager.InsertActionGroup (w1, 0); this.AddAccelGroup (this.UIManager.AccelGroup); this.Name = "MainWindow"; this.Title = global::Mono.Unix.Catalog.GetString ("GUI CorCompare"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Container child MainWindow.Gtk.Container+ContainerChild this.vbox1 = new global::Gtk.VBox (); this.vbox1.Name = "vbox1"; this.vbox1.Spacing = 6; // Container child vbox1.Gtk.Box+BoxChild this.UIManager.AddUiFromString (""); this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget ("/menubar1"))); this.menubar1.Name = "menubar1"; this.vbox1.Add (this.menubar1); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.menubar1])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox1.Gtk.Box+BoxChild this.notebook1 = new global::Gtk.Notebook (); this.notebook1.CanFocus = true; this.notebook1.Name = "notebook1"; this.notebook1.CurrentPage = 1; this.notebook1.ShowBorder = false; this.notebook1.ShowTabs = false; // Container child notebook1.Gtk.Notebook+NotebookChild this.GtkScrolledWindow = new global::Gtk.ScrolledWindow (); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this.tree = new global::Gtk.TreeView (); this.tree.CanFocus = true; this.tree.Name = "tree"; this.GtkScrolledWindow.Add (this.tree); this.notebook1.Add (this.GtkScrolledWindow); // Notebook tab this.label1 = new global::Gtk.Label (); this.label1.Name = "label1"; this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("page1"); this.notebook1.SetTabLabel (this.GtkScrolledWindow, this.label1); this.label1.ShowAll (); // Container child notebook1.Gtk.Notebook+NotebookChild this.label3 = new global::Gtk.Label (); this.label3.Name = "label3"; this.label3.Xpad = 20; this.label3.Ypad = 20; this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("This tool allows you to compare the API of assemblies.\n\nTo initiate a comparison, use the \"Compare\" menu and use one of the presets based on the assemblies you have installed on your system and some popular profiles, or use \"Custom\" to define your own comparison"); this.label3.Wrap = true; this.notebook1.Add (this.label3); global::Gtk.Notebook.NotebookChild w5 = ((global::Gtk.Notebook.NotebookChild)(this.notebook1 [this.label3])); w5.Position = 1; // Notebook tab this.label2 = new global::Gtk.Label (); this.label2.Name = "label2"; this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("page2"); this.notebook1.SetTabLabel (this.label3, this.label2); this.label2.ShowAll (); this.vbox1.Add (this.notebook1); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.notebook1])); w6.Position = 1; // Container child vbox1.Gtk.Box+BoxChild this.AdditionalInfoWindow = new global::Gtk.ScrolledWindow (); this.AdditionalInfoWindow.Name = "AdditionalInfoWindow"; this.AdditionalInfoWindow.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child AdditionalInfoWindow.Gtk.Container+ContainerChild this.AdditionalInfoText = new global::Gtk.TextView (); this.AdditionalInfoText.CanFocus = true; this.AdditionalInfoText.Name = "AdditionalInfoText"; this.AdditionalInfoText.Editable = false; this.AdditionalInfoWindow.Add (this.AdditionalInfoText); this.vbox1.Add (this.AdditionalInfoWindow); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.AdditionalInfoWindow])); w8.Position = 2; w8.Expand = false; // Container child vbox1.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.table1 = new global::Gtk.Table (((uint)(3)), ((uint)(5)), false); this.table1.Name = "table1"; this.table1.RowSpacing = ((uint)(6)); this.table1.ColumnSpacing = ((uint)(6)); // Container child table1.Gtk.Table+TableChild this.label4 = new global::Gtk.Label (); this.label4.Name = "label4"; this.label4.Xalign = 1F; this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("Missing"); this.table1.Add (this.label4); global::Gtk.Table.TableChild w9 = ((global::Gtk.Table.TableChild)(this.table1 [this.label4])); w9.TopAttach = ((uint)(1)); w9.BottomAttach = ((uint)(2)); w9.LeftAttach = ((uint)(3)); w9.RightAttach = ((uint)(4)); w9.XOptions = ((global::Gtk.AttachOptions)(4)); w9.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.label5 = new global::Gtk.Label (); this.label5.Name = "label5"; this.label5.Xalign = 1F; this.label5.LabelProp = global::Mono.Unix.Catalog.GetString ("TODO"); this.table1.Add (this.label5); global::Gtk.Table.TableChild w10 = ((global::Gtk.Table.TableChild)(this.table1 [this.label5])); w10.TopAttach = ((uint)(2)); w10.BottomAttach = ((uint)(3)); w10.XOptions = ((global::Gtk.AttachOptions)(4)); w10.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.label6 = new global::Gtk.Label (); this.label6.Name = "label6"; this.label6.Xalign = 1F; this.label6.LabelProp = global::Mono.Unix.Catalog.GetString ("Extra"); this.table1.Add (this.label6); global::Gtk.Table.TableChild w11 = ((global::Gtk.Table.TableChild)(this.table1 [this.label6])); w11.TopAttach = ((uint)(2)); w11.BottomAttach = ((uint)(3)); w11.LeftAttach = ((uint)(3)); w11.RightAttach = ((uint)(4)); w11.XOptions = ((global::Gtk.AttachOptions)(4)); w11.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.label7 = new global::Gtk.Label (); this.label7.Name = "label7"; this.label7.Xalign = 1F; this.label7.LabelProp = global::Mono.Unix.Catalog.GetString ("Not implemented"); this.table1.Add (this.label7); global::Gtk.Table.TableChild w12 = ((global::Gtk.Table.TableChild)(this.table1 [this.label7])); w12.TopAttach = ((uint)(1)); w12.BottomAttach = ((uint)(2)); w12.XOptions = ((global::Gtk.AttachOptions)(4)); w12.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.label8 = new global::Gtk.Label (); this.label8.Name = "label8"; this.label8.Xalign = 1F; this.label8.LabelProp = global::Mono.Unix.Catalog.GetString ("No errors"); this.label8.Justify = ((global::Gtk.Justification)(2)); this.table1.Add (this.label8); global::Gtk.Table.TableChild w13 = ((global::Gtk.Table.TableChild)(this.table1 [this.label8])); w13.XOptions = ((global::Gtk.AttachOptions)(4)); w13.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.label9 = new global::Gtk.Label (); this.label9.Name = "label9"; this.label9.Xalign = 1F; this.label9.LabelProp = global::Mono.Unix.Catalog.GetString ("Error"); this.table1.Add (this.label9); global::Gtk.Table.TableChild w14 = ((global::Gtk.Table.TableChild)(this.table1 [this.label9])); w14.LeftAttach = ((uint)(3)); w14.RightAttach = ((uint)(4)); w14.XOptions = ((global::Gtk.AttachOptions)(4)); w14.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.legendImageError = new global::Gtk.Image (); this.legendImageError.Name = "legendImageError"; this.table1.Add (this.legendImageError); global::Gtk.Table.TableChild w15 = ((global::Gtk.Table.TableChild)(this.table1 [this.legendImageError])); w15.LeftAttach = ((uint)(4)); w15.RightAttach = ((uint)(5)); w15.XOptions = ((global::Gtk.AttachOptions)(4)); w15.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.legendImageExtra = new global::Gtk.Image (); this.legendImageExtra.Name = "legendImageExtra"; this.table1.Add (this.legendImageExtra); global::Gtk.Table.TableChild w16 = ((global::Gtk.Table.TableChild)(this.table1 [this.legendImageExtra])); w16.TopAttach = ((uint)(2)); w16.BottomAttach = ((uint)(3)); w16.LeftAttach = ((uint)(4)); w16.RightAttach = ((uint)(5)); w16.XOptions = ((global::Gtk.AttachOptions)(4)); w16.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.legendImageMissing = new global::Gtk.Image (); this.legendImageMissing.Name = "legendImageMissing"; this.table1.Add (this.legendImageMissing); global::Gtk.Table.TableChild w17 = ((global::Gtk.Table.TableChild)(this.table1 [this.legendImageMissing])); w17.TopAttach = ((uint)(1)); w17.BottomAttach = ((uint)(2)); w17.LeftAttach = ((uint)(4)); w17.RightAttach = ((uint)(5)); w17.XOptions = ((global::Gtk.AttachOptions)(4)); w17.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.legendImageNIEX = new global::Gtk.Image (); this.legendImageNIEX.Name = "legendImageNIEX"; this.table1.Add (this.legendImageNIEX); global::Gtk.Table.TableChild w18 = ((global::Gtk.Table.TableChild)(this.table1 [this.legendImageNIEX])); w18.TopAttach = ((uint)(1)); w18.BottomAttach = ((uint)(2)); w18.LeftAttach = ((uint)(1)); w18.RightAttach = ((uint)(2)); w18.XOptions = ((global::Gtk.AttachOptions)(4)); w18.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.legendImageOK = new global::Gtk.Image (); this.legendImageOK.Name = "legendImageOK"; this.table1.Add (this.legendImageOK); global::Gtk.Table.TableChild w19 = ((global::Gtk.Table.TableChild)(this.table1 [this.legendImageOK])); w19.LeftAttach = ((uint)(1)); w19.RightAttach = ((uint)(2)); w19.XOptions = ((global::Gtk.AttachOptions)(4)); w19.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.legendImageTODO = new global::Gtk.Image (); this.legendImageTODO.Name = "legendImageTODO"; this.table1.Add (this.legendImageTODO); global::Gtk.Table.TableChild w20 = ((global::Gtk.Table.TableChild)(this.table1 [this.legendImageTODO])); w20.TopAttach = ((uint)(2)); w20.BottomAttach = ((uint)(3)); w20.LeftAttach = ((uint)(1)); w20.RightAttach = ((uint)(2)); w20.XOptions = ((global::Gtk.AttachOptions)(4)); w20.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.vseparator1 = new global::Gtk.VSeparator (); this.vseparator1.Name = "vseparator1"; this.table1.Add (this.vseparator1); global::Gtk.Table.TableChild w21 = ((global::Gtk.Table.TableChild)(this.table1 [this.vseparator1])); w21.LeftAttach = ((uint)(2)); w21.RightAttach = ((uint)(3)); w21.XOptions = ((global::Gtk.AttachOptions)(4)); w21.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.vseparator2 = new global::Gtk.VSeparator (); this.vseparator2.Name = "vseparator2"; this.table1.Add (this.vseparator2); global::Gtk.Table.TableChild w22 = ((global::Gtk.Table.TableChild)(this.table1 [this.vseparator2])); w22.TopAttach = ((uint)(1)); w22.BottomAttach = ((uint)(2)); w22.LeftAttach = ((uint)(2)); w22.RightAttach = ((uint)(3)); w22.XOptions = ((global::Gtk.AttachOptions)(4)); w22.YOptions = ((global::Gtk.AttachOptions)(4)); // Container child table1.Gtk.Table+TableChild this.vseparator3 = new global::Gtk.VSeparator (); this.vseparator3.Name = "vseparator3"; this.table1.Add (this.vseparator3); global::Gtk.Table.TableChild w23 = ((global::Gtk.Table.TableChild)(this.table1 [this.vseparator3])); w23.TopAttach = ((uint)(2)); w23.BottomAttach = ((uint)(3)); w23.LeftAttach = ((uint)(2)); w23.RightAttach = ((uint)(3)); w23.XOptions = ((global::Gtk.AttachOptions)(4)); w23.YOptions = ((global::Gtk.AttachOptions)(4)); this.expander1.Add (this.table1); this.GtkLabel4 = new global::Gtk.Label (); this.GtkLabel4.Name = "GtkLabel4"; this.GtkLabel4.LabelProp = global::Mono.Unix.Catalog.GetString ("Legend"); this.GtkLabel4.UseUnderline = true; this.expander1.LabelWidget = this.GtkLabel4; this.vbox1.Add (this.expander1); global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.expander1])); w25.Position = 3; w25.Expand = false; // Container child vbox1.Gtk.Box+BoxChild this.statusbar1 = new global::Gtk.Statusbar (); this.statusbar1.Name = "statusbar1"; this.statusbar1.Spacing = 6; // Container child statusbar1.Gtk.Box+BoxChild this.progressbar1 = new global::Gtk.ProgressBar (); this.progressbar1.Name = "progressbar1"; this.statusbar1.Add (this.progressbar1); global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.statusbar1 [this.progressbar1])); w26.Position = 2; this.vbox1.Add (this.statusbar1); global::Gtk.Box.BoxChild w27 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.statusbar1])); w27.Position = 4; w27.Expand = false; w27.Fill = false; this.Add (this.vbox1); if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 648; this.DefaultHeight = 759; this.AdditionalInfoWindow.Hide (); this.Show (); this.DeleteEvent += new global::Gtk.DeleteEventHandler (this.OnDeleteEvent); this.quit.Activated += new global::System.EventHandler (this.OnQuitActivated); this.Custom.Activated += new global::System.EventHandler (this.OnCustomActivated); this.ShowMissing.Toggled += new global::System.EventHandler (this.OnShowMissingToggled); this.ShowExtra.Toggled += new global::System.EventHandler (this.OnShowExtraToggled); this.ShowPresent.Toggled += new global::System.EventHandler (this.OnShowPresentToggled); this.ShowErrors.Toggled += new global::System.EventHandler (this.OnShowErrorsToggled); this.Refresh.Activated += new global::System.EventHandler (this.OnRefreshActivated); this.ShowTodo.Toggled += new global::System.EventHandler (this.OnShowTodoToggled); this.ShowNotImplemented.Toggled += new global::System.EventHandler (this.OnShowNotImplementedToggled); this.ToggleRowExpansionAction.Activated += new global::System.EventHandler (this.OnToggleRowExpansion); } } mono-tools-4.2/gui-compare/gui-compare.mds0000664000175000017500000000123012413742070022630 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/gui-compare/Makefile.am0000664000175000017500000000372312413742070021760 0ustar00directhexdirecthex00000000000000guicomparedir=$(prefix)/lib/gui-compare bin_SCRIPTS = gui-compare guicompare_DATA = gui-compare.exe gui-compare.exe.mdb CLEANFILES = gui-compare.exe gui-compare.exe.mdb gui-compare gui_compare_sources = \ $(srcdir)/gtk-gui/generated.cs \ $(srcdir)/MainWindow.cs \ $(srcdir)/gtk-gui/MainWindow.cs \ $(srcdir)/Main.cs \ $(srcdir)/AssemblyInfo.cs \ $(srcdir)/InfoManager.cs \ $(srcdir)/CompareContext.cs \ $(srcdir)/Comparison.cs \ $(srcdir)/Metadata.cs \ $(srcdir)/MasterMetadata.cs \ $(srcdir)/Masterinfo.cs \ $(srcdir)/CecilMetadata.cs \ $(srcdir)/ProviderSelector.cs \ $(srcdir)/gtk-gui/guicompare.ProviderSelector.cs\ $(srcdir)/Config.cs \ $(srcdir)/CustomCompare.cs \ $(srcdir)/gtk-gui/GuiCompare.CustomCompare.cs gui_compare_resources = \ $(srcdir)/gtk-gui/gui.stetic \ $(srcdir)/cm/c.gif \ $(srcdir)/cm/d.gif \ $(srcdir)/cm/e.gif \ $(srcdir)/cm/en.gif \ $(srcdir)/cm/f.gif \ $(srcdir)/cm/i.gif \ $(srcdir)/cm/m.gif \ $(srcdir)/cm/n.gif \ $(srcdir)/cm/p.gif \ $(srcdir)/cm/r.gif \ $(srcdir)/cm/s.gif \ $(srcdir)/cm/sc.gif \ $(srcdir)/cm/se.gif \ $(srcdir)/cm/sm.gif \ $(srcdir)/cm/st.gif \ $(srcdir)/cm/sx.gif \ $(srcdir)/cm/tb.gif \ $(srcdir)/cm/tm.gif \ $(srcdir)/cm/tp.gif \ $(srcdir)/cm/w.gif \ $(srcdir)/cm/y.gif \ $(srcdir)/gtk-gui/objects.xml \ $(srcdir)/cm/mn.png EXTRA_DIST = $(gui_compare_sources) $(gui_compare_resources) gui-compare.mds gui-compare.mdp gui-compare.in packages = -pkg:gtk-sharp-2.0 -pkg:glib-sharp-2.0 -pkg:glade-sharp-2.0 -r:$(CECIL_ASM) assemblies = -r:System -r:System.Core -r:Mono.Posix -r:System.Xml ress= $(foreach res,$(gui_compare_resources), $(addprefix -resource:,$(res)),$(notdir $(res))) gui-compare.exe: $(gui_compare_sources) $(gui_compare_resources) $(DMCS) -noconfig -codepage:utf8 -warn:4 -optimize+ -debug -define:DEBUG -target:exe -out:gui-compare.exe $(gui_compare_sources) $(ress) $(packages) $(assemblies) mono-tools-4.2/gui-compare/gui-compare.mdp0000664000175000017500000001330212413742070022630 0ustar00directhexdirecthex00000000000000 mono-tools-4.2/ilcontrast/0000775000175000017500000000000012642235741017677 5ustar00directhexdirecthex00000000000000mono-tools-4.2/ilcontrast/ChangeLog0000664000175000017500000000152512413742070021446 0ustar00directhexdirecthex000000000000002008-06-15 Alp Toker * Makefile.am: * Window.cs: Add WebKit support, enabled if webkit-sharp is around. 2008-01-16 Wade Berrier * ilconstrast.desktop.in: no extension on icon, remove 'Application' from Categories. (standards enforced by rpmlint) 2007-10-01 Raja R Harinath * Makefile.am (sources): Move Global.cs ... (build_source): ... here. 2007-07-06 Wade Berrier * ilcontrast.in: search gre.d to aid in finding libgtkembedmoz (Stolen from monodevelop wrapper) 2007-01-31 Mike Kestner * Window.cs: break a 2.6 dep by removing AboutDialog usage. 2007-01-31 Mike Kestner * Makefile.am: make conditional on ENABLE_GECKO. 2007-01-31 Mike Kestner * initial checkin. mono-tools-4.2/ilcontrast/ComparisonInfo.cs0000664000175000017500000000414012413742070023145 0ustar00directhexdirecthex00000000000000// ComparisonInfo.cs : ComparisonInfo class // // Author: Mike Kestner // // Copyright (c) 2007 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. namespace IlContrast { using System; using System.IO; public class ComparisonInfo { string result_path; string base_assembly_path; string target_assembly_path; public ComparisonInfo (string base_assembly_path, string target_assembly_path, string result_path) { this.base_assembly_path = base_assembly_path; this.target_assembly_path = target_assembly_path; this.result_path = result_path; } public ComparisonInfo (string base_path, string target_path) : this (base_path, target_path, Path.Combine (Application.DeployPath, "temp.html")) {} public string BaseAssemblyPath { get { return base_assembly_path; } set { base_assembly_path = value; } } public string TargetAssemblyPath { get { return target_assembly_path; } set { target_assembly_path = value; } } public string ResultPath { get { return result_path; } set { result_path = value; } } } } mono-tools-4.2/ilcontrast/Application.cs0000664000175000017500000000514612413742070022471 0ustar00directhexdirecthex00000000000000// Application.cs : Main application class // // Author: Mike Kestner // // Copyright (c) 2007 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. namespace IlContrast { using System; using System.IO; using Gtk; using ICSharpCode.SharpZipLib.Tar; public class Application { public static int Main (string[] args) { string base_path = null; string target_path = null; foreach (string arg in args) { if (arg.StartsWith ("--base=")) base_path = arg.Substring (7); else if (arg.StartsWith ("--target=")) target_path = arg.Substring (9); } ComparisonInfo info = null; if (args.Length > 0) { if (base_path == null || target_path == null) { Console.Error.WriteLine ("Usage: ilcontrast [--base= --target=]"); return 1; } info = new ComparisonInfo (base_path, target_path); } Gtk.Application.Init(); if (!Directory.Exists (DataPath)) { Directory.CreateDirectory (DataPath); TarArchive tar = TarArchive.CreateInputTarArchive (System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream ("deploy.tar")); tar.ExtractContents (DataPath); } IlContrast.Window win = new IlContrast.Window (info); win.Show (); Gtk.Application.Run (); return 0; } public static string DataPath { get { string data_path = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); return Path.Combine (data_path, "ilcontrast"); } } public static string DeployPath { get { return Path.Combine (DataPath, "deploy"); } } } } mono-tools-4.2/ilcontrast/ilcontrast.desktop.in0000664000175000017500000000043612413742070024056 0ustar00directhexdirecthex00000000000000[Desktop Entry] Version=1.0 Name=Mono IL Contrast GenericName=Assembly Comparison Tool Comment=Identify differences in the API exposed by mono library assemblies. Exec=@bindir@/ilcontrast Icon=monodoc StartupNotify=true Terminal=false Type=Application Categories=Development;Profiling; mono-tools-4.2/ilcontrast/Makefile.in0000664000175000017500000005015512642235732021752 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = ilcontrast ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = ilcontrast 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)$(assemblydir)" \ "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pixmapdir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 = $(assembly_DATA) $(desktop_DATA) $(pixmap_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ilcontrast.in \ ChangeLog DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ TARGET = ilcontrast.exe CLEANFILES = $(TARGET) $(TARGET).mdb DISTCLEANFILES = Global.cs ilcontrast ilcontrast.desktop EXTRA_DIST = $(sources) ilcontrast.png mono-api.xsl deploy.tar Global.cs.in ilcontrast.in ilcontrast.desktop.in assemblydir = $(libdir)/ilcontrast desktopdir = $(datadir)/applications pixmapdir = $(datadir)/pixmaps @ENABLE_GECKO_TRUE@@ENABLE_WEBKIT_FALSE@assembly_DATA = $(TARGET) @ENABLE_WEBKIT_TRUE@assembly_DATA = $(TARGET) @ENABLE_GECKO_TRUE@@ENABLE_WEBKIT_FALSE@bin_SCRIPTS = ilcontrast @ENABLE_WEBKIT_TRUE@bin_SCRIPTS = ilcontrast @ENABLE_GECKO_TRUE@@ENABLE_WEBKIT_FALSE@desktop_DATA = ilcontrast.desktop @ENABLE_WEBKIT_TRUE@desktop_DATA = ilcontrast.desktop @ENABLE_GECKO_TRUE@@ENABLE_WEBKIT_FALSE@pixmap_DATA = ilcontrast.png @ENABLE_WEBKIT_TRUE@pixmap_DATA = ilcontrast.png @ENABLE_WEBKIT_FALSE@references = $(GTK_SHARP_LIBS) $(GECKO_SHARP_LIBS) -d:USE_GECKO -r:ICSharpCode.SharpZipLib.dll @ENABLE_WEBKIT_TRUE@references = $(GTK_SHARP_LIBS) $(WEBKIT_SHARP_LIBS) -r:ICSharpCode.SharpZipLib.dll resources = \ /resource:$(srcdir)/ilcontrast.png,ilcontrast.png \ /resource:$(srcdir)/mono-api.xsl,mono-api.xsl \ /resource:$(srcdir)/deploy.tar,deploy.tar \ # sources = \ Application.cs \ ComparisonInfo.cs \ Window.cs \ mono-api-diff.cs \ mono-api-info.cs \ # build_sources = Global.cs $(addprefix $(srcdir)/, $(sources)) 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) --gnu ilcontrast/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu ilcontrast/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): ilcontrast: $(top_builddir)/config.status $(srcdir)/ilcontrast.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-assemblyDATA: $(assembly_DATA) @$(NORMAL_INSTALL) @list='$(assembly_DATA)'; test -n "$(assemblydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(assemblydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(assemblydir)" || 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)$(assemblydir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(assemblydir)" || exit $$?; \ done uninstall-assemblyDATA: @$(NORMAL_UNINSTALL) @list='$(assembly_DATA)'; test -n "$(assemblydir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(assemblydir)'; $(am__uninstall_files_from_dir) install-desktopDATA: $(desktop_DATA) @$(NORMAL_INSTALL) @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(desktopdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(desktopdir)" || 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)$(desktopdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \ done uninstall-desktopDATA: @$(NORMAL_UNINSTALL) @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(desktopdir)'; $(am__uninstall_files_from_dir) install-pixmapDATA: $(pixmap_DATA) @$(NORMAL_INSTALL) @list='$(pixmap_DATA)'; test -n "$(pixmapdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pixmapdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pixmapdir)" || 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)$(pixmapdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pixmapdir)" || exit $$?; \ done uninstall-pixmapDATA: @$(NORMAL_UNINSTALL) @list='$(pixmap_DATA)'; test -n "$(pixmapdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pixmapdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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)$(assemblydir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pixmapdir)"; 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: 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-assemblyDATA install-desktopDATA \ install-pixmapDATA 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-assemblyDATA uninstall-binSCRIPTS \ uninstall-desktopDATA uninstall-pixmapDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-assemblyDATA \ install-binSCRIPTS install-data install-data-am \ install-desktopDATA 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-pixmapDATA 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 tags-am uninstall uninstall-am \ uninstall-assemblyDATA uninstall-binSCRIPTS \ uninstall-desktopDATA uninstall-pixmapDATA .PRECIOUS: Makefile @ENABLE_GECKO_FALSE@@ENABLE_WEBKIT_FALSE@all: @ENABLE_GECKO_FALSE@@ENABLE_WEBKIT_FALSE@ echo "Install webkit-sharp or gecko-sharp to build ilContrast" ilcontrast.exe: $(build_sources) $(MCS) -out:ilcontrast.exe $(references) $(resources) $(build_sources) Global.cs: Global.cs.in sed -e "s|\@VERSION\@|$(VERSION)|" $< > $@ ilcontrast.desktop: ilcontrast.desktop.in sed -e "s|\@bindir\@|$(bindir)|" $< > $@ # 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-tools-4.2/ilcontrast/Global.cs.in0000664000175000017500000000255512413742070022034 0ustar00directhexdirecthex00000000000000// Global.cs : Global variables class // // Author: Mike Kestner // // Copyright (c) 2007 Mike Kestner // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without restriction, // including without limitation the rights to use, copy, modify, merge, // publish, distribute, sublicense, and/or sell copies of the Software, // and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS // BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // // Expanded from Global.cs.in by autoconf namespace IlContrast { using System; public class Global { public const string VersionNumber = "@VERSION@"; } } mono-tools-4.2/ilcontrast/mono-api.xsl0000664000175000017500000003636012413742070022150 0ustar00directhexdirecthex00000000000000
TODO Missing
Extra Errors
Completed

Target Reference: monodoc msdn msdn2

Legend :
Assembly Namespace Class Struct
Interface Delegate Enum Method
Field Property Event Attribute

y
n
c
s
i
i
w
d
en
m
p
e
x m
f
o m
r
_ cm/se.gif t cm/st.gif t No TODO description : % : : : : WARNING:
mono-tools-4.2/ilcontrast/mono-api-info.cs0000664000175000017500000006620012413742070022674 0ustar00directhexdirecthex00000000000000// // mono-api-info.cs - Dumps public assembly information to an xml file. // // Authors: // Gonzalo Paniagua Javier (gonzalo@ximian.com) // // Copyright (C) 2003-2005 Novell, Inc (http://www.novell.com) // using System; using System.Collections; using System.Globalization; using System.Reflection; using System.Runtime.InteropServices; using System.Security.Permissions; using System.Text; using System.Xml; namespace Mono.AssemblyInfo { class Driver { #if false static int Main (string [] args) { if (args.Length == 0) return 1; AssemblyCollection acoll = new AssemblyCollection (); foreach (string fullName in args) { acoll.Add (fullName); } XmlDocument doc = new XmlDocument (); acoll.Document = doc; acoll.DoOutput (); XmlTextWriter writer = new XmlTextWriter (Console.Out); writer.Formatting = Formatting.Indented; XmlNode decl = doc.CreateXmlDeclaration ("1.0", null, null); doc.InsertBefore (decl, doc.DocumentElement); doc.WriteTo (writer); return 0; } #endif } public class AssemblyCollection { XmlDocument document; ArrayList assemblies; public AssemblyCollection () { assemblies = new ArrayList (); } public bool Add (string name) { Assembly ass = LoadAssembly (name); if (ass == null) return false; assemblies.Add (ass); return true; } public void DoOutput () { if (document == null) throw new InvalidOperationException ("Document not set"); XmlNode nassemblies = document.CreateElement ("assemblies", null); document.AppendChild (nassemblies); foreach (Assembly a in assemblies) { AssemblyData data = new AssemblyData (document, nassemblies, a); data.DoOutput (); } } public XmlDocument Document { set { document = value; } } static Assembly LoadAssembly (string aname) { Assembly ass = null; try { string name = aname; if (!name.EndsWith (".dll")) name += ".dll"; ass = Assembly.LoadFrom (name); return ass; } catch { } try { ass = Assembly.LoadWithPartialName (aname); return ass; } catch { } return null; } } abstract class BaseData { protected XmlDocument document; protected XmlNode parent; protected BaseData (XmlDocument doc, XmlNode parent) { this.document = doc; this.parent = parent; } public abstract void DoOutput (); protected void AddAttribute (XmlNode node, string name, string value) { XmlAttribute attr = document.CreateAttribute (name); attr.Value = value; node.Attributes.Append (attr); } } class AssemblyData : BaseData { Assembly ass; public AssemblyData (XmlDocument document, XmlNode parent, Assembly ass) : base (document, parent) { this.ass = ass; } public override void DoOutput () { if (document == null) throw new InvalidOperationException ("Document not set"); XmlNode nassembly = document.CreateElement ("assembly", null); AssemblyName aname = ass.GetName (); AddAttribute (nassembly, "name", aname.Name); AddAttribute (nassembly, "version", aname.Version.ToString ()); parent.AppendChild (nassembly); AttributeData.OutputAttributes (document, nassembly, ass.GetCustomAttributes (false)); Type [] types = ass.GetExportedTypes (); if (types == null || types.Length == 0) return; Array.Sort (types, TypeComparer.Default); XmlNode nss = document.CreateElement ("namespaces", null); nassembly.AppendChild (nss); string currentNS = "$%&$&"; XmlNode ns = null; XmlNode classes = null; foreach (Type t in types) { if (t.Namespace == null || t.Namespace == "") continue; if (t.IsNotPublic) continue; if (t.IsNestedPublic || t.IsNestedAssembly || t.IsNestedFamANDAssem || t.IsNestedFamORAssem || t.IsNestedPrivate) continue; if (t.DeclaringType != null) continue; // enforce !nested if (t.Namespace != currentNS) { currentNS = t.Namespace; ns = document.CreateElement ("namespace", null); AddAttribute (ns, "name", currentNS); nss.AppendChild (ns); classes = document.CreateElement ("classes", null); ns.AppendChild (classes); } TypeData bd = new TypeData (document, classes, t); bd.DoOutput (); } } } abstract class MemberData : BaseData { MemberInfo [] members; public MemberData (XmlDocument document, XmlNode parent, MemberInfo [] members) : base (document, parent) { this.members = members; } public override void DoOutput () { XmlNode mclass = document.CreateElement (ParentTag, null); parent.AppendChild (mclass); foreach (MemberInfo member in members) { XmlNode mnode = document.CreateElement (Tag, null); mclass.AppendChild (mnode); AddAttribute (mnode, "name", GetName (member)); if (!NoMemberAttributes) AddAttribute (mnode, "attrib", GetMemberAttributes (member)); AttributeData.OutputAttributes (document, mnode, member.GetCustomAttributes (false)); AddExtraData (mnode, member); } } protected virtual void AddExtraData (XmlNode p, MemberInfo member) { } protected virtual string GetName (MemberInfo member) { return "NoNAME"; } protected virtual string GetMemberAttributes (MemberInfo member) { return null; } public virtual bool NoMemberAttributes { get { return false; } set {} } public virtual string ParentTag { get { return "NoPARENTTAG"; } } public virtual string Tag { get { return "NoTAG"; } } } class TypeData : MemberData { Type type; const BindingFlags flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.NonPublic; public TypeData (XmlDocument document, XmlNode parent, Type type) : base (document, parent, null) { this.type = type; } public override void DoOutput () { if (document == null) throw new InvalidOperationException ("Document not set"); XmlNode nclass = document.CreateElement ("class", null); AddAttribute (nclass, "name", type.Name); string classType = GetClassType (type); AddAttribute (nclass, "type", classType); if (type.BaseType != null) AddAttribute (nclass, "base", type.BaseType.ToString ()); if (type.IsSealed) AddAttribute (nclass, "sealed", "true"); if (type.IsAbstract) AddAttribute (nclass, "abstract", "true"); if (type.IsSerializable) AddAttribute (nclass, "serializable", "true"); string charSet = GetCharSet (type); AddAttribute (nclass, "charset", charSet); string layout = GetLayout (type); if (layout != null) AddAttribute (nclass, "layout", layout); parent.AppendChild (nclass); AttributeData.OutputAttributes (document, nclass, type.GetCustomAttributes (false)); Type [] interfaces = type.GetInterfaces (); if (interfaces != null && interfaces.Length > 0) { XmlNode ifaces = document.CreateElement ("interfaces", null); nclass.AppendChild (ifaces); foreach (Type t in interfaces) { if (!t.IsPublic) { // we're only interested in public interfaces continue; } XmlNode iface = document.CreateElement ("interface", null); AddAttribute (iface, "name", t.ToString ()); ifaces.AppendChild (iface); } } #if NET_2_0 // Generic constraints Type [] gargs = type.GetGenericArguments (); XmlElement ngeneric = (gargs.Length == 0) ? null : document.CreateElement ("generic-type-constraints"); foreach (Type garg in gargs) { Type [] csts = garg.GetGenericParameterConstraints (); if (csts.Length == 0 || csts [0] == typeof (object)) continue; XmlElement el = document.CreateElement ("generic-type-constraint"); el.SetAttribute ("name", garg.ToString ()); el.SetAttribute ("generic-attribute", garg.GenericParameterAttributes.ToString ()); ngeneric.AppendChild (el); foreach (Type ct in csts) { XmlElement cel = document.CreateElement ("type"); cel.AppendChild (document.CreateTextNode (ct.FullName)); el.AppendChild (cel); } } if (ngeneric != null && ngeneric.FirstChild != null) nclass.AppendChild (ngeneric); #endif ArrayList members = new ArrayList (); FieldInfo[] fields = GetFields (type); if (fields.Length > 0) { Array.Sort (fields, MemberInfoComparer.Default); FieldData fd = new FieldData (document, nclass, fields); // Special case for enum fields if (classType == "enum") { string etype = fields [0].GetType ().ToString (); AddAttribute (nclass, "enumtype", etype); } members.Add (fd); } ConstructorInfo [] ctors = GetConstructors (type); if (ctors.Length > 0) { Array.Sort (ctors, MemberInfoComparer.Default); members.Add (new ConstructorData (document, nclass, ctors)); } PropertyInfo[] properties = GetProperties (type); if (properties.Length > 0) { Array.Sort (properties, MemberInfoComparer.Default); members.Add (new PropertyData (document, nclass, properties)); } EventInfo [] events = GetEvents (type); if (events.Length > 0) { Array.Sort (events, MemberInfoComparer.Default); members.Add (new EventData (document, nclass, events)); } MethodInfo [] methods = GetMethods (type); if (methods.Length > 0) { Array.Sort (methods, MemberInfoComparer.Default); members.Add (new MethodData (document, nclass, methods)); } foreach (MemberData md in members) md.DoOutput (); Type [] nested = type.GetNestedTypes (); if (nested != null && nested.Length > 0) { XmlNode classes = document.CreateElement ("classes", null); nclass.AppendChild (classes); foreach (Type t in nested) { TypeData td = new TypeData (document, classes, t); td.DoOutput (); } } } protected override string GetMemberAttributes (MemberInfo member) { if (member != type) throw new InvalidOperationException ("odd"); return ((int) type.Attributes).ToString (CultureInfo.InvariantCulture); } public static bool MustDocumentMethod(MethodBase method) { // All other methods return (method.IsPublic || method.IsFamily || method.IsFamilyOrAssembly); } static string GetClassType (Type t) { if (t.IsEnum) return "enum"; if (t.IsValueType) return "struct"; if (t.IsInterface) return "interface"; if (typeof (Delegate).IsAssignableFrom (t)) return "delegate"; return "class"; } private static string GetCharSet (Type type) { if (type.IsAnsiClass) return CharSet.Ansi.ToString (CultureInfo.InvariantCulture); if (type.IsAutoClass) return CharSet.Auto.ToString (CultureInfo.InvariantCulture); if (type.IsUnicodeClass) return CharSet.Unicode.ToString (CultureInfo.InvariantCulture); return CharSet.None.ToString (CultureInfo.InvariantCulture); } private static string GetLayout (Type type) { if (type.IsAutoLayout) return LayoutKind.Auto.ToString (CultureInfo.InvariantCulture); if (type.IsExplicitLayout) return LayoutKind.Explicit.ToString (CultureInfo.InvariantCulture); if (type.IsLayoutSequential) return LayoutKind.Sequential.ToString (CultureInfo.InvariantCulture); return null; } private FieldInfo[] GetFields (Type type) { ArrayList list = new ArrayList (); FieldInfo[] fields = type.GetFields (flags); foreach (FieldInfo field in fields) { if (field.IsSpecialName) continue; // we're only interested in public or protected members if (!field.IsPublic && !field.IsFamily && !field.IsFamilyOrAssembly) continue; list.Add (field); } return (FieldInfo[]) list.ToArray (typeof (FieldInfo)); } internal static PropertyInfo[] GetProperties (Type type) { ArrayList list = new ArrayList (); PropertyInfo[] properties = type.GetProperties (flags); foreach (PropertyInfo property in properties) { MethodInfo getMethod = null; MethodInfo setMethod = null; if (property.CanRead) { try { getMethod = property.GetGetMethod (true); } catch (System.Security.SecurityException) { } } if (property.CanWrite) { try { setMethod = property.GetSetMethod (true); } catch (System.Security.SecurityException) { } } bool hasGetter = (getMethod != null) && MustDocumentMethod (getMethod); bool hasSetter = (setMethod != null) && MustDocumentMethod (setMethod); // if neither the getter or setter should be documented, then // skip the property if (!hasGetter && !hasSetter) { continue; } list.Add (property); } return (PropertyInfo[]) list.ToArray (typeof (PropertyInfo)); } private MethodInfo[] GetMethods (Type type) { ArrayList list = new ArrayList (); MethodInfo[] methods = type.GetMethods (flags); foreach (MethodInfo method in methods) { if (method.IsSpecialName) continue; // we're only interested in public or protected members if (!MustDocumentMethod(method)) continue; list.Add (method); } return (MethodInfo[]) list.ToArray (typeof (MethodInfo)); } private ConstructorInfo[] GetConstructors (Type type) { ArrayList list = new ArrayList (); ConstructorInfo[] ctors = type.GetConstructors (flags); foreach (ConstructorInfo constructor in ctors) { // we're only interested in public or protected members if (!constructor.IsPublic && !constructor.IsFamily && !constructor.IsFamilyOrAssembly) continue; list.Add (constructor); } return (ConstructorInfo[]) list.ToArray (typeof (ConstructorInfo)); } private EventInfo[] GetEvents (Type type) { ArrayList list = new ArrayList (); EventInfo[] events = type.GetEvents (flags); foreach (EventInfo eventInfo in events) { MethodInfo addMethod = eventInfo.GetAddMethod (true); if (addMethod == null || !MustDocumentMethod (addMethod)) continue; list.Add (eventInfo); } return (EventInfo[]) list.ToArray (typeof (EventInfo)); } } class FieldData : MemberData { public FieldData (XmlDocument document, XmlNode parent, FieldInfo [] members) : base (document, parent, members) { } protected override string GetName (MemberInfo member) { FieldInfo field = (FieldInfo) member; return field.Name; } protected override string GetMemberAttributes (MemberInfo member) { FieldInfo field = (FieldInfo) member; return ((int) field.Attributes).ToString (CultureInfo.InvariantCulture); } protected override void AddExtraData (XmlNode p, MemberInfo member) { base.AddExtraData (p, member); FieldInfo field = (FieldInfo) member; AddAttribute (p, "fieldtype", field.FieldType.ToString ()); if (field.IsLiteral) { object value = field.GetValue (null); string stringValue = null; if (value is Enum) { // FIXME: when Mono bug #60090 has been // fixed, we should just be able to use // Convert.ToString stringValue = ((Enum) value).ToString ("D", CultureInfo.InvariantCulture); } else { stringValue = Convert.ToString (value, CultureInfo.InvariantCulture); } if (stringValue != null) AddAttribute (p, "value", stringValue); } } public override string ParentTag { get { return "fields"; } } public override string Tag { get { return "field"; } } } class PropertyData : MemberData { public PropertyData (XmlDocument document, XmlNode parent, PropertyInfo [] members) : base (document, parent, members) { } protected override string GetName (MemberInfo member) { PropertyInfo prop = (PropertyInfo) member; return prop.Name; } protected override void AddExtraData (XmlNode p, MemberInfo member) { base.AddExtraData (p, member); PropertyInfo prop = (PropertyInfo) member; Type t = prop.PropertyType; AddAttribute (p, "ptype", prop.PropertyType.ToString ()); MethodInfo _get = prop.GetGetMethod (true); MethodInfo _set = prop.GetSetMethod (true); bool haveGet = (_get != null && TypeData.MustDocumentMethod(_get)); bool haveSet = (_set != null && TypeData.MustDocumentMethod(_set)); MethodInfo [] methods; if (haveGet && haveSet) { methods = new MethodInfo [] {_get, _set}; } else if (haveGet) { methods = new MethodInfo [] {_get}; } else if (haveSet) { methods = new MethodInfo [] {_set}; } else { //odd return; } string parms = Parameters.GetSignature (methods [0].GetParameters ()); AddAttribute (p, "params", parms); MethodData data = new MethodData (document, p, methods); //data.NoMemberAttributes = true; data.DoOutput (); } protected override string GetMemberAttributes (MemberInfo member) { PropertyInfo prop = (PropertyInfo) member; return ((int) prop.Attributes & (0xFFFFFFFF ^ (int) PropertyAttributes.ReservedMask)).ToString (CultureInfo.InvariantCulture); } public override string ParentTag { get { return "properties"; } } public override string Tag { get { return "property"; } } } class EventData : MemberData { public EventData (XmlDocument document, XmlNode parent, EventInfo [] members) : base (document, parent, members) { } protected override string GetName (MemberInfo member) { EventInfo evt = (EventInfo) member; return evt.Name; } protected override string GetMemberAttributes (MemberInfo member) { EventInfo evt = (EventInfo) member; return ((int) evt.Attributes).ToString (CultureInfo.InvariantCulture); } protected override void AddExtraData (XmlNode p, MemberInfo member) { base.AddExtraData (p, member); EventInfo evt = (EventInfo) member; AddAttribute (p, "eventtype", evt.EventHandlerType.ToString ()); } public override string ParentTag { get { return "events"; } } public override string Tag { get { return "event"; } } } class MethodData : MemberData { bool noAtts; public MethodData (XmlDocument document, XmlNode parent, MethodBase [] members) : base (document, parent, members) { } protected override string GetName (MemberInfo member) { MethodBase method = (MethodBase) member; string name = method.Name; string parms = Parameters.GetSignature (method.GetParameters ()); #if NET_2_0 MethodInfo mi = method as MethodInfo; Type [] genArgs = mi == null ? Type.EmptyTypes : mi.GetGenericArguments (); if (genArgs.Length > 0) { string [] genArgNames = new string [genArgs.Length]; for (int i = 0; i < genArgs.Length; i++) { genArgNames [i] = genArgs [i].Name; string genArgCsts = String.Empty; Type [] gcs = genArgs [i].GetGenericParameterConstraints (); if (gcs.Length > 0) { string [] gcNames = new string [gcs.Length]; for (int g = 0; g < gcs.Length; g++) gcNames [g] = gcs [g].FullName; genArgCsts = String.Concat ( "(", string.Join (", ", gcNames), ") ", genArgNames [i]); } else genArgCsts = genArgNames [i]; if ((genArgs [i].GenericParameterAttributes & GenericParameterAttributes.ReferenceTypeConstraint) != 0) genArgCsts = "class " + genArgCsts; else if ((genArgs [i].GenericParameterAttributes & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0) genArgCsts = "struct " + genArgCsts; genArgNames [i] = genArgCsts; } return String.Format ("{0}<{2}>({1})", name, parms, string.Join (",", genArgNames)); } #endif return String.Format ("{0}({1})", name, parms); } protected override string GetMemberAttributes (MemberInfo member) { MethodBase method = (MethodBase) member; return ((int)( method.Attributes & ~MethodAttributes.ReservedMask)).ToString (CultureInfo.InvariantCulture); } protected override void AddExtraData (XmlNode p, MemberInfo member) { base.AddExtraData (p, member); ParameterData parms = new ParameterData (document, p, ((MethodBase) member).GetParameters ()); parms.DoOutput (); if (!(member is MethodBase)) return; MethodBase mbase = (MethodBase) member; if (mbase.IsAbstract) AddAttribute (p, "abstract", "true"); if (mbase.IsVirtual) AddAttribute (p, "virtual", "true"); if (mbase.IsStatic) AddAttribute (p, "static", "true"); if (!(member is MethodInfo)) return; MethodInfo method = (MethodInfo) member; AddAttribute (p, "returntype", method.ReturnType.ToString ()); AttributeData.OutputAttributes (document, p, method.ReturnTypeCustomAttributes.GetCustomAttributes (false)); #if NET_2_0 // Generic constraints Type [] gargs = method.GetGenericArguments (); XmlElement ngeneric = (gargs.Length == 0) ? null : document.CreateElement ("generic-method-constraints"); foreach (Type garg in gargs) { Type [] csts = garg.GetGenericParameterConstraints (); if (csts.Length == 0 || csts [0] == typeof (object)) continue; XmlElement el = document.CreateElement ("generic-method-constraint"); el.SetAttribute ("name", garg.ToString ()); el.SetAttribute ("generic-attribute", garg.GenericParameterAttributes.ToString ()); ngeneric.AppendChild (el); foreach (Type ct in csts) { XmlElement cel = document.CreateElement ("type"); cel.AppendChild (document.CreateTextNode (ct.FullName)); el.AppendChild (cel); } } if (ngeneric != null && ngeneric.FirstChild != null) p.AppendChild (ngeneric); #endif } public override bool NoMemberAttributes { get { return noAtts; } set { noAtts = value; } } public override string ParentTag { get { return "methods"; } } public override string Tag { get { return "method"; } } } class ConstructorData : MethodData { public ConstructorData (XmlDocument document, XmlNode parent, ConstructorInfo [] members) : base (document, parent, members) { } public override string ParentTag { get { return "constructors"; } } public override string Tag { get { return "constructor"; } } } class ParameterData : BaseData { private ParameterInfo[] parameters; public ParameterData (XmlDocument document, XmlNode parent, ParameterInfo[] parameters) : base (document, parent) { this.parameters = parameters; } public override void DoOutput () { XmlNode parametersNode = document.CreateElement ("parameters", null); parent.AppendChild (parametersNode); foreach (ParameterInfo parameter in parameters) { XmlNode paramNode = document.CreateElement ("parameter", null); parametersNode.AppendChild (paramNode); AddAttribute (paramNode, "name", parameter.Name); AddAttribute (paramNode, "position", parameter.Position.ToString(CultureInfo.InvariantCulture)); AddAttribute (paramNode, "attrib", ((int) parameter.Attributes).ToString()); string direction = "in"; if (parameter.ParameterType.IsByRef) { direction = parameter.IsOut ? "out" : "ref"; } Type t = parameter.ParameterType; AddAttribute (paramNode, "type", t.ToString ()); if (parameter.IsOptional) { AddAttribute (paramNode, "optional", "true"); if (parameter.DefaultValue != System.DBNull.Value) AddAttribute (paramNode, "defaultValue", (parameter.DefaultValue == null) ? "NULL" : parameter.DefaultValue.ToString ()); } if (direction != "in") AddAttribute (paramNode, "direction", direction); AttributeData.OutputAttributes (document, paramNode, parameter.GetCustomAttributes (false)); } } } class AttributeData : BaseData { object [] atts; AttributeData (XmlDocument doc, XmlNode parent, object[] attributes) : base (doc, parent) { atts = attributes; } public override void DoOutput () { if (document == null) throw new InvalidOperationException ("Document not set"); if (atts == null || atts.Length == 0) return; XmlNode natts = parent.SelectSingleNode("attributes"); if (natts == null) { natts = document.CreateElement ("attributes", null); parent.AppendChild (natts); } for (int i = 0; i < atts.Length; ++i) { Type t = atts [i].GetType (); if (!t.IsPublic && !t.Name.EndsWith ("TODOAttribute")) continue; // we ignore attributes that inherit from SecurityAttribute on purpose as they: // * aren't part of GetCustomAttributes in Fx 1.0/1.1; // * are encoded differently and in a different metadata table; and // * won't ever exactly match MS implementation (from a syntax pov) if (t.IsSubclassOf (typeof (SecurityAttribute))) continue; XmlNode node = document.CreateElement ("attribute"); AddAttribute (node, "name", t.ToString ()); XmlNode properties = null; foreach (PropertyInfo pi in TypeData.GetProperties (t)) { if (pi.Name == "TypeId") continue; if (properties == null) { properties = node.AppendChild (document.CreateElement ("properties")); } try { object o = pi.GetValue (atts [i], null); XmlNode n = properties.AppendChild (document.CreateElement ("property")); AddAttribute (n, "name", pi.Name); if (o == null) { AddAttribute (n, "null", "true"); continue; } string value = o.ToString (); if (t == typeof (GuidAttribute)) value = value.ToUpper (); AddAttribute (n, "value", value); } catch (TargetInvocationException) { continue; } } natts.AppendChild (node); } } public static void OutputAttributes (XmlDocument doc, XmlNode parent, object[] attributes) { AttributeData ad = new AttributeData (doc, parent, attributes); ad.DoOutput (); } private static bool MustDocumentAttribute (Type attributeType) { // only document MonoTODOAttribute and public attributes return attributeType.Name.EndsWith ("TODOAttribute") || attributeType.IsPublic; } } class Parameters { private Parameters () {} public static string GetSignature (ParameterInfo [] infos) { if (infos == null || infos.Length == 0) return ""; StringBuilder sb = new StringBuilder (); foreach (ParameterInfo info in infos) { string modifier; if (info.IsIn) modifier = "in "; else if (info.IsRetval) modifier = "ref "; else if (info.IsOut) modifier = "out "; else modifier = ""; string type_name = info.ParameterType.ToString ().Replace ('<', '[').Replace ('>', ']'); sb.AppendFormat ("{0}{1}, ", modifier, type_name); } sb.Length -= 2; // remove ", " return sb.ToString (); } } class TypeComparer : IComparer { public static TypeComparer Default = new TypeComparer (); public int Compare (object a, object b) { Type ta = (Type) a; Type tb = (Type) b; int result = String.Compare (ta.Namespace, tb.Namespace); if (result != 0) return result; return String.Compare (ta.Name, tb.Name); } } class MemberInfoComparer : IComparer { public static MemberInfoComparer Default = new MemberInfoComparer (); public int Compare (object a, object b) { MemberInfo ma = (MemberInfo) a; MemberInfo mb = (MemberInfo) b; return String.Compare (ma.Name, mb.Name); } } class MethodBaseComparer : IComparer { public static MethodBaseComparer Default = new MethodBaseComparer (); public int Compare (object a, object b) { MethodBase ma = (MethodBase) a; MethodBase mb = (MethodBase) b; int res = String.Compare (ma.Name, mb.Name); if (res != 0) return res; ParameterInfo [] pia = ma.GetParameters (); ParameterInfo [] pib = mb.GetParameters (); if (pia.Length != pib.Length) return pia.Length - pib.Length; string siga = Parameters.GetSignature (pia); string sigb = Parameters.GetSignature (pib); return String.Compare (siga, sigb); } } } mono-tools-4.2/ilcontrast/deploy.tar0000664000175000017500000021400012413742070021672 0ustar00directhexdirecthex00000000000000deploy/0000755000175000001440000000000010557271675012140 5ustar mkestnerusersdeploy/cm/0000755000175000001440000000000010557271727012535 5ustar mkestnerusersdeploy/cm/c.gif0000644000175000001440000000022610557271603013437 0ustar mkestnerusersGIF89a!,CIt򘊯6[7} pcGpy 4}@: E2)ڡ0Mb٦R;deploy/cm/d.gif0000644000175000001440000000021110557271603013432 0ustar mkestnerusersGIF89a!,NXԾPA++Dqqdi&k[\kl%O$Vg^b ( q6@R٧4Dj{9g;deploy/cm/e.gif0000644000175000001440000000153510557271603013445 0ustar mkestnerusersGIF89a3f3333f333ff3fffff3f3f̙3f3333f3333333333f3333333f3f33ff3f3f3f3333f3333333f3̙333333f333ff3ffffff3f33f3ff3f3f3ffff3fffffffffff3fffffff3fff̙ffff3fffff3f̙3333f33̙3ff3ffff̙f3f̙3f̙̙3f̙3f3333f333ff3fffff̙̙3̙f̙̙̙3f̙3f3f3333f333ff3fffff3f3f̙3f!,: HX0@"pQ'RaBB -nx1E$K,˗0;deploy/cm/f.gif0000644000175000001440000000013210557271603013436 0ustar mkestnerusersGIF89a!,+oS0" nrqǷ^z^HQ;deploy/cm/i.gif0000644000175000001440000000013210557271603013441 0ustar mkestnerusersGIF89a!,+Qo$ yuBrRN c5D;deploy/cm/m.gif0000644000175000001440000000014510557271603013451 0ustar mkestnerusersGIF89a,2X0E&u!]AA*yϦ %!bB֊B̤RFtr;deploy/cm/n.gif0000644000175000001440000000010110557271603013442 0ustar mkestnerusersGIF89a, ˽dtMvi^ {;deploy/cm/p.gif0000644000175000001440000000015710557271603013457 0ustar mkestnerusersGIF89a!,4H9Iou 5 X*i!FW,*KӍ-Hcdl>;deploy/cm/r.gif0000644000175000001440000000011110557271603013447 0ustar mkestnerusersGIF89a,"˝ʼnum}d*Mh*%}CF;deploy/cm/s.gif0000644000175000001440000000017710557271603013464 0ustar mkestnerusersGIF89a!,Dxgc9.Wx^ciZj nw/0q$t,Nan;deploy/cm/w.gif0000644000175000001440000000036010557271603013462 0ustar mkestnerusersPNG  IHDRasRGBgAMA a cHRMz&u0`:pQ<tEXtSoftwarePaint.NET v2.1 KIDAT8O͐ 0\iҦ"(33*Q9>- D @D@҂ 7XRIIENDB`deploy/cm/y.gif0000644000175000001440000000013410557271603013463 0ustar mkestnerusersGIF89a!,-폀SDa & A(Wے} ;deploy/cm/en.gif0000644000175000001440000000015710557271603013622 0ustar mkestnerusersGIF89a!,4HI"=CuYQt)Jn䡁 ddl:;deploy/cm/sc.gif0000644000175000001440000000010610557271603013617 0ustar mkestnerusersGIF89a !, &`jdۓIy;deploy/cm/se.gif0000644000175000001440000000011110557271603013615 0ustar mkestnerusersGIF89a !,  ܋-<"a Q;deploy/cm/sm.gif0000644000175000001440000000011410557271603013630 0ustar mkestnerusersGIF89a !, "=C1FeY[]GAÈt;deploy/cm/tb.gif0000644000175000001440000000006110557271603013617 0ustar mkestnerusersGIF89a !, O;deploy/cm/st.gif0000644000175000001440000000014510557271603013643 0ustar mkestnerusersGIF89a !, *h&BPb\\@AES]i  ,+}^ !;deploy/cm/tm.gif0000644000175000001440000000010010557271603013624 0ustar mkestnerusersGIF89a Xx!, +^ X;e;deploy/cm/sx.gif0000644000175000001440000000011110557271603013640 0ustar mkestnerusersGIF89a !, +lR{ }V _;deploy/cm/tp.gif0000644000175000001440000000010310557271603013632 0ustar mkestnerusersGIF89a Xx!, +ʁ{[xqtR;deploy/cm/cormissing.css0000644000175000001440000000322010557271603015412 0ustar mkestnerusers.y IMG { border: 0px; padding: 0px; margin: 0px; margin-right: 4px; vertical-align: middle; } .y, .y_, .n, .n_, .c, .c_, .c, .c_, .d, .d_, .en, .en_, .i, .i_, .s, .s_, .e, .e_, .f, .f_, .m, .m_, .o, .o_, .p, .p_, .r, .r_, .x, .x_, .w, .w_ { FONT: 10px 'Verdana'; margin-left: 20px; } .y_ .n, .y_ .n_, .n_ .c, .n_ .c_, .n_ .s, .n_ .s_, .n_ .d, .n_ .d_, .n_ .en, .n_ .en_, .n_ .i, .n_ .i_, .c_ .c, .c_ .c_, .c_ .e, .c_ .e_, .c_ .f, .c_ .f_, .c_ .m, .c_ .m_, .c_ .o, .c_ .o_, .c_ .p, .c_ .p_, .c_ .r, .c_ .r_, .c_ .x, .c_ .x_, .c_ .i, .c_ .i_, .c_ .w, .c_ .w_, .d_ .c, .d_ .c_, .d_ .e, .d_ .e_, .d_ .f, .d_ .f_, .d_ .m, .d_ .m_, .d_ .o, .d_ .o_, .d_ .p, .d_ .p_, .d_ .r, .d_ .r_, .d_ .x, .d_ .x_, .d_ .w, .d_ .w_, .en_ .c, .en_ .c_, .en_ .e, .en_ .e_, .en_ .f, .en_ .f_, .en_ .m, .en_ .m_, .en_ .o, .en_ .o_, .en_ .p, .en_ .p_, .en_ .r, .en_ .r_, .en_ .x, .en_ .x_, .en_ .w, .en_ .w_, .i_ .c, .i_ .c_, .i_ .e, .i_ .e_, .i_ .f, .i_ .f_, .i_ .m, .i_ .m_, .i_ .o, .i_ .o_, .i_ .p, .i_ .p_, .i_ .r, .i_ .r_, .i_ .x, .i_ .x_, .i_ .w, .i_ .w_, .i_ .i, .i_ .i_, .s_ .c, .s_ .c_, .s_ .e, .s_ .e_, .s_ .f, .s_ .f_, .s_ .m, .s_ .m_, .s_ .o, .s_ .o_, .s_ .p, .s_ .p_, .s_ .r, .s_ .r_, .s_ .x, .s_ .x_, .s_ .i, .s_ .i_, .s_ .w, .s_ .w_, .e_ .r, .e_ .r_, .e_ .o, .e_ .o_, .f_ .r, .f_ .r_, .f_ .o, .f_ .o_, .m_ .r, .m_ .r_, .m_ .o, .m_ .o_, .o_ .r, .o_ .r_, .o_ .o, .o_ .o_, .p_ .r, .p_ .r_, .p_ .o, .p_ .o_, .r_ .r, .r_ .r_, .r_ .o, .r_ .o_, .x_ .r, .x_ .r_, .x_ .o, .x_ .o_ .w_ .r, .w_ .r_, .w_ .o, .w_ .o_ { display: none; } .t { cursor: pointer; margin-right: 8px; } .filter { cursor: pointer; vertical-align: middle; } .st { margin-left: 20px; } .l { cursor: pointer; } deploy/cm/cormissing.js0000644000175000001440000003322310557271603015244 0ustar mkestnerusers// FIXME: // It still does not update icons previous to a type/member name when // certain icon kinds are unchecked (when an item has "todo" and "missing", // the default display is "missing" and when "missing" is unchecked it // should turn into "todo"). function toggle (elt) { if (elt == null) return; var eltLink = firstElement (elt); if (eltLink != null && eltLink.className == 't') // toggle { var ich = elt.className.indexOf ('_'); if (ich < 0) { eltLink.src = 'cm/tp.gif'; elt.className += '_'; } else { eltLink.src = 'cm/tm.gif'; elt.className = elt.className.slice (0, ich); } } } function setView (elt, fView) { var eltLink = firstElement (elt); if (eltLink != null && eltLink.className == 't') // toggle { var ich = elt.className.indexOf ('_'); if (ich < 0 && !fView) { eltLink.src = 'cm/tp.gif'; elt.className += '_'; } else if (ich >= 0 && fView) { eltLink.src = 'cm/tm.gif'; elt.className = elt.className.slice (0, ich); } } } function firstElement (elt) { var c = elt.firstChild; while (c != null) { if (c.nodeType == 1) // Node.ELEMENT_NODE (IE6 does not recognize it) return c; c = c.nextSibling; } return null; } function trimSrc (strSrc) { return strSrc.slice (strSrc.lastIndexOf ('/') + 1, strSrc.lastIndexOf ('.')); } function getChildrenByTagName (elt, strTag) { strTag = strTag.toLowerCase (); var rgChildren = new Array (); var eltChild = firstElement (elt); while (eltChild) { if (eltChild.tagName && eltChild.tagName.toLowerCase () == strTag) rgChildren.push (eltChild); eltChild = eltChild.nextSibling; } return rgChildren; } function viewAll (elt, dictTypes, attrFilters) { var fView = isShown (elt, dictTypes, attrFilters); var aCounts = new Array (4); for (i = 0; i < 4; i++) aCounts [i] = 0; var rgElts = getChildrenByTagName (elt, 'DIV'); for (iElt in rgElts) { var aChildRet = viewAll (rgElts [iElt], dictTypes, attrFilters); if (aChildRet != null) { fView = true; for (i = 0; i < 4; i++) aCounts [i] += aChildRet [i]; } } elt.style.display = fView ? '' : 'none'; if (!fView) return null; rgShownDivs = getChildrenByTagName (elt, 'DIV'); for (i = 0; i < rgShownDivs.length; i++) { var cDiv = rgShownDivs [i]; if (cDiv.style.display == 'none') continue; incrementCount (cDiv, aCounts, dictTypes); } // update the numbers rgSpans = getChildrenByTagName (elt, 'SPAN'); for (iSpan in rgSpans) { var cSpan = rgSpans [iSpan]; var cImage = firstElement (cSpan); if (cImage == null) continue; switch (trimSrc (cImage.src)) { case 'st': cSpan.lastChild.nodeValue = ": " + aCounts [0]; break; case 'sm': cSpan.lastChild.nodeValue = ": " + aCounts [1]; break; case 'sx': cSpan.lastChild.nodeValue = ": " + aCounts [2]; break; case 'se': cSpan.lastChild.nodeValue = ": " + aCounts [3]; break; } } return aCounts; } function isShown (elt, dictTypes, attrFilters) { if (!isShownMarkType (elt, dictTypes)) return false; // Check attributes that are being filtered out. var rgSpans = getChildrenByTagName (elt, 'SPAN'); var cSpans = rgSpans.length; for (var iSpan = 0; iSpan < cSpans; iSpan++) { var strSpan = rgSpans [iSpan].firstChild.nodeValue; for (strzzz in attrFilters) if (strSpan == strzzz) return false; } return true; } function isShownMarkType (elt, dictTypes) { var rgImages = getChildrenByTagName (elt, 'IMG'); var cImages = rgImages.length; for (var iImage = 0; iImage < cImages; iImage++) { var strImage = trimSrc (rgImages [iImage].src); if (dictTypes [strImage]) return true; } return false; } function incrementCount (cDiv, aCounts, dictTypes) { switch (cDiv.className) { case 'y': case 'y_': // assembly case 'n': case 'n_': // namespace // types case 'c': case 'c_': case 'i': case 'i_': case 'en': case 'en_': case 'd': case 'd_': // members case 'r': case 'r_': case 'x': case 'x_': case 'm': case 'm_': case 'f': case 'f_': case 'e': case 'e_': case 'p': case 'p_': case 'o': case 'o_': var rgImgs = getChildrenByTagName (cDiv, 'IMG'); for (iImg = 0; iImg < rgImgs.length; iImg++) { var cImg = rgImgs [iImg]; if (cImg.className != 't') continue; var stype = trimSrc (cImg.src); if (!dictTypes [stype]) continue; switch (stype) { case "st": aCounts [0]++; break; case "sm": aCounts [1]++; break; case "sx": aCounts [2]++; break; case "se": aCounts [3]++; break; default: continue; } break; } break; } } /* just for debugging use now. function firstInnerText (elt) { var s = elt.innerText; if (s != null) return s; var n = elt.firstChild; while (n != null) { s = n.nodeValue; if (s != null && s.replace (/^\s+/g, '') != '') return s; s = firstInnerText (n); if (s != null) return s; n = n.nextSibling; } return s; } */ function getView (elt) { var eltLink = firstElement (elt); if (eltLink != null && eltLink.className == 't') // toggle { var ich = elt.className.indexOf ('_'); if (ich < 0) return true; } return false; } function getParentDiv (elt) { if (elt) { do { elt = elt.parentNode; } while (elt && elt.tagName != 'DIV'); } return elt; } function getName (elt) { var rgSpans = getChildrenByTagName (elt, 'SPAN'); for (var iSpan = 0; iSpan < rgSpans.length; iSpan ++) { var span = rgSpans [iSpan]; if (span.className == 'l') // label { if (span.innerText) return span.innerText; else return span.firstChild.nodeValue; } } return null; } function clickHandler (evt) { var elt; if (document.layers) elt = evt.taget; else if (window.event && window.event.srcElement) { elt = window.event.srcElement; evt = window.event; } else if (evt && evt.stopPropagation) elt = evt.target; if (!elt.className && elt.parentNode) elt = elt.parentNode; if (elt.className == 'l') // label { var strClass; var strField; var strNamespace; var strAssembly; var strFieldType; elt = getParentDiv (elt); var strEltClass = elt.className; if (strEltClass.charAt (strEltClass.length - 1) == '_') strEltClass = strEltClass.slice (0, strEltClass.length - 1); if (strEltClass == 'x') // constructor { strField = 'ctor'; elt = getParentDiv (elt); } else if (strEltClass == 'm' || // method strEltClass == 'p' || // property strEltClass == 'e' || // event strEltClass == 'f') // field { strFieldType = strEltClass; strField = getName (elt); var match = strField.match ( /[\.A-Z0-9_]*/i ); if (match) strField = match [0]; elt = getParentDiv (elt); } var strEltClass = elt.className; if (strEltClass.charAt (strEltClass.length - 1) == '_') strEltClass = strEltClass.slice (0, strEltClass.length - 1); if (strEltClass == 'c' || // class strEltClass == 's' || // struct strEltClass == 'i' || // struct strEltClass == 'd' || // delegate strEltClass == 'en') // enum { strClass = getName (elt); if (strEltClass == 'en') strField = null; elt = getParentDiv (elt); } var strEltClass = elt.className; if (strEltClass.charAt (strEltClass.length - 1) == '_') strEltClass = strEltClass.slice (0, strEltClass.length - 1); if (strEltClass == 'n') { strNamespace = getName (elt); elt = getParentDiv (elt); } var strEltClass = elt.className; if (strEltClass.charAt (strEltClass.length - 1) == '_') strEltClass = strEltClass.slice (0, strEltClass.length - 1); if (strEltClass == 'y') { strAssembly = getName (elt); } if (evt.ctrlKey) { var strRoot = 'http://svn.myrealbox.com/viewcvs/trunk/mcs/class/'; var strExtra = ''; if (strAssembly) { if (strAssembly == 'mscorlib') strAssembly = 'corlib'; else if (strAssembly == 'System.Xml') strAssembly = 'System.XML'; strRoot = strRoot + strAssembly + '/'; if (strNamespace) { strRoot = strRoot + strNamespace + '/'; if (strClass) { strRoot += strClass + '.cs'; strExtra += '?view=markup'; } } window.open (strRoot + strExtra, 'CVS'); } } else if (strNamespace) { if (document.getElementById ('TargetMsdn1').checked) { var re = /\./g ; strNamespace = strNamespace.toLowerCase ().replace (re, ''); if (strClass) strNamespace += strClass.toLowerCase () + 'class'; if (strField) strNamespace += strField; if (strClass || strField) strNamespace += 'topic'; window.open ('http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrf' + strNamespace + '.asp', 'MSDN'); } else { if (strClass) strNamespace += '.' + strClass; if (strField) strNamespace += '.' + strField; if (document.getElementById ('TargetMonodoc').checked) { var category = null; if (strClass == null) category = "N:"; else if (strField == null) category = "T:"; else { switch (strFieldType) { case 'f': category = "F:"; break; case 'p': category = "P:"; break; case 'm': category = "M:"; break; case 'e': category = "E:"; break; } } if (category != null) window.open ('http://www.go-mono.com/docs/monodoc.ashx?link=' + category + strNamespace); } else { window.open ('http://msdn2.microsoft.com/library/' + strNamespace + '.aspx', 'MSDN'); } } } } else { if (elt.parentNode && elt.parentNode.className == 't') // toggle elt = elt.parentNode; else if (elt.className != 't') // toggle return; while (elt != null && elt.tagName != 'DIV') elt = elt.parentNode; if (evt.shiftKey) { var rgElts = getChildrenByTagName (elt, 'DIV'); var cElts = rgElts.length; if (cElts != 0) { var fView = false; var iElt; for (iElt = 0; iElt < cElts; iElt ++) { if (getView (rgElts [iElt])) { fView = true; break; } } for (iElt = 0; iElt < cElts; iElt ++) { setView (rgElts [iElt], !fView); } } } else if (evt.ctrlKey) { setView (elt, true); var eltParent = getParentDiv (elt); while (eltParent) { var rgSiblings = getChildrenByTagName (eltParent, 'DIV'); var cSiblings = rgSiblings.length; for (var iSibling = 0; iSibling < cSiblings; iSibling++) { var eltSibling = rgSiblings [iSibling]; if (eltSibling != elt) { setView (eltSibling, false); } } elt = eltParent; eltParent = getParentDiv (elt); } } else toggle (elt); } return false; } function filterTree () { var eltMissing = document.getElementById ('missing'); var eltTodo = document.getElementById ('todo'); var eltExtra = document.getElementById ('extra'); var eltErrors = document.getElementById ('errors'); var eltComVisible = document.getElementById ('ComVisible'); var eltDebuggerDisplay = document.getElementById ('DebuggerDisplay'); var dictTypes = new Object (); if (eltMissing.checked) dictTypes ['sm'] = true; if (eltTodo.checked) dictTypes ['st'] = true; if (eltErrors.checked) dictTypes ['se'] = true; if (eltExtra.checked) dictTypes ['sx'] = true; // dictTypes ['sc'] = true; var attrFilters = new Object (); var rgOptions = getChildrenByTagName (document.getElementById ('FilteredAttributes'), "option"); for (i = 0; i < rgOptions.length; i++) attrFilters [rgOptions [i].firstChild.nodeValue.replace (/\s+/g, '')] = true; viewAll (document.getElementById ('ROOT'), dictTypes, attrFilters); } function addAndFilter () { var newInput = document.getElementById ('NewFilterTarget'); var newAttr = newInput.value; if (newAttr.length > 0) { var selection = document.getElementById ('FilteredAttributes'); var newElem = document.createElement ('option'); newElem.appendChild (document.createTextNode (newAttr)); selection.appendChild (newElem); newInput.value = ''; filterTree (); } } function removeAndFilter () { var selection = document.getElementById ('FilteredAttributes'); if (selection.selectedIndex >= 0) { var newInput = document.getElementById ('NewFilterTarget'); if (newInput.value.length == 0) newInput.value = selection.options [selection.selectedIndex].firstChild.nodeValue; selection.removeChild (selection.options [selection.selectedIndex]); filterTree (); } } function selectMissing () { toggleFilter ('missing'); } function selectTodo () { toggleFilter ('todo'); } function selectExtra () { toggleFilter ('extra'); } function selectErrors () { toggleFilter ('errors'); } function toggleAttributeFilter (attrName) { toggleFilter (attrName); } function toggleFilter (strFilter) { var eltTodo = document.getElementById ('todo'); var eltMissing = document.getElementById ('missing'); var eltExtra = document.getElementById ('extra'); var eltErrors = document.getElementById ('errors'); var eltToggle = document.getElementById (strFilter); if (window && window.event && window.event.shiftKey) { eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = false; eltToggle.checked = true; } else if (!eltTodo.checked && !eltMissing.checked && !eltExtra.checked && !eltErrors.checked) { eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true; eltToggle.checked = false; } filterTree (); } function onLoad () { var eltMissing = document.getElementById ('missing'); var eltTodo = document.getElementById ('todo'); var eltExtra = document.getElementById ('extra'); var eltErrors = document.getElementById ('errors'); eltMissing.checked = eltTodo.checked = eltExtra.checked = eltErrors.checked = true; filterTree (); } if (document.layers) { document.captureEvents (Event.MOUSEUP); document.onmouseup = clickHandler; } else if (document.attachEvent) { document.attachEvent('onclick', clickHandler); } else if (document.addEventListener) { document.addEventListener('click', clickHandler, false); } else document.onclick = clickHandler; deploy/images/0000755000175000001440000000000010557271654013402 5ustar mkestnerusersdeploy/images/bgsquares.xcf.gz0000644000175000001440000000532710557271604016521 0ustar mkestnerusers'C;gimp_temp.14330.xcf gAG˩n(fgf{gfg+7߫^[kk( P @FI40j(#0BD!!7uvRiuI;3;?̥L6/7+xFAX:H?c8tȏ[;:<1G<2{#[ُ[CA0幸yXij&^{/\I!n?=0ο~t4_,ճGoPp X;s/?{pt|=5kf6[ggn}ӶG~ֶ#޿u9tI{Ї_86) KAp o| ߶.p9vg9׽K3O S`Κ^^.|1=^0?`8O] ~ 0"k:3~y'Y3|Xp/CΗ_/Ëw+Nup/SsXSe ΛEt1]LU/E" c1c1c,cKX2ƒ1d%c,cK%_ſlųo·M|7"ȏD#?#?#_/e2_/e2?ʏ(?ʏ(?ʏ(?ʏ(?Əc?Əc?Əc?Əc?Ώ8?Ώ8?Ώ8?Ώ8_W+ _W+ ?O?O?O?O?O$?O$?O$?O$?OS?OS?OS?OS?O4?O4?O4?O4?3 ?3 ?3 ?3 ?,?,?,?,?s?s?s?s_WU*_WU*?sٹԥ哻Us^;I#"o|[;w{ pڜvg=zw\,pٌλ=x?rL˻~cWʐ.^o}ZrؾM'\:ew;NG<۟샽Zr`M?sxp)Zq'̜9?8Ǻ>C~^xO7 s4^01ǯ㍰T>?ğ9|m<Nj`)7e\6e\6eWxއS{| _Ap: b(h~x7~ß<M7o|W; 9P Qy2@w~zideploy/images/bgsquares.gif0000644000175000001440000001154310557271604016064 0ustar mkestnerusersGIF89a  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~! ,@H*\P`#JHŋ3><ñǏ CIIZR\ɲ˗0cʜ͛8sɳϟ@ JѣH*]ʴӧPJJիXjʵׯBKlAhӪ]+۷p~Iݻ,˷߿ LÈ+jJL9˘3˹g-CMӨS^ͺuȰc/L6F͸s̻L NȓͼydУN}ؕkν\* /gSG$l}lmB0n*W1yΜ["Dmt>4BkxPGaҚ-kJ\ׇu]-d5eDp-7n7xn߀un78W^dY;g.褗n騧ꬷ.n/o'7G/Wogw/o觯/o HL:'H Z̠7z GH(L W0 gH8̡w@ H"HL&:PH*ZX̢.z` H2hL6pH:x̣> IBL"F:򑐌$'IJZ̤&7NzdF9ojBCRҔA%fTVҕ:ezd9 ZŖ9e.u)^ŗ #bӘB]LfșЁ&\9MjКfmMně'9NrĜtA' չNvVƝ')CzǞg~(I+QB*H(ZQlѨH8 *~jiHH))UGX)iLi )hѩGxSjG**R*(QS*Z*W:5q+Y:dzMj} [ַ).k[jWU^zc]ʥ6n,adؕ V|]lǾQekb6n_ mk>+ҮMiPֆa`+ m_p~ V+Mr:ЍtKZͮvz xKMz|Kͯ~LN;'L [ΰ7{ GL(NW0gL8αw@L"HN&;PL*[Xβ.{`N?Ha&S`iؚfyqٜS犼yٞgeS~٢<ڰv٤cSiKљ.٦|ҡVSjS+Ω&تYK5#cZWuj}jL;. mc#;"AA,.mk%F5oK[pn;窷L3{-|N*:TZ"ϭSgI3FN.N,~q[U80P\#@MN%g\9S3lNs<'ksDѡOnlu^J}ꌫ,i\zNpu>#|lmՆ}ed ~/|O+ku򔏚ߊ?mh~D+VOo}^f'ot/i l,-5ϿS_ֿ>}q>'ïwϾ_}?/ѿ?ŧ=3x ؀8Xx؁ "8$X&x(*,؂.0284X6x8:<؃>@B8DXFxHJL؄NPR8TXVxXZ\؅^`b8dXfxhjl؆npr8tXvxxz|؇~8Xx؈8Xx؉8Xx؊8Xx؋8XxȘʸ،8Xxؘڸ؍8t4o'RjWh AvIcaȎ >`(A3c_;s"ŏ^(#]Hg\a[ĐEZhiVȑ)1#i0%'WP0i2lx긓"9UUȓcBTh\ɔS&E iӂR}ƕ "QHuf–Pm$HbOeė藜N(PEd수MȘH(}BLh@ƙkK8%DfQJ0Śt',G7"si)*ɛǩ+Iy,9I-).. ۩/y091ٍ1ɍ2I334Y5yfgBysjs Z z *tJ**zt:jt!*# %'u)+-/ju1 35*7u9;z=? vACjE*GZvIڌKZMO4U:GR[Q]_JQazcPejgj5iZk4mJo 4q:sZ3u*w2y{1} J10ꈇ/ڈ/60*Z1 2 2j3ꍣ4ڍ4ʍz5+ʈ** *))z)j )Z(J*(:(**VF'V ' W*r&z[k&Z~q zѰ[`{5$۱W [";SQ&(O,.K24[Gq8[:Cѳ>@?1DF{;Jk6۴´PkR;U W۴Y[{]K_ace;hjl۶npr;t[v{xz|۷~;[{۸;[{۹;[{ۺ;[{ۻ;[{țʻۼ;[{؛ڻ۽;[{蛾껾۾;[{ۿ<\| <\| "<$\&|(*,.02<4\6|8:<>@BIDATxiAEAYlҎ[,AaEUEӣ~ߏ[l6^6zN @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@^qNظv|b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@^qMX F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @9^ 6/#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 Fkz#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 F@#b @1 FmIENDB`deploy/images/mono.gif0000644000175000001440000000600710557271604015037 0ustar mkestnerusersGIF89aP$ޜ| b VVVMҢ]Ie׎.,'mv۴ c&v ﶫճ6f l9^^]ß,O?><>"ʶb&#m%zzz~~}hhg>uLަ"κ:H2 GE=wvt! ?,PpH,Ȥrl:ШtJZجvzxL.zn|N~V=$:>L=>$>=R>8>d/:3;3:]8:Jźc8]=:38U/$$/+=9;3F+9=9+;S Xɛ7K9hyQEX5xHH9Xn\O|ܡVx#&$v8asA;H@C:7&8MP!YEw42Viٷxy:f]oʃyr)^=xzX Qhj#Ё:*$̑->E[- {ܑy'xW2r==*űo> MfWPx:2hK_uDb?lϾrIJC_0k\Qq?$~C@p]FEN^l+0UV덶mw9CQ9PX<5s2UOcd+Y+Hei}Bp9I6,Z ]HJZVaVaT#:TiV\YQAcJã:\Bden9&;8ZR2&qV!9d*OJK|ۄNfj mjĊItY?`ktM2ჲoyl&.-^̥8ݷrr6RᶂD I(r-èPnl Qx+wOluɽylwT9xnE*a 8J ʸND/Q.L2dGiczŶaϗpt\:J[9. O:BBc~ }}5ӧu@'d~ɫ, >o9}n5>PbgY<`W q)pmDӥfvgf9i'RG$AItFw}<9p7p-J'cD|v٤Vs 'GȿBYQ?p *.2+hw1 \Ő3i 8@>D/yXֲH @]E(w6Kl! _U;Y.&yBOrѷ*3%+dyHQU+k%3j6ADJI3mĹ9"{RKv\Mzkzָv;Jj )qZ-M9K󚷛e9@z6Xot rf2%!ִ5T~Zw+;h;p:fZ>LE |ML_C{] O&LY8:n0%"(4D\Ƹsz2+F&ɨrJ*Pw"SoAù4]NBm2oRK#LŭShEAaS\9&IJ5 L Dv-#n2uG,]yN5`!k v7%zcj~5c}!<}A!4XtI9`ͭ8بlp 0= lJz4f-fiQNьZd1/e"4 ::xa e'L =Oԇ6i2Y0Bk׃*HȒjjzCSJB8;:&qf"eyxq}bvYC&-U,y H5Է.(rl0P3BWB+{^WZ7 Ԧt|(<"m h_m^e/LډqirvFS.5ybrNMPb:o[zNeǰ7} Yūd"#1f#[V=k0ߋw1Ti>(g5A_\JH$7+RȊB;ީ9N>=>#A⊓}ѲarCF`%' !bEz"mr^ƖK1}1/;t~0*@49Y!idȅZ5!lj`6[uXdg B X p舮 #xJp `5(x ,=QhaH X f8X/x؋8XxȘʸ،8;deploy/images/mono.png0000644000175000001440000001061710557271604015060 0ustar mkestnerusersPNG  IHDRP<gAMA aPLTE$ޜ| b VVVMҢ]Ie׎.,'mv۴ c&v ﶫճ6f l9^^]ß,O?><>"ʶb&#m%zzz~~}hhg>uLަ"κ:H2 GE=wvtV(VtRNS@f pHYs  d_tIME *,CIDATxk{C8MCM܄&$d&U&)bWF"$PnkeFA98^e/{o8%)QRE%),; 2w7lI,?w7$eQr'Qj %"~@%'KCZ͏OWwI?K5__>y%CK%#I_UXP7*~,Bjh&. ڒ{wo .?TBі)"rB4#Xë!L ^AB 2iVG9Ty[ )\ /mrY:gEI٭n= \^Ǩ7ʃL4bXzPICO*WR 3Фt"y|y\#1%a$? Tn BKUצ]g.I7en.{dC7)T鵋."I<@ɔ:<_Xb|)eU Hncz#]Ihu^ ܏\UU#CXGd.On:3EH $1R&}+&xH79rԇEzŤr{@#H+t$fBV"e '%?^0ѐ<_^~k4QjW9sM=@X+֊Ԫ#{i: 4$T-`"jy+ >\]|]\3L~^?tnI %HyXfJ_/+FW^oj@זadX>NIC~ Um.(G(֥"R$y-6"Iayu$.pcX?n 9<;slUCM&j4Y),k0 Y왆 svꩬLŽ,}fR:#7ΪH3 H@!Vlԍ1˝ K>DS034ru=U]Gbr *sZ7@d:$ȉ+DH-LD~"];"B9F dK죗DO^L$S "/F ^CC/y-{{>0*?鮰^ A1~I:"U%pPg s֪d^ $u|*u;"GGmi&ܐhR%tA|EibH;! `Kd2IR{2d#"P|~q-_ff+6ʸ%"| =D(VvDr"C[ZfZKsj!2AkŽ@+N'6k꾹_~n) řZ=W;"  3b&D$4Db׀L&M}+e"BdQե-HxhG:GDDձ#2{uUؼR-0["&ɪo Dj$+gr嫶(I&TN٨A 3"`֎: iVZ"aF>v>&r2}:뫄EucO~c{$2rCz;AuJSHQL@&k*D$Y?@+>G>D"Ȑ1mYߚllѬZږS9/D-6r"9l# ~_CŐ6NkO5jqӢ>+tg\C Hdluh'.z\b~>\6N8?g"'WJjk+SA1ފX!"#y#k6qD,ݦ1kf#I;o⧅"l.bE™;34||nrZȻGD6z0" D:zvD^kOds vbCgK4)MwH䠬H8+ĿH|9yc|-RbDXKm=?C~{|4<-Iuf gaw@DMh:ASy=  x]*Kzf^e=9g.ewCٷBD!lkiXx"2gGɴ%e)Irx"Df[ bI"*RYAID#pT~gcɸ.ӫ}2 宸̸ D4PUlx"8X_ )0%7ˎ gȽDvA%59J"F&EQ&h/Ks[10\C^Qh@\8~DD iYk8S_hsg%5gX%"^b}ЎbN9A

^+/ڜiq;gx7Z.3lp!Ӳ`UJ!x010"H^i8ufQ*9H`tAIlZLDY̟/K%05Aݦ鵢iۥG|OA oO6MRڳԖWV7v=S߇n(Lɸ=7GmXQi{oY9>lk8IS=2Oy1{Z>o ڶHm1}֗ N5Ԓ"wCYGsYό*逜 mЕ!? köB`^|YXvu3S;!mLn&OmUÒĸޫB8u>19'=-uZ38ap$8{n;}|PcAlGT=L Bhs +:j^|B&&{ydso>g|fsHou1Sy_bNJdR.)H~'%#0'wg_* ;pqKlPN*& \ D&0VaH߻LʽlYʤNl6;2K)ݚHZKR;-[7Ds^5ٞȶk" aH\ܝ;"H9¸Jh//3R HWN$ |NaCHV1 I+gQ?Y)}-_iRpXGX;yBIYMd]{]HU!Ŗ^˸MȿIENDB`deploy/images/pixel.gif0000644000175000001440000000006110557271604015202 0ustar mkestnerusersGIF89a! ,L;deploy/images/pixel.png0000644000175000001440000000023410557271604015223 0ustar mkestnerusersPNG  IHDRb{,gAMA a PLTE~OtRNS@f pHYs  ~tIME 1C߆ IDATxc`'IENDB`mono-tools-4.2/ilcontrast/Window.cs0000664000175000017500000002025512413742070021473 0ustar00directhexdirecthex00000000000000// Window.cs - Toplevel Window Class // // Author: Mike Kestner // // Copyright (c) 2007 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. namespace IlContrast { using Gdk; using Gtk; using System; using System.Threading; using System.Xml; using System.Xml.Xsl; using Mono.AssemblyCompare; using Mono.AssemblyInfo; public class Window : Gtk.Window { Box main_vbox; Statusbar statusbar; #if USE_GECKO Gecko.WebControl browser; #else WebKit.WebView web_view; #endif bool first_show = false; Thread worker; ComparisonInfo info; public Window (ComparisonInfo info) : base ("ilContrast Assembly Comparison Tool") { DefaultSize = new Size (450, 450); main_vbox = new VBox (false, 0); AddActionUI (); #if USE_GECKO browser = new Gecko.WebControl (); main_vbox.PackStart (browser, true, true, 0); #else web_view = new WebKit.WebView (); ScrolledWindow sw = new ScrolledWindow (); sw.Add (web_view); main_vbox.PackStart (sw, true, true, 0); #endif statusbar = new Statusbar (); main_vbox.PackStart (statusbar, false, false, 0); Add (main_vbox); main_vbox.ShowAll (); first_show = true; this.info = info; } protected override void OnShown () { base.OnShown (); if (first_show) Refresh (); first_show = false; } protected override bool OnDeleteEvent (Gdk.Event ev) { Gtk.Application.Quit (); return true; } void Refresh () { if (info == null) { info = RequestComparisonInfo (); if (info == null) return; } worker = new Thread (new ThreadStart (GenerateHtmlTarget)); worker.Start (); } ComparisonInfo RequestComparisonInfo () { uint cid = statusbar.GetContextId ("assemblies"); statusbar.Pop (cid); statusbar.Push (cid, "Choosing Base Assembly"); FileChooserDialog d = new FileChooserDialog ("Choose Base Assembly", this, FileChooserAction.Open, Stock.Cancel, ResponseType.Cancel, Stock.Open, ResponseType.Accept); FileFilter filter = new FileFilter (); filter.AddPattern ("*.dll"); d.Filter = filter; if ((ResponseType) d.Run () == ResponseType.Cancel) { d.Destroy (); return null; } d.Hide (); string base_path = d.Filename; statusbar.Pop (cid); statusbar.Push (cid, "Choosing Target Assembly"); d.Title = "Choose Target Assembly"; if ((ResponseType) d.Run () == ResponseType.Cancel) { d.Destroy (); return null; } string target_path = d.Filename; d.Hide (); d.Destroy (); return new ComparisonInfo (base_path, target_path); } string Status { set { uint cid = statusbar.GetContextId ("status"); statusbar.Pop (cid); statusbar.Push (cid, value); } } void LoadUrl (string url) { #if USE_GECKO browser.LoadUrl (url); #else web_view.Open (url); #endif } void GenerateHtmlTarget () { Gtk.Application.Invoke (delegate { Status = "Loading Base Assembly Information"; }); XmlDocument base_info = LoadAssemblyInfo (info.BaseAssemblyPath); Gtk.Application.Invoke (delegate { Status = "Loading Target Assembly Information"; }); XmlDocument target_info = LoadAssemblyInfo (info.TargetAssemblyPath); Gtk.Application.Invoke (delegate { Status = "Comparing Assembly Information"; }); XmlDocument diff_doc = CompareAssemblies (base_info, target_info); Gtk.Application.Invoke (delegate { Status = "Formatting Comparison for Display"; }); XslTransform xsl = new XslTransform (); xsl.Load (new XmlTextReader (System.Reflection.Assembly.GetCallingAssembly ().GetManifestResourceStream ("mono-api.xsl"))); using(System.IO.FileStream stream = new System.IO.FileStream(info.ResultPath, System.IO.FileMode.Create, System.IO.FileAccess.Write)) { System.IO.StreamWriter writer = new System.IO.StreamWriter (stream); WriteHtmlHeader (writer); xsl.Transform (diff_doc, null, stream); WriteHtmlFooter (writer); writer.Close (); } Gtk.Application.Invoke (delegate { LoadUrl (info.ResultPath); Status = info.BaseAssemblyPath + " -> " + info.TargetAssemblyPath; }); worker = null; } void WriteHtmlFooter (System.IO.StreamWriter writer) { writer.WriteLine (" "); writer.WriteLine (""); } void WriteHtmlHeader (System.IO.StreamWriter writer) { writer.WriteLine (" "); writer.WriteLine (" "); writer.WriteLine (" Class Status Page"); writer.WriteLine (" "); writer.WriteLine (" "); writer.WriteLine (" "); writer.WriteLine (" "); } XmlDocument LoadAssemblyInfo (string path) { AssemblyCollection collection = new AssemblyCollection (); collection.Add (path); XmlDocument result = new XmlDocument (); collection.Document = result; collection.DoOutput (); return result; } XmlDocument CompareAssemblies (XmlDocument base_doc, XmlDocument updated_doc) { XMLAssembly base_assm = new XMLAssembly (); base_assm.LoadData (base_doc.SelectSingleNode ("/assemblies/assembly")); XMLAssembly updated_assm = new XMLAssembly (); updated_assm.LoadData (updated_doc.SelectSingleNode ("/assemblies/assembly")); return base_assm.CompareAndGetDocument (updated_assm); } void QuitActivated (object o, EventArgs args) { Gtk.Application.Quit (); } void AboutActivated (object o, EventArgs args) { Dialog about = new Dialog ("About ilContrast", this, DialogFlags.DestroyWithParent, Stock.Close, ResponseType.Accept); about.VBox.PackStart (new Gtk.Image (new Gdk.Pixbuf (null, "ilcontrast.png", 64, 64)), false, false, 6); Label label = new Label (""); label.Markup = "ilContrast " + Global.VersionNumber + ""; about.VBox.PackStart (label, false, false, 6); about.VBox.PackStart (new Label ("Assembly Comparison Tool"), false, false, 6); about.VBox.PackStart (new Label ("Copyright (c) 2007 Novell, Inc."), false, false, 6); about.VBox.ShowAll (); about.Run (); about.Destroy (); } const string uiInfo = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; void AddActionUI () { ActionEntry[] actions = new ActionEntry[] { new ActionEntry ("FileMenu", null, "_File", null, null, null), new ActionEntry ("Quit", Stock.Quit, "_Quit", "Q", "Quit", new EventHandler (QuitActivated)), new ActionEntry ("HelpMenu", null, "_Help", null, null, null), new ActionEntry ("About", null, "_About IlContrast...", "A", "About IlContrast", new EventHandler (AboutActivated)), }; ActionGroup group = new ActionGroup ("group"); group.Add (actions); UIManager uim = new UIManager (); uim.InsertActionGroup (group, (int) uim.NewMergeId ()); uim.AddUiFromString (uiInfo); main_vbox.PackStart (uim.GetWidget ("/MenuBar"), false, true, 0); //main_vbox.PackStart (uim.GetWidget ("/ToolBar"), false, true, 0); } } } mono-tools-4.2/ilcontrast/mono-api-diff.cs0000664000175000017500000013374412413742070022661 0ustar00directhexdirecthex00000000000000// // mono-api-diff.cs - Compares 2 xml files produced by mono-api-info and // produces a file suitable to build class status pages. // // Authors: // Gonzalo Paniagua Javier (gonzalo@ximian.com) // // (C) 2003 Novell, Inc (http://www.novell.com) // using System; using System.Collections; using System.IO; using System.Reflection; using System.Text; using System.Xml; namespace Mono.AssemblyCompare { #if false class Driver { static int Main (string [] args) { if (args.Length != 2) return 1; XMLAssembly ms = CreateXMLAssembly (args [0]); XMLAssembly mono = CreateXMLAssembly (args [1]); XmlDocument doc = ms.CompareAndGetDocument (mono); XmlTextWriter writer = new XmlTextWriter (Console.Out); writer.Formatting = Formatting.Indented; doc.WriteTo (writer); return 0; } static XMLAssembly CreateXMLAssembly (string file) { XmlDocument doc = new XmlDocument (); doc.Load (File.OpenRead (file)); XmlNode node = doc.SelectSingleNode ("/assemblies/assembly"); XMLAssembly result = new XMLAssembly (); try { result.LoadData (node); } catch (Exception e) { Console.Error.WriteLine ("Error loading {0}: {1}\n{2}", file, e.Message, e); Environment.Exit (1); } return result; } } #endif public class Counters { public int Present; public int PresentTotal; public int Missing; public int MissingTotal; public int Todo; public int TodoTotal; public int Extra; public int ExtraTotal; public int Warning; public int WarningTotal; public int ErrorTotal; public Counters () { } public void AddPartialToPartial (Counters other) { Present += other.Present; Extra += other.Extra; Missing += other.Missing; Todo += other.Todo; Warning += other.Warning; AddPartialToTotal (other); } public void AddPartialToTotal (Counters other) { PresentTotal += other.Present; ExtraTotal += other.Extra; MissingTotal += other.Missing; TodoTotal += other.Todo; WarningTotal += other.Warning; } public void AddTotalToPartial (Counters other) { Present += other.PresentTotal; Extra += other.ExtraTotal; Missing += other.MissingTotal; Todo += other.TodoTotal; Warning += other.WarningTotal; AddTotalToTotal (other); } public void AddTotalToTotal (Counters other) { PresentTotal += other.PresentTotal; ExtraTotal += other.ExtraTotal; MissingTotal += other.MissingTotal; TodoTotal += other.TodoTotal; WarningTotal += other.WarningTotal; ErrorTotal += other.ErrorTotal; } public int Total { get { return Present + Missing; } } public int AbsTotal { get { return PresentTotal + MissingTotal; } } public int Ok { get { return Present - Todo; } } public int OkTotal { get { return PresentTotal - TodoTotal - ErrorTotal; } } public override string ToString () { StringWriter sw = new StringWriter (); sw.WriteLine ("Present: {0}", Present); sw.WriteLine ("PresentTotal: {0}", PresentTotal); sw.WriteLine ("Missing: {0}", Missing); sw.WriteLine ("MissingTotal: {0}", MissingTotal); sw.WriteLine ("Todo: {0}", Todo); sw.WriteLine ("TodoTotal: {0}", TodoTotal); sw.WriteLine ("Extra: {0}", Extra); sw.WriteLine ("ExtraTotal: {0}", ExtraTotal); sw.WriteLine ("Warning: {0}", Warning); sw.WriteLine ("WarningTotal: {0}", WarningTotal); sw.WriteLine ("ErrorTotal: {0}", ErrorTotal); sw.WriteLine ("--"); return sw.GetStringBuilder ().ToString (); } } public abstract class XMLData { protected XmlDocument document; protected Counters counters; bool haveWarnings; public XMLData () { counters = new Counters (); } public virtual void LoadData (XmlNode node) { } protected object [] LoadRecursive (XmlNodeList nodeList, Type type) { ArrayList list = new ArrayList (); foreach (XmlNode node in nodeList) { XMLData data = (XMLData) Activator.CreateInstance (type); data.LoadData (node); list.Add (data); } return (object []) list.ToArray (type); } protected void AddAttribute (XmlNode node, string name, string value) { XmlAttribute attr = document.CreateAttribute (name); attr.Value = value; node.Attributes.Append (attr); } protected void AddExtra (XmlNode node) { //TODO: count all the subnodes? AddAttribute (node, "presence", "extra"); AddAttribute (node, "ok", "1"); AddAttribute (node, "ok_total", "1"); AddAttribute (node, "extra", "1"); AddAttribute (node, "extra_total", "1"); } public void AddCountersAttributes (XmlNode node) { if (counters.Missing > 0) AddAttribute (node, "missing", counters.Missing.ToString ()); if (counters.Present > 0) AddAttribute (node, "present", counters.Present.ToString ()); if (counters.Extra > 0) AddAttribute (node, "extra", counters.Extra.ToString ()); if (counters.Ok > 0) AddAttribute (node, "ok", counters.Ok.ToString ()); if (counters.Total > 0) { int percent = (100 * counters.Ok / counters.Total); AddAttribute (node, "complete", percent.ToString ()); } if (counters.Todo > 0) AddAttribute (node, "todo", counters.Todo.ToString ()); if (counters.Warning > 0) AddAttribute (node, "warning", counters.Warning.ToString ()); if (counters.MissingTotal > 0) AddAttribute (node, "missing_total", counters.MissingTotal.ToString ()); if (counters.PresentTotal > 0) AddAttribute (node, "present_total", counters.PresentTotal.ToString ()); if (counters.ExtraTotal > 0) AddAttribute (node, "extra_total", counters.ExtraTotal.ToString ()); if (counters.OkTotal > 0) AddAttribute (node, "ok_total", counters.OkTotal.ToString ()); if (counters.AbsTotal > 0) { int percent = (100 * counters.OkTotal / counters.AbsTotal); AddAttribute (node, "complete_total", percent.ToString ()); } if (counters.TodoTotal > 0) { AddAttribute (node, "todo_total", counters.TodoTotal.ToString ()); //TODO: should be different on error. check error cases in corcompare. AddAttribute (node, "error_total", counters.Todo.ToString ()); } if (counters.WarningTotal > 0) AddAttribute (node, "warning_total", counters.WarningTotal.ToString ()); } protected void AddWarning (XmlNode parent, string fmt, params object [] args) { counters.Warning++; haveWarnings = true; XmlNode warnings = parent.SelectSingleNode ("warnings"); if (warnings == null) { warnings = document.CreateElement ("warnings", null); parent.AppendChild (warnings); } AddAttribute (parent, "error", "warning"); XmlNode warning = document.CreateElement ("warning", null); AddAttribute (warning, "text", String.Format (fmt, args)); warnings.AppendChild (warning); } public bool HaveWarnings { get { return haveWarnings; } } public Counters Counters { get { return counters; } } public abstract void CompareTo (XmlDocument doc, XmlNode parent, object other); } abstract class XMLNameGroup : XMLData { protected XmlNode group; protected Hashtable keys; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != GroupName) throw new FormatException (String.Format ("Expecting <{0}>", GroupName)); keys = new Hashtable (); foreach (XmlNode n in node.ChildNodes) { string name = n.Attributes ["name"].Value; if (CheckIfAdd (name, n)) { string key = GetNodeKey (name, n); //keys.Add (key, name); keys [key] = name; LoadExtraData (key, n); } } } protected virtual bool CheckIfAdd (string value, XmlNode node) { return true; } protected virtual void LoadExtraData (string name, XmlNode node) { } public override void CompareTo (XmlDocument doc, XmlNode parent, object other) { this.document = doc; if (group == null) group = doc.CreateElement (GroupName, null); Hashtable okeys = null; if (other != null && ((XMLNameGroup) other).keys != null) { okeys = ((XMLNameGroup) other).keys; } XmlNode node = null; bool onull = (okeys == null); if (keys != null) { foreach (DictionaryEntry entry in keys) { node = doc.CreateElement (Name, null); group.AppendChild (node); string key = (string) entry.Key; string name = (string) entry.Value; AddAttribute (node, "name", name); if (!onull && HasKey (key, okeys)) { CompareToInner (key, node, (XMLNameGroup) other); okeys.Remove (key); counters.Present++; } else { AddAttribute (node, "presence", "missing"); counters.Missing++; } } } if (!onull && okeys.Count != 0) { foreach (string value in okeys.Values) { node = doc.CreateElement (Name, null); AddAttribute (node, "name", (string) value); AddAttribute (node, "presence", "extra"); group.AppendChild (node); counters.Extra++; } } if (group.HasChildNodes) parent.AppendChild (group); } protected virtual void CompareToInner (string name, XmlNode node, XMLNameGroup other) { } public virtual string GetNodeKey (string name, XmlNode node) { return name; } public virtual bool HasKey (string key, Hashtable other) { return other.ContainsKey (key); } public abstract string GroupName { get; } public abstract string Name { get; } } public class XMLAssembly : XMLData { XMLAttributes attributes; XMLNamespace [] namespaces; string name; string version; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); name = node.Attributes ["name"].Value; version = node.Attributes ["version"].Value; XmlNode atts = node.FirstChild; attributes = new XMLAttributes (); if (atts.Name == "attributes") { attributes.LoadData (atts); atts = atts.NextSibling; } if (atts == null || atts.Name != "namespaces") { Console.Error.WriteLine ("Warning: no namespaces found!"); return; } namespaces = (XMLNamespace []) LoadRecursive (atts.ChildNodes, typeof (XMLNamespace)); } public override void CompareTo (XmlDocument doc, XmlNode parent, object other) { XMLAssembly assembly = (XMLAssembly) other; XmlNode childA = doc.CreateElement ("assembly", null); AddAttribute (childA, "name", name); AddAttribute (childA, "version", version); if (name != assembly.name) AddWarning (childA, "Assembly names not equal: {0}, {1}", name, assembly.name); if (version != assembly.version) AddWarning (childA, "Assembly version not equal: {0}, {1}", version, assembly.version); parent.AppendChild (childA); attributes.CompareTo (doc, childA, assembly.attributes); counters.AddPartialToPartial (attributes.Counters); CompareNamespaces (childA, assembly.namespaces); if (assembly.attributes != null && assembly.attributes.IsTodo) { counters.Todo++; counters.TodoTotal++; counters.ErrorTotal++; AddAttribute (childA, "error", "todo"); if (assembly.attributes.Comment != null) AddAttribute (childA, "comment", assembly.attributes.Comment); } AddCountersAttributes (childA); } void CompareNamespaces (XmlNode parent, XMLNamespace [] other) { ArrayList newNS = new ArrayList (); XmlNode group = document.CreateElement ("namespaces", null); parent.AppendChild (group); Hashtable oh = CreateHash (other); XmlNode node = null; int count = (namespaces == null) ? 0 : namespaces.Length; for (int i = 0; i < count; i++) { XMLNamespace xns = namespaces [i]; node = document.CreateElement ("namespace", null); newNS.Add (node); AddAttribute (node, "name", xns.Name); if (oh.ContainsKey (xns.Name)) { int idx = (int) oh [xns.Name]; xns.CompareTo (document, node, other [idx]); other [idx] = null; xns.AddCountersAttributes (node); counters.Present++; counters.PresentTotal++; counters.AddPartialToTotal (xns.Counters); } else { AddAttribute (node, "presence", "missing"); counters.Missing++; counters.MissingTotal++; } } if (other != null) { count = other.Length; for (int i = 0; i < count; i++) { XMLNamespace n = other [i]; if (n == null) continue; node = document.CreateElement ("namespace", null); newNS.Add (node); AddAttribute (node, "name", n.Name); AddExtra (node); counters.ExtraTotal++; } } XmlNode [] nodes = (XmlNode []) newNS.ToArray (typeof (XmlNode)); Array.Sort (nodes, XmlNodeComparer.Default); foreach (XmlNode nn in nodes) group.AppendChild (nn); } static Hashtable CreateHash (XMLNamespace [] other) { Hashtable result = new Hashtable (); if (other != null) { int i = 0; foreach (XMLNamespace n in other) { result [n.Name] = i++; } } return result; } public XmlDocument CompareAndGetDocument (XMLAssembly other) { XmlDocument doc = new XmlDocument (); this.document = doc; XmlNode parent = doc.CreateElement ("assemblies", null); doc.AppendChild (parent); CompareTo (doc, parent, other); XmlNode decl = doc.CreateXmlDeclaration ("1.0", null, null); doc.InsertBefore (decl, doc.DocumentElement); return doc; } } class XMLNamespace : XMLData { string name; XMLClass [] types; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != "namespace") throw new FormatException ("Expecting "); name = node.Attributes ["name"].Value; XmlNode classes = node.FirstChild; if (classes == null) { Console.Error.WriteLine ("Warning: no classes for {0}", node.Attributes ["name"]); return; } if (classes.Name != "classes") throw new FormatException ("Expecting . Got <" + classes.Name + ">"); types = (XMLClass []) LoadRecursive (classes.ChildNodes, typeof (XMLClass)); } public override void CompareTo (XmlDocument doc, XmlNode parent, object other) { this.document = doc; XMLNamespace nspace = (XMLNamespace) other; XmlNode childA = doc.CreateElement ("classes", null); parent.AppendChild (childA); CompareTypes (childA, nspace.types); } void CompareTypes (XmlNode parent, XMLClass [] other) { ArrayList newNodes = new ArrayList (); Hashtable oh = CreateHash (other); XmlNode node = null; int count = (types == null) ? 0 : types.Length; for (int i = 0; i < count; i++) { XMLClass xclass = types [i]; node = document.CreateElement ("class", null); newNodes.Add (node); AddAttribute (node, "name", xclass.Name); AddAttribute (node, "type", xclass.Type); if (oh.ContainsKey (xclass.Name)) { int idx = (int) oh [xclass.Name]; xclass.CompareTo (document, node, other [idx]); other [idx] = null; counters.AddPartialToPartial (xclass.Counters); } else { AddAttribute (node, "presence", "missing"); counters.Missing++; counters.MissingTotal++; } } if (other != null) { count = other.Length; for (int i = 0; i < count; i++) { XMLClass c = other [i]; if (c == null || c.Name.EndsWith ("TODOAttribute")) continue; node = document.CreateElement ("class", null); newNodes.Add (node); AddAttribute (node, "name", c.Name); AddAttribute (node, "type", c.Type); AddExtra (node); counters.Extra++; counters.ExtraTotal++; } } XmlNode [] nodes = (XmlNode []) newNodes.ToArray (typeof (XmlNode)); Array.Sort (nodes, XmlNodeComparer.Default); foreach (XmlNode nn in nodes) parent.AppendChild (nn); } static Hashtable CreateHash (XMLClass [] other) { Hashtable result = new Hashtable (); if (other != null) { int i = 0; foreach (XMLClass c in other) { result [c.Name] = i++; } } return result; } public string Name { get { return name; } } } class XMLClass : XMLData { string name; string type; string baseName; bool isSealed; bool isSerializable; bool isAbstract; string charSet; string layout; XMLAttributes attributes; XMLInterfaces interfaces; XMLGenericTypeConstraints genericConstraints; XMLFields fields; XMLConstructors constructors; XMLProperties properties; XMLEvents events; XMLMethods methods; XMLClass [] nested; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); name = node.Attributes ["name"].Value; type = node.Attributes ["type"].Value; XmlAttribute xatt = node.Attributes ["base"]; if (xatt != null) baseName = xatt.Value; xatt = node.Attributes ["sealed"]; isSealed = (xatt != null && xatt.Value == "true"); xatt = node.Attributes ["abstract"]; isAbstract = (xatt != null && xatt.Value == "true"); xatt = node.Attributes["serializable"]; isSerializable = (xatt != null && xatt.Value == "true"); xatt = node.Attributes["charset"]; if (xatt != null) charSet = xatt.Value; xatt = node.Attributes["layout"]; if (xatt != null) layout = xatt.Value; XmlNode child = node.FirstChild; if (child == null) { // Console.Error.WriteLine ("Empty class {0} {1}", name, type); return; } if (child.Name == "attributes") { attributes = new XMLAttributes (); attributes.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "interfaces") { interfaces = new XMLInterfaces (); interfaces.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "generic-type-constraints") { genericConstraints = new XMLGenericTypeConstraints (); genericConstraints.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "fields") { fields = new XMLFields (); fields.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "constructors") { constructors = new XMLConstructors (); constructors.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "properties") { properties = new XMLProperties (); properties.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "events") { events = new XMLEvents (); events.LoadData (child); child = child.NextSibling; } if (child != null && child.Name == "methods") { methods = new XMLMethods (); methods.LoadData (child); child = child.NextSibling; } if (child == null) return; if (child.Name != "classes") { Console.WriteLine ("name: {0} type: {1} {2}", name, type, child.NodeType); throw new FormatException ("Expecting . Got <" + child.Name + ">"); } nested = (XMLClass []) LoadRecursive (child.ChildNodes, typeof (XMLClass)); } public override void CompareTo (XmlDocument doc, XmlNode parent, object other) { this.document = doc; XMLClass oclass = (XMLClass) other; if (attributes != null || oclass.attributes != null) { if (attributes == null) attributes = new XMLAttributes (); attributes.CompareTo (doc, parent, oclass.attributes); counters.AddPartialToPartial (attributes.Counters); if (oclass.attributes != null && oclass.attributes.IsTodo) { counters.Todo++; counters.TodoTotal++; counters.ErrorTotal++; AddAttribute (parent, "error", "todo"); if (oclass.attributes.Comment != null) AddAttribute (parent, "comment", oclass.attributes.Comment); } } if (type != oclass.type) AddWarning (parent, "Class type is wrong: {0} != {1}", type, oclass.type); if (baseName != oclass.baseName) AddWarning (parent, "Base class is wrong: {0} != {1}", baseName, oclass.baseName); if (isAbstract != oclass.isAbstract || isSealed != oclass.isSealed) { if ((isAbstract && isSealed) || (oclass.isAbstract && oclass.isSealed)) AddWarning (parent, "Should {0}be static", (isAbstract && isSealed) ? "" : "not "); else if (isAbstract != oclass.isAbstract) AddWarning (parent, "Should {0}be abstract", isAbstract ? "" : "not "); else if (isSealed != oclass.isSealed) AddWarning (parent, "Should {0}be sealed", isSealed ? "" : "not "); } if (isSerializable != oclass.isSerializable) AddWarning (parent, "Should {0}be serializable", isSerializable ? "" : "not "); if (charSet != oclass.charSet) AddWarning (parent, "CharSet is wrong: {0} != {1}", charSet, oclass.charSet); if (layout != oclass.layout) AddWarning (parent, "Layout is wrong: {0} != {1}", layout, oclass.layout); if (interfaces != null || oclass.interfaces != null) { if (interfaces == null) interfaces = new XMLInterfaces (); interfaces.CompareTo (doc, parent, oclass.interfaces); counters.AddPartialToPartial (interfaces.Counters); } if (genericConstraints != null || oclass.genericConstraints != null) { if (genericConstraints == null) genericConstraints = new XMLGenericTypeConstraints (); genericConstraints.CompareTo (doc, parent, oclass.genericConstraints); counters.AddPartialToPartial (genericConstraints.Counters); } if (fields != null || oclass.fields != null) { if (fields == null) fields = new XMLFields (); fields.CompareTo (doc, parent, oclass.fields); counters.AddPartialToPartial (fields.Counters); } if (constructors != null || oclass.constructors != null) { if (constructors == null) constructors = new XMLConstructors (); constructors.CompareTo (doc, parent, oclass.constructors); counters.AddPartialToPartial (constructors.Counters); } if (properties != null || oclass.properties != null) { if (properties == null) properties = new XMLProperties (); properties.CompareTo (doc, parent, oclass.properties); counters.AddPartialToPartial (properties.Counters); } if (events != null || oclass.events != null) { if (events == null) events = new XMLEvents (); events.CompareTo (doc, parent, oclass.events); counters.AddPartialToPartial (events.Counters); } if (methods != null || oclass.methods != null) { if (methods == null) methods = new XMLMethods (); methods.CompareTo (doc, parent, oclass.methods); counters.AddPartialToPartial (methods.Counters); } if (nested != null || oclass.nested != null) { XmlNode n = doc.CreateElement ("classes", null); parent.AppendChild (n); CompareTypes (n, oclass.nested); } AddCountersAttributes (parent); } void CompareTypes (XmlNode parent, XMLClass [] other) { ArrayList newNodes = new ArrayList (); Hashtable oh = CreateHash (other); XmlNode node = null; int count = (nested == null) ? 0 : nested.Length; for (int i = 0; i < count; i++) { XMLClass xclass = nested [i]; node = document.CreateElement ("nestedclass", null); newNodes.Add (node); AddAttribute (node, "name", xclass.Name); AddAttribute (node, "type", xclass.Type); if (oh.ContainsKey (xclass.Name)) { int idx = (int) oh [xclass.Name]; xclass.CompareTo (document, node, other [idx]); other [idx] = null; counters.AddPartialToPartial (xclass.Counters); } else { // TODO: Should I count here? AddAttribute (node, "presence", "missing"); counters.Missing++; counters.MissingTotal++; } } if (other != null) { count = other.Length; for (int i = 0; i < count; i++) { XMLClass c = other [i]; if (c == null || c.Name.EndsWith ("TODOAttribute")) continue; node = document.CreateElement ("nestedclass", null); newNodes.Add (node); AddAttribute (node, "name", c.Name); AddExtra (node); counters.Extra++; counters.ExtraTotal++; } } XmlNode [] nodes = (XmlNode []) newNodes.ToArray (typeof (XmlNode)); Array.Sort (nodes, XmlNodeComparer.Default); foreach (XmlNode nn in nodes) parent.AppendChild (nn); } static Hashtable CreateHash (XMLClass [] other) { Hashtable result = new Hashtable (); if (other != null) { int i = 0; foreach (XMLClass c in other) { result [c.Name] = i++; } } return result; } public string Name { get { return name; } } public string Type { get { return type; } } } class XMLParameter : XMLData { string name; string type; string attrib; string direction; bool isUnsafe; bool isOptional; string defaultValue; public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != "parameter") throw new ArgumentException ("Expecting "); name = node.Attributes["name"].Value; type = node.Attributes["type"].Value; attrib = node.Attributes["attrib"].Value; if (node.Attributes ["direction"] != null) direction = node.Attributes["direction"].Value; if (node.Attributes["unsafe"] != null) isUnsafe = bool.Parse (node.Attributes["unsafe"].Value); if (node.Attributes["optional"] != null) isOptional = bool.Parse (node.Attributes["optional"].Value); if (node.Attributes["defaultValue"] != null) defaultValue = node.Attributes["defaultValue"].Value; } public override void CompareTo (XmlDocument doc, XmlNode parent, object other) { this.document = doc; XMLParameter oparm = (XMLParameter) other; if (type != oparm.type) AddWarning (parent, "Parameter type is wrong: {0} != {1}", type, oparm.type); if (attrib != oparm.attrib) AddWarning (parent, "Parameter attributes wrong: {0} != {1}", attrib, oparm.attrib); if (direction != oparm.direction) AddWarning (parent, "Parameter direction wrong: {0} != {1}", direction, oparm.direction); if (isUnsafe != oparm.isUnsafe) AddWarning (parent, "Parameter unsafe wrong: {0} != {1}", isUnsafe, oparm.isUnsafe); if (isOptional != oparm.isOptional) AddWarning (parent, "Parameter optional wrong: {0} != {1}", isOptional, oparm.isOptional); if (defaultValue != oparm.defaultValue) AddWarning (parent, "Parameter default value wrong: {0} != {1}", (defaultValue == null) ? "(no default value)" : defaultValue, (oparm.defaultValue == null) ? "(no default value)" : oparm.defaultValue); } public string Name { get { return name; } } } class XMLAttributeProperties: XMLNameGroup { static Hashtable ignored_properties; static XMLAttributeProperties () { ignored_properties = new Hashtable (); ignored_properties.Add ("System.Reflection.AssemblyKeyFileAttribute", "KeyFile"); ignored_properties.Add ("System.Reflection.AssemblyCompanyAttribute", "Company"); ignored_properties.Add ("System.Reflection.AssemblyConfigurationAttribute", "Configuration"); ignored_properties.Add ("System.Reflection.AssemblyCopyrightAttribute", "Copyright"); ignored_properties.Add ("System.Reflection.AssemblyProductAttribute", "Product"); ignored_properties.Add ("System.Reflection.AssemblyTrademarkAttribute", "Trademark"); ignored_properties.Add ("System.Reflection.AssemblyInformationalVersionAttribute", "InformationalVersion"); ignored_properties.Add ("System.ObsoleteAttribute", "Message"); ignored_properties.Add ("System.IO.IODescriptionAttribute", "Description"); ignored_properties.Add ("System.Diagnostics.MonitoringDescriptionAttribute", "Description"); } Hashtable properties = new Hashtable (); string attribute; public XMLAttributeProperties (string attribute) { this.attribute = attribute; } public override void LoadData(XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.ChildNodes == null) return; string ignored = ignored_properties [attribute] as string; foreach (XmlNode n in node.ChildNodes) { string name = n.Attributes ["name"].Value; if (ignored == name) continue; if (n.Attributes ["null"] != null) { properties.Add (name, null); continue; } string value = n.Attributes ["value"].Value; properties.Add (name, value); } } public override void CompareTo (XmlDocument doc, XmlNode parent, object other) { this.document = doc; Hashtable other_properties = ((XMLAttributeProperties)other).properties; foreach (DictionaryEntry de in other_properties) { object other_value = properties [de.Key]; if (de.Value == null) { if (other_value != null) AddWarning (parent, "Property '{0}' is 'null' and should be '{1}'", de.Key, other_value); continue; } if (de.Value.Equals (other_value)) continue; AddWarning (parent, "Property '{0}' is '{1}' and should be '{2}'", de.Key, de.Value, other_value == null ? "null" : other_value); } } public override string GroupName { get { return "properties"; } } public override string Name { get { return ""; } } } class XMLAttributes : XMLNameGroup { Hashtable properties = new Hashtable (); bool isTodo; string comment; protected override bool CheckIfAdd (string value, XmlNode node) { if (value.EndsWith ("TODOAttribute")) { isTodo = true; XmlNode pNode = node.SelectSingleNode ("properties"); if (pNode.ChildNodes [0].Attributes ["value"] != null) { comment = pNode.ChildNodes [0].Attributes ["value"].Value; } return false; } return true; } protected override void CompareToInner (string name, XmlNode node, XMLNameGroup other) { XMLAttributeProperties other_prop = ((XMLAttributes)other).properties [name] as XMLAttributeProperties; XMLAttributeProperties this_prop = properties [name] as XMLAttributeProperties; if (other_prop == null || this_prop == null) return; this_prop.CompareTo (document, node, other_prop); counters.AddPartialToPartial (this_prop.Counters); } public override string GetNodeKey (string name, XmlNode node) { string key = null; // if multiple attributes with the same name (type) exist, then we // cannot be sure which attributes correspond, so we must use the // name of the attribute (type) and the name/value of its properties // as key XmlNodeList attributes = node.ParentNode.SelectNodes("attribute[@name='" + name + "']"); if (attributes.Count > 1) { ArrayList keyParts = new ArrayList (); XmlNodeList properties = node.SelectNodes ("properties/property"); foreach (XmlNode property in properties) { XmlAttributeCollection attrs = property.Attributes; if (attrs["value"] != null) { keyParts.Add (attrs["name"].Value + "=" + attrs["value"].Value); } else { keyParts.Add (attrs["name"].Value + "="); } } // sort properties by name, as order of properties in XML is // undefined keyParts.Sort (); // insert name (type) of attribute keyParts.Insert (0, name); StringBuilder sb = new StringBuilder (); foreach (string value in keyParts) { sb.Append (value); sb.Append (';'); } key = sb.ToString (); } else { key = name; } return key; } protected override void LoadExtraData(string name, XmlNode node) { XmlNode pNode = node.SelectSingleNode ("properties"); if (name.EndsWith ("TODOAttribute")) { isTodo = true; if (pNode.ChildNodes [0].Attributes ["value"] != null) { comment = pNode.ChildNodes [0].Attributes ["value"].Value; } return; } if (pNode != null) { XMLAttributeProperties p = new XMLAttributeProperties (name); p.LoadData (pNode); properties[name] = p; } } public override string GroupName { get { return "attributes"; } } public override string Name { get { return "attribute"; } } public bool IsTodo { get { return isTodo; } } public string Comment { get { return comment; } } } class XMLInterfaces : XMLNameGroup { public override string GroupName { get { return "interfaces"; } } public override string Name { get { return "interface"; } } } abstract class XMLGenericGroup : XMLNameGroup { string attributes; protected override void LoadExtraData (string name, XmlNode node) { attributes = ((XmlElement) node).GetAttribute ("generic-attribute"); } protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) { base.CompareToInner (name, parent, other); XMLGenericGroup g = (XMLGenericGroup) other; if (attributes != g.attributes) AddWarning (parent, "Incorrect generic attributes: '{0}' != '{1}'", attributes, g.attributes); } } class XMLGenericTypeConstraints : XMLGenericGroup { public override string GroupName { get { return "generic-type-constraints"; } } public override string Name { get { return "generic-type-constraint"; } } } class XMLGenericMethodConstraints : XMLGenericGroup { public override string GroupName { get { return "generic-method-constraints"; } } public override string Name { get { return "generic-method-constraint"; } } } abstract class XMLMember : XMLNameGroup { Hashtable attributeMap; Hashtable access = new Hashtable (); protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["attrib"]; if (xatt != null) access [name] = xatt.Value; XmlNode orig = node; node = node.FirstChild; while (node != null) { if (node != null && node.Name == "attributes") { XMLAttributes a = new XMLAttributes (); a.LoadData (node); if (attributeMap == null) attributeMap = new Hashtable (); attributeMap [name] = a; break; } node = node.NextSibling; } base.LoadExtraData (name, orig); } protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) { base.CompareToInner (name, parent, other); XMLMember mb = other as XMLMember; XMLAttributes att = null; XMLAttributes oatt = null; if (attributeMap != null) att = attributeMap [name] as XMLAttributes; if (mb != null && mb.attributeMap != null) oatt = mb.attributeMap [name] as XMLAttributes; if (att != null || oatt != null) { if (att == null) att = new XMLAttributes (); att.CompareTo (document, parent, oatt); counters.AddPartialToPartial(att.Counters); if (oatt != null && oatt.IsTodo) { counters.Todo++; counters.ErrorTotal++; AddAttribute (parent, "error", "todo"); if (oatt.Comment != null) AddAttribute (parent, "comment", oatt.Comment); } } XMLMember member = (XMLMember) other; string acc = access [name] as string; if (acc == null) return; string oacc = null; if (member.access != null) oacc = member.access [name] as string; string accName = ConvertToString (Int32.Parse (acc)); string oaccName = ""; if (oacc != null) oaccName = ConvertToString (Int32.Parse (oacc)); if (accName != oaccName) AddWarning (parent, "Incorrect attributes: '{0}' != '{1}'", accName, oaccName); } protected virtual string ConvertToString (int att) { return null; } } class XMLFields : XMLMember { Hashtable fieldTypes; Hashtable fieldValues; protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["fieldtype"]; if (xatt != null) { if (fieldTypes == null) fieldTypes = new Hashtable (); fieldTypes [name] = xatt.Value; } xatt = node.Attributes ["value"]; if (xatt != null) { if (fieldValues == null) fieldValues = new Hashtable (); fieldValues[name] = xatt.Value; } base.LoadExtraData (name, node); } protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) { base.CompareToInner (name, parent, other); XMLFields fields = (XMLFields) other; if (fieldTypes != null) { string ftype = fieldTypes [name] as string; string oftype = null; if (fields.fieldTypes != null) oftype = fields.fieldTypes [name] as string; if (ftype != oftype) AddWarning (parent, "Field type is {0} and should be {1}", oftype, ftype); } if (fieldValues != null) { string fvalue = fieldValues [name] as string; string ofvalue = null; if (fields.fieldValues != null) ofvalue = fields.fieldValues [name] as string; if (fvalue != ofvalue) AddWarning (parent, "Field value is {0} and should be {1}", ofvalue, fvalue); } } protected override string ConvertToString (int att) { FieldAttributes fa = (FieldAttributes) att; return fa.ToString (); } public override string GroupName { get { return "fields"; } } public override string Name { get { return "field"; } } } class XMLParameters : XMLNameGroup { public override void LoadData (XmlNode node) { if (node == null) throw new ArgumentNullException ("node"); if (node.Name != GroupName) throw new FormatException (String.Format ("Expecting <{0}>", GroupName)); keys = new Hashtable (); foreach (XmlNode n in node.ChildNodes) { string name = n.Attributes["name"].Value; string key = GetNodeKey (name, n); XMLParameter parm = new XMLParameter (); parm.LoadData (n); keys.Add (key, parm); LoadExtraData (key, n); } } public override string GroupName { get { return "parameters"; } } public override string Name { get { return "parameter"; } } public override string GetNodeKey (string name, XmlNode node) { return node.Attributes["position"].Value; } public override void CompareTo (XmlDocument doc, XmlNode parent, object other) { this.document = doc; if (group == null) group = doc.CreateElement (GroupName, null); Hashtable okeys = null; if (other != null && ((XMLParameters) other).keys != null) { okeys = ((XMLParameters) other).keys; } XmlNode node = null; bool onull = (okeys == null); if (keys != null) { foreach (DictionaryEntry entry in keys) { node = doc.CreateElement (Name, null); group.AppendChild (node); string key = (string) entry.Key; XMLParameter parm = (XMLParameter) entry.Value; AddAttribute (node, "name", parm.Name); if (!onull && HasKey (key, okeys)) { parm.CompareTo (document, node, okeys[key]); counters.AddPartialToPartial (parm.Counters); okeys.Remove (key); counters.Present++; } else { AddAttribute (node, "presence", "missing"); counters.Missing++; } } } if (!onull && okeys.Count != 0) { foreach (XMLParameter value in okeys.Values) { node = doc.CreateElement (Name, null); AddAttribute (node, "name", value.Name); AddAttribute (node, "presence", "extra"); group.AppendChild (node); counters.Extra++; } } if (group.HasChildNodes) parent.AppendChild (group); } } class XMLProperties : XMLMember { Hashtable nameToMethod = new Hashtable (); protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) { Counters copy = counters; counters = new Counters(); XMLProperties oprop = other as XMLProperties; if (oprop != null) { XMLMethods m = nameToMethod [name] as XMLMethods; XMLMethods om = oprop.nameToMethod [name] as XMLMethods; if (m != null || om != null) { if (m == null) m = new XMLMethods (); m.CompareTo(document, parent, om); counters.AddPartialToPartial(m.Counters); } } base.CompareToInner (name, parent, other); AddCountersAttributes(parent); copy.AddPartialToPartial(counters); counters = copy; } protected override void LoadExtraData (string name, XmlNode node) { XmlNode orig = node; node = node.FirstChild; while (node != null) { if (node != null && node.Name == "methods") { XMLMethods m = new XMLMethods (); XmlNode parent = node.ParentNode; string key = GetNodeKey (name, parent); m.LoadData (node); nameToMethod [key] = m; break; } node = node.NextSibling; } base.LoadExtraData (name, orig); } public override string GetNodeKey (string name, XmlNode node) { XmlAttributeCollection atts = node.Attributes; return String.Format ("{0}:{1}:{2}", atts ["name"].Value, atts ["ptype"].Value, atts ["params"].Value); } public override string GroupName { get { return "properties"; } } public override string Name { get { return "property"; } } } class XMLEvents : XMLMember { Hashtable eventTypes; protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["eventtype"]; if (xatt != null) { if (eventTypes == null) eventTypes = new Hashtable (); eventTypes [name] = xatt.Value; } base.LoadExtraData (name, node); } protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) { Counters copy = counters; counters = new Counters (); try { base.CompareToInner (name, parent, other); AddCountersAttributes (parent); if (eventTypes == null) return; XMLEvents evt = (XMLEvents) other; string etype = eventTypes [name] as string; string oetype = null; if (evt.eventTypes != null) oetype = evt.eventTypes [name] as string; if (etype != oetype) AddWarning (parent, "Event type is {0} and should be {1}", oetype, etype); } finally { AddCountersAttributes (parent); copy.AddPartialToPartial (counters); counters = copy; } } protected override string ConvertToString (int att) { EventAttributes ea = (EventAttributes) att; return ea.ToString (); } public override string GroupName { get { return "events"; } } public override string Name { get { return "event"; } } } class XMLMethods : XMLMember { Hashtable returnTypes; Hashtable parameters; Hashtable genericConstraints; Hashtable signatureFlags; [Flags] enum SignatureFlags { None = 0, Abstract = 1, Virtual = 2, Static = 4 } protected override void LoadExtraData (string name, XmlNode node) { XmlAttribute xatt = node.Attributes ["returntype"]; if (xatt != null) { if (returnTypes == null) returnTypes = new Hashtable (); returnTypes [name] = xatt.Value; } SignatureFlags flags = SignatureFlags.None; if (((XmlElement) node).GetAttribute ("abstract") == "true") flags |= SignatureFlags.Abstract; if (((XmlElement) node).GetAttribute ("static") == "true") flags |= SignatureFlags.Static; if (((XmlElement) node).GetAttribute ("virtual") == "true") flags |= SignatureFlags.Virtual; if (flags != SignatureFlags.None) { if (signatureFlags == null) signatureFlags = new Hashtable (); signatureFlags [name] = flags; } XmlNode parametersNode = node.SelectSingleNode ("parameters"); if (parametersNode != null) { if (parameters == null) parameters = new Hashtable (); XMLParameters parms = new XMLParameters (); parms.LoadData (parametersNode); parameters[name] = parms; } XmlNode genericNode = node.SelectSingleNode ("generic-method-constraints"); if (genericNode != null) { if (genericConstraints == null) genericConstraints = new Hashtable (); XMLGenericMethodConstraints csts = new XMLGenericMethodConstraints (); csts.LoadData (genericNode); genericConstraints [name] = csts; } base.LoadExtraData (name, node); } protected override void CompareToInner (string name, XmlNode parent, XMLNameGroup other) { // create backup of actual counters Counters copy = counters; // initialize counters for current method counters = new Counters(); try { base.CompareToInner(name, parent, other); XMLMethods methods = (XMLMethods) other; SignatureFlags flags = signatureFlags != null && signatureFlags.ContainsKey (name) ? (SignatureFlags) signatureFlags [name] : SignatureFlags.None; SignatureFlags oflags = methods.signatureFlags != null && methods.signatureFlags.ContainsKey (name) ? (SignatureFlags) methods.signatureFlags [name] : SignatureFlags.None; if (flags!= oflags) { if (flags == SignatureFlags.None) AddWarning (parent, String.Format ("should not be {0}", oflags)); else if (oflags == SignatureFlags.None) AddWarning (parent, String.Format ("should be {0}", flags)); else AddWarning (parent, String.Format ("{0} and should be {1}", oflags, flags)); } if (returnTypes != null) { string rtype = returnTypes[name] as string; string ortype = null; if (methods.returnTypes != null) ortype = methods.returnTypes[name] as string; if (rtype != ortype) AddWarning (parent, "Return type is {0} and should be {1}", ortype, rtype); } if (parameters != null) { XMLParameters parms = parameters[name] as XMLParameters; parms.CompareTo (document, parent, methods.parameters[name]); counters.AddPartialToPartial (parms.Counters); } } finally { // output counter attributes in result document AddCountersAttributes(parent); // add temporary counters to actual counters copy.AddPartialToPartial(counters); // restore backup of actual counters counters = copy; } } protected override string ConvertToString (int att) { MethodAttributes ma = (MethodAttributes) att; // ignore ReservedMasks ma &= ~ MethodAttributes.ReservedMask; ma &= ~ MethodAttributes.VtableLayoutMask; if ((ma & MethodAttributes.FamORAssem) != 0) ma = (ma & ~ MethodAttributes.FamORAssem) | MethodAttributes.Family; // ignore the HasSecurity attribute for now if ((ma & MethodAttributes.HasSecurity) != 0) ma = (MethodAttributes) (att - (int) MethodAttributes.HasSecurity); // ignore the RequireSecObject attribute for now if ((ma & MethodAttributes.RequireSecObject) != 0) ma = (MethodAttributes) (att - (int) MethodAttributes.RequireSecObject); // we don't care if the implementation is forwarded through PInvoke if ((ma & MethodAttributes.PinvokeImpl) != 0) ma = (MethodAttributes) (att - (int) MethodAttributes.PinvokeImpl); return ma.ToString (); } public override string GroupName { get { return "methods"; } } public override string Name { get { return "method"; } } } class XMLConstructors : XMLMethods { public override string GroupName { get { return "constructors"; } } public override string Name { get { return "constructor"; } } } class XmlNodeComparer : IComparer { public static XmlNodeComparer Default = new XmlNodeComparer (); public int Compare (object a, object b) { XmlNode na = (XmlNode) a; XmlNode nb = (XmlNode) b; return String.Compare (na.Attributes ["name"].Value, nb.Attributes ["name"].Value); } } } mono-tools-4.2/ilcontrast/ilcontrast.png0000664000175000017500000000070012413742070022556 0ustar00directhexdirecthex00000000000000PNG  IHDR@@. pHYsodrIDATxY0 >zo0 2&r⇰-w}A,[@k5b9X|@A$@33R-4:@б @t*!O  9c *;> ^"ٯ8:pygp 2Z,nt/18LJqwRF03<(j D P)a] \Nm@tN]y9m_3lD_, q,"Io$IK٣+=~3)ҧoek-OF>|eP6@: D2U|e53Դn!]e ;IENDB`mono-tools-4.2/ilcontrast/Makefile.am0000664000175000017500000000274512642235713021742 0ustar00directhexdirecthex00000000000000TARGET = ilcontrast.exe CLEANFILES = $(TARGET) $(TARGET).mdb DISTCLEANFILES = Global.cs ilcontrast ilcontrast.desktop EXTRA_DIST = $(sources) ilcontrast.png mono-api.xsl deploy.tar Global.cs.in ilcontrast.in ilcontrast.desktop.in assemblydir = $(libdir)/ilcontrast desktopdir = $(datadir)/applications pixmapdir = $(datadir)/pixmaps if ENABLE_WEBKIT assembly_DATA = $(TARGET) bin_SCRIPTS = ilcontrast desktop_DATA = ilcontrast.desktop pixmap_DATA = ilcontrast.png else if ENABLE_GECKO assembly_DATA = $(TARGET) bin_SCRIPTS = ilcontrast desktop_DATA = ilcontrast.desktop pixmap_DATA = ilcontrast.png else all: echo "Install webkit-sharp or gecko-sharp to build ilContrast" endif endif if ENABLE_WEBKIT references = $(GTK_SHARP_LIBS) $(WEBKIT_SHARP_LIBS) -r:ICSharpCode.SharpZipLib.dll else references = $(GTK_SHARP_LIBS) $(GECKO_SHARP_LIBS) -d:USE_GECKO -r:ICSharpCode.SharpZipLib.dll endif resources = \ /resource:$(srcdir)/ilcontrast.png,ilcontrast.png \ /resource:$(srcdir)/mono-api.xsl,mono-api.xsl \ /resource:$(srcdir)/deploy.tar,deploy.tar \ # sources = \ Application.cs \ ComparisonInfo.cs \ Window.cs \ mono-api-diff.cs \ mono-api-info.cs \ # build_sources = Global.cs $(addprefix $(srcdir)/, $(sources)) ilcontrast.exe: $(build_sources) $(MCS) -out:ilcontrast.exe $(references) $(resources) $(build_sources) Global.cs: Global.cs.in sed -e "s|\@VERSION\@|$(VERSION)|" $< > $@ ilcontrast.desktop: ilcontrast.desktop.in sed -e "s|\@bindir\@|$(bindir)|" $< > $@ mono-tools-4.2/ilcontrast/ilcontrast.in0000664000175000017500000000250512413742070022405 0ustar00directhexdirecthex00000000000000#! /bin/sh prefix=@prefix@ exec_prefix=@exec_prefix@ ilcontrastdir=$prefix/lib/ilcontrast getdirectory () { w=`which $1` if test -h $w; then (cd `dirname $w`/`dirname \`readlink $w\``; pwd) else dirname $w fi } if test -n "$MOZILLA_FIVE_HOME"; then MOZILLA_HOME=$MOZILLA_FIVE_HOME elif test x@MOZILLA_HOME@ != x; then if [ -f @MOZILLA_HOME@/chrome/comm.jar ]; then MOZILLA_HOME=@MOZILLA_HOME@ fi elif grep GRE_PATH /etc/gre.d/*.conf > /dev/null ; then MOZILLA_HOME=$(grep -h GRE_PATH= /etc/gre.d/*.conf | cut -d '"' -f 2 -d = | head -n 1) elif [ $(which xulrunner 2> /dev/null) ] > /dev/null ; then MOZILLA_FIVE_HOME=`getdirectory xulrunner` MOZILLA_HOME=$MOZILLA_FIVE_HOME elif [ $(which mozilla 2> /dev/null) ] && grep MOZILLA_FIVE_HOME= "$(which mozilla)" > /dev/null ; then MOZILLA_HOME=$(grep MOZILLA_FIVE_HOME= $(which mozilla) | cut -d '"' -f 2) elif [ $(which firefox 2> /dev/null) ] && grep MOZILLA_FIVE_HOME= "$(which firefox)" > /dev/null ; then MOZILLA_HOME=$(grep MOZILLA_FIVE_HOME= $(which firefox) | cut -d '"' -f 2) fi if [ -n $LD_LIBRARY_PATH ]; then export LD_LIBRARY_PATH=$MOZILLA_HOME:$LD_LIBRARY_PATH else export LD_LIBRARY_PATH=$MOZILLA_HOME fi export MOZILLA_FIVE_HOME export MOZILLA_HOME export LD_LIBRARY_PATH exec @RUNTIME@ $ilcontrastdir/ilcontrast.exe "$@" mono-tools-4.2/create-native-map/0000775000175000017500000000000012642235741021017 5ustar00directhexdirecthex00000000000000mono-tools-4.2/create-native-map/ChangeLog0000664000175000017500000001510712413742070022567 0ustar00directhexdirecthex000000000000002007-06-28 Jonathan Pryor * src/create-native-map.cs: Sort members by Ordinal|IgnoreCase; sort types by their .FullName property, so that namespace is taken into account when sorting them and emitting their declarations. * src/TestMap.cs: Make one of the enum's a `long' type, to see how the constants change in the generated .h file. * src/test.h.ref, src/test.xml.ref, src/test.c.ref, src/test.cs.ref: Flush (due to TestEnum type change in TestMap.cs). 2007-04-12 Jonathan Pryor * src/create-native-map.cs: Remove unused methods; fix indenting; fix _cnm_return_val_if_overflow() so that it doesn't trigger false positives on Linux and Intel Mac OS X * src/Makefile.am: Test --impl-header with a header that actually exists -- allows the libtest.so target to actually work. (Granted, now "test.h" has *two* includes in test.c, but that's not a problem.) Add a test-overflow target to create test-overflow program from test-overflow.c, test-overflow.h. * src/test-overflow.c, src/test-overflow.h: Tests for _cnm_return_val_if_overflow(). * src/test.c.ref: Flush. 2006-11-30 Mike Kestner * bin/Makefile.am: distcheck fixes * bin/create-native-map.in: renamed for distcheck friendliness * src/Makefile.am: distcheck fixes 2006-11-30 Jonathan Pryor * src/create-native-map.cs: _cnm_return_val_if_overflow() shouldn't check for overflow if DEBUG isn't defined. It's causing too many false positives in MonoPosixHelper. * src/test.c.ref: Flush (_cnm_return_val_if_overflow() change). 2006-11-17 Jonathan Pryor * src/create-native-map.cs: SupressFlags values should still be bitwise OR'd with the value returned from the FromManagedType() functions, just like they are in the ToManagedType() functions. * src/test.c.ref: Flush (SuppressFlags fix) 2006-11-15 Jonathan Pryor * src/create-native-map.cs: - Mask against SuppressFlags if SuppressFlags is non-null, as if you have bitmask & non-bitmask values in the same enum, it's fairly certain that the non-bitmask values won't start at 0. This fixes FilePermissions mapping in MonoPosixHelper. - Fix _cnm_return_val_if_overflow() macro so that it doesn't generate warnings about value overflows. * src/MapAttribute.cs: Change SuppressFlags to be a string, not a bool. This contains the value to mask against. * src/TestMap.cs: Test new SuppressFlags semantics. * src/test.c.ref: Flush (updated _cnm_return_val_if_overflow() value; addition of bitmask semantics). 2006-10-30 Wade Berrier * src/Makefile.am bin/Makefile.am: add source files to EXTRA_DIST to fix building from tarball 2006-10-27 Jonathan Pryor * man/create-native-map.1: Add documentation for MapAttribute.SuppressFlags; remove documentation for MapAttribute.NativeSymbolPrefix. * src/create-native-map.cs: Add support for MapAttribute.SuppressFlags. * src/MapAttribute.cs: Add SuppressFlags property (default is false). * src/TestMap.cs: Add [Flags] enums, and tests for [Map(SuppressFlags=true)]. * src/test.c.ref, src/test.cs.ref, src/test.h.ref, src/test.xml.ref: Flush. 2006-10-26 Jonathan Pryor * src/create-native-map.cs: Enclose structure conversion functions with `#ifdef HAVE_<>', as not all platforms will have the required types. For example, only *nix platforms have `struct stat', so having a function which uses `struct stat' on Win32 will break (w/o the use of Cygwin). * src/test.c.ref: Flush. 2006-10-26 Jonathan Pryor * src/create-native-map.cs: Remove the fallback, and just fallback to the appropriate System.Int??.MinValue/MaxValue values. * src/test.c.ref: Flush. 2006-10-26 Jonathan Pryor * src/create-native-map.cs: Add support for limits fallbacks -- if G_MAXINT8 isn't defined, fallback to INT8_MAX (from ), and if that doesn't exist use a hard-coded (possibly wrong) implementation. * src/test.c.ref: Flush. 2006-10-24 Jonathan Pryor * Makefile.am, lib/Makefile.am: Added; build subdirectories. * bin/create-native-map: Script to startup `dirname`/../lib/create-native-map/create-native-map.exe. * bin/Makefile.am: Added; install $bindir/create-native-map. * lib/create-native-map/Makefile.am: Added; present to make sure $top_builddir/lib/create-native-map is created. * lib/pkgconfig/create-native-map.pc.in: Aded; pkgconfig file to copy an installed version of create-native-map.exe & MapAttribute.cs. * lib/pkgconfig/Makfile.am: Added; install the create-native-map.pc file. * man/create-native-map.1: Man page for create-native-map. * man/Makefile.am: Added; install the man page. * src/create-native-map.cs: - Moved from mcs/class/Mono.Posix/Mono.Unix.Native/make-map.cs - check for t.Namespace==null before looking using Configuration.NamespaceRenames (Dictionary`2 doesn't like null keys); - HeaderFileGenerator needs to know about member renames (so it uses the renamed member in conversion code); - Clean up enumeration generation for readablility. - Generate structure declarations for [Map]-decorated types and types used within a [DllImport]-marked method. - Warnings should be prefixed with "warning: ". - Don't generate function prototypes for already-generated functions (e.g. if we emit a prototype for Mono_Posix_ToFilePermissions, don't re-declare that function later because we found a DllImport for it). - Add new arguments: --autoconf-member, --exclude-native-symbol, --library, --rename-member, --rename-namespace. These are to: - Allow native structure members to only be accessed if an Autoconf macro is defined (--autoconf-member) - Modify the C "namespace" of types/functions (--rename-namespace) - Specify the DllImport library that prototypes should be generated for (--library) - Exclude symbols from the function declaration system (--exclude-native-symbol) - Member renaming (--rename-member). (Curse you glibc making st_atime a macro!) * src/Makefile.am: Added; build create-native-map.exe; test cases. * src/MapAttribute.cs: Added; the attribute that create-native-map looks for, and should be copied into projects using create-native-map. * src/TestMap.cs: Added; test case for create-native-map.exe * src/test.c.ref, src/test.cs.ref, src/test.h.ref, src/test.xml.ref: Added; expected create-native-map.exe output for TestMap.cs. * ChangeLog: Started. mono-tools-4.2/create-native-map/lib/0000775000175000017500000000000012642235741021565 5ustar00directhexdirecthex00000000000000mono-tools-4.2/create-native-map/lib/pkgconfig/0000775000175000017500000000000012642235741023534 5ustar00directhexdirecthex00000000000000mono-tools-4.2/create-native-map/lib/pkgconfig/Makefile.in0000664000175000017500000003631312642235731025606 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = create-native-map/lib/pkgconfig ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = create-native-map.pc CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 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)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in \ $(srcdir)/create-native-map.pc.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkgconfigdir = $(prefix)/lib/pkgconfig pkgconfig_DATA = create-native-map.pc DISTCLEANFILES = create-native-map.pc EXTRA_DIST = create-native-map.pc.in 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) --gnu create-native-map/lib/pkgconfig/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu create-native-map/lib/pkgconfig/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): create-native-map.pc: $(top_builddir)/config.status $(srcdir)/create-native-map.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 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: ctags CTAGS: cscope cscopelist: 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 $(DATA) installdirs: for dir in "$(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: 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-pkgconfigDATA 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: uninstall-pkgconfigDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-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 tags-am uninstall uninstall-am \ uninstall-pkgconfigDATA .PRECIOUS: Makefile # 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-tools-4.2/create-native-map/lib/pkgconfig/create-native-map.pc.in0000664000175000017500000000051712413742070027764 0ustar00directhexdirecthex00000000000000prefix=${pcfiledir}/../.. exec_prefix=${pcfiledir}/../.. libdir=@libdir@ includedir=${prefix}/include assemblies_dir=${libdir}/create-native-map Sources=${assemblies_dir}/MapAttribute.cs Programs=${assemblies_dir}/create-native-map.exe Name: create-native-map Description: C/C# Mapping Generator Version: @VERSION@ Requires: Libs: mono-tools-4.2/create-native-map/lib/pkgconfig/Makefile.am0000664000175000017500000000023412413742070025561 0ustar00directhexdirecthex00000000000000 pkgconfigdir = $(prefix)/lib/pkgconfig pkgconfig_DATA = create-native-map.pc DISTCLEANFILES = create-native-map.pc EXTRA_DIST = create-native-map.pc.in mono-tools-4.2/create-native-map/lib/Makefile.in0000664000175000017500000004547212642235731023645 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = create-native-map/lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = create-native-map pkgconfig 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) --gnu create-native-map/lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu create-native-map/lib/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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ 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-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/create-native-map/lib/create-native-map/0000775000175000017500000000000012642235741025067 5ustar00directhexdirecthex00000000000000mono-tools-4.2/create-native-map/lib/create-native-map/Makefile.in0000664000175000017500000003115312642235731027136 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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@ # do nothing VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = create-native-map/lib/create-native-map ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ 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) --gnu create-native-map/lib/create-native-map/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu create-native-map/lib/create-native-map/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: ctags CTAGS: cscope cscopelist: 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: 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-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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/create-native-map/lib/create-native-map/Makefile.am0000664000175000017500000000001612413742070027112 0ustar00directhexdirecthex00000000000000# do nothing mono-tools-4.2/create-native-map/lib/Makefile.am0000664000175000017500000000004612413742070023613 0ustar00directhexdirecthex00000000000000SUBDIRS = create-native-map pkgconfig mono-tools-4.2/create-native-map/src/0000775000175000017500000000000012642235741021606 5ustar00directhexdirecthex00000000000000mono-tools-4.2/create-native-map/src/MapAttribute.cs0000664000175000017500000000331312413742070024530 0ustar00directhexdirecthex00000000000000// // MapAttribute.cs // // Author: // Miguel de Icaza (miguel@gnome.org) // // (C) 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; [AttributeUsage ( AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Struct)] internal class MapAttribute : Attribute { private string nativeType; private string suppressFlags; public MapAttribute () { } public MapAttribute (string nativeType) { this.nativeType = nativeType; } public string NativeType { get {return nativeType;} } public string SuppressFlags { get {return suppressFlags;} set {suppressFlags = value;} } } mono-tools-4.2/create-native-map/src/create-native-map.cs0000664000175000017500000016115612642235713025450 0ustar00directhexdirecthex00000000000000// // create-native-map.cs: Builds a C map of constants defined on C# land // // Authors: // Miguel de Icaza (miguel@novell.com) // Jonathan Pryor (jonpryor@vt.edu) // // (C) 2003 Novell, Inc. // (C) 2004-2005 Jonathan Pryor // // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // 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.Globalization; using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; using Mono.Unix.Native; delegate void CreateFileHandler (string assembly_name, string file_prefix); delegate void AssemblyAttributesHandler (Assembly assembly); delegate void TypeHandler (Type t, string ns, string fn); delegate void CloseFileHandler (string file_prefix); class MakeMap { public static int Main (string [] args) { FileGenerator[] generators = new FileGenerator[]{ new HeaderFileGenerator (), new SourceFileGenerator (), new ConvertFileGenerator (), new ConvertDocFileGenerator (), }; Configuration config = new Configuration (); bool exit = false; try { exit = !config.Parse (args); } catch (Exception e) { Console.WriteLine ("{0}: error: {1}", Environment.GetCommandLineArgs () [0], e.Message); exit = true; } if (exit) { Configuration.ShowHelp (); return 1; } MapUtils.config = config; MakeMap composite = new MakeMap (); foreach (FileGenerator g in generators) { g.Configuration = config; composite.FileCreators += new CreateFileHandler (g.CreateFile); composite.AssemblyAttributesHandler += new AssemblyAttributesHandler (g.WriteAssemblyAttributes); composite.TypeHandler += new TypeHandler (g.WriteType); composite.FileClosers += new CloseFileHandler (g.CloseFile); } return composite.Run (config); } event CreateFileHandler FileCreators; event AssemblyAttributesHandler AssemblyAttributesHandler; event TypeHandler TypeHandler; event CloseFileHandler FileClosers; int Run (Configuration config) { FileCreators (config.AssemblyFileName, config.OutputPrefix); Assembly assembly = Assembly.LoadFrom (config.AssemblyFileName); AssemblyAttributesHandler (assembly); Type [] exported_types = assembly.GetTypes (); Array.Sort (exported_types, new TypeFullNameComparer ()); foreach (Type t in exported_types) { string ns = MapUtils.GetNamespace (t); /* if (ns == null || !ns.StartsWith ("Mono")) continue; */ string fn = MapUtils.GetManagedType (t); TypeHandler (t, ns, fn); } FileClosers (config.OutputPrefix); return 0; } private class TypeFullNameComparer : IComparer { public int Compare (Type t1, Type t2) { if (t1 == t2) return 0; if (t1 == null) return 1; if (t2 == null) return -1; return CultureInfo.InvariantCulture.CompareInfo.Compare ( t1.FullName, t2.FullName, CompareOptions.Ordinal); } } } class Configuration { Dictionary renameMembers = new Dictionary (); Dictionary renameNamespaces = new Dictionary (); List libraries = new List(); List optionals = new List (); List excludes = new List (); List iheaders = new List (); List pheaders = new List (); List imacros = new List (); List pmacros = new List (); string assembly_name; string output; delegate void ArgumentHandler (Configuration c, string name, string value); static Dictionary handlers; static Configuration () { handlers = new Dictionary (); handlers ["autoconf-header"] = delegate (Configuration c, string name, string value) { c.iheaders.Add ("ah:" + name); }; handlers ["autoconf-member"] = delegate (Configuration c, string name, string value) { c.optionals.Add (name); }; handlers ["impl-header"] = delegate (Configuration c, string name, string value) { c.iheaders.Add (name); }; handlers ["impl-macro"] = delegate (Configuration c, string name, string value) { if (value != null) name += "=" + value; c.imacros.Add (name); }; handlers ["library"] = delegate (Configuration c, string name, string value) { c.libraries.Add (name); }; handlers ["exclude-native-symbol"] = delegate (Configuration c, string name, string value) { c.excludes.Add (name); }; handlers ["public-header"] = delegate (Configuration c, string name, string value) { c.pheaders.Add (name); }; handlers ["public-macro"] = delegate (Configuration c, string name, string value) { if (value != null) name += "=" + value; c.pmacros.Add (name); }; handlers ["rename-member"] = delegate (Configuration c, string name, string value) { if (value == null) { throw new Exception ("missing rename value"); } c.renameMembers [name] = value; }; handlers ["rename-namespace"] = delegate (Configuration c, string name, string value) { if (value == null) { throw new Exception ("missing rename value"); } value = value.Replace (".", "_"); c.renameNamespaces [name] = value; }; } public Configuration () { } public List NativeLibraries { get {return libraries;} } public List AutoconfMembers { get {return optionals;} } public List NativeExcludeSymbols { get {return excludes;} } public List PublicHeaders { get {return pheaders;} } public List PublicMacros { get {return pmacros;} } public List ImplementationHeaders { get {return iheaders;} } public List ImplementationMacros { get {return imacros;} } public IDictionary MemberRenames { get {return renameMembers;} } public IDictionary NamespaceRenames { get {return renameNamespaces;} } public string AssemblyFileName { get {return assembly_name;} } public string OutputPrefix { get {return output;} } const string NameValue = @"(?[^=]+)(=(?.*))?"; const string Argument = @"^--(?[\w-]+)([=:]" + NameValue + ")?$"; public bool Parse (string[] args) { Regex argRE = new Regex (Argument); Regex valRE = new Regex (NameValue); for (int i = 0; i < args.Length; ++i) { Match m = argRE.Match (args [i]); if (m.Success) { string arg = m.Groups ["Argument"].Value; if (arg == "help") return false; if (!m.Groups ["Name"].Success) { if ((i+1) >= args.Length) throw new Exception ( string.Format ("missing value for argument {0}", args [i])); m = valRE.Match (args [++i]); if (!m.Success) { throw new Exception ( string.Format ("invalid value for argument {0}: {1}", args [i-1], args[i])); } } string name = m.Groups ["Name"].Value; string value = m.Groups ["Value"].Success ? m.Groups ["Value"].Value : null; if (handlers.ContainsKey (arg)) { handlers [arg] (this, name, value); } else { throw new Exception ("invalid argument " + arg); } } else if (assembly_name == null) { assembly_name = args [i]; } else { output = args [i]; } } if (assembly_name == null) throw new Exception ("missing ASSEMBLY"); if (output == null) throw new Exception ("missing OUTPUT-PREFIX"); libraries.Sort (); optionals.Sort (); excludes.Sort (); return true; } public static void ShowHelp () { Console.WriteLine ( "Usage: create-native-map \n" + "\t[--autoconf-header=HEADER]* \n" + "\t[--autoconf-member=MEMBER]* \n" + "\t[--exclude-native-symbol=SYMBOL]*\n" + "\t[--impl-header=HEADER]* \n" + "\t[--impl-macro=MACRO]* \n" + "\t[--library=LIBRARY]+ \n" + "\t[--public-header=HEADER]* \n" + "\t[--public-macro=MACRO]* \n" + "\t[--rename-member=FROM=TO]* \n" + "\t[--rename-namespace=FROM=TO]*\n" + "\tASSEMBLY OUTPUT-PREFIX" ); } } static class MapUtils { internal static Configuration config; public static T GetCustomAttribute (MemberInfo element) where T : Attribute { return (T) Attribute.GetCustomAttribute (element, typeof(T), true); } public static T GetCustomAttribute (Assembly assembly) where T : Attribute { return (T) Attribute.GetCustomAttribute (assembly, typeof(T), true); } public static T[] GetCustomAttributes (MemberInfo element) where T : Attribute { return (T[]) Attribute.GetCustomAttributes (element, typeof(T), true); } public static T[] GetCustomAttributes (Assembly assembly) where T : Attribute { return (T[]) Attribute.GetCustomAttributes (assembly, typeof(T), true); } public static MapAttribute GetMapAttribute (ICustomAttributeProvider element) { foreach (object o in element.GetCustomAttributes (true)) { if (!IsMapAttribute (o)) continue; string nativeType = GetPropertyValueAsString (o, "NativeType"); MapAttribute map = nativeType == null ? new MapAttribute () : new MapAttribute (nativeType); map.SuppressFlags = GetPropertyValueAsString (o, "SuppressFlags"); return map; } return null; } private static bool IsMapAttribute (object o) { Type t = o.GetType (); do { if (t.Name == "MapAttribute") { return true; } t = t.BaseType; } while (t != null); return false; } private static string GetPropertyValueAsString (object o, string property) { object v = GetPropertyValue (o, property); string s = v == null ? null : v.ToString (); if (s != null) return s.Length == 0 ? null : s; return null; } private static object GetPropertyValue (object o, string property) { PropertyInfo p = o.GetType().GetProperty (property); if (p == null) return null; if (!p.CanRead) return null; return p.GetValue (o, new object[0]); } public static bool IsIntegralType (Type t) { return t == typeof(byte) || t == typeof(sbyte) || t == typeof(char) || t == typeof(short) || t == typeof(ushort) || t == typeof(int) || t == typeof(uint) || t == typeof(long) || t == typeof(ulong); } public static bool IsBlittableType (Type t) { return IsIntegralType (t) || t == typeof(IntPtr) || t == typeof(UIntPtr); } public static string GetNativeType (Type t) { Type et = GetElementType (t); string ut = et.Name; if (et.IsEnum) ut = Enum.GetUnderlyingType (et).Name; string type = null; switch (ut) { case "Boolean": type = "int"; break; case "Byte": type = "unsigned char"; break; case "SByte": type = "signed char"; break; case "Int16": type = "short"; break; case "UInt16": type = "unsigned short"; break; case "Int32": type = "int"; break; case "UInt32": type = "unsigned int"; break; case "Int64": type = "gint64"; break; case "UInt64": type = "guint64"; break; case "IntPtr": type = "void*"; break; case "UIntPtr": type = "void*"; break; case "String": type = "const char"; break; /* ref type */ case "StringBuilder": type = "char"; break; /* ref type */ case "Void": type = "void"; break; case "HandleRef": type = "void*"; break; } bool isDelegate = IsDelegate (t); if (type == null) type = isDelegate ? t.Name : GetStructName (t); if (!et.IsValueType && !isDelegate) { type += "*"; } while (t.HasElementType) { t = t.GetElementType (); type += "*"; } return type; //return (t.IsByRef || t.IsArray || (!t.IsValueType && !isDelegate)) ? type + "*" : type; } public static bool IsDelegate (Type t) { return typeof(Delegate).IsAssignableFrom (t); } private static string GetStructName (Type t) { t = GetElementType (t); return "struct " + GetManagedType (t); } public static Type GetElementType (Type t) { while (t.HasElementType) { t = t.GetElementType (); } return t; } public static string GetNamespace (Type t) { if (t.Namespace == null) return ""; if (config.NamespaceRenames.ContainsKey (t.Namespace)) return config.NamespaceRenames [t.Namespace]; return t.Namespace.Replace ('.', '_'); } public static string GetManagedType (Type t) { string ns = GetNamespace (t); string tn = (t.DeclaringType != null ? t.DeclaringType.Name + "_" : "") + t.Name; return ns + "_" + tn; } public static string GetNativeType (FieldInfo field) { MapAttribute map = GetMapAttribute (field) ?? GetMapAttribute (field.FieldType); if (map != null) return map.NativeType; return null; } public static string GetFunctionDeclaration (string name, MethodInfo method) { StringBuilder sb = new StringBuilder (); #if false Console.WriteLine (t); foreach (object o in t.GetMembers ()) Console.WriteLine ("\t" + o); #endif sb.Append (method.ReturnType == typeof(string) ? "char*" : MapUtils.GetNativeType (method.ReturnType)); sb.Append (" ").Append (name).Append (" ("); ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length == 0) { sb.Append ("void"); } else { if (parameters.Length > 0) { WriteParameterDeclaration (sb, parameters [0]); } for (int i = 1; i < parameters.Length; ++i) { sb.Append (", "); WriteParameterDeclaration (sb, parameters [i]); } } sb.Append (")"); return sb.ToString (); } private static void WriteParameterDeclaration (StringBuilder sb, ParameterInfo pi) { // DumpTypeInfo (pi.ParameterType); string nt = GetNativeType (pi.ParameterType); sb.AppendFormat ("{0} {1}", nt, pi.Name); } internal class _MemberNameComparer : IComparer, IComparer { public int Compare (FieldInfo m1, FieldInfo m2) { return Compare ((MemberInfo) m1, (MemberInfo) m2); } public int Compare (MemberInfo m1, MemberInfo m2) { if (m1 == m2) return 0; if (m1 == null) return 1; if (m2 == null) return -1; return CultureInfo.InvariantCulture.CompareInfo.Compare ( m1.Name, m2.Name, CompareOptions.Ordinal); } } private class _OrdinalStringComparer : IComparer { public int Compare (string s1, string s2) { if (object.ReferenceEquals (s1, s2)) return 0; if (s1 == null) return 1; if (s2 == null) return -1; return CultureInfo.InvariantCulture.CompareInfo.Compare (s1, s2, CompareOptions.OrdinalIgnoreCase); } } internal static _MemberNameComparer MemberNameComparer = new _MemberNameComparer (); internal static IComparer OrdinalStringComparer = new _OrdinalStringComparer (); } abstract class FileGenerator { private Configuration config; public Configuration Configuration { get {return config;} set {config = value;} } public abstract void CreateFile (string assembly_name, string file_prefix); public virtual void WriteAssemblyAttributes (Assembly assembly) { } public abstract void WriteType (Type t, string ns, string fn); public abstract void CloseFile (string file_prefix); protected static void WriteHeader (StreamWriter s, string assembly) { WriteHeader (s, assembly, false); } protected static void WriteHeader (StreamWriter s, string assembly, bool noConfig) { s.WriteLine ( "/*\n" + " * This file was automatically generated by create-native-map from {0}.\n" + " *\n" + " * DO NOT MODIFY.\n" + " */", assembly); if (!noConfig) { s.WriteLine ("#ifdef HAVE_CONFIG_H"); s.WriteLine ("#include "); s.WriteLine ("#endif /* ndef HAVE_CONFIG_H */"); } s.WriteLine (); } protected static bool CanMapType (Type t) { return MapUtils.GetMapAttribute (t) != null; } protected static bool IsFlagsEnum (Type t) { return t.IsEnum && MapUtils.GetCustomAttributes (t).Length > 0; } protected static void SortFieldsInOffsetOrder (Type t, FieldInfo[] fields) { Array.Sort (fields, delegate (FieldInfo f1, FieldInfo f2) { long o1 = (long) Marshal.OffsetOf (f1.DeclaringType, f1.Name); long o2 = (long) Marshal.OffsetOf (f2.DeclaringType, f2.Name); return o1.CompareTo (o2); }); } protected static void WriteMacroDefinition (TextWriter writer, string macro) { if (macro == null || macro.Length == 0) return; string[] val = macro.Split ('='); writer.WriteLine ("#ifndef {0}", val [0]); writer.WriteLine ("#define {0}{1}", val [0], val.Length > 1 ? " " + val [1] : ""); writer.WriteLine ("#endif /* ndef {0} */", val [0]); writer.WriteLine (); } private static Regex includeRegex = new Regex (@"^(?ah:)?(?(""|<)(?.*)(""|>))$"); protected static void WriteIncludeDeclaration (TextWriter writer, string inc) { if (inc == null || inc.Length == 0) return; Match m = includeRegex.Match (inc); if (!m.Groups ["Include"].Success) { Console.WriteLine ("warning: invalid PublicIncludeFile: {0}", inc); return; } if (m.Success && m.Groups ["AutoHeader"].Success) { string i = m.Groups ["IncludeFile"].Value; string def = "HAVE_" + i.ToUpper ().Replace ("/", "_").Replace (".", "_"); writer.WriteLine ("#ifdef {0}", def); writer.WriteLine ("#include {0}", m.Groups ["Include"]); writer.WriteLine ("#endif /* ndef {0} */", def); } else writer.WriteLine ("#include {0}", m.Groups ["Include"]); } protected string GetNativeMemberName (FieldInfo field) { if (!Configuration.MemberRenames.ContainsKey (field.Name)) return field.Name; return Configuration.MemberRenames [field.Name]; } } class HeaderFileGenerator : FileGenerator { StreamWriter sh; string assembly_file; Dictionary methods = new Dictionary (); Dictionary structs = new Dictionary (); Dictionary delegates = new Dictionary (); List decls = new List (); public override void CreateFile (string assembly_name, string file_prefix) { sh = File.CreateText (file_prefix + ".h"); file_prefix = file_prefix.Replace ("../", "").Replace ("/", "_"); this.assembly_file = assembly_name = Path.GetFileName (assembly_name); WriteHeader (sh, assembly_name, true); assembly_name = assembly_name.Replace (".dll", "").Replace (".", "_"); sh.WriteLine ("#ifndef INC_" + assembly_name + "_" + file_prefix + "_H"); sh.WriteLine ("#define INC_" + assembly_name + "_" + file_prefix + "_H\n"); sh.WriteLine ("#include \n"); sh.WriteLine ("G_BEGIN_DECLS\n"); // Kill warning about unused method DumpTypeInfo (null); } public override void WriteAssemblyAttributes (Assembly assembly) { sh.WriteLine ("/*\n * Public Macros\n */"); foreach (string def in Configuration.PublicMacros) { WriteMacroDefinition (sh, def); } sh.WriteLine (); sh.WriteLine ("/*\n * Public Includes\n */"); foreach (string inc in Configuration.PublicHeaders) { WriteIncludeDeclaration (sh, inc); } sh.WriteLine (); sh.WriteLine ("/*\n * Enumerations\n */"); } public override void WriteType (Type t, string ns, string fn) { WriteEnum (t, ns, fn); CacheStructs (t, ns, fn); CacheExternalMethods (t, ns, fn); } private void WriteEnum (Type t, string ns, string fn) { if (!CanMapType (t) || !t.IsEnum) return; string etype = MapUtils.GetNativeType (t); WriteLiteralValues (sh, t, fn); sh.WriteLine ("int {1}_From{2} ({0} x, {0} *r);", etype, ns, t.Name); sh.WriteLine ("int {1}_To{2} ({0} x, {0} *r);", etype, ns, t.Name); Configuration.NativeExcludeSymbols.Add ( string.Format ("{1}_From{2}", etype, ns, t.Name)); Configuration.NativeExcludeSymbols.Add ( string.Format ("{1}_To{2}", etype, ns, t.Name)); Configuration.NativeExcludeSymbols.Sort (); sh.WriteLine (); } static void WriteLiteralValues (StreamWriter sh, Type t, string n) { object inst = Activator.CreateInstance (t); int max_field_length = 0; FieldInfo[] fields = t.GetFields (); Array.Sort (fields, delegate (FieldInfo f1, FieldInfo f2) { max_field_length = Math.Max (max_field_length, f1.Name.Length); max_field_length = Math.Max (max_field_length, f2.Name.Length); return MapUtils.MemberNameComparer.Compare (f1, f2); }); max_field_length += 1 + n.Length; sh.WriteLine ("enum {0} {{", n); foreach (FieldInfo fi in fields) { if (!fi.IsLiteral) continue; string e = n + "_" + fi.Name; sh.WriteLine ("\t{0,-" + max_field_length + "} = 0x{1},", e, string.Format ("{0:x}", fi.GetValue (inst)).ToLower ()); sh.WriteLine ("\t#define {0,-" + max_field_length + "} {0}", e); } sh.WriteLine ("};"); } private void CacheStructs (Type t, string ns, string fn) { if (t.IsEnum) return; MapAttribute map = MapUtils.GetMapAttribute (t); if (map != null) { if (map.NativeType != null && map.NativeType.Length > 0) decls.Add (map.NativeType); RecordTypes (t); } } private void CacheExternalMethods (Type t, string ns, string fn) { BindingFlags bf = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; foreach (MethodInfo m in t.GetMethods (bf)) { if ((m.Attributes & MethodAttributes.PinvokeImpl) == 0) continue; DllImportAttribute dia = GetDllImportInfo (m); if (dia == null) { Console.WriteLine ("warning: unable to emit native prototype for P/Invoke " + "method: {0}", m); continue; } // we shouldn't declare prototypes for POSIX, etc. functions. if (Configuration.NativeLibraries.BinarySearch (dia.Value) < 0 || IsOnExcludeList (dia.EntryPoint)) continue; methods [dia.EntryPoint] = m; RecordTypes (m); } } private static DllImportAttribute GetDllImportInfo (MethodInfo method) { // .NET 2.0 synthesizes pseudo-attributes such as DllImport DllImportAttribute dia = MapUtils.GetCustomAttribute (method); if (dia != null) return dia; // We're not on .NET 2.0; assume we're on Mono and use some internal // methods... Type MonoMethod = Type.GetType ("System.Reflection.MonoMethod", false); if (MonoMethod == null) { Console.WriteLine ("warning: cannot find MonoMethod"); return null; } MethodInfo GetDllImportAttribute = MonoMethod.GetMethod ("GetDllImportAttribute", BindingFlags.Static | BindingFlags.NonPublic); if (GetDllImportAttribute == null) { Console.WriteLine ("warning: cannot find GetDllImportAttribute"); return null; } IntPtr mhandle = method.MethodHandle.Value; return (DllImportAttribute) GetDllImportAttribute.Invoke (null, new object[]{mhandle}); } private bool IsOnExcludeList (string method) { int idx = Configuration.NativeExcludeSymbols.BinarySearch (method); return (idx < 0) ? false : true; } private void RecordTypes (MethodInfo method) { ParameterInfo[] parameters = method.GetParameters (); foreach (ParameterInfo pi in parameters) { RecordTypes (pi.ParameterType); } } private void RecordTypes (Type st) { if (typeof(Delegate).IsAssignableFrom (st) && !delegates.ContainsKey (st.Name)) { MethodInfo mi = st.GetMethod ("Invoke"); delegates [st.Name] = mi; RecordTypes (mi); return; } Type et = MapUtils.GetElementType (st); string s = MapUtils.GetNativeType (et); if (s.StartsWith ("struct ") && !structs.ContainsKey (et.FullName)) { structs [et.FullName] = et; foreach (FieldInfo fi in et.GetFields (BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { RecordTypes (fi.FieldType); } } } public override void CloseFile (string file_prefix) { IEnumerable structures = Sort (structs.Keys); sh.WriteLine (); sh.WriteLine ("/*\n * Managed Structure Declarations\n */\n"); foreach (string s in structures) { sh.WriteLine ("struct {0};", MapUtils.GetManagedType (structs [s])); } sh.WriteLine (); sh.WriteLine ("/*\n * Inferred Structure Declarations\n */\n"); foreach (string s in decls) { sh.WriteLine ("{0};", s); } sh.WriteLine (); sh.WriteLine ("/*\n * Delegate Declarations\n */\n"); foreach (string s in Sort (delegates.Keys)) { sh.WriteLine ("typedef {0};", MapUtils.GetFunctionDeclaration ("(*" + s + ")", delegates [s])); } sh.WriteLine (); sh.WriteLine ("/*\n * Structures\n */\n"); foreach (string s in structures) { WriteStructDeclarations (s); } sh.WriteLine (); sh.WriteLine ("/*\n * Functions\n */"); foreach (string method in Configuration.NativeExcludeSymbols) { if (methods.ContainsKey (method)) methods.Remove (method); } foreach (string method in Sort (methods.Keys)) { WriteMethodDeclaration ((MethodInfo) methods [method], method); } sh.WriteLine ("\nG_END_DECLS\n"); sh.WriteLine ("#endif /* ndef INC_Mono_Posix_" + file_prefix + "_H */\n"); sh.Close (); } private static IEnumerable Sort (ICollection c) { List al = new List (c); al.Sort (MapUtils.OrdinalStringComparer); return al; } private void WriteStructDeclarations (string s) { Type t = structs [s]; #if false if (!t.Assembly.CodeBase.EndsWith (this.assembly_file)) { return; } #endif sh.WriteLine ("struct {0} {{", MapUtils.GetManagedType (t)); FieldInfo[] fields = t.GetFields (BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); int max_type_len = 0, max_name_len = 0, max_native_len = 0; Array.ForEach (fields, delegate (FieldInfo f) { max_type_len = Math.Max (max_type_len, HeaderFileGenerator.GetType (f.FieldType).Length); max_name_len = Math.Max (max_name_len, GetNativeMemberName (f).Length); string native_type = MapUtils.GetNativeType (f); if (native_type != null) max_native_len = Math.Max (max_native_len, native_type.Length); }); SortFieldsInOffsetOrder (t, fields); foreach (FieldInfo field in fields) { string fname = GetNativeMemberName (field); sh.Write ("\t{0,-" + max_type_len + "} {1};", GetType (field.FieldType), fname); string native_type = MapUtils.GetNativeType (field); if (native_type != null) { sh.Write (new string (' ', max_name_len - fname.Length)); sh.Write (" /* {0,-" + max_native_len + "} */", native_type); } sh.WriteLine (); } sh.WriteLine ("};"); MapAttribute map = MapUtils.GetMapAttribute (t); if (map != null && map.NativeType != null && map.NativeType.Length != 0 && t.Assembly.CodeBase.EndsWith (this.assembly_file)) { sh.WriteLine (); sh.WriteLine ( "int\n{0}_From{1} ({3}{4} from, {2} *to);\n" + "int\n{0}_To{1} ({2} *from, {3}{4} to);\n", MapUtils.GetNamespace (t), t.Name, map.NativeType, MapUtils.GetNativeType (t), t.IsValueType ? "*" : ""); Configuration.NativeExcludeSymbols.Add ( string.Format ("{0}_From{1}", MapUtils.GetNamespace (t), t.Name)); Configuration.NativeExcludeSymbols.Add ( string.Format ("{0}_To{1}", MapUtils.GetNamespace (t), t.Name)); Configuration.NativeExcludeSymbols.Sort (); } sh.WriteLine (); } private static string GetType (Type t) { if (typeof(Delegate).IsAssignableFrom (t)) return t.Name; return MapUtils.GetNativeType (t); } private void WriteMethodDeclaration (MethodInfo method, string entryPoint) { if (method.ReturnType.IsClass) { Console.WriteLine ("warning: {0} has a return type of {1}, which is a reference type", entryPoint, method.ReturnType.FullName); } sh.Write (MapUtils.GetFunctionDeclaration (entryPoint, method)); sh.WriteLine (";"); } private void DumpTypeInfo (Type t) { if (t == null) return; sh.WriteLine ("\t\t/* Type Info for " + t.FullName + ":"); foreach (MemberInfo mi in typeof(Type).GetMembers()) { sh.WriteLine ("\t\t\t{0}={1}", mi.Name, GetMemberValue (mi, t)); } sh.WriteLine ("\t\t */"); } private static string GetMemberValue (MemberInfo mi, Type t) { try { switch (mi.MemberType) { case MemberTypes.Constructor: case MemberTypes.Method: { MethodBase b = (MethodBase) mi; if (b.GetParameters().Length == 0) return b.Invoke (t, new object[]{}).ToString(); return "<>"; } case MemberTypes.Field: return ((FieldInfo) mi).GetValue (t).ToString (); case MemberTypes.Property: { PropertyInfo pi = (PropertyInfo) mi; if (!pi.CanRead) return "<>"; return pi.GetValue (t, null).ToString (); } default: return "<>"; } } catch (Exception e) { return "<>"; } } } class SourceFileGenerator : FileGenerator { StreamWriter sc; string file_prefix; public override void CreateFile (string assembly_name, string file_prefix) { sc = File.CreateText (file_prefix + ".c"); WriteHeader (sc, assembly_name); if (file_prefix.IndexOf ("/") != -1) file_prefix = file_prefix.Substring (file_prefix.IndexOf ("/") + 1); this.file_prefix = file_prefix; sc.WriteLine ("#include "); sc.WriteLine ("#include "); sc.WriteLine (); } public override void WriteAssemblyAttributes (Assembly assembly) { sc.WriteLine ("/*\n * Implementation Macros\n */"); foreach (string def in Configuration.ImplementationMacros) { WriteMacroDefinition (sc, def); } sc.WriteLine (); sc.WriteLine ("/*\n * Implementation Includes\n */"); foreach (string inc in Configuration.ImplementationHeaders) { WriteIncludeDeclaration (sc, inc); } sc.WriteLine (); sc.WriteLine ("#include \"{0}.h\"", file_prefix); sc.WriteLine (@" #include /* errno, EOVERFLOW */ #include /* g* types, g_assert_not_reached() */"); WriteFallbackMacro ("CNM_MININT8", "G_MININT8", sbyte.MinValue.ToString ()); WriteFallbackMacro ("CNM_MAXINT8", "G_MAXINT8", sbyte.MaxValue.ToString ()); WriteFallbackMacro ("CNM_MAXUINT8", "G_MAXUINT8", byte.MaxValue.ToString ()); WriteFallbackMacro ("CNM_MININT16", "G_MININT16", short.MinValue.ToString ()); WriteFallbackMacro ("CNM_MAXINT16", "G_MAXINT16", short.MaxValue.ToString ()); WriteFallbackMacro ("CNM_MAXUINT16", "G_MAXUINT16", ushort.MaxValue.ToString ()); WriteFallbackMacro ("CNM_MININT32", "G_MININT32", int.MinValue.ToString ()); WriteFallbackMacro ("CNM_MAXINT32", "G_MAXINT32", int.MaxValue.ToString ()); WriteFallbackMacro ("CNM_MAXUINT32", "G_MAXUINT32", uint.MaxValue.ToString () + "U"); WriteFallbackMacro ("CNM_MININT64", "G_MININT64", long.MinValue.ToString () + "LL"); WriteFallbackMacro ("CNM_MAXINT64", "G_MAXINT64", long.MaxValue.ToString () + "LL"); WriteFallbackMacro ("CNM_MAXUINT64", "G_MAXUINT64", ulong.MaxValue.ToString () + "ULL"); sc.WriteLine (@" /* returns TRUE if @type is an unsigned type */ #define _cnm_integral_type_is_unsigned(type) \ (sizeof(type) == sizeof(gint8) \ ? (((type)-1) > CNM_MAXINT8) \ : sizeof(type) == sizeof(gint16) \ ? (((type)-1) > CNM_MAXINT16) \ : sizeof(type) == sizeof(gint32) \ ? (((type)-1) > CNM_MAXINT32) \ : sizeof(type) == sizeof(gint64) \ ? (((type)-1) > CNM_MAXINT64) \ : (g_assert_not_reached (), 0)) /* returns the minimum value of @type as a gint64 */ #define _cnm_integral_type_min(type) \ (_cnm_integral_type_is_unsigned (type) \ ? 0 \ : sizeof(type) == sizeof(gint8) \ ? CNM_MININT8 \ : sizeof(type) == sizeof(gint16) \ ? CNM_MININT16 \ : sizeof(type) == sizeof(gint32) \ ? CNM_MININT32 \ : sizeof(type) == sizeof(gint64) \ ? CNM_MININT64 \ : (g_assert_not_reached (), 0)) /* returns the maximum value of @type as a guint64 */ #define _cnm_integral_type_max(type) \ (_cnm_integral_type_is_unsigned (type) \ ? sizeof(type) == sizeof(gint8) \ ? CNM_MAXUINT8 \ : sizeof(type) == sizeof(gint16) \ ? CNM_MAXUINT16 \ : sizeof(type) == sizeof(gint32) \ ? CNM_MAXUINT32 \ : sizeof(type) == sizeof(gint64) \ ? CNM_MAXUINT64 \ : (g_assert_not_reached (), 0) \ : sizeof(type) == sizeof(gint8) \ ? CNM_MAXINT8 \ : sizeof(type) == sizeof(gint16) \ ? CNM_MAXINT16 \ : sizeof(type) == sizeof(gint32) \ ? CNM_MAXINT32 \ : sizeof(type) == sizeof(gint64) \ ? CNM_MAXINT64 \ : (g_assert_not_reached (), 0)) #ifdef _CNM_DUMP #define _cnm_dump(to_t,from) \ printf (""# %s -> %s: uns=%i; min=%llx; max=%llx; value=%llx; lt=%i; l0=%i; gt=%i; e=%i\n"", \ #from, #to_t, \ (int) _cnm_integral_type_is_unsigned (to_t), \ (gint64) (_cnm_integral_type_min (to_t)), \ (gint64) (_cnm_integral_type_max (to_t)), \ (gint64) (from), \ (((gint64) _cnm_integral_type_min (to_t)) <= (gint64) from), \ (from < 0), \ (((guint64) from) <= (guint64) _cnm_integral_type_max (to_t)), \ !((int) _cnm_integral_type_is_unsigned (to_t) \ ? ((0 <= from) && \ ((guint64) from <= (guint64) _cnm_integral_type_max (to_t))) \ : ((gint64) _cnm_integral_type_min(to_t) <= (gint64) from && \ (guint64) from <= (guint64) _cnm_integral_type_max (to_t))) \ ) #else /* ndef _CNM_DUMP */ #define _cnm_dump(to_t, from) do {} while (0) #endif /* def _CNM_DUMP */ #ifdef DEBUG #define _cnm_return_val_if_overflow(to_t,from,val) G_STMT_START { \ int uns = _cnm_integral_type_is_unsigned (to_t); \ gint64 min = (gint64) _cnm_integral_type_min (to_t); \ guint64 max = (guint64) _cnm_integral_type_max (to_t); \ gint64 sf = (gint64) from; \ guint64 uf = (guint64) from; \ if (!(uns ? ((0 <= from) && (uf <= max)) \ : (min <= sf && (from < 0 || uf <= max)))) { \ _cnm_dump(to_t, from); \ errno = EOVERFLOW; \ return (val); \ } \ } G_STMT_END #else /* !def DEBUG */ /* don't do any overflow checking */ #define _cnm_return_val_if_overflow(to_t,from,val) G_STMT_START { \ } G_STMT_END #endif /* def DEBUG */ "); } private void WriteFallbackMacro (string target, string glib, string def) { sc.WriteLine (@" #if defined ({1}) #define {0} {1} #else #define {0} ({2}) #endif", target, glib, def); } public override void WriteType (Type t, string ns, string fn) { if (!CanMapType (t)) return; string etype = MapUtils.GetNativeType (t); if (t.IsEnum) { bool bits = IsFlagsEnum (t); WriteFromManagedEnum (t, ns, fn, etype, bits); WriteToManagedEnum (t, ns, fn, etype, bits); } else { WriteFromManagedClass (t, ns, fn, etype); WriteToManagedClass (t, ns, fn, etype); } } private void WriteFromManagedEnum (Type t, string ns, string fn, string etype, bool bits) { sc.WriteLine ("int {1}_From{2} ({0} x, {0} *r)", etype, ns, t.Name); sc.WriteLine ("{"); sc.WriteLine ("\t*r = 0;"); FieldInfo[] fields = t.GetFields (); Array.Sort (fields, MapUtils.MemberNameComparer); Array values = Enum.GetValues (t); foreach (FieldInfo fi in fields) { if (!fi.IsLiteral) continue; if (MapUtils.GetCustomAttribute (fi) != null) { sc.WriteLine ("\t/* {0}_{1} is obsolete or optional; ignoring */", fn, fi.Name); continue; } MapAttribute map = MapUtils.GetMapAttribute (fi); bool is_bits = bits && (map != null ? map.SuppressFlags == null : true); if (is_bits) // properly handle case where [Flags] enumeration has helper // synonyms. e.g. DEFFILEMODE and ACCESSPERMS for mode_t. sc.WriteLine ("\tif ((x & {0}_{1}) == {0}_{1})", fn, fi.Name); else if (GetSuppressFlags (map) == null) sc.WriteLine ("\tif (x == {0}_{1})", fn, fi.Name); else sc.WriteLine ("\tif ((x & {0}_{1}) == {0}_{2})", fn, map.SuppressFlags, fi.Name); sc.WriteLine ("#ifdef {0}", fi.Name); if (is_bits || GetSuppressFlags (map) != null) sc.WriteLine ("\t\t*r |= {1};", fn, fi.Name); else sc.WriteLine ("\t\t{{*r = {1}; return 0;}}", fn, fi.Name); sc.WriteLine ("#else /* def {0} */", fi.Name); if (is_bits && IsRedundant (t, fi, values)) { sc.WriteLine ("\t\t{{/* Ignoring {0}_{1}, as it is constructed from other values */}}", fn, fi.Name); } else { sc.WriteLine ("\t\t{errno = EINVAL; return -1;}"); } sc.WriteLine ("#endif /* ndef {0} */", fi.Name); } // For many values, 0 is a valid value, but doesn't have it's own symbol. // Examples: Error (0 means "no error"), WaitOptions (0 means "no options"). // Make 0 valid for all conversions. sc.WriteLine ("\tif (x == 0)\n\t\treturn 0;"); if (bits) sc.WriteLine ("\treturn 0;"); else sc.WriteLine ("\terrno = EINVAL; return -1;"); // return error if not matched sc.WriteLine ("}\n"); } private static string GetSuppressFlags (MapAttribute map) { if (map != null) { return map.SuppressFlags == null ? null : map.SuppressFlags.Length == 0 ? null : map.SuppressFlags; } return null; } private static bool IsRedundant (Type t, FieldInfo fi, Array values) { long v = Convert.ToInt64 (fi.GetValue (null)); long d = v; if (v == 0) return false; foreach (object o in values) { long e = Convert.ToInt64 (o); if (((d & e) != 0) && (e < d)) { v &= ~e; } } if (v == 0) { return true; } return false; } private void WriteToManagedEnum (Type t, string ns, string fn, string etype, bool bits) { sc.WriteLine ("int {1}_To{2} ({0} x, {0} *r)", etype, ns, t.Name); sc.WriteLine ("{"); sc.WriteLine ("\t*r = 0;", etype); // For many values, 0 is a valid value, but doesn't have it's own symbol. // Examples: Error (0 means "no error"), WaitOptions (0 means "no options"). // Make 0 valid for all conversions. sc.WriteLine ("\tif (x == 0)\n\t\treturn 0;"); FieldInfo[] fields = t.GetFields (); Array.Sort (fields, MapUtils.MemberNameComparer); foreach (FieldInfo fi in fields) { if (!fi.IsLiteral) continue; MapAttribute map = MapUtils.GetMapAttribute (fi); bool is_bits = bits && (map != null ? map.SuppressFlags == null: true); sc.WriteLine ("#ifdef {0}", fi.Name); if (is_bits) // properly handle case where [Flags] enumeration has helper // synonyms. e.g. DEFFILEMODE and ACCESSPERMS for mode_t. sc.WriteLine ("\tif ((x & {1}) == {1})\n\t\t*r |= {0}_{1};", fn, fi.Name); else if (GetSuppressFlags (map) == null) sc.WriteLine ("\tif (x == {1})\n\t\t{{*r = {0}_{1}; return 0;}}", fn, fi.Name); else sc.WriteLine ("\tif ((x & {2}) == {1})\n\t\t*r |= {0}_{1};", fn, fi.Name, map.SuppressFlags); sc.WriteLine ("#endif /* ndef {0} */", fi.Name); } if (bits) sc.WriteLine ("\treturn 0;"); else sc.WriteLine ("\terrno = EINVAL; return -1;"); sc.WriteLine ("}\n"); } private void WriteFromManagedClass (Type t, string ns, string fn, string etype) { MapAttribute map = MapUtils.GetMapAttribute (t); if (map == null || map.NativeType == null || map.NativeType.Length == 0) return; string nativeMacro = GetAutoconfDefine (map.NativeType); sc.WriteLine ("#ifdef {0}", nativeMacro); sc.WriteLine ("int\n{0}_From{1} (struct {0}_{1} *from, {2} *to)", MapUtils.GetNamespace (t), t.Name, map.NativeType); WriteManagedClassConversion (t, delegate (FieldInfo field) { MapAttribute ft = MapUtils.GetMapAttribute (field); if (ft != null) return ft.NativeType; return MapUtils.GetNativeType (field.FieldType); }, delegate (FieldInfo field) { return GetNativeMemberName (field); }, delegate (FieldInfo field) { return field.Name; }, delegate (FieldInfo field) { return string.Format ("{0}_From{1}", MapUtils.GetNamespace (field.FieldType), field.FieldType.Name); } ); sc.WriteLine ("#endif /* ndef {0} */\n\n", nativeMacro); } private static string GetAutoconfDefine (string nativeType) { return string.Format ("HAVE_{0}", nativeType.ToUpperInvariant ().Replace (" ", "_")); } private delegate string GetFromType (FieldInfo field); private delegate string GetToFieldName (FieldInfo field); private delegate string GetFromFieldName (FieldInfo field); private delegate string GetFieldCopyMethod (FieldInfo field); private void WriteManagedClassConversion (Type t, GetFromType gft, GetFromFieldName gffn, GetToFieldName gtfn, GetFieldCopyMethod gfc) { MapAttribute map = MapUtils.GetMapAttribute (t); sc.WriteLine ("{"); FieldInfo[] fields = GetFieldsToCopy (t); SortFieldsInOffsetOrder (t, fields); int max_len = 0; foreach (FieldInfo f in fields) { max_len = Math.Max (max_len, f.Name.Length); if (!MapUtils.IsIntegralType (f.FieldType)) continue; string d = GetAutoconfDefine (map, f); if (d != null) sc.WriteLine ("#ifdef " + d); sc.WriteLine ("\t_cnm_return_val_if_overflow ({0}, from->{1}, -1);", gft (f), gffn (f)); if (d != null) sc.WriteLine ("#endif /* ndef " + d + " */"); } sc.WriteLine ("\n\tmemset (to, 0, sizeof(*to));\n"); foreach (FieldInfo f in fields) { string d = GetAutoconfDefine (map, f); if (d != null) sc.WriteLine ("#ifdef " + d); if (MapUtils.IsBlittableType (f.FieldType)) { sc.WriteLine ("\tto->{0,-" + max_len + "} = from->{1};", gtfn (f), gffn (f)); } else if (f.FieldType.IsEnum) { sc.WriteLine ("\tif ({0} (from->{1}, &to->{2}) != 0) {{", gfc (f), gffn (f), gtfn (f)); sc.WriteLine ("\t\treturn -1;"); sc.WriteLine ("\t}"); } else if (f.FieldType.IsValueType) { sc.WriteLine ("\tif ({0} (&from->{1}, &to->{2}) != 0) {{", gfc (f), gffn (f), gtfn (f)); sc.WriteLine ("\t\treturn -1;"); sc.WriteLine ("\t}"); } if (d != null) sc.WriteLine ("#endif /* ndef " + d + " */"); } sc.WriteLine (); sc.WriteLine ("\treturn 0;"); sc.WriteLine ("}"); } private void WriteToManagedClass (Type t, string ns, string fn, string etype) { MapAttribute map = MapUtils.GetMapAttribute (t); if (map == null || map.NativeType == null || map.NativeType.Length == 0) return; string nativeMacro = GetAutoconfDefine (map.NativeType); sc.WriteLine ("#ifdef {0}", nativeMacro); sc.WriteLine ("int\n{0}_To{1} ({2} *from, struct {0}_{1} *to)", MapUtils.GetNamespace (t), t.Name, map.NativeType); WriteManagedClassConversion (t, delegate (FieldInfo field) { return MapUtils.GetNativeType (field.FieldType); }, delegate (FieldInfo field) { return field.Name; }, delegate (FieldInfo field) { return GetNativeMemberName (field); }, delegate (FieldInfo field) { return string.Format ("{0}_To{1}", MapUtils.GetNamespace (field.FieldType), field.FieldType.Name); } ); sc.WriteLine ("#endif /* ndef {0} */\n\n", nativeMacro); } private static FieldInfo[] GetFieldsToCopy (Type t) { FieldInfo[] fields = t.GetFields (BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly); int count = 0; for (int i = 0; i < fields.Length; ++i) if (MapUtils.GetCustomAttribute (fields [i]) == null) ++count; FieldInfo[] rf = new FieldInfo [count]; for (int i = 0, j = 0; i < fields.Length; ++i) { if (MapUtils.GetCustomAttribute (fields [i]) == null) rf [j++] = fields [i]; } return rf; } private string GetAutoconfDefine (MapAttribute typeMap, FieldInfo field) { if (Configuration.AutoconfMembers.BinarySearch (field.Name) < 0 && Configuration.AutoconfMembers.BinarySearch (field.DeclaringType.Name + "." + field.Name) < 0) return null; return string.Format ("HAVE_{0}_{1}", typeMap.NativeType.ToUpperInvariant().Replace (" ", "_"), field.Name.ToUpperInvariant ()); } public override void CloseFile (string file_prefix) { sc.Close (); } } class ConvertFileGenerator : FileGenerator { StreamWriter scs; public override void CreateFile (string assembly_name, string file_prefix) { scs = File.CreateText (file_prefix + ".cs"); WriteHeader (scs, assembly_name, true); scs.WriteLine ("using System;"); scs.WriteLine ("using System.Runtime.InteropServices;"); scs.WriteLine ("using Mono.Unix.Native;\n"); scs.WriteLine ("namespace Mono.Unix.Native {\n"); scs.WriteLine ("\tpublic sealed /* static */ partial class NativeConvert"); scs.WriteLine ("\t{"); scs.WriteLine ("\t\tprivate NativeConvert () {}\n"); scs.WriteLine ("\t\tprivate const string LIB = \"{0}\";\n", Configuration.NativeLibraries[0]); scs.WriteLine ("\t\tprivate static void ThrowArgumentException (object value)"); scs.WriteLine ("\t\t{"); scs.WriteLine ("\t\t\tthrow new ArgumentOutOfRangeException (\"value\", value,"); scs.WriteLine ("\t\t\t\tLocale.GetText (\"Current platform doesn't support this value.\"));"); scs.WriteLine ("\t\t}\n"); } public override void WriteType (Type t, string ns, string fn) { if (!CanMapType (t)) return; if (t.IsEnum) WriteEnum (t, ns, fn); else WriteStruct (t, ns, fn); } private void WriteEnum (Type t, string ns, string fn) { string mtype = Enum.GetUnderlyingType(t).Name; ObsoleteAttribute oa = MapUtils.GetCustomAttribute (t); string visibility = (t.Attributes & TypeAttributes.Public) != 0 ? "public" : "internal"; string obsolete = ""; if (oa != null) { obsolete = string.Format ("[Obsolete (\"{0}\", {1})]\n\t\t", oa.Message, oa.IsError ? "true" : "false"); } scs.WriteLine ( "\t\t{0}[DllImport (LIB, EntryPoint=\"{1}_From{2}\")]\n" + "\t\tprivate static extern int From{2} ({2} value, out {3} rval);\n" + "\n" + "\t\t{0}{4} static bool TryFrom{2} ({2} value, out {3} rval)\n" + "\t\t{{\n" + "\t\t\treturn From{2} (value, out rval) == 0;\n" + "\t\t}}\n" + "\n" + "\t\t{0}{4} static {3} From{2} ({2} value)\n" + "\t\t{{\n" + "\t\t\t{3} rval;\n" + "\t\t\tif (From{2} (value, out rval) == -1)\n" + "\t\t\t\tThrowArgumentException (value);\n" + "\t\t\treturn rval;\n" + "\t\t}}\n" + "\n" + "\t\t{0}[DllImport (LIB, EntryPoint=\"{1}_To{2}\")]\n" + "\t\tprivate static extern int To{2} ({3} value, out {2} rval);\n" + "\n" + "\t\t{0}{4} static bool TryTo{2} ({3} value, out {2} rval)\n" + "\t\t{{\n" + "\t\t\treturn To{2} (value, out rval) == 0;\n" + "\t\t}}\n" + "\n" + "\t\t{0}{4} static {2} To{2} ({3} value)\n" + "\t\t{{\n" + "\t\t\t{2} rval;\n" + "\t\t\tif (To{2} (value, out rval) == -1)\n" + "\t\t\t\tThrowArgumentException (value);\n" + "\t\t\treturn rval;\n" + "\t\t}}\n", obsolete, ns, t.Name, mtype, visibility ); } private void WriteStruct (Type t, string ns, string fn) { if (MapUtils.IsDelegate (t)) return; MapAttribute map = MapUtils.GetMapAttribute (t); if (map == null || map.NativeType == null || map.NativeType.Length == 0) return; ObsoleteAttribute oa = MapUtils.GetCustomAttribute (t); string obsolete = ""; if (oa != null) { obsolete = string.Format ("[Obsolete (\"{0}\", {1})]\n\t\t", oa.Message, oa.IsError ? "true" : "false"); } string _ref = t.IsValueType ? "ref " : ""; string _out = t.IsValueType ? "out " : ""; scs.WriteLine ( "\t\t{0}[DllImport (LIB, EntryPoint=\"{1}_From{2}\")]\n" + "\t\tprivate static extern int From{2} ({3}{2} source, IntPtr destination);\n" + "\n" + "\t\t{0}public static bool TryCopy ({3}{2} source, IntPtr destination)\n" + "\t\t{{\n" + "\t\t\treturn From{2} ({3}source, destination) == 0;\n" + "\t\t}}\n" + "\n" + "\t\t{0}[DllImport (LIB, EntryPoint=\"{1}_To{2}\")]\n" + "\t\tprivate static extern int To{2} (IntPtr source, {4}{2} destination);\n" + "\n" + "\t\t{0}public static bool TryCopy (IntPtr source, {4}{2} destination)\n" + "\t\t{{\n" + "\t\t\treturn To{2} (source, {4}destination) == 0;\n" + "\t\t}}\n", obsolete, ns, t.Name, _ref, _out ); } public override void CloseFile (string file_prefix) { scs.WriteLine ("\t}"); scs.WriteLine ("}\n"); scs.Close (); } } class ConvertDocFileGenerator : FileGenerator { StreamWriter scs; public override void CreateFile (string assembly_name, string file_prefix) { scs = File.CreateText (file_prefix + ".xml"); scs.WriteLine (" "); } public override void WriteType (Type t, string ns, string fn) { if (!CanMapType (t) || !t.IsEnum) return; if ((t.Attributes & TypeAttributes.Public) == 0) return; bool bits = IsFlagsEnum (t); string type = GetCSharpType (t); string mtype = Enum.GetUnderlyingType(t).FullName; string member = t.Name; string ftype = t.FullName; string to_returns = ""; string to_remarks = ""; string to_exception = ""; if (bits) { to_returns = "An approximation of the equivalent managed value."; to_remarks = @"The current conversion functions are unable to determine if a value in a [Flags]-marked enumeration does not exist on the current platform. As such, if contains a flag value which the current platform doesn't support, it will not be present in the managed value returned. This should only be a problem if was not previously returned by .\n"; } else { to_returns = "The equivalent managed value."; to_exception = @" has no equivalent managed value. "; } scs.WriteLine (@" Method System.Boolean The managed value to convert. The OS-specific equivalent value. Converts a enumeration value to an OS-specific value. if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the OS-specific equivalent value of into . Otherwise, will contain 0. Method {3} The managed value to convert. Converts a to an OS-specific value. The equivalent OS-specific value. has no equivalent OS-specific value. Method System.Boolean The OS-specific value to convert. The managed equivalent value Converts an OS-specific value to a . if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the managed equivalent value of into . Otherwise, will contain a 0 cast to a . " + to_remarks + @" Method {0} The OS-specific value to convert. Converts an OS-specific value to a . " + to_returns + "\n" + to_exception + @" " + to_remarks + @" ", ftype, member, type, mtype ); } private string GetCSharpType (Type t) { string ut = t.Name; if (t.IsEnum) ut = Enum.GetUnderlyingType (t).Name; Type et = t.GetElementType (); if (et != null && et.IsEnum) ut = Enum.GetUnderlyingType (et).Name; string type = null; switch (ut) { case "Boolean": type = "bool"; break; case "Byte": type = "byte"; break; case "SByte": type = "sbyte"; break; case "Int16": type = "short"; break; case "UInt16": type = "ushort"; break; case "Int32": type = "int"; break; case "UInt32": type = "uint"; break; case "Int64": type = "long"; break; case "UInt64": type = "ulong"; break; } return type; } public override void CloseFile (string file_prefix) { scs.WriteLine (" "); scs.Close (); } } // vim: noexpandtab // Local Variables: // tab-width: 4 // c-basic-offset: 4 // indent-tabs-mode: t // End: mono-tools-4.2/create-native-map/src/TestMap.cs0000664000175000017500000000612412642235713023514 0ustar00directhexdirecthex00000000000000// Test file for make-map.cs using System; using System.Runtime.InteropServices; using System.Text; // Make sure that a null namespace doesn't kill make-map class GlobalClass {} namespace MakeMap.Test { struct ForDelegate {int i;} [Map] delegate string MyDelegate ( bool b1, byte b2, sbyte b3, short s1, ushort us1, int i1, uint ui1, long l1, ulong ul1, IntPtr p1, UIntPtr p2, string s2, StringBuilder sb1, HandleRef h, ForDelegate fd); [Map] public enum TestEnum : long { Foo, Bar, Baz, Qux, } [Map, Flags] public enum SimpleFlagsEnum { None = 0, A = 1, B = 2, C = 4, D = 8, } [Map, Flags] public enum FlagsEnum { None = 0, A = 1, B = 2, C = 4, D = 8, All = A | B | C | D, // Device types S_IFMT = 0xF000, // Bits which determine file type [Map(SuppressFlags="S_IFMT")] S_IFDIR = 0x4000, // Directory [Map(SuppressFlags="S_IFMT")] S_IFCHR = 0x2000, // Character device [Map(SuppressFlags="S_IFMT")] S_IFBLK = 0x6000, // Block device [Map(SuppressFlags="S_IFMT")] S_IFREG = 0x8000, // Regular file [Map(SuppressFlags="S_IFMT")] S_IFIFO = 0x1000, // FIFO [Map(SuppressFlags="S_IFMT")] S_IFLNK = 0xA000, // Symbolic link [Map(SuppressFlags="S_IFMT")] S_IFSOCK = 0xC000, // Socket } [Map ("struct foo")] struct Foo { public int foo; public IntPtr p; // this should be within a #ifdef HAVE_AUTOCONF_ME block, due to // --autoconf-member. public long autoconf_me; } [Map ("struct foo_holder")] struct FooHolder { public Foo foo; public TestEnum mode; } delegate void DelFoo (int i, Foo f); delegate void DelRefFoo (int i, ref Foo f); delegate void DelArrayFoo (int i, Foo[] f); delegate void DelRefArrayFoo (int i, ref Foo[] f); delegate void DelBaz (int i, Baz b); delegate void DelRefBaz (int i, ref Baz b); delegate void DelArrayBaz (int i, Baz[] b); delegate void DelRefArrayBaz (int i, ref Baz[] b); [StructLayout (LayoutKind.Sequential)] class Baz { public DelFoo b1; public DelRefFoo b2; public DelArrayFoo b3; public DelRefArrayFoo b4; public DelBaz b5; public DelRefBaz b6; public DelArrayBaz b7; public DelRefArrayBaz b8; } [StructLayout (LayoutKind.Sequential)] class Qux { public int i; public Baz b; } class NativeMethods { [DllImport ("NativeLib")] private static extern void UseQux (DelFoo b, ref Qux q); // This shouldn't appear in test.h, due to --exclude-native-symbol [DllImport ("NativeLib")] private static extern void exclude_native_symbol (); } [Map] enum InternalEnum : long { Foo, } [Map ("struct parent")] [StructLayout (LayoutKind.Sequential)] public class Parent { public int i; } [Map ("struct child")] [StructLayout (LayoutKind.Sequential)] public class Child : Parent { public int j; } } // Testing namespace renaming; this should be NSTo within test.h namespace MakeMap.ToBeRenamed { [Map] class Stat { // this should be st_atime_ in test.h due to --rename-member. [Map ("time_t")] public long st_atime; } [Map] public enum Colors { Red, Blue, Green } } mono-tools-4.2/create-native-map/src/test.cs.ref0000664000175000017500000001574112642235713023676 0ustar00directhexdirecthex00000000000000/* * This file was automatically generated by create-native-map from TestMap.dll. * * DO NOT MODIFY. */ using System; using System.Runtime.InteropServices; using Mono.Unix.Native; namespace Mono.Unix.Native { public sealed /* static */ partial class NativeConvert { private NativeConvert () {} private const string LIB = "NativeLib"; private static void ThrowArgumentException (object value) { throw new ArgumentOutOfRangeException ("value", value, Locale.GetText ("Current platform doesn't support this value.")); } [DllImport (LIB, EntryPoint="MakeMap_Test_FromChild")] private static extern int FromChild (Child source, IntPtr destination); public static bool TryCopy (Child source, IntPtr destination) { return FromChild (source, destination) == 0; } [DllImport (LIB, EntryPoint="MakeMap_Test_ToChild")] private static extern int ToChild (IntPtr source, Child destination); public static bool TryCopy (IntPtr source, Child destination) { return ToChild (source, destination) == 0; } [DllImport (LIB, EntryPoint="MakeMap_Test_FromFlagsEnum")] private static extern int FromFlagsEnum (FlagsEnum value, out Int32 rval); public static bool TryFromFlagsEnum (FlagsEnum value, out Int32 rval) { return FromFlagsEnum (value, out rval) == 0; } public static Int32 FromFlagsEnum (FlagsEnum value) { Int32 rval; if (FromFlagsEnum (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Test_ToFlagsEnum")] private static extern int ToFlagsEnum (Int32 value, out FlagsEnum rval); public static bool TryToFlagsEnum (Int32 value, out FlagsEnum rval) { return ToFlagsEnum (value, out rval) == 0; } public static FlagsEnum ToFlagsEnum (Int32 value) { FlagsEnum rval; if (ToFlagsEnum (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Test_FromFoo")] private static extern int FromFoo (ref Foo source, IntPtr destination); public static bool TryCopy (ref Foo source, IntPtr destination) { return FromFoo (ref source, destination) == 0; } [DllImport (LIB, EntryPoint="MakeMap_Test_ToFoo")] private static extern int ToFoo (IntPtr source, out Foo destination); public static bool TryCopy (IntPtr source, out Foo destination) { return ToFoo (source, out destination) == 0; } [DllImport (LIB, EntryPoint="MakeMap_Test_FromFooHolder")] private static extern int FromFooHolder (ref FooHolder source, IntPtr destination); public static bool TryCopy (ref FooHolder source, IntPtr destination) { return FromFooHolder (ref source, destination) == 0; } [DllImport (LIB, EntryPoint="MakeMap_Test_ToFooHolder")] private static extern int ToFooHolder (IntPtr source, out FooHolder destination); public static bool TryCopy (IntPtr source, out FooHolder destination) { return ToFooHolder (source, out destination) == 0; } [DllImport (LIB, EntryPoint="MakeMap_Test_FromInternalEnum")] private static extern int FromInternalEnum (InternalEnum value, out Int64 rval); internal static bool TryFromInternalEnum (InternalEnum value, out Int64 rval) { return FromInternalEnum (value, out rval) == 0; } internal static Int64 FromInternalEnum (InternalEnum value) { Int64 rval; if (FromInternalEnum (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Test_ToInternalEnum")] private static extern int ToInternalEnum (Int64 value, out InternalEnum rval); internal static bool TryToInternalEnum (Int64 value, out InternalEnum rval) { return ToInternalEnum (value, out rval) == 0; } internal static InternalEnum ToInternalEnum (Int64 value) { InternalEnum rval; if (ToInternalEnum (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Test_FromParent")] private static extern int FromParent (Parent source, IntPtr destination); public static bool TryCopy (Parent source, IntPtr destination) { return FromParent (source, destination) == 0; } [DllImport (LIB, EntryPoint="MakeMap_Test_ToParent")] private static extern int ToParent (IntPtr source, Parent destination); public static bool TryCopy (IntPtr source, Parent destination) { return ToParent (source, destination) == 0; } [DllImport (LIB, EntryPoint="MakeMap_Test_FromSimpleFlagsEnum")] private static extern int FromSimpleFlagsEnum (SimpleFlagsEnum value, out Int32 rval); public static bool TryFromSimpleFlagsEnum (SimpleFlagsEnum value, out Int32 rval) { return FromSimpleFlagsEnum (value, out rval) == 0; } public static Int32 FromSimpleFlagsEnum (SimpleFlagsEnum value) { Int32 rval; if (FromSimpleFlagsEnum (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Test_ToSimpleFlagsEnum")] private static extern int ToSimpleFlagsEnum (Int32 value, out SimpleFlagsEnum rval); public static bool TryToSimpleFlagsEnum (Int32 value, out SimpleFlagsEnum rval) { return ToSimpleFlagsEnum (value, out rval) == 0; } public static SimpleFlagsEnum ToSimpleFlagsEnum (Int32 value) { SimpleFlagsEnum rval; if (ToSimpleFlagsEnum (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Test_FromTestEnum")] private static extern int FromTestEnum (TestEnum value, out Int64 rval); public static bool TryFromTestEnum (TestEnum value, out Int64 rval) { return FromTestEnum (value, out rval) == 0; } public static Int64 FromTestEnum (TestEnum value) { Int64 rval; if (FromTestEnum (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Test_ToTestEnum")] private static extern int ToTestEnum (Int64 value, out TestEnum rval); public static bool TryToTestEnum (Int64 value, out TestEnum rval) { return ToTestEnum (value, out rval) == 0; } public static TestEnum ToTestEnum (Int64 value) { TestEnum rval; if (ToTestEnum (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Rename_FromColors")] private static extern int FromColors (Colors value, out Int32 rval); public static bool TryFromColors (Colors value, out Int32 rval) { return FromColors (value, out rval) == 0; } public static Int32 FromColors (Colors value) { Int32 rval; if (FromColors (value, out rval) == -1) ThrowArgumentException (value); return rval; } [DllImport (LIB, EntryPoint="MakeMap_Rename_ToColors")] private static extern int ToColors (Int32 value, out Colors rval); public static bool TryToColors (Int32 value, out Colors rval) { return ToColors (value, out rval) == 0; } public static Colors ToColors (Int32 value) { Colors rval; if (ToColors (value, out rval) == -1) ThrowArgumentException (value); return rval; } } } mono-tools-4.2/create-native-map/src/Makefile.in0000664000175000017500000004137712642235731023666 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = create-native-map/src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 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)$(assemblydir)" DATA = $(assembly_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ CNM_FILES = \ create-native-map.cs \ MapAttribute.cs TM_FILES = \ MapAttribute.cs \ TestMap.cs cnm_build_sources = $(addprefix $(srcdir)/, $(CNM_FILES)) tm_build_sources = $(addprefix $(srcdir)/, $(TM_FILES)) EXE = ../lib/create-native-map/create-native-map.exe REFS = -r:Mono.Posix.dll assemblydir = $(prefix)/lib/create-native-map assembly_DATA = $(EXE) MapAttribute.cs test_output = test.c test.h test.cs test.xml CLEANFILES = $(EXE) $(EXE).mdb $(test_output) TestMap.dll TestMap.dll.mdb libtest.so EXTRA_DIST = $(CNM_FILES) TestMap.cs test.c.ref test.cs.ref test.h.ref test.xml.ref 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) --gnu create-native-map/src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu create-native-map/src/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): install-assemblyDATA: $(assembly_DATA) @$(NORMAL_INSTALL) @list='$(assembly_DATA)'; test -n "$(assemblydir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(assemblydir)'"; \ $(MKDIR_P) "$(DESTDIR)$(assemblydir)" || 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)$(assemblydir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(assemblydir)" || exit $$?; \ done uninstall-assemblyDATA: @$(NORMAL_UNINSTALL) @list='$(assembly_DATA)'; test -n "$(assemblydir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(assemblydir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: 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 $(DATA) installdirs: for dir in "$(DESTDIR)$(assemblydir)"; 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) 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-assemblyDATA 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: uninstall-assemblyDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-assemblyDATA \ 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 tags-am uninstall uninstall-am \ uninstall-assemblyDATA .PRECIOUS: Makefile all: $(EXE) $(EXE) : $(cnm_build_sources) $(MCS) $(MCS_FLAGS) -d:TRACE -debug+ -out:$@ -target:exe $(REFS) $(cnm_build_sources) check: $(PROGRAM) TestMap.dll TestMap.dll: $(tm_build_sources) $(PROGRAM) $(MCS) -debug+ -out:$@ -t:library $(tm_build_sources) $(test_output): TestMap.dll $(EXE) ../bin/create-native-map \ --autoconf-member autoconf_me \ --autoconf-header='' \ --public-header='' \ --public-macro=DefineMe=42 \ --impl-header='' \ --impl-header='"test.h"' \ --impl-macro='FOO="foo"' \ --exclude-native-symbol=exclude_native_symbol \ --library=NativeLib \ --rename-member=st_atime=st_atime_ \ --rename-namespace=MakeMap.ToBeRenamed=MakeMap_Rename \ $< test check: $(test_output) for f in test.c test.h test.cs test.xml ; do \ diff -rup $(srcdir)/$$f.ref $$f ; \ done check-update: for f in test.c test.h test.cs test.xml ; do \ mv $$f $$f.ref ; \ done libtest.so: test.c gcc -shared -o $@ $^ -I.. `pkg-config --libs --cflags glib-2.0` test-overflow: test-overflow.c test-overflow.h test.c gcc -o $@ $< `pkg-config --libs --cflags glib-2.0` # 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-tools-4.2/create-native-map/src/test.h.ref0000664000175000017500000001563412642235713023521 0ustar00directhexdirecthex00000000000000/* * This file was automatically generated by create-native-map from TestMap.dll. * * DO NOT MODIFY. */ #ifndef INC_TestMap_test_H #define INC_TestMap_test_H #include G_BEGIN_DECLS /* * Public Macros */ #ifndef DefineMe #define DefineMe 42 #endif /* ndef DefineMe */ /* * Public Includes */ #include /* * Enumerations */ enum MakeMap_Test_FlagsEnum { MakeMap_Test_FlagsEnum_A = 0x00000001, #define MakeMap_Test_FlagsEnum_A MakeMap_Test_FlagsEnum_A MakeMap_Test_FlagsEnum_All = 0x0000000f, #define MakeMap_Test_FlagsEnum_All MakeMap_Test_FlagsEnum_All MakeMap_Test_FlagsEnum_B = 0x00000002, #define MakeMap_Test_FlagsEnum_B MakeMap_Test_FlagsEnum_B MakeMap_Test_FlagsEnum_C = 0x00000004, #define MakeMap_Test_FlagsEnum_C MakeMap_Test_FlagsEnum_C MakeMap_Test_FlagsEnum_D = 0x00000008, #define MakeMap_Test_FlagsEnum_D MakeMap_Test_FlagsEnum_D MakeMap_Test_FlagsEnum_None = 0x00000000, #define MakeMap_Test_FlagsEnum_None MakeMap_Test_FlagsEnum_None MakeMap_Test_FlagsEnum_S_IFBLK = 0x00006000, #define MakeMap_Test_FlagsEnum_S_IFBLK MakeMap_Test_FlagsEnum_S_IFBLK MakeMap_Test_FlagsEnum_S_IFCHR = 0x00002000, #define MakeMap_Test_FlagsEnum_S_IFCHR MakeMap_Test_FlagsEnum_S_IFCHR MakeMap_Test_FlagsEnum_S_IFDIR = 0x00004000, #define MakeMap_Test_FlagsEnum_S_IFDIR MakeMap_Test_FlagsEnum_S_IFDIR MakeMap_Test_FlagsEnum_S_IFIFO = 0x00001000, #define MakeMap_Test_FlagsEnum_S_IFIFO MakeMap_Test_FlagsEnum_S_IFIFO MakeMap_Test_FlagsEnum_S_IFLNK = 0x0000a000, #define MakeMap_Test_FlagsEnum_S_IFLNK MakeMap_Test_FlagsEnum_S_IFLNK MakeMap_Test_FlagsEnum_S_IFMT = 0x0000f000, #define MakeMap_Test_FlagsEnum_S_IFMT MakeMap_Test_FlagsEnum_S_IFMT MakeMap_Test_FlagsEnum_S_IFREG = 0x00008000, #define MakeMap_Test_FlagsEnum_S_IFREG MakeMap_Test_FlagsEnum_S_IFREG MakeMap_Test_FlagsEnum_S_IFSOCK = 0x0000c000, #define MakeMap_Test_FlagsEnum_S_IFSOCK MakeMap_Test_FlagsEnum_S_IFSOCK }; int MakeMap_Test_FromFlagsEnum (int x, int *r); int MakeMap_Test_ToFlagsEnum (int x, int *r); enum MakeMap_Test_InternalEnum { MakeMap_Test_InternalEnum_Foo = 0x0000000000000000, #define MakeMap_Test_InternalEnum_Foo MakeMap_Test_InternalEnum_Foo }; int MakeMap_Test_FromInternalEnum (gint64 x, gint64 *r); int MakeMap_Test_ToInternalEnum (gint64 x, gint64 *r); enum MakeMap_Test_SimpleFlagsEnum { MakeMap_Test_SimpleFlagsEnum_A = 0x00000001, #define MakeMap_Test_SimpleFlagsEnum_A MakeMap_Test_SimpleFlagsEnum_A MakeMap_Test_SimpleFlagsEnum_B = 0x00000002, #define MakeMap_Test_SimpleFlagsEnum_B MakeMap_Test_SimpleFlagsEnum_B MakeMap_Test_SimpleFlagsEnum_C = 0x00000004, #define MakeMap_Test_SimpleFlagsEnum_C MakeMap_Test_SimpleFlagsEnum_C MakeMap_Test_SimpleFlagsEnum_D = 0x00000008, #define MakeMap_Test_SimpleFlagsEnum_D MakeMap_Test_SimpleFlagsEnum_D MakeMap_Test_SimpleFlagsEnum_None = 0x00000000, #define MakeMap_Test_SimpleFlagsEnum_None MakeMap_Test_SimpleFlagsEnum_None }; int MakeMap_Test_FromSimpleFlagsEnum (int x, int *r); int MakeMap_Test_ToSimpleFlagsEnum (int x, int *r); enum MakeMap_Test_TestEnum { MakeMap_Test_TestEnum_Bar = 0x0000000000000001, #define MakeMap_Test_TestEnum_Bar MakeMap_Test_TestEnum_Bar MakeMap_Test_TestEnum_Baz = 0x0000000000000002, #define MakeMap_Test_TestEnum_Baz MakeMap_Test_TestEnum_Baz MakeMap_Test_TestEnum_Foo = 0x0000000000000000, #define MakeMap_Test_TestEnum_Foo MakeMap_Test_TestEnum_Foo MakeMap_Test_TestEnum_Qux = 0x0000000000000003, #define MakeMap_Test_TestEnum_Qux MakeMap_Test_TestEnum_Qux }; int MakeMap_Test_FromTestEnum (gint64 x, gint64 *r); int MakeMap_Test_ToTestEnum (gint64 x, gint64 *r); enum MakeMap_Rename_Colors { MakeMap_Rename_Colors_Blue = 0x00000001, #define MakeMap_Rename_Colors_Blue MakeMap_Rename_Colors_Blue MakeMap_Rename_Colors_Green = 0x00000002, #define MakeMap_Rename_Colors_Green MakeMap_Rename_Colors_Green MakeMap_Rename_Colors_Red = 0x00000000, #define MakeMap_Rename_Colors_Red MakeMap_Rename_Colors_Red }; int MakeMap_Rename_FromColors (int x, int *r); int MakeMap_Rename_ToColors (int x, int *r); /* * Managed Structure Declarations */ struct MakeMap_Test_Baz; struct MakeMap_Test_Child; struct MakeMap_Test_Foo; struct MakeMap_Test_FooHolder; struct MakeMap_Test_ForDelegate; struct MakeMap_Test_Parent; struct MakeMap_Test_Qux; struct MakeMap_Rename_Stat; /* * Inferred Structure Declarations */ struct child; struct foo; struct foo_holder; struct parent; /* * Delegate Declarations */ typedef void (*DelArrayBaz) (int i, struct MakeMap_Test_Baz** b); typedef void (*DelArrayFoo) (int i, struct MakeMap_Test_Foo* f); typedef void (*DelBaz) (int i, struct MakeMap_Test_Baz* b); typedef void (*DelFoo) (int i, struct MakeMap_Test_Foo f); typedef void (*DelRefArrayBaz) (int i, struct MakeMap_Test_Baz*** b); typedef void (*DelRefArrayFoo) (int i, struct MakeMap_Test_Foo** f); typedef void (*DelRefBaz) (int i, struct MakeMap_Test_Baz** b); typedef void (*DelRefFoo) (int i, struct MakeMap_Test_Foo* f); typedef char* (*MyDelegate) (int b1, unsigned char b2, signed char b3, short s1, unsigned short us1, int i1, unsigned int ui1, gint64 l1, guint64 ul1, void* p1, void* p2, const char* s2, char* sb1, void* h, struct MakeMap_Test_ForDelegate fd); /* * Structures */ struct MakeMap_Test_Baz { DelFoo b1; DelRefFoo b2; DelArrayFoo b3; DelRefArrayFoo b4; DelBaz b5; DelRefBaz b6; DelArrayBaz b7; DelRefArrayBaz b8; }; struct MakeMap_Test_Child { int i; int j; }; int MakeMap_Test_FromChild (struct MakeMap_Test_Child* from, struct child *to); int MakeMap_Test_ToChild (struct child *from, struct MakeMap_Test_Child* to); struct MakeMap_Test_Foo { int foo; void* p; gint64 autoconf_me; }; int MakeMap_Test_FromFoo (struct MakeMap_Test_Foo* from, struct foo *to); int MakeMap_Test_ToFoo (struct foo *from, struct MakeMap_Test_Foo* to); struct MakeMap_Test_FooHolder { struct MakeMap_Test_Foo foo; /* struct foo */ gint64 mode; }; int MakeMap_Test_FromFooHolder (struct MakeMap_Test_FooHolder* from, struct foo_holder *to); int MakeMap_Test_ToFooHolder (struct foo_holder *from, struct MakeMap_Test_FooHolder* to); struct MakeMap_Test_ForDelegate { int i; }; struct MakeMap_Test_Parent { int i; }; int MakeMap_Test_FromParent (struct MakeMap_Test_Parent* from, struct parent *to); int MakeMap_Test_ToParent (struct parent *from, struct MakeMap_Test_Parent* to); struct MakeMap_Test_Qux { int i; struct MakeMap_Test_Baz* b; }; struct MakeMap_Rename_Stat { gint64 st_atime_; /* time_t */ }; /* * Functions */ void UseQux (DelFoo b, struct MakeMap_Test_Qux** q); G_END_DECLS #endif /* ndef INC_Mono_Posix_test_H */ mono-tools-4.2/create-native-map/src/test.xml.ref0000664000175000017500000005555212413742070024070 0ustar00directhexdirecthex00000000000000 Method System.Boolean The managed value to convert. The OS-specific equivalent value. Converts a enumeration value to an OS-specific value. if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the OS-specific equivalent value of into . Otherwise, will contain 0. Method System.Int32 The managed value to convert. Converts a to an OS-specific value. The equivalent OS-specific value. has no equivalent OS-specific value. Method System.Boolean The OS-specific value to convert. The managed equivalent value Converts an OS-specific value to a . if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the managed equivalent value of into . Otherwise, will contain a 0 cast to a . The current conversion functions are unable to determine if a value in a [Flags]-marked enumeration does not exist on the current platform. As such, if contains a flag value which the current platform doesn't support, it will not be present in the managed value returned. This should only be a problem if was not previously returned by . Method MakeMap.Test.FlagsEnum The OS-specific value to convert. Converts an OS-specific value to a . An approximation of the equivalent managed value. The current conversion functions are unable to determine if a value in a [Flags]-marked enumeration does not exist on the current platform. As such, if contains a flag value which the current platform doesn't support, it will not be present in the managed value returned. This should only be a problem if was not previously returned by . Method System.Boolean The managed value to convert. The OS-specific equivalent value. Converts a enumeration value to an OS-specific value. if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the OS-specific equivalent value of into . Otherwise, will contain 0. Method System.Int32 The managed value to convert. Converts a to an OS-specific value. The equivalent OS-specific value. has no equivalent OS-specific value. Method System.Boolean The OS-specific value to convert. The managed equivalent value Converts an OS-specific value to a . if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the managed equivalent value of into . Otherwise, will contain a 0 cast to a . The current conversion functions are unable to determine if a value in a [Flags]-marked enumeration does not exist on the current platform. As such, if contains a flag value which the current platform doesn't support, it will not be present in the managed value returned. This should only be a problem if was not previously returned by . Method MakeMap.Test.SimpleFlagsEnum The OS-specific value to convert. Converts an OS-specific value to a . An approximation of the equivalent managed value. The current conversion functions are unable to determine if a value in a [Flags]-marked enumeration does not exist on the current platform. As such, if contains a flag value which the current platform doesn't support, it will not be present in the managed value returned. This should only be a problem if was not previously returned by . Method System.Boolean The managed value to convert. The OS-specific equivalent value. Converts a enumeration value to an OS-specific value. if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the OS-specific equivalent value of into . Otherwise, will contain 0. Method System.Int64 The managed value to convert. Converts a to an OS-specific value. The equivalent OS-specific value. has no equivalent OS-specific value. Method System.Boolean The OS-specific value to convert. The managed equivalent value Converts an OS-specific value to a . if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the managed equivalent value of into . Otherwise, will contain a 0 cast to a . Method MakeMap.Test.TestEnum The OS-specific value to convert. Converts an OS-specific value to a . The equivalent managed value. has no equivalent managed value. Method System.Boolean The managed value to convert. The OS-specific equivalent value. Converts a enumeration value to an OS-specific value. if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the OS-specific equivalent value of into . Otherwise, will contain 0. Method System.Int32 The managed value to convert. Converts a to an OS-specific value. The equivalent OS-specific value. has no equivalent OS-specific value. Method System.Boolean The OS-specific value to convert. The managed equivalent value Converts an OS-specific value to a . if the conversion was successful; otherwise, . This is an exception-safe alternative to . If successful, this method stores the managed equivalent value of into . Otherwise, will contain a 0 cast to a . Method MakeMap.ToBeRenamed.Colors The OS-specific value to convert. Converts an OS-specific value to a . The equivalent managed value. has no equivalent managed value. mono-tools-4.2/create-native-map/src/test.c.ref0000664000175000017500000004226312642235713023512 0ustar00directhexdirecthex00000000000000/* * This file was automatically generated by create-native-map from TestMap.dll. * * DO NOT MODIFY. */ #ifdef HAVE_CONFIG_H #include #endif /* ndef HAVE_CONFIG_H */ #include #include /* * Implementation Macros */ #ifndef FOO #define FOO "foo" #endif /* ndef FOO */ /* * Implementation Includes */ #ifdef HAVE_UNISTD_H #include #endif /* ndef HAVE_UNISTD_H */ #include #include "test.h" #include "test.h" #include /* errno, EOVERFLOW */ #include /* g* types, g_assert_not_reached() */ #if defined (G_MININT8) #define CNM_MININT8 G_MININT8 #else #define CNM_MININT8 (-128) #endif #if defined (G_MAXINT8) #define CNM_MAXINT8 G_MAXINT8 #else #define CNM_MAXINT8 (127) #endif #if defined (G_MAXUINT8) #define CNM_MAXUINT8 G_MAXUINT8 #else #define CNM_MAXUINT8 (255) #endif #if defined (G_MININT16) #define CNM_MININT16 G_MININT16 #else #define CNM_MININT16 (-32768) #endif #if defined (G_MAXINT16) #define CNM_MAXINT16 G_MAXINT16 #else #define CNM_MAXINT16 (32767) #endif #if defined (G_MAXUINT16) #define CNM_MAXUINT16 G_MAXUINT16 #else #define CNM_MAXUINT16 (65535) #endif #if defined (G_MININT32) #define CNM_MININT32 G_MININT32 #else #define CNM_MININT32 (-2147483648) #endif #if defined (G_MAXINT32) #define CNM_MAXINT32 G_MAXINT32 #else #define CNM_MAXINT32 (2147483647) #endif #if defined (G_MAXUINT32) #define CNM_MAXUINT32 G_MAXUINT32 #else #define CNM_MAXUINT32 (4294967295U) #endif #if defined (G_MININT64) #define CNM_MININT64 G_MININT64 #else #define CNM_MININT64 (-9223372036854775808LL) #endif #if defined (G_MAXINT64) #define CNM_MAXINT64 G_MAXINT64 #else #define CNM_MAXINT64 (9223372036854775807LL) #endif #if defined (G_MAXUINT64) #define CNM_MAXUINT64 G_MAXUINT64 #else #define CNM_MAXUINT64 (18446744073709551615ULL) #endif /* returns TRUE if @type is an unsigned type */ #define _cnm_integral_type_is_unsigned(type) \ (sizeof(type) == sizeof(gint8) \ ? (((type)-1) > CNM_MAXINT8) \ : sizeof(type) == sizeof(gint16) \ ? (((type)-1) > CNM_MAXINT16) \ : sizeof(type) == sizeof(gint32) \ ? (((type)-1) > CNM_MAXINT32) \ : sizeof(type) == sizeof(gint64) \ ? (((type)-1) > CNM_MAXINT64) \ : (g_assert_not_reached (), 0)) /* returns the minimum value of @type as a gint64 */ #define _cnm_integral_type_min(type) \ (_cnm_integral_type_is_unsigned (type) \ ? 0 \ : sizeof(type) == sizeof(gint8) \ ? CNM_MININT8 \ : sizeof(type) == sizeof(gint16) \ ? CNM_MININT16 \ : sizeof(type) == sizeof(gint32) \ ? CNM_MININT32 \ : sizeof(type) == sizeof(gint64) \ ? CNM_MININT64 \ : (g_assert_not_reached (), 0)) /* returns the maximum value of @type as a guint64 */ #define _cnm_integral_type_max(type) \ (_cnm_integral_type_is_unsigned (type) \ ? sizeof(type) == sizeof(gint8) \ ? CNM_MAXUINT8 \ : sizeof(type) == sizeof(gint16) \ ? CNM_MAXUINT16 \ : sizeof(type) == sizeof(gint32) \ ? CNM_MAXUINT32 \ : sizeof(type) == sizeof(gint64) \ ? CNM_MAXUINT64 \ : (g_assert_not_reached (), 0) \ : sizeof(type) == sizeof(gint8) \ ? CNM_MAXINT8 \ : sizeof(type) == sizeof(gint16) \ ? CNM_MAXINT16 \ : sizeof(type) == sizeof(gint32) \ ? CNM_MAXINT32 \ : sizeof(type) == sizeof(gint64) \ ? CNM_MAXINT64 \ : (g_assert_not_reached (), 0)) #ifdef _CNM_DUMP #define _cnm_dump(to_t,from) \ printf ("# %s -> %s: uns=%i; min=%llx; max=%llx; value=%llx; lt=%i; l0=%i; gt=%i; e=%i\n", \ #from, #to_t, \ (int) _cnm_integral_type_is_unsigned (to_t), \ (gint64) (_cnm_integral_type_min (to_t)), \ (gint64) (_cnm_integral_type_max (to_t)), \ (gint64) (from), \ (((gint64) _cnm_integral_type_min (to_t)) <= (gint64) from), \ (from < 0), \ (((guint64) from) <= (guint64) _cnm_integral_type_max (to_t)), \ !((int) _cnm_integral_type_is_unsigned (to_t) \ ? ((0 <= from) && \ ((guint64) from <= (guint64) _cnm_integral_type_max (to_t))) \ : ((gint64) _cnm_integral_type_min(to_t) <= (gint64) from && \ (guint64) from <= (guint64) _cnm_integral_type_max (to_t))) \ ) #else /* ndef _CNM_DUMP */ #define _cnm_dump(to_t, from) do {} while (0) #endif /* def _CNM_DUMP */ #ifdef DEBUG #define _cnm_return_val_if_overflow(to_t,from,val) G_STMT_START { \ int uns = _cnm_integral_type_is_unsigned (to_t); \ gint64 min = (gint64) _cnm_integral_type_min (to_t); \ guint64 max = (guint64) _cnm_integral_type_max (to_t); \ gint64 sf = (gint64) from; \ guint64 uf = (guint64) from; \ if (!(uns ? ((0 <= from) && (uf <= max)) \ : (min <= sf && (from < 0 || uf <= max)))) { \ _cnm_dump(to_t, from); \ errno = EOVERFLOW; \ return (val); \ } \ } G_STMT_END #else /* !def DEBUG */ /* don't do any overflow checking */ #define _cnm_return_val_if_overflow(to_t,from,val) G_STMT_START { \ } G_STMT_END #endif /* def DEBUG */ #ifdef HAVE_STRUCT_CHILD int MakeMap_Test_FromChild (struct MakeMap_Test_Child *from, struct child *to) { _cnm_return_val_if_overflow (int, from->j, -1); memset (to, 0, sizeof(*to)); to->j = from->j; return 0; } #endif /* ndef HAVE_STRUCT_CHILD */ #ifdef HAVE_STRUCT_CHILD int MakeMap_Test_ToChild (struct child *from, struct MakeMap_Test_Child *to) { _cnm_return_val_if_overflow (int, from->j, -1); memset (to, 0, sizeof(*to)); to->j = from->j; return 0; } #endif /* ndef HAVE_STRUCT_CHILD */ int MakeMap_Test_FromFlagsEnum (int x, int *r) { *r = 0; if ((x & MakeMap_Test_FlagsEnum_A) == MakeMap_Test_FlagsEnum_A) #ifdef A *r |= A; #else /* def A */ {errno = EINVAL; return -1;} #endif /* ndef A */ if ((x & MakeMap_Test_FlagsEnum_All) == MakeMap_Test_FlagsEnum_All) #ifdef All *r |= All; #else /* def All */ {/* Ignoring MakeMap_Test_FlagsEnum_All, as it is constructed from other values */} #endif /* ndef All */ if ((x & MakeMap_Test_FlagsEnum_B) == MakeMap_Test_FlagsEnum_B) #ifdef B *r |= B; #else /* def B */ {errno = EINVAL; return -1;} #endif /* ndef B */ if ((x & MakeMap_Test_FlagsEnum_C) == MakeMap_Test_FlagsEnum_C) #ifdef C *r |= C; #else /* def C */ {errno = EINVAL; return -1;} #endif /* ndef C */ if ((x & MakeMap_Test_FlagsEnum_D) == MakeMap_Test_FlagsEnum_D) #ifdef D *r |= D; #else /* def D */ {errno = EINVAL; return -1;} #endif /* ndef D */ if ((x & MakeMap_Test_FlagsEnum_None) == MakeMap_Test_FlagsEnum_None) #ifdef None *r |= None; #else /* def None */ {errno = EINVAL; return -1;} #endif /* ndef None */ if ((x & MakeMap_Test_FlagsEnum_S_IFMT) == MakeMap_Test_FlagsEnum_S_IFBLK) #ifdef S_IFBLK *r |= S_IFBLK; #else /* def S_IFBLK */ {errno = EINVAL; return -1;} #endif /* ndef S_IFBLK */ if ((x & MakeMap_Test_FlagsEnum_S_IFMT) == MakeMap_Test_FlagsEnum_S_IFCHR) #ifdef S_IFCHR *r |= S_IFCHR; #else /* def S_IFCHR */ {errno = EINVAL; return -1;} #endif /* ndef S_IFCHR */ if ((x & MakeMap_Test_FlagsEnum_S_IFMT) == MakeMap_Test_FlagsEnum_S_IFDIR) #ifdef S_IFDIR *r |= S_IFDIR; #else /* def S_IFDIR */ {errno = EINVAL; return -1;} #endif /* ndef S_IFDIR */ if ((x & MakeMap_Test_FlagsEnum_S_IFMT) == MakeMap_Test_FlagsEnum_S_IFIFO) #ifdef S_IFIFO *r |= S_IFIFO; #else /* def S_IFIFO */ {errno = EINVAL; return -1;} #endif /* ndef S_IFIFO */ if ((x & MakeMap_Test_FlagsEnum_S_IFMT) == MakeMap_Test_FlagsEnum_S_IFLNK) #ifdef S_IFLNK *r |= S_IFLNK; #else /* def S_IFLNK */ {errno = EINVAL; return -1;} #endif /* ndef S_IFLNK */ if ((x & MakeMap_Test_FlagsEnum_S_IFMT) == MakeMap_Test_FlagsEnum_S_IFMT) #ifdef S_IFMT *r |= S_IFMT; #else /* def S_IFMT */ {/* Ignoring MakeMap_Test_FlagsEnum_S_IFMT, as it is constructed from other values */} #endif /* ndef S_IFMT */ if ((x & MakeMap_Test_FlagsEnum_S_IFMT) == MakeMap_Test_FlagsEnum_S_IFREG) #ifdef S_IFREG *r |= S_IFREG; #else /* def S_IFREG */ {errno = EINVAL; return -1;} #endif /* ndef S_IFREG */ if ((x & MakeMap_Test_FlagsEnum_S_IFMT) == MakeMap_Test_FlagsEnum_S_IFSOCK) #ifdef S_IFSOCK *r |= S_IFSOCK; #else /* def S_IFSOCK */ {errno = EINVAL; return -1;} #endif /* ndef S_IFSOCK */ if (x == 0) return 0; return 0; } int MakeMap_Test_ToFlagsEnum (int x, int *r) { *r = 0; if (x == 0) return 0; #ifdef A if ((x & A) == A) *r |= MakeMap_Test_FlagsEnum_A; #endif /* ndef A */ #ifdef All if ((x & All) == All) *r |= MakeMap_Test_FlagsEnum_All; #endif /* ndef All */ #ifdef B if ((x & B) == B) *r |= MakeMap_Test_FlagsEnum_B; #endif /* ndef B */ #ifdef C if ((x & C) == C) *r |= MakeMap_Test_FlagsEnum_C; #endif /* ndef C */ #ifdef D if ((x & D) == D) *r |= MakeMap_Test_FlagsEnum_D; #endif /* ndef D */ #ifdef None if ((x & None) == None) *r |= MakeMap_Test_FlagsEnum_None; #endif /* ndef None */ #ifdef S_IFBLK if ((x & S_IFMT) == S_IFBLK) *r |= MakeMap_Test_FlagsEnum_S_IFBLK; #endif /* ndef S_IFBLK */ #ifdef S_IFCHR if ((x & S_IFMT) == S_IFCHR) *r |= MakeMap_Test_FlagsEnum_S_IFCHR; #endif /* ndef S_IFCHR */ #ifdef S_IFDIR if ((x & S_IFMT) == S_IFDIR) *r |= MakeMap_Test_FlagsEnum_S_IFDIR; #endif /* ndef S_IFDIR */ #ifdef S_IFIFO if ((x & S_IFMT) == S_IFIFO) *r |= MakeMap_Test_FlagsEnum_S_IFIFO; #endif /* ndef S_IFIFO */ #ifdef S_IFLNK if ((x & S_IFMT) == S_IFLNK) *r |= MakeMap_Test_FlagsEnum_S_IFLNK; #endif /* ndef S_IFLNK */ #ifdef S_IFMT if ((x & S_IFMT) == S_IFMT) *r |= MakeMap_Test_FlagsEnum_S_IFMT; #endif /* ndef S_IFMT */ #ifdef S_IFREG if ((x & S_IFMT) == S_IFREG) *r |= MakeMap_Test_FlagsEnum_S_IFREG; #endif /* ndef S_IFREG */ #ifdef S_IFSOCK if ((x & S_IFMT) == S_IFSOCK) *r |= MakeMap_Test_FlagsEnum_S_IFSOCK; #endif /* ndef S_IFSOCK */ return 0; } #ifdef HAVE_STRUCT_FOO int MakeMap_Test_FromFoo (struct MakeMap_Test_Foo *from, struct foo *to) { _cnm_return_val_if_overflow (int, from->foo, -1); #ifdef HAVE_STRUCT_FOO_AUTOCONF_ME _cnm_return_val_if_overflow (gint64, from->autoconf_me, -1); #endif /* ndef HAVE_STRUCT_FOO_AUTOCONF_ME */ memset (to, 0, sizeof(*to)); to->foo = from->foo; to->p = from->p; #ifdef HAVE_STRUCT_FOO_AUTOCONF_ME to->autoconf_me = from->autoconf_me; #endif /* ndef HAVE_STRUCT_FOO_AUTOCONF_ME */ return 0; } #endif /* ndef HAVE_STRUCT_FOO */ #ifdef HAVE_STRUCT_FOO int MakeMap_Test_ToFoo (struct foo *from, struct MakeMap_Test_Foo *to) { _cnm_return_val_if_overflow (int, from->foo, -1); #ifdef HAVE_STRUCT_FOO_AUTOCONF_ME _cnm_return_val_if_overflow (gint64, from->autoconf_me, -1); #endif /* ndef HAVE_STRUCT_FOO_AUTOCONF_ME */ memset (to, 0, sizeof(*to)); to->foo = from->foo; to->p = from->p; #ifdef HAVE_STRUCT_FOO_AUTOCONF_ME to->autoconf_me = from->autoconf_me; #endif /* ndef HAVE_STRUCT_FOO_AUTOCONF_ME */ return 0; } #endif /* ndef HAVE_STRUCT_FOO */ #ifdef HAVE_STRUCT_FOO_HOLDER int MakeMap_Test_FromFooHolder (struct MakeMap_Test_FooHolder *from, struct foo_holder *to) { memset (to, 0, sizeof(*to)); if (MakeMap_Test_FromFoo (&from->foo, &to->foo) != 0) { return -1; } if (MakeMap_Test_FromTestEnum (from->mode, &to->mode) != 0) { return -1; } return 0; } #endif /* ndef HAVE_STRUCT_FOO_HOLDER */ #ifdef HAVE_STRUCT_FOO_HOLDER int MakeMap_Test_ToFooHolder (struct foo_holder *from, struct MakeMap_Test_FooHolder *to) { memset (to, 0, sizeof(*to)); if (MakeMap_Test_ToFoo (&from->foo, &to->foo) != 0) { return -1; } if (MakeMap_Test_ToTestEnum (from->mode, &to->mode) != 0) { return -1; } return 0; } #endif /* ndef HAVE_STRUCT_FOO_HOLDER */ int MakeMap_Test_FromInternalEnum (gint64 x, gint64 *r) { *r = 0; if (x == MakeMap_Test_InternalEnum_Foo) #ifdef Foo {*r = Foo; return 0;} #else /* def Foo */ {errno = EINVAL; return -1;} #endif /* ndef Foo */ if (x == 0) return 0; errno = EINVAL; return -1; } int MakeMap_Test_ToInternalEnum (gint64 x, gint64 *r) { *r = 0; if (x == 0) return 0; #ifdef Foo if (x == Foo) {*r = MakeMap_Test_InternalEnum_Foo; return 0;} #endif /* ndef Foo */ errno = EINVAL; return -1; } #ifdef HAVE_STRUCT_PARENT int MakeMap_Test_FromParent (struct MakeMap_Test_Parent *from, struct parent *to) { _cnm_return_val_if_overflow (int, from->i, -1); memset (to, 0, sizeof(*to)); to->i = from->i; return 0; } #endif /* ndef HAVE_STRUCT_PARENT */ #ifdef HAVE_STRUCT_PARENT int MakeMap_Test_ToParent (struct parent *from, struct MakeMap_Test_Parent *to) { _cnm_return_val_if_overflow (int, from->i, -1); memset (to, 0, sizeof(*to)); to->i = from->i; return 0; } #endif /* ndef HAVE_STRUCT_PARENT */ int MakeMap_Test_FromSimpleFlagsEnum (int x, int *r) { *r = 0; if ((x & MakeMap_Test_SimpleFlagsEnum_A) == MakeMap_Test_SimpleFlagsEnum_A) #ifdef A *r |= A; #else /* def A */ {errno = EINVAL; return -1;} #endif /* ndef A */ if ((x & MakeMap_Test_SimpleFlagsEnum_B) == MakeMap_Test_SimpleFlagsEnum_B) #ifdef B *r |= B; #else /* def B */ {errno = EINVAL; return -1;} #endif /* ndef B */ if ((x & MakeMap_Test_SimpleFlagsEnum_C) == MakeMap_Test_SimpleFlagsEnum_C) #ifdef C *r |= C; #else /* def C */ {errno = EINVAL; return -1;} #endif /* ndef C */ if ((x & MakeMap_Test_SimpleFlagsEnum_D) == MakeMap_Test_SimpleFlagsEnum_D) #ifdef D *r |= D; #else /* def D */ {errno = EINVAL; return -1;} #endif /* ndef D */ if ((x & MakeMap_Test_SimpleFlagsEnum_None) == MakeMap_Test_SimpleFlagsEnum_None) #ifdef None *r |= None; #else /* def None */ {errno = EINVAL; return -1;} #endif /* ndef None */ if (x == 0) return 0; return 0; } int MakeMap_Test_ToSimpleFlagsEnum (int x, int *r) { *r = 0; if (x == 0) return 0; #ifdef A if ((x & A) == A) *r |= MakeMap_Test_SimpleFlagsEnum_A; #endif /* ndef A */ #ifdef B if ((x & B) == B) *r |= MakeMap_Test_SimpleFlagsEnum_B; #endif /* ndef B */ #ifdef C if ((x & C) == C) *r |= MakeMap_Test_SimpleFlagsEnum_C; #endif /* ndef C */ #ifdef D if ((x & D) == D) *r |= MakeMap_Test_SimpleFlagsEnum_D; #endif /* ndef D */ #ifdef None if ((x & None) == None) *r |= MakeMap_Test_SimpleFlagsEnum_None; #endif /* ndef None */ return 0; } int MakeMap_Test_FromTestEnum (gint64 x, gint64 *r) { *r = 0; if (x == MakeMap_Test_TestEnum_Bar) #ifdef Bar {*r = Bar; return 0;} #else /* def Bar */ {errno = EINVAL; return -1;} #endif /* ndef Bar */ if (x == MakeMap_Test_TestEnum_Baz) #ifdef Baz {*r = Baz; return 0;} #else /* def Baz */ {errno = EINVAL; return -1;} #endif /* ndef Baz */ if (x == MakeMap_Test_TestEnum_Foo) #ifdef Foo {*r = Foo; return 0;} #else /* def Foo */ {errno = EINVAL; return -1;} #endif /* ndef Foo */ if (x == MakeMap_Test_TestEnum_Qux) #ifdef Qux {*r = Qux; return 0;} #else /* def Qux */ {errno = EINVAL; return -1;} #endif /* ndef Qux */ if (x == 0) return 0; errno = EINVAL; return -1; } int MakeMap_Test_ToTestEnum (gint64 x, gint64 *r) { *r = 0; if (x == 0) return 0; #ifdef Bar if (x == Bar) {*r = MakeMap_Test_TestEnum_Bar; return 0;} #endif /* ndef Bar */ #ifdef Baz if (x == Baz) {*r = MakeMap_Test_TestEnum_Baz; return 0;} #endif /* ndef Baz */ #ifdef Foo if (x == Foo) {*r = MakeMap_Test_TestEnum_Foo; return 0;} #endif /* ndef Foo */ #ifdef Qux if (x == Qux) {*r = MakeMap_Test_TestEnum_Qux; return 0;} #endif /* ndef Qux */ errno = EINVAL; return -1; } int MakeMap_Rename_FromColors (int x, int *r) { *r = 0; if (x == MakeMap_Rename_Colors_Blue) #ifdef Blue {*r = Blue; return 0;} #else /* def Blue */ {errno = EINVAL; return -1;} #endif /* ndef Blue */ if (x == MakeMap_Rename_Colors_Green) #ifdef Green {*r = Green; return 0;} #else /* def Green */ {errno = EINVAL; return -1;} #endif /* ndef Green */ if (x == MakeMap_Rename_Colors_Red) #ifdef Red {*r = Red; return 0;} #else /* def Red */ {errno = EINVAL; return -1;} #endif /* ndef Red */ if (x == 0) return 0; errno = EINVAL; return -1; } int MakeMap_Rename_ToColors (int x, int *r) { *r = 0; if (x == 0) return 0; #ifdef Blue if (x == Blue) {*r = MakeMap_Rename_Colors_Blue; return 0;} #endif /* ndef Blue */ #ifdef Green if (x == Green) {*r = MakeMap_Rename_Colors_Green; return 0;} #endif /* ndef Green */ #ifdef Red if (x == Red) {*r = MakeMap_Rename_Colors_Red; return 0;} #endif /* ndef Red */ errno = EINVAL; return -1; } mono-tools-4.2/create-native-map/src/Makefile.am0000664000175000017500000000373312642235713023647 0ustar00directhexdirecthex00000000000000 CNM_FILES = \ create-native-map.cs \ MapAttribute.cs TM_FILES = \ MapAttribute.cs \ TestMap.cs cnm_build_sources = $(addprefix $(srcdir)/, $(CNM_FILES)) tm_build_sources = $(addprefix $(srcdir)/, $(TM_FILES)) EXE = ../lib/create-native-map/create-native-map.exe REFS = -r:Mono.Posix.dll all: $(EXE) $(EXE) : $(cnm_build_sources) $(MCS) $(MCS_FLAGS) -d:TRACE -debug+ -out:$@ -target:exe $(REFS) $(cnm_build_sources) assemblydir = $(prefix)/lib/create-native-map assembly_DATA = $(EXE) MapAttribute.cs check: $(PROGRAM) TestMap.dll TestMap.dll: $(tm_build_sources) $(PROGRAM) $(MCS) -debug+ -out:$@ -t:library $(tm_build_sources) test_output = test.c test.h test.cs test.xml $(test_output): TestMap.dll $(EXE) ../bin/create-native-map \ --autoconf-member autoconf_me \ --autoconf-header='' \ --public-header='' \ --public-macro=DefineMe=42 \ --impl-header='' \ --impl-header='"test.h"' \ --impl-macro='FOO="foo"' \ --exclude-native-symbol=exclude_native_symbol \ --library=NativeLib \ --rename-member=st_atime=st_atime_ \ --rename-namespace=MakeMap.ToBeRenamed=MakeMap_Rename \ $< test check: $(test_output) for f in test.c test.h test.cs test.xml ; do \ diff -rup $(srcdir)/$$f.ref $$f ; \ done check-update: for f in test.c test.h test.cs test.xml ; do \ mv $$f $$f.ref ; \ done libtest.so: test.c gcc -shared -o $@ $^ -I.. `pkg-config --libs --cflags glib-2.0` test-overflow: test-overflow.c test-overflow.h test.c gcc -o $@ $< `pkg-config --libs --cflags glib-2.0` CLEANFILES = $(EXE) $(EXE).mdb $(test_output) TestMap.dll TestMap.dll.mdb libtest.so EXTRA_DIST = $(CNM_FILES) TestMap.cs test.c.ref test.cs.ref test.h.ref test.xml.ref mono-tools-4.2/create-native-map/bin/0000775000175000017500000000000012642235741021567 5ustar00directhexdirecthex00000000000000mono-tools-4.2/create-native-map/bin/Makefile.in0000664000175000017500000003707712642235731023651 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = create-native-map/bin ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) 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)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ bin_SCRIPTS = create-native-map EXTRA_DIST = create-native-map.in CLEANFILES = create-native-map 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) --gnu create-native-map/bin/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu create-native-map/bin/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): 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) tags TAGS: ctags CTAGS: cscope cscopelist: 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) installdirs: for dir in "$(DESTDIR)$(bindir)"; 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) 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-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 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-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 tags-am uninstall uninstall-am \ uninstall-binSCRIPTS .PRECIOUS: Makefile create-native-map: create-native-map.in cp $(srcdir)/$@.in $@ chmod +x $@ # 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-tools-4.2/create-native-map/bin/create-native-map.in0000775000175000017500000000017412413742070025420 0ustar00directhexdirecthex00000000000000#!/bin/sh bindir=`dirname "$0"` libdir="$bindir/../lib/create-native-map" exec mono "$libdir/create-native-map.exe" "$@" mono-tools-4.2/create-native-map/bin/Makefile.am0000664000175000017500000000026112413742070023614 0ustar00directhexdirecthex00000000000000 bin_SCRIPTS = create-native-map EXTRA_DIST = create-native-map.in CLEANFILES = create-native-map create-native-map: create-native-map.in cp $(srcdir)/$@.in $@ chmod +x $@ mono-tools-4.2/create-native-map/Makefile.in0000664000175000017500000004545412642235731023077 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = create-native-map ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-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 \ tags-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_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog 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@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = bin src lib man 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) --gnu create-native-map/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu create-native-map/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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) 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; \ $(am__define_uniq_tagged_files); \ 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-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ 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" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files 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: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ 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-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/create-native-map/Makefile.am0000664000175000017500000000003212413742070023040 0ustar00directhexdirecthex00000000000000SUBDIRS = bin src lib man mono-tools-4.2/create-native-map/man/0000775000175000017500000000000012642235741021572 5ustar00directhexdirecthex00000000000000mono-tools-4.2/create-native-map/man/Makefile.in0000664000175000017500000003721012642235731023641 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = create-native-map/man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 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; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ man_MANS = create-native-map.1 EXTRA_DIST = $(man_MANS) 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) --gnu create-native-map/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu create-native-map/man/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): 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) tags TAGS: ctags CTAGS: cscope cscopelist: 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 $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)"; 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: 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-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-man 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-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-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am 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-man1 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 tags-am uninstall uninstall-am uninstall-man \ uninstall-man1 .PRECIOUS: Makefile # 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-tools-4.2/create-native-map/man/Makefile.am0000664000175000017500000000007312413742070023620 0ustar00directhexdirecthex00000000000000 man_MANS = create-native-map.1 EXTRA_DIST = $(man_MANS) mono-tools-4.2/create-native-map/man/create-native-map.10000664000175000017500000002473212642235713025165 0ustar00directhexdirecthex00000000000000.\" .\" create-native-map manual page. .\" (C) 2006 Jonathan Pryor .\" Author: .\" Jonathan Pryor (jonpryor@vt.edu) .\" .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .TH "create-native-map" 1 .SH NAME create-native-map \- C/C# Mapping Creator .SH SYNOPSIS .B create-native-map [OPTIONS]* ASSEMBLY-FILE-NAME OUPUT-PREFIX .SH OPTIONS .TP .I \--autoconf-header=HEADER .I HEADER is a header file name in the syntax typically used with the C .I #include statement, e.g. .I "#include " or .I "#include ""local.h""" \&. .Sp An Autoconf-formatted macro is generated from the include name, and a .I #include directive is wrapped within a .I #ifdef block for the Autoconf macro within the generated .I .c file. .Sp For example, .I "--autoconf-header=" would generate the code: .nf #ifndef HAVE_STDIO_H #include #endif /* ndef HAVE_STDIO_H */ .fi .TP .I \--autoconf-member=MEMBER Specify that any access to .I MEMBER should be wrapped within a .I #ifdef HAVE_MEMBER block. .I MEMBER can be either a .I field-name or a .I class-name \&. .I field-name combination. .Sp For example, given the C# declaration: .nf [Mono.Unix.Native.Map ("struct dirent")] struct Dirent { public long d_off; } .fi then .I "--autoconf-member=d_off" would generate the code similar to: .nf int ToDirent (struct dirent *from, struct Dirent *to) { #ifdef HAVE_STRUCT_DIRENT_D_OFF to->d_off = from->d_off; #endif /* ndef HAVE_STRUCT_DIRENT_D_OFF */ } .fi .TP .I \--exclude-native-symbol=SYMBOL .I SYMBOL is a .I [DllImport] -marked method that should .I not have a prototype generated for it. .TP .I \--impl-header=HEADER Insert a .I #include statement within the generated .I .c file for .I HEADER \&. .Sp For example, .I "--impl-header=" generates .nf #include .fi .TP .I \--impl-macro=MACRO Insert a .I #define statement within the generated .I .c file. .I MACRO can contain a .I "=" to separate the macro name from the macro value. .Sp For example, .I "--impl-macro=FOO=42" generates .nf #define FOO 42 .fi .TP .I \--library=LIBRARY Create prototypes for .I [DllImport] -marked methods which reference the native library .I LIBRARY into the generated .I .h file. .TP .I \--public-header=HEADER Insert a .I #include statement within the generated .I .h file for .I HEADER \&. .Sp For example, .I "--public-header=" generates .nf #include .fi .TP .I \--public-macro=MACRO Insert a .I #define statement within the generated .I .h file. .I MACRO can contain a .I "=" to separate the macro name from the macro value. .Sp For example, .I "--public-macro=FOO=42" generates .nf #define FOO 42 .fi .TP .I \--rename-member=FROM=TO This is used when .I FROM is a C macro, and thus must be altered in order to be used sanely. All generated references to the managed representation will use .I TO instead of .I FROM \&. .Sp For example, given the C# declaration: .nf [Mono.Unix.Native.Map ("struct stat")] struct Stat { public long st_atime; } .fi and the argument .I "--rename-member=st_atime=st_atime_" , the generated .I .h file would contain: .nf struct Stat { gint64 st_atime_; }; .fi (note the altered field name), while the generated .I .c file would contain: .nf ToStat (struct stat *from, struct Stat *to) { to->st_atime_ = from->st_atime; } .fi .TP .I \--rename-namespace=FROM=TO By default, the C "namespace" (symbol prefix) is the C# namespace; types within the C# namespace .I Mono.Unix.Native would be in the C "namespace" .I Mono_Unix_Native \&. Use .I "--rename-namespace" to modify the default, e.g. .I "--rename-namespace=Mono.Unix.Native=Mono_Posix" \&. .PP .SH DESCRIPTION .I create-native-map is a program for a specific scenario: keeping code which is tightly coupled between C and C# in sync with each other, based upon the C# types. .PP Platform Invoke is only useful if the managed code knows the exact types and layout of all unmanaged structures it uses. This is usually the case on Windows, but it is .I not the case on Unix. For example, .I "struct stat" makes use of types with sizes that will vary from platform to platform (or even based on the compiler macros defined!). For example, .I off_t is usually a signed 32-bit integer on ILP32 platforms, but may be a signed 64-bit integer on LP64 platforms, but may also be a 64-bit signed integer on ILP32 platforms if the .I "_FILE_OFFSET_BITS" macro has the value 64. In short, everything is flexible within Unix, and managed code can't deal with such flexibility. .PP Thus, the niche for .I create-native-map : assume a fixed ABI that managed code can target, and generate code to "thunk" the managed representations to the corresponding native representations. This needs to be done for .I everything that can vary between platforms and compiler flags, from enumeration values ( .I SIGBUS has the value 10 on FreeBSD but 7 on Linux) to structure members (how big is .I off_t ?). .PP .I create-native-map will inspect .I ASSEMBLY-FILE-NAME and output the following files: .RS .ne 8 .TP .I OUTPUT-PREFIX.h Contains enumeration values, class and structure declarations, delegate declarations, and .I [DllImport] -marked methods (from the library specified by .I \--library ) within the assembly .I ASSEMBLY-FILE-NAME \&. .TP .I OUTPUT-PREFIX.c Contains the implementation of enumeration and structure conversion functions. .TP .I OUTPUT-PREFIX.cs Contains a partial class .I NativeConvert containing enumeration translation methods. .TP .I OUTPUT-PREFIX.xml Generates ECMA XML documentation stubs for the enumeration translation methods in .I OUTPUT-PREFIX.cs \&. .ne .RE .PP .I create-native-map primarily looks for .I MapAttribute -decorated types, and makes use of two .I MapAttribute properties: .RS .ne 8 .TP .I NativeType Contains the corresponding C type. Only useful if applied to classes, structures, and fields. .TP .I SuppressFlags When specified on an enumeration member of a .I [Flags] -decorated enumeration type, .I disables the normal code generator support for bit-masking enumeration types. .Sp This is useful when bitmask and non-bitmask information is stored within the same type, and bitmask checking shouldn't be used for the non-bitmask values. Example: .I Mono.Unix.Native.FilePermissions.S_IFREG , which is not a bitmask value, while most of .I FilePermissions consists of bitmask values ( .I FilePermissions.S_IRUSR , .I FilePermissions.S_IWUSR , etc.). .ne .RE .PP The .I MapAttribute attribute can be specified on classes, structures, delegates, fields, and enumerations. .TP Delegates Code generation for delegates ignores the .I MapAttribute.NativeType property, and generates a function pointer .I typedef that best matches the delegate declaration into the .I .h file. .Sp For example, .nf namespace Foo { [Map] delegate string MyCallback (string s); } .fi generates the .I typedef : .nf typedef char* (*Foo_MyCallback) (const char *s); .fi .TP Classes and Structures A .I [Map] -decorated class or structure will get a C structure declaration within the .I .h file: .nf [Map] struct Foo { public int i; } .fi becomes .nf struct Foo { public int i; }; .fi If the .I MapAttribute.NativeType property is set, then conversion functions will be declared within the .I .h file and created within the .I .c file: .nf namespace Foo { [Map ("struct stat")] struct Stat { public uint st_uid; } } .fi becomes .nf /* The .h file */ struct Foo_Stat { unsigned int st_uid; }; int Foo_FromStat (struct Foo_Stat *from, struct stat *to); int Foo_ToStat (struct stat *to, sxtruct Foo_Stat *to); /* The .c file */ int Foo_FromStat (struct Foo_Stat *from, struct stat *to) { memset (to, 0, sizeof(*to); to->st_uid = from->st_uid; return 0; } int Foo_ToStat (struct stat *to, sxtruct Foo_Stat *to) { memset (to, 0, sizeof(*to); to->st_uid = from->st_uid; return 0; } .fi For classes, the conversion functions will only copy fields declared in the class itself. Fields declared in parent classes will not be copied. (This is because .I create-native-map does not know how the inheritance is implemented in C. Therefore copying fields from parent classes is left to the caller of the conversion functions.) .TP Fields If a field (1) has the .I MapAttribute attribute, and (2) has the .I MapAttribute.NativeType property set, then the specified native type will be used for overflow checking. For example: .nf namespace Foo { [Map ("struct stat")] struct Stat { [Map ("off_t")] public long st_size; } } .fi generates .nf /* The .h file */ struct Foo_Stat { gint64 st_size; }; int Foo_FromStat (struct Foo_Stat *from, struct stat *to); int Foo_ToStat (struct stat *to, sxtruct Foo_Stat *to); /* The .c file */ int Foo_FromStat (struct Foo_Stat *from, struct stat *to) { _cnm_return_val_if_overflow (off_t, from->st_size, -1); memset (to, 0, sizeof(*to); to->st_size = from->st_size; return 0; } int Foo_ToStat (struct stat *to, sxtruct Foo_Stat *to) { _cnm_return_val_if_overflow (gint64, from->st_size, -1); memset (to, 0, sizeof(*to); to->st_size = from->st_size; return 0; } .fi This is useful for better error checking within the conversion functions. .I MapAttribute.NativeType is required for this as there is no other way to know what the native type is (without parsing the system header files...). .TP Enumerations Generates a C enumeration and macros for each of the members within the enumeration. .I To and .I From functions are also declared in the .I .h file and implemented in the .I .c file. .Sp For example, .nf namespace Foo { [Map] enum Errno { EINVAL } } .fi would generate the following in the .I .h file: .nf enum Foo_Errno { Foo_Errno_EINVAL = 0, #define Foo_Errno_EINVAL Foo_Errno_EINVAL }; int Foo_FromErrno (int from, int *to); int Foo_ToErrno (int from, int *to); .fi and generates the following in the the .I .c file: .nf int Foo_FromErrno (int from, int *to) { *to = 0; if (from == Foo_Errno_EPERM) #ifdef EINVAL {*to = EINVAL;} #else {errno = EINVAL; return -1;} #endif return 0; } int Foo_ToErrno (int from, int *to) { *to = 0; #ifdef EINVAL if (from == EINVAL) {*to = Foo_Errno_EPERM; return 0;} #endif return -1; } .fi Different code will be generated if the managed enum is a .I [Flags] -decorated enumeration (to account for bitwise flags), but this is the basic idea. .PP .SH MAILING LISTS Visit http://lists.ximian.com/mailman/listinfo/mono-devel-list for details. .SH WEB SITE Visit http://www.mono-project.com for details mono-tools-4.2/missing0000755000175000017500000001533012550553153017112 0ustar00directhexdirecthex00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 Free Software Foundation, Inc. # Originally written 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 case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man 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 # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # 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-tools-4.2/Makefile.am0000664000175000017500000000031212413742070017537 0ustar00directhexdirecthex00000000000000SUBDIRS= po docbrowser asn1view create-native-map ilcontrast gui-compare \ gendarme mperfmon gsharp webdoc minvoke Mono.Profiler #capture aclocal flags for autoreconf ACLOCAL_AMFLAGS=$(ACLOCAL_FLAGS) mono-tools-4.2/config.guess0000755000175000017500000012355012405615464020042 0ustar00directhexdirecthex00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2014 Free Software Foundation, Inc. timestamp='2014-03-23' # This file 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 3 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, 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp 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` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: mono-tools-4.2/webdoc/0000775000175000017500000000000012642235743016762 5ustar00directhexdirecthex00000000000000mono-tools-4.2/webdoc/web.config0000664000175000017500000000245712642235743020736 0ustar00directhexdirecthex00000000000000
mono-tools-4.2/webdoc/README.md0000664000175000017500000000251212642235743020241 0ustar00directhexdirecthex00000000000000Webdoc ====== Webdoc is the web container for monodoc. It normally includes: - a header - a footer - a navigation tree - the monodoc iframe Structure --------- Each webdoc instance consists of a skin (theme, chrome) and several plugins. Plugins are located in the plugins directory. The plugins currently available are: - iframe: helps size the iframe correctly in your webdoc instance. Recommended unless you want to use your own code for that - sidebar: left navigation tree. Again, recommended unless you feel like writign and wiring up your own (good luck!) - fast search: searches while you type - full search: returns a page of search results (`search.html`). Can be styled however you like. Skins are located in the skins directory. Each skin consists of: - `header.html` (required) - `footer.html` (required) - additional css and js (usually placed in the `common-extension.css`/`common-extension.js` file) - images folder (optional) How to Use ---------- Making a new instance of webdoc is easy. First, you need to edit web.config to point to the location of your monodoc source root. `MonodocRootDir` -> monodoc source root Next, throw your skin into the skins directory (or use one that's already there). Edit the `plugins.def` file, uncommenting the plugins you want to use, and setting the location of your skin. mono-tools-4.2/webdoc/Global.asax0000664000175000017500000000675112642235743021051 0ustar00directhexdirecthex00000000000000<%@ Application ClassName="Mono.Website.Global" %> <%@ Import Namespace="Monodoc" %> <%@ Import Namespace="System.Web.Configuration" %> <%@ Import Namespace="System.Collections.Generic" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Linq" %> <%@ Assembly name="monodoc" %> mono-tools-4.2/webdoc/plugins/0000775000175000017500000000000012642235743020443 5ustar00directhexdirecthex00000000000000mono-tools-4.2/webdoc/plugins/iframe-plugin/0000775000175000017500000000000012642235743023202 5ustar00directhexdirecthex00000000000000mono-tools-4.2/webdoc/plugins/iframe-plugin/jquery.iframe-auto-height-plugin.1.9.0.min.js0000664000175000017500000000453312642235744033265 0ustar00directhexdirecthex00000000000000/* Plugin: iframe autoheight jQuery Plugin Version: 1.9.0 Description: when the page loads set the height of an iframe based on the height of its contents see README: http://github.com/house9/jquery-iframe-auto-height */ (function(a){a.fn.iframeAutoHeight=function(b){function d(a){c.debug&&c.debug===!0&&window.console&&console.log(a)}function e(b,c){d("Diagnostics from '"+c+"'");try{d(" "+a(b,window.top.document).contents().find("body")[0].scrollHeight+" for ...find('body')[0].scrollHeight"),d(" "+a(b.contentWindow.document).height()+" for ...contentWindow.document).height()"),d(" "+a(b.contentWindow.document.body).height()+" for ...contentWindow.document.body).height()")}catch(e){d(" unable to check in this state")}d("End diagnostics -> results vary by browser and when diagnostics are requested")}var c=a.extend({heightOffset:0,minHeight:0,callback:function(a){},animate:!1,debug:!1,diagnostics:!1,resetToMinHeight:!1,triggerFunctions:[],heightCalculationOverrides:[]},b);return d(c),this.each(function(){function g(a){var c=null;return jQuery.each(b,function(b,d){if(a[d])return c=f[d],!1}),c===null&&(c=f["default"]),c}function i(b){c.diagnostics&&e(b,"resizeHeight"),c.resetToMinHeight&&c.resetToMinHeight===!0&&(b.style.height=c.minHeight+"px");var f=a(b,window.top.document).contents().find("body"),h=g(a.browser),i=h(b,f,c,a.browser);d(i),i0){d(c.triggerFunctions.length+" trigger Functions");for(var j=0;j'e$"\#E1CnĎ~J,,AaUw^4I%Pu Q33{0i1TGgwy}%%'R  = 3G%p0 JRo5Ȇ0IĦmykxT_}(^yKs>i_%n=q4e-M¤D! , I)*')Ed]PR A:!zrbw %6"G(d$["JFhaQP`p%†/BFP\cU ?TtW/pG&OtDa_sylD'M q tc b2DM : d% 4%s) uE3 YUtږD$JiM^%o/rvl9'L;99% i9 C "B BDs ^Xf}$P {L?P O4 E咛V$dJ#)pV$! , IiRͧ"Jd] RZN*P*;$P{*N\EА!1UO2D _r6Ib H8 B; "'ZtbK#C'Kw}?Kiz6:xKAC&}9tz\ \D5;x Qd( KW  MBIڈM=ˤs⸽8DaJ`@LG! , IiRͧ"Jd] RZN*P*;$P{*N\EА!1UO2D _r6Ib H8 B; "'ZtbK#C'KGziz68}z~%XK9:0}% tz\Blc LbQ   lj ųKň x(țPX ,ւ|/"! , IiRͧ"Jd] RZN*P*;$P{*N\EА!1UO2D _r6Ib H8 B; "'ZtbK#C'KGziz68}z~%:A/ C} u\ h}b D]=  V)  ڊ9CDK Ku *00StD! , IiRͧ"Jd] RZN*P*;$P{*N\EА!1UO2D _r6Ib H8 B; "'ZtbK#C'KGz z5 C: A/ C}u\ Eh}b6[=Wx&)I9Ԭ@oCT?Kd]B76ЫD! , IiRͧ"Jd] RZN*P*;$P{*N\EА!1UO2D _r6I ƀH03hոaj U {CIkmbK#cK8 {a8nV:/q:M Cu~Ehk6 [_6P.]6!)V! , IiRͧ"Jd]U RZN JjN2sK6 dI)  LHWG 6 KX젱.6d~zhuur/6 X5I;_t O#E {O9V94;VC/ 6Ø~*'MonbX:~]+V*mK_OrKN@.d~qЦDB֋ 5D;mono-tools-4.2/webdoc/plugins/search-plugin/fullsearch/0000775000175000017500000000000012642235743025334 5ustar00directhexdirecthex00000000000000mono-tools-4.2/webdoc/plugins/search-plugin/fullsearch/fullsearch.js0000664000175000017500000000270412642235744030026 0ustar00directhexdirecthex00000000000000//support for a full page of search results /monodoc.ashx?search= var spinner = $('#s_spinner'); function process_hash () { var query = window.location.hash; if (query == null || query.length < 2) return; var ul = $('#s_results ul'); ul.empty (); var currentNumber = 0; var count = 0; // Remove hash '#' symbol query = query.substring(1); $('#s_term').text (query); var fetch_and_add_results = function (url) { spinner.toggleClass ('hidden'); $.getJSON (url, function (data) { spinner.toggleClass ('hidden'); count = data.count; currentNumber += data.result.length; if (data.result.length == 0) { $('
', { 'class': 's_message' }).text('No more results').replaceAll($('#s_morebtn')).fadeOut(4000, function () { $(this).remove(); }); } else { var lis = $.map (data.result, function (element) { return '
  • ' + element.name + ' ' + (element.fulltitle.length > 0 ? '(' + element.fulltitle + ')' : '') + '
  • '; }); ul.append (lis.join ('')); } }); }; fetch_and_add_results ('/monodoc.ashx?search=' + query + '&callback=?'); $('#s_morebtn input').click (function () { fetch_and_add_results ('/monodoc.ashx?search=' + query + '&start=' + currentNumber + '&count=' + count + '&callback=?'); }); } process_hash (); window.addEventListener("hashchange", process_hash, false); mono-tools-4.2/webdoc/plugins/search-plugin/fullsearch/search.css0000664000175000017500000000074512642235744027322 0ustar00directhexdirecthex00000000000000#s_spinner, #s_header, #s_morebtn, .s_message { text-align: center; } #s_header { margin-bottom: 1em; } div.hidden { display: none; visibility: hidden; } #s_results a { color: #777; } #s_results a:hover { color: black; } #s_results span.fulltitle { font-style: italic; font-size: 80%; } #s_results li { margin-bottom: 0.5em; } #s_morebtn input { font-size: x-large; padding: 5px 14px 6px; } #s_morebtn { margin-bottom: 1em; } .s_message { font-size: xx-large; } mono-tools-4.2/webdoc/plugins/search-plugin/fullsearch/search.html0000664000175000017500000000151412642235744027471 0ustar00directhexdirecthex00000000000000

    Search result(s) for ''

      mono-tools-4.2/webdoc/plugins/search-plugin/fastsearch/0000775000175000017500000000000012642235743025327 5ustar00directhexdirecthex00000000000000mono-tools-4.2/webdoc/plugins/search-plugin/fastsearch/search.js0000664000175000017500000000715612642235744027144 0ustar00directhexdirecthex00000000000000var search_input = $('#fsearch'); var search_window = $('#fsearch_window'); var lis = null; var page_top_offset = $('#main_part').offset().top; var is_shown = false; var hide = function () { if (!is_shown) return; search_window.css ({'display' : 'none', 'opacity' : 0}); is_shown = false; }; var show = function () { if (is_shown) return; search_window.css ({'display' : 'block', 'height' : 'auto', 'opacity' : 1.0, 'width': search_input.width() + 'px', 'top': page_top_offset + 'px' }); is_shown = true; }; var param = document.URL.split('#')[1]; if(param) { $('#content_frame').attr('src', '/plugins/search-plugin/fullsearch/search.html#' + param); } search_input.blur (function () { window.setTimeout (hide, 200); if (search_input.val ().length == 0) search_input.css ('width', '19em'); }); search_input.focus (function () { search_input.css ('width', '29em'); if (search_window.text().length > 0 && search_input.val().length > 0) show (); window.setTimeout (function () { search_input[0].select (); }, 10); }); search_input.keyup (function (event) { if ($(this).val () == "") hide(); // Only process if we receive an alnum or backspace or del if (event.which != 8 && event.which != 46 && (event.which < 'A'.charCodeAt(0) || event.which > 'Z'.charCodeAt(0)) && (event.which < '0'.charCodeAt(0) || event.which > '9'.charCodeAt(0))) return; var callback = function (data) { if (data == null || data.length == 0) return; var items = []; $.each (data, function(key, val) { var item = val.name; var url = val.url.replace (/[<>]/g, function (c) { return c == '<' ? '{' : '}'; }); items.push('
    • ' + item + '
    • '); }); var uls = $('

      "); if (end != -1) { int start = webpage.LastIndexOf (' ', end); if (start != -1) { name = webpage.Substring (start + 1, end - start - 1); } } } catch (Exception) { // many things can go wrong but it's only some // "additional" (not essential) data // FIXME: report error to UI } return name; } private string GetOidInfoFromElibel (string oid) { string name = String.Empty; try { string url = String.Concat ("http://asn1.elibel.tm.fr/cgi-bin/oid/display?oid=", oid, "&action=display"); HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url); WebResponse resp = req.GetResponse (); Stream s = resp.GetResponseStream (); StreamReader sr = new StreamReader (s, Encoding.UTF8); string webpage = sr.ReadToEnd (); int end = webpage.IndexOf (")}"); if (end != -1) { end = webpage.LastIndexOf ("(", end); int start = webpage.LastIndexOf (' ', end); if (start != -1) { name = webpage.Substring (start + 1, end - start - 1); } } } catch (Exception) { // many things can go wrong but it's only some // "additional" (not essential) data // FIXME: report error to UI } return name; } } } mono-tools-4.2/asn1view/common/ASN1Decoder.cs0000664000175000017500000001023012413742070023047 0ustar00directhexdirecthex00000000000000// // ASN1Decoder.cs: ASN.1 Decoder // // Author: // Sebastien Pouliot // // Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) // using System; using System.Collections; using System.Text; // NOTE: This class is a prototype. A future version of it will be included into // Mono.Security.dll in Mono 2.0. Use at your own risk (as the API _will_ change). namespace Mono.Security { public class ASN1Element { private byte [] _data; private int _position; private int _valueLength; private int _valuePosition; private ArrayList _childs; public ASN1Element (byte[] buffer, int start) { _data = buffer; _position = start; _valuePosition = start + 1; _valueLength = _data [_valuePosition++]; // special case #1 : undefined length if (_valueLength == 0x80) { // Value.Length will have it anyway _valueLength = -1; } // special case where L contains the Length of the Length + 0x80 else if ((_valueLength & 0x80) == 0x80) { int len = _valueLength & 0x7F; _valueLength = 0; for (int i = 0; i < len; i++) _valueLength = _valueLength * 256 + _data [_valuePosition++]; } if (IsConstructed && (_valueLength != 0)) { DecodeChilds (); if (_valueLength == -1) { // update to the true (known) length int childLength = 0; if ((_childs != null) && (_childs.Count > 0)) { foreach (ASN1Element child in _childs) { childLength += child.TotalLength; } } _valueLength = childLength; } } } public byte Tag { get { return _data [_position]; } } public int Length { get { return _valueLength; } } public byte[] Value { get { if (_valueLength < 0) return null; byte[] value = new byte [_valueLength]; Buffer.BlockCopy (_data, _valuePosition, value, 0, value.Length); return value; } } public bool IsConstructed { get { return ((_data [_position] & 0x20) == 0x20); } } public bool IsUndefinedLength { get { return (_data [_position + 1] == 0x80); } } public int Count { get { if (_childs == null) return 0; return _childs.Count; } } public ASN1Element this [int index] { get { try { if ((index < 0) || (index >= _childs.Count)) return null; return (ASN1Element)_childs [index]; } catch (ArgumentOutOfRangeException) { return null; } } } public int Position { get { return _position; } } internal int TotalLength { get { return _valuePosition - _position + _valueLength; } } // note: Length has a variable length ;-) public int ValuePosition { get { return _valuePosition; } } private void DecodeChilds () { _childs = new ArrayList (); int childpos = _valuePosition; int end = childpos + _valueLength; while ((_valueLength == -1) || (childpos < end)) { ASN1Element el = new ASN1Element (_data, childpos); _childs.Add (el); childpos += el.TotalLength; // exit condition for undefined length (_valueLength == -1) if ((el.Tag == 0x00) && (el.Length == 0)) break; } } public override string ToString () { StringBuilder sb = new StringBuilder (); BuildString (sb, 0); return sb.ToString (); } internal void BuildString (StringBuilder sb, int level) { for (int i = 0; i < level; i++) { sb.Append (" "); } if (this.Value != null) { if (this.Count > 0) { sb.AppendFormat ("Tag {0} Length {1} {2} {3}", this.Tag.ToString ("X2"), this.Length, "{", Environment.NewLine); for (int j = 0; j < this.Count; j++) { (this [j] as ASN1Element).BuildString (sb, level + 1); } for (int i = 0; i < level; i++) { sb.Append (" "); } sb.AppendFormat ("{0} {1}", "}", Environment.NewLine); } else { sb.AppendFormat ("Tag {0} Length {1} Value {2} {3}", this.Tag.ToString ("X2"), this.Length, (this.Length == 0) ? String.Empty : BitConverter.ToString (this.Value), Environment.NewLine); } } else { sb.AppendFormat ("Tag {0} Length {1} {2}", this.Tag.ToString ("X2"), this.IsUndefinedLength ? "Undefined" : "0", Environment.NewLine); } } } } mono-tools-4.2/asn1view/common/Makefile.in0000664000175000017500000003117112642235731022611 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = asn1view/common ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ FILES = ASN1Decoder.cs \ AssemblyInfo.cs \ OidCache.cs \ PrettyPrinter.cs EXTRA_DIST = $(FILES) 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) --gnu asn1view/common/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu asn1view/common/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: ctags CTAGS: cscope cscopelist: 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: 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-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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/asn1view/common/AssemblyInfo.cs0000664000175000017500000000403112413742070023454 0ustar00directhexdirecthex00000000000000// // AssemblyInfo.cs: Assembly Informations // // Author: // Sebastien Pouliot // // Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) // using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; // AssemblyTitle and AssemblyDescription are in //Main.cs [assembly: AssemblyCompany ("Novell Inc.")] [assembly: AssemblyCopyright ("Copyright © 2004-2005 Novell Inc.")] [assembly: AssemblyVersion ("0.1.1.0")] namespace Mono.Tools { public class AssemblyInfo { private string _name; private string _title; private string _copyright; private string _description; private string _version; public AssemblyInfo () : this (Assembly.GetExecutingAssembly ()) { } public AssemblyInfo (Assembly a) { if (a == null) throw new ArgumentNullException ("a"); AssemblyName an = a.GetName (); _name = an.ToString (); object [] att = a.GetCustomAttributes (typeof (AssemblyTitleAttribute), false); _title = ((att.Length > 0) ? ((AssemblyTitleAttribute) att [0]).Title : String.Empty); att = a.GetCustomAttributes (typeof (AssemblyCopyrightAttribute), false); _copyright = ((att.Length > 0) ? ((AssemblyCopyrightAttribute) att [0]).Copyright : String.Empty); att = a.GetCustomAttributes (typeof (AssemblyDescriptionAttribute), false); _description = ((att.Length > 0) ? ((AssemblyDescriptionAttribute) att [0]).Description : String.Empty); _version = an.Version.ToString (); } public string Copyright { get { return _copyright; } } public string Description { get { return _description; } } public string Name { get { return _name; } } public string Title { get { return _title; } } public string Version { get { return _version; } } public override string ToString () { StringBuilder sb = new StringBuilder (); sb.AppendFormat ("{1} - version {2}{0}{3}{0}{4}{0}", Environment.NewLine, _title, _version, _description, _copyright); return sb.ToString (); } } } mono-tools-4.2/asn1view/common/OidCache.cs0000664000175000017500000000345412413742070022530 0ustar00directhexdirecthex00000000000000// // OidCache.cs: OID Cache Management // // Author: // Sebastien Pouliot // // Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com) // using System; using System.Collections; using System.IO; public class OidCache { private Hashtable _cache; private bool _modified; public OidCache () { _cache = new Hashtable (); _modified = false; } public OidCache (string filename) : this () { Load (filename); } public void Add (string oid, string description) { _cache.Add (oid, description); _modified = true; } public void Clear () { _cache.Clear (); _modified = true; } public string Get (string oid) { return (string) _cache [oid]; } public void Load (string filename) { if (!File.Exists (filename)) return; using (StreamReader sr = new StreamReader (filename)) { string oid = sr.ReadLine (); while (oid != null) { _cache.Add (oid, sr.ReadLine ()); oid = sr.ReadLine (); } sr.Close (); } _modified = false; } public void Save (string filename) { if (!_modified) return; try { if (!File.Exists (filename)) { string path = Path.GetDirectoryName (filename); if (!Directory.Exists (path)) { Directory.CreateDirectory (path); } } using (StreamWriter sw = new StreamWriter (filename)) { foreach (DictionaryEntry de in _cache) { string desc = (string) de.Value; // don't cache empty values. maybe we // can download updated data (or from // elsewhere) in a future session... if ((desc != null) && (desc.Length > 0)) { sw.WriteLine (de.Key); sw.WriteLine (de.Value); } } sw.Close (); } _modified = false; } catch (Exception e) { Console.Error.WriteLine ("OID cache couldn't be saved. Cause: {0}", e.ToString ()); } } } mono-tools-4.2/asn1view/common/Makefile.am0000664000175000017500000000014412413742070022567 0ustar00directhexdirecthex00000000000000FILES= ASN1Decoder.cs \ AssemblyInfo.cs \ OidCache.cs \ PrettyPrinter.cs EXTRA_DIST= $(FILES) mono-tools-4.2/asn1view/README0000664000175000017500000000113112413742070020120 0ustar00directhexdirecthex00000000000000FEATURES General - Decode ASN.1 structures; - Support undefined length elements; - Support encapsulated ASN.1 elements; - Export textual representation of structures (great for diffs); - Download and cache OID definitions from the web, either from: - Alvestrand (www.alvestrand.no); or - Elibel (asn1.elibel.tm.fr). Gnome specific - Find bar (a la FireFox) with highlight (yellow); - Encapsulated ASN.1 in alternate color (blue); HISTORY 2004-12-05 Version 0.1.0.0 - Initial (un)release with Gnome support (Gtk#); 2005-05-08 Version 0.1.1.0 - First public version (restructured for SVN); mono-tools-4.2/asn1view/art/0000775000175000017500000000000012642235741020040 5ustar00directhexdirecthex00000000000000mono-tools-4.2/asn1view/art/Makefile.in0000664000175000017500000003116512642235731022112 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) 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 = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = asn1view/art ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = 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 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ACLOCAL_FLAGS = @ACLOCAL_FLAGS@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CATALOGS = @CATALOGS@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CECIL_ASM = @CECIL_ASM@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CSHARP_FLAGS = @CSHARP_FLAGS@ CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DMCS = @DMCS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GACUTIL = @GACUTIL@ GECKO_SHARP_CFLAGS = @GECKO_SHARP_CFLAGS@ GECKO_SHARP_LIBS = @GECKO_SHARP_LIBS@ GENDARME_VERSION = @GENDARME_VERSION@ GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ GMCS = @GMCS@ GMOFILES = @GMOFILES@ GMSGFMT = @GMSGFMT@ GNOME_SHARP_CFLAGS = @GNOME_SHARP_CFLAGS@ GNOME_SHARP_LIBS = @GNOME_SHARP_LIBS@ GNUNIT_VERSION = @GNUNIT_VERSION@ GREP = @GREP@ GTKHTML_SHARP_CFLAGS = @GTKHTML_SHARP_CFLAGS@ GTKHTML_SHARP_LIBS = @GTKHTML_SHARP_LIBS@ GTK_SHARP_CFLAGS = @GTK_SHARP_CFLAGS@ GTK_SHARP_LIBS = @GTK_SHARP_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTOBJEXT = @INSTOBJEXT@ INTLLIBS = @INTLLIBS@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIB_PREFIX = @LIB_PREFIX@ LIB_SUFFIX = @LIB_SUFFIX@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MDOC = @MDOC@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MOZILLA_HOME = @MOZILLA_HOME@ MSGFMT = @MSGFMT@ MSGFMT_OPTS = @MSGFMT_OPTS@ NUNIT_CFLAGS = @NUNIT_CFLAGS@ NUNIT_LIBS = @NUNIT_LIBS@ OBJEXT = @OBJEXT@ 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@ POFILES = @POFILES@ POSUB = @POSUB@ PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ RESGEN = @RESGEN@ RUNTIME = @RUNTIME@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TOOLS_VERSION = @TOOLS_VERSION@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ WEBKIT_SHARP_CFLAGS = @WEBKIT_SHARP_CFLAGS@ WEBKIT_SHARP_LIBS = @WEBKIT_SHARP_LIBS@ XGETTEXT = @XGETTEXT@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ 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 = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ FILES = export-16.png \ export.png \ text_hilight-16.png \ text_lolight-16.png EXTRA_DIST = $(FILES) 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) --gnu asn1view/art/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu asn1view/art/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: ctags CTAGS: cscope cscopelist: 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: 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-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 cscopelist-am \ ctags-am 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 tags-am uninstall uninstall-am .PRECIOUS: Makefile # 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-tools-4.2/asn1view/art/text_lolight-16.png0000664000175000017500000000045112413742070023472 0ustar00directhexdirecthex00000000000000PNG  IHDR7tIME 't( pHYs  d_gAMA aIDATxc`be+LaPbd?Հ;8=u!@p* o !J3:klx( _Hid7M!HLD N 9-@ 0EWB@%0(㔾 Lq(@JaIENDB`mono-tools-4.2/asn1view/art/text_hilight-16.png0000664000175000017500000000110012413742070023450 0ustar00directhexdirecthex00000000000000PNG  IHDRagAMA abKGD pHYs  ~tIME <<IDATxڥOkSAHE,tKq!ХKq!BhuG_D1D]KT31b /.9wܙ(o@k`x[VeVI, MSi,˔esrΩRVz]FCfSVKRI岢(RUS d& 0k*Bށ 1yc̼`vpl< | G>W~e2$Q'O&u7a ]џ 4hf*1)xf?<4U Et?+Nv y Nהּ/5_7 KC`& [pՆ>pJ^sNqyʍauзc\@xY=۳^~yswELkÂK{ [:Pwvz?衴9|  m5 PW:#ԝdb4%%RAsäu0@­1|>?P?Wݠ1*Bo= 0~ D@cY c1@ oºMUUmsG9g4"z(DAA/,,$&쪪*:n'yw rZKuu5imqQxxMӰA?iqk83;@A"ip>?̅!F  m b YҚ/H!@ ."J7m$OQh>cXFV.5&;w(\P8)#ֿ}{ p1FF0c:FL_O$/v 0fOT$M$ ۚAƂ,i7Kz)$FLG m; CH9FY)A.Zߟظ.15^Dmt]HdiĘIVv>4R`^R{m; r.F5rssy̅HIM#elt_owaIT"`A/uyV}(.8DIHTVQ r ] aIENDB`mono-tools-4.2/asn1view/art/export-16.png0000664000175000017500000000134312413742070022306 0ustar00directhexdirecthex00000000000000PNG  IHDRabKGD pHYs  ~tIME .1\l&pIDATxMHq?{1Ks)&%iy\nCB*X "ѥRR FBw!V%Mjmn,uXiں|<Y*@HriO-IJXj5K'.`=*1¬l  T*R LLxv Gj,y_b}M,D#DJrȲ$I;|3d ~@c4GFCpwɄ` cXuD{Gp/38Rc{M(rf.((cOvҏ ۯ199n'hׇѡ\{}䤁(es}ȒDzzό;t  m>L_q gN @jX *B4IENDB`mono-tools-4.2/asn1view/Makefile.am0000664000175000017500000000003112413742070021272 0ustar00directhexdirecthex00000000000000SUBDIRS= art gtk common mono-tools-4.2/COPYING.LIB0000664000175000017500000006143112413742070017154 0ustar00directhexdirecthex00000000000000 The Mono runtime is licensed under the terms of the GNU Library General Public License, version 2. GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it!