diff --git a/Makefile.in b/Makefile.in index a80823be98..f0873e25ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -85,7 +85,7 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/config.h.in mkinstalldirs \ $(srcdir)/mono-core.spec.in $(srcdir)/mono-uninstalled.pc.in \ AUTHORS COPYING.LIB ChangeLog NEWS compile config.guess \ - config.rpath config.sub depcomp install-sh missing ltmain.sh + config.rpath config.sub install-sh missing ltmain.sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ diff --git a/configure.REMOVED.git-id b/configure.REMOVED.git-id index dc6ce318a4..73361a6915 100644 --- a/configure.REMOVED.git-id +++ b/configure.REMOVED.git-id @@ -1 +1 @@ -0d2865058e8904b609431e735d1a6a58dd269476 \ No newline at end of file +d8620aa82da0a0b38b32fce2756391f51b4f0e09 \ No newline at end of file diff --git a/configure.ac.REMOVED.git-id b/configure.ac.REMOVED.git-id index b569026b33..c04bfedd79 100644 --- a/configure.ac.REMOVED.git-id +++ b/configure.ac.REMOVED.git-id @@ -1 +1 @@ -e26c88521f1fb3392393ffb4a102d2f9441ab54f \ No newline at end of file +eb6b931cec597bff05367555adbfdfd531547514 \ No newline at end of file diff --git a/docs/deploy/mono-api-codegen.html b/docs/deploy/mono-api-codegen.html index 01dcc567d6..a370ad8c3d 100644 --- a/docs/deploy/mono-api-codegen.html +++ b/docs/deploy/mono-api-codegen.html @@ -122,7 +122,7 @@ mono_code_manager_invalidate (MonoCodeManager *cman)
mono_code_manager_new_dynamic
MonoCodeManager* -mono_code_manager_new_dynamic (int bind_size) +mono_code_manager_new_dynamic (void)

@@ -134,8 +134,6 @@ mono_code_manager_new_dynamic (int bind_size) Creates a new code manager suitable for holding native code that can be used for single or small methods that need to be deallocated independently of other native code. - BIND_SIZE is the amount of memory reserved for storing thunks. If its 0, - the default size is used. diff --git a/docs/deploy/mono-api-internal.html b/docs/deploy/mono-api-internal.html index 0ba9ccc20d..22f51d2c2e 100644 --- a/docs/deploy/mono-api-internal.html +++ b/docs/deploy/mono-api-internal.html @@ -476,6 +476,33 @@ mono_loader_lock (void)

Prototype: mono_gc_enable

+ +

+
mono_gc_is_finalizer_thread
+ +
gboolean +mono_gc_is_finalizer_thread (MonoThread *thread) + +
+

+Parameters +

thread:
the thread to test.
+Remarks +

+ In Mono objects are finalized asynchronously on a separate thread. + This routine tests whether the thread argument represents the + finalization thread. + +

+ Returns true if thread is the finalization thread. + +

+
+
mono_gc_out_of_memory
+ +
Prototype: mono_gc_out_of_memory
+

+

mono_gc_start_world
@@ -497,6 +524,13 @@ mono_loader_lock (void)
Prototype: mono_gc_alloc_fixed

+

+
+
mono_gc_enable_events
+ +
Prototype: mono_gc_enable_events
+

+

mono_gc_free_fixed
diff --git a/docs/deploy/mono-api-jit.html b/docs/deploy/mono-api-jit.html index f8f86ac094..b26123c17b 100644 --- a/docs/deploy/mono-api-jit.html +++ b/docs/deploy/mono-api-jit.html @@ -111,7 +111,7 @@ mono_print_method_from_ip (void *ip) This prints the name of the method at address ip in the standard output. Unlike mono_pmip which returns a string, this routine - prints the value on the standard output. + prints the value on the standard output.
diff --git a/docs/deploy/mono-api-object.html b/docs/deploy/mono-api-object.html index 18cfa0aa3c..04f57c2540 100644 --- a/docs/deploy/mono-api-object.html +++ b/docs/deploy/mono-api-object.html @@ -108,6 +108,7 @@ MonoObject* mono_object_isinst gpointer mono_object_unbox (MonoObject *obj); MonoObject* mono_object_castclass_mbyref (MonoObject *obj, MonoClass *klass); + guint mono_object_get_size (MonoObject* o); MonoObject* mono_value_box (MonoDomain *domain, MonoClass *class, @@ -422,6 +423,13 @@ mono_object_castclass_mbyref (MonoObject *obj, MonoClass *klass)
obj if obj is derived from klass, throws an exception otherwise
+
+
+
mono_object_is_alive
+ +
Prototype: mono_object_is_alive
+

+

mono_object_get_size
diff --git a/docs/deploy/mono-api-profiler.html b/docs/deploy/mono-api-profiler.html index 8703c31398..cee44a4860 100644 --- a/docs/deploy/mono-api-profiler.html +++ b/docs/deploy/mono-api-profiler.html @@ -104,12 +104,12 @@
mono_profiler_install
void -mono_profiler_install (MonoProfiler *prof, int version, MonoProfileFunc callback) +mono_profiler_install (MonoProfiler *prof, MonoProfileFunc callback)

Parameters -

prof:
a MonoProfiler structure pointer, or a pointer to a derived structure.
version:
profiler API version (see profiler.h)
callback:
the function to invoke at shutdown
+
prof:
a MonoProfiler structure pointer, or a pointer to a derived structure.
callback:
the function to invoke at shutdown
Remarks

Use mono_profiler_install to activate profiling in the Mono runtime. diff --git a/mcs/Makefile b/mcs/Makefile index b94a7c82d6..687178d9cf 100644 --- a/mcs/Makefile +++ b/mcs/Makefile @@ -14,6 +14,7 @@ mobile_SUBDIRS := build class mobile_static_SUBDIRS := build class binary_reference_assemblies_SUBDIRS := build class net_4_5_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs +xammac_net_4_5_SUBDIRS := build class xbuild_12_SUBDIRS := build class tools/xbuild xbuild_14_SUBDIRS := build class tools/xbuild @@ -57,6 +58,7 @@ $(_boot_:%=profile-do--monodroid--%): profile-do--monodroid--%: $(_boot_:%=profile-do--monotouch--%): profile-do--monotouch--%: profile-do--build--% $(_boot_:%=profile-do--monotouch_runtime--%): profile-do--monotouch_runtime--%: profile-do--build--% $(_boot_:%=profile-do--xammac--%): profile-do--xammac--%: profile-do--build--% +$(_boot_:%=profile-do--xammac_net_4_5--%): profile-do--xammac_net_4_5--%: profile-do--build--% $(_boot_:%=profile-do--mobile--%): profile-do--mobile--%: profile-do--build--% $(_boot_:%=profile-do--mobile_static--%): profile-do--mobile_static--%: profile-do--build--% $(_boot_:%=profile-do--build--%): profile-do--build--%: profile-do--basic--% diff --git a/mcs/build/common/Consts.cs b/mcs/build/common/Consts.cs index e738b8d395..1527064894 100644 --- a/mcs/build/common/Consts.cs +++ b/mcs/build/common/Consts.cs @@ -34,7 +34,7 @@ static class Consts // Use these assembly version constants to make code more maintainable. // - public const string MonoVersion = "4.0.2.0"; + public const string MonoVersion = "4.0.3.0"; public const string MonoCompany = "Mono development team"; public const string MonoProduct = "Mono Common Language Infrastructure"; public const string MonoCopyright = "(c) Various Mono authors"; diff --git a/mcs/build/common/SR.cs b/mcs/build/common/SR.cs index fbc9eb2138..edc4e8f79b 100644 --- a/mcs/build/common/SR.cs +++ b/mcs/build/common/SR.cs @@ -9,7 +9,6 @@ static class AssemblyRef public const string EcmaPublicKey = "b77a5c561934e089"; public const string MicrosoftPublicKey = "b03f5f7f11d50a3a"; - public const string MicrosoftVSDesigner = Consts.AssemblyMicrosoft_VSDesigner; public const string SystemDesign = Consts.AssemblySystem_Design; public const string SystemDrawing = Consts.AssemblySystem_Drawing; public const string SystemWeb = Consts.AssemblySystem_Web; diff --git a/mcs/class/Facades/Makefile b/mcs/class/Facades/Makefile index ffdea4c751..bbd79e215c 100644 --- a/mcs/class/Facades/Makefile +++ b/mcs/class/Facades/Makefile @@ -18,6 +18,7 @@ net_4_5_SUBDIRS = $(monotouch_SUBDIRS) System.Reflection.Emit.ILGeneration Syste monodroid_SUBDIRS = $(net_4_5_SUBDIRS) xammac_SUBDIRS = $(net_4_5_SUBDIRS) +xammac_net_4_5_SUBDIRS = $(net_4_5_SUBDIRS) PROFILE_SUBDIRS = $(net_4_5_SUBDIRS) diff --git a/mcs/class/Facades/System.ServiceModel.Security/TypeForwarders.cs b/mcs/class/Facades/System.ServiceModel.Security/TypeForwarders.cs index dc2f5dc8c6..61d5b5a044 100644 --- a/mcs/class/Facades/System.ServiceModel.Security/TypeForwarders.cs +++ b/mcs/class/Facades/System.ServiceModel.Security/TypeForwarders.cs @@ -26,6 +26,7 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.TransportSecurityBindingElement))] #if !MOBILE [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.DnsEndpointIdentity))] +#if !XAMMAC_4_5 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.MessageSecurityVersion))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.BasicSecurityProfileVersion))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.SecureConversationVersion))] @@ -36,6 +37,7 @@ [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.SupportingTokenParameters))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.Tokens.UserNameSecurityTokenParameters))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Security.TrustVersion))] +#endif [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.SpnEndpointIdentity))] [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.UpnEndpointIdentity))] #endif diff --git a/mcs/class/Makefile b/mcs/class/Makefile index 2eb6c03954..259f063abd 100644 --- a/mcs/class/Makefile +++ b/mcs/class/Makefile @@ -75,6 +75,48 @@ monotouch_runtime_dirs := \ System.XML \ Mono.CSharp +xammac_4_5_dirs := \ + corlib \ + System \ + Mono.Posix \ + System.Core \ + System.XML \ + Mono.Security \ + System \ + I18N \ + System.Numerics \ + Mono.Data.Tds \ + System.Transactions \ + System.EnterpriseServices \ + System.Data \ + System.Runtime.Serialization \ + System.Xml.Linq \ + Mono.Data.Sqlite \ + System.Runtime.Serialization.Formatters.Soap \ + System.ComponentModel.DataAnnotations \ + System.IdentityModel \ + System.IdentityModel.Selectors \ + Mono.Messaging \ + System.Configuration.Install \ + System.Messaging \ + System.Web.Services \ + System.Net \ + System.ServiceModel \ + System.ServiceModel.Web \ + System.Json \ + System.Data.Services.Client \ + System.IO.Compression \ + System.IO.Compression.FileSystem \ + System.ComponentModel.Composition.4.5 \ + System.Windows \ + System.Xml.Serialization \ + Mono.CSharp \ + Microsoft.CSharp \ + Mono.CompilerServices.SymbolWriter \ + System.Data.Linq \ + System.Net.Http \ + $(pcl_facade_dirs) + net_4_5_dirs := \ corlib \ System \ @@ -217,6 +259,7 @@ monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs) mobile_static_SUBDIRS := $(mobile_static_dirs) mobile_SUBDIRS := $(mobile_dynamic_dirs) xammac_SUBDIRS := $(xammac_dirs) +xammac_net_4_5_SUBDIRS := $(xammac_4_5_dirs) binary_reference_assemblies_SUBDIRS := reference-assemblies net_4_5_SUBDIRS := $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler xbuild_12_SUBDIRS := $(xbuild_4_0_dirs) @@ -224,7 +267,7 @@ xbuild_14_SUBDIRS := $(xbuild_4_0_dirs) include ../build/rules.make -SUBDIRS = $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_5_dirs) +SUBDIRS = $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_5_dirs) $(xammac_net_4_5_SUBDIRS) DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs) diff --git a/mcs/class/System.ComponentModel.Composition.4.5/Makefile b/mcs/class/System.ComponentModel.Composition.4.5/Makefile index 6ca1e59791..9118fce344 100644 --- a/mcs/class/System.ComponentModel.Composition.4.5/Makefile +++ b/mcs/class/System.ComponentModel.Composition.4.5/Makefile @@ -12,7 +12,7 @@ CLEAN_FILES += $(STRING_MESSAGES) EXTRA_DISTFILES = \ src/ComponentModel/Strings.resx -VALID_PROFILE := $(filter net_4_5 monotouch monodroid xammac mobile mobile_static, $(PROFILE)) +VALID_PROFILE := $(filter net_4_5 monotouch monodroid xammac xammac_net_4_5 mobile mobile_static, $(PROFILE)) ifndef VALID_PROFILE LIBRARY_NAME = dummy-System.ComponentModel.Composition.dll NO_INSTALL = yes diff --git a/mcs/class/System.Core/xammac_net_4_5_System.Core.dll.sources b/mcs/class/System.Core/xammac_net_4_5_System.Core.dll.sources new file mode 100644 index 0000000000..89d524cd1b --- /dev/null +++ b/mcs/class/System.Core/xammac_net_4_5_System.Core.dll.sources @@ -0,0 +1 @@ +#include net_4_5_System.Core.dll.sources diff --git a/mcs/class/System.Data.Linq/Makefile b/mcs/class/System.Data.Linq/Makefile index 26832172d4..0138a084a0 100755 --- a/mcs/class/System.Data.Linq/Makefile +++ b/mcs/class/System.Data.Linq/Makefile @@ -17,7 +17,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) EXTRA_DISTFILES = src/DbLinq/Schema/Dbml/DbmlSchema.xsd # This is a .NET 3.5+ assembly -VALID_PROFILE := $(filter net_4_5, $(PROFILE)) +VALID_PROFILE := $(filter xammac_net_4_5 net_4_5, $(PROFILE)) ifndef VALID_PROFILE LIBRARY_NAME = dummy-System.Data.Linq.dll NO_INSTALL = yes diff --git a/mcs/class/System.Data.Services.Client/Makefile b/mcs/class/System.Data.Services.Client/Makefile index 9f4e3b8b4d..b56fb960bb 100644 --- a/mcs/class/System.Data.Services.Client/Makefile +++ b/mcs/class/System.Data.Services.Client/Makefile @@ -17,9 +17,11 @@ LIB_MCS_FLAGS = \ -resource:Client/System.Data.Services.Client.resources \ -warn:2 +ifndef NO_WINDOWS_BASE ifneq (2.1, $(FRAMEWORK_VERSION)) LIB_MCS_FLAGS += -r:WindowsBase endif +endif include ../../build/library.make diff --git a/mcs/class/System.Data.Services.Client/xammac_net_4_5_System.Data.Services.Client.dll.sources b/mcs/class/System.Data.Services.Client/xammac_net_4_5_System.Data.Services.Client.dll.sources new file mode 100644 index 0000000000..37dc2990c8 --- /dev/null +++ b/mcs/class/System.Data.Services.Client/xammac_net_4_5_System.Data.Services.Client.dll.sources @@ -0,0 +1 @@ +#include net_4_5_System.Data.Services.Client.dll.sources diff --git a/mcs/class/System.Data/Makefile b/mcs/class/System.Data/Makefile index d2fdfba105..34bf46f343 100644 --- a/mcs/class/System.Data/Makefile +++ b/mcs/class/System.Data/Makefile @@ -8,8 +8,8 @@ LIB_MCS_FLAGS = \ -nowarn:649 \ -unsafe \ -r:System \ - -r:System.Xml.dll \ - -r:System.Core.dll + -r:System.Xml.dll \ + -d:NET_2_0 MOBILE := $(filter monotouch monodroid xammac mobile mobile_static, $(PROFILE)) ifdef MOBILE diff --git a/mcs/class/System.Data/ReferenceSources/Bid.cs b/mcs/class/System.Data/ReferenceSources/Bid.cs index 72b5304235..21b400ba96 100644 --- a/mcs/class/System.Data/ReferenceSources/Bid.cs +++ b/mcs/class/System.Data/ReferenceSources/Bid.cs @@ -11,11 +11,7 @@ static class Bid internal static void TraceEx(uint flags, string fmtPrintfW, params object[] args) { } -#if !MOBILE - internal static void TraceSqlReturn(string fmtPrintfW, System.Data.Odbc.ODBC32.RetCode a1, string a2) - { - } -#endif + internal static void ScopeEnter(out IntPtr hScp, string fmt, params object[] args) { hScp = NoData; } diff --git a/mcs/class/System.Data/ReferenceSources/DbConnectionStringDefaults.cs b/mcs/class/System.Data/ReferenceSources/DbConnectionStringDefaults.cs new file mode 100644 index 0000000000..c687f585b3 --- /dev/null +++ b/mcs/class/System.Data/ReferenceSources/DbConnectionStringDefaults.cs @@ -0,0 +1,57 @@ +using System.Data.SqlClient; + +namespace System.Data.Common { + internal static class DbConnectionStringDefaults { + // all +// internal const string NamedConnection = ""; + + // Odbc + internal const string Driver = ""; + internal const string Dsn = ""; + + // OleDb + internal const bool AdoNetPooler = false; + internal const string FileName = ""; + internal const int OleDbServices = ~(/*DBPROPVAL_OS_AGR_AFTERSESSION*/0x00000008 | /*DBPROPVAL_OS_CLIENTCURSOR*/0x00000004); // -13 + internal const string Provider = ""; + + // OracleClient + internal const bool Unicode = false; + internal const bool OmitOracleConnectionName = false; + + // SqlClient + internal const ApplicationIntent ApplicationIntent = System.Data.SqlClient.ApplicationIntent.ReadWrite; + internal const string ApplicationName = ".Net SqlClient Data Provider"; + internal const bool AsynchronousProcessing = false; + internal const string AttachDBFilename = ""; + internal const int ConnectTimeout = 15; + internal const bool ConnectionReset = true; + internal const bool ContextConnection = false; + internal const string CurrentLanguage = ""; + internal const string DataSource = ""; + internal const bool Encrypt = false; + internal const bool Enlist = true; + internal const string FailoverPartner = ""; + internal const string InitialCatalog = ""; + internal const bool IntegratedSecurity = false; + internal const int LoadBalanceTimeout = 0; // default of 0 means don't use + internal const bool MultipleActiveResultSets = false; + internal const bool MultiSubnetFailover = false; + internal const int MaxPoolSize = 100; + internal const int MinPoolSize = 0; + internal const string NetworkLibrary = ""; + internal const int PacketSize = 8000; + internal const string Password = ""; + internal const bool PersistSecurityInfo = false; + internal const bool Pooling = true; + internal const bool TrustServerCertificate = false; + internal const string TypeSystemVersion = "Latest"; + internal const string UserID = ""; + internal const bool UserInstance = false; + internal const bool Replication = false; + internal const string WorkstationID = ""; + internal const string TransactionBinding = "Implicit Unbind"; + internal const int ConnectRetryCount = 1; + internal const int ConnectRetryInterval = 10; + } +} \ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/OdbcHandle.cs b/mcs/class/System.Data/ReferenceSources/OdbcHandle.cs deleted file mode 100644 index 213d8dab63..0000000000 --- a/mcs/class/System.Data/ReferenceSources/OdbcHandle.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text; -using System.Runtime.InteropServices; - -namespace System.Data.Odbc { - - internal abstract class OdbcHandle : SafeHandle { - - protected OdbcHandle(ODBC32.SQL_HANDLE handleType, OdbcHandle parentHandle) : base(IntPtr.Zero, true) { - throw new NotImplementedException (); - } - - internal ODBC32.RetCode GetDiagnosticRecord(short record, out string sqlState, StringBuilder message, out int nativeError, out short cchActual) { - throw new NotImplementedException (); - } - } -} \ No newline at end of file diff --git a/mcs/class/System.Data/ReferenceSources/Res.cs b/mcs/class/System.Data/ReferenceSources/Res.cs index 83d364e80c..4cf4fa5e9b 100644 --- a/mcs/class/System.Data/ReferenceSources/Res.cs +++ b/mcs/class/System.Data/ReferenceSources/Res.cs @@ -74,7 +74,7 @@ static class Res public const string ADP_InvalidDataType = "ADP_InvalidDataType"; public const string ADP_InvalidDateTimeDigits = "ADP_InvalidDateTimeDigits"; public const string ADP_InvalidDestinationBufferIndex = "ADP_InvalidDestinationBufferIndex"; - public const string ADP_InvalidEnumerationValue = "The {0} enumeration value, {1}, is invalid."; + public const string ADP_InvalidEnumerationValue = "ADP_InvalidEnumerationValue"; public const string ADP_InvalidFormatValue = "ADP_InvalidFormatValue"; public const string ADP_InvalidImplicitConversion = "ADP_InvalidImplicitConversion"; public const string ADP_InvalidKey = "ADP_InvalidKey"; @@ -99,7 +99,7 @@ static class Res public const string ADP_InvalidUDL = "ADP_InvalidUDL"; public const string ADP_InvalidValue = "ADP_InvalidValue"; public const string ADP_InvalidXMLBadVersion = "ADP_InvalidXMLBadVersion"; - public const string ADP_KeywordNotSupported = "Keyword not supported: '{0}'."; + public const string ADP_KeywordNotSupported = "ADP_KeywordNotSupported"; public const string ADP_LiteralValueIsInvalid = "ADP_LiteralValueIsInvalid"; public const string ADP_LocalTransactionPresent = "ADP_LocalTransactionPresent"; public const string ADP_MismatchedAsyncResult = "ADP_MismatchedAsyncResult"; diff --git a/mcs/class/System.Data/ReferenceSources/ResCategoryAttribute.cs b/mcs/class/System.Data/ReferenceSources/ResCategoryAttribute.cs deleted file mode 100644 index d8086404a8..0000000000 --- a/mcs/class/System.Data/ReferenceSources/ResCategoryAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.ComponentModel; - -namespace System.Data -{ - sealed class ResCategoryAttribute : CategoryAttribute - { - public ResCategoryAttribute (string category) - : base (category) - { - } - } -} \ No newline at end of file diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs new file mode 100644 index 0000000000..c5a68d0105 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DataColumnMapping.cs @@ -0,0 +1,131 @@ +// +// System.Data.Common.DataColumnMapping.cs +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) +// +// (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002-2003 +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.ComponentModel; +using System.Data; + +namespace System.Data.Common { +#if NET_2_0 + [TypeConverterAttribute ("System.Data.Common.DataColumnMapping+DataColumnMappingConverter, " + Consts.AssemblySystem_Data)] +#else + [TypeConverterAttribute (typeof (DataColumnMappingConverter))] +#endif + public sealed class DataColumnMapping : MarshalByRefObject, IColumnMapping, ICloneable + { + #region Fields + + string sourceColumn; + string dataSetColumn; + + #endregion // Fields + + #region Constructors + + public DataColumnMapping () + { + sourceColumn = String.Empty; + dataSetColumn = String.Empty; + } + + public DataColumnMapping (string sourceColumn, string dataSetColumn) + { + this.sourceColumn = sourceColumn; + this.dataSetColumn = dataSetColumn; + } + + #endregion // Constructors + + #region Properties + +#if ONLY_1_1 + [DataSysDescription ("DataColumn.ColumnName")] +#endif + [DefaultValue ("")] + public string DataSetColumn { + get { return dataSetColumn; } + set { dataSetColumn = value; } + } + +#if !NET_2_0 + [DataSysDescription ("Source column name - case sensitive.")] +#endif + [DefaultValue ("")] + public string SourceColumn { + get { return sourceColumn; } + set { sourceColumn = value; } + } + + #endregion // Properties + + #region Methods + + [EditorBrowsable (EditorBrowsableState.Advanced)] + public DataColumn GetDataColumnBySchemaAction (DataTable dataTable, Type dataType, MissingSchemaAction schemaAction) + { + if (dataTable.Columns.Contains (dataSetColumn)) + return dataTable.Columns [dataSetColumn]; + if (schemaAction == MissingSchemaAction.Ignore) + return null; + if (schemaAction == MissingSchemaAction.Error) + throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", DataSetColumn, dataTable.TableName, SourceColumn)); + return new DataColumn (dataSetColumn, dataType); + } + +#if NET_2_0 + [EditorBrowsable (EditorBrowsableState.Advanced)] + public static DataColumn GetDataColumnBySchemaAction (string sourceColumn, string dataSetColumn, DataTable dataTable, Type dataType, MissingSchemaAction schemaAction) + { + if (dataTable.Columns.Contains (dataSetColumn)) + return dataTable.Columns [dataSetColumn]; + if (schemaAction == MissingSchemaAction.Ignore) + return null; + if (schemaAction == MissingSchemaAction.Error) + throw new InvalidOperationException (String.Format ("Missing the DataColumn '{0}' in the DataTable '{1}' for the SourceColumn '{2}'", dataSetColumn, dataTable.TableName, sourceColumn)); + return new DataColumn (dataSetColumn, dataType); + } +#endif + + object ICloneable.Clone () + { + return new DataColumnMapping (SourceColumn, DataSetColumn); + } + + public override string ToString () + { + return SourceColumn; + } + + #endregion // Methods + } +} diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs new file mode 100644 index 0000000000..22e6f1338e --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DataColumnMappingCollection.cs @@ -0,0 +1,338 @@ +// +// System.Data.Common.DataColumnMappingCollection +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) +// +// (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002-2003 +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR 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.ComponentModel; +using System.Data; + +namespace System.Data.Common +{ + public sealed class DataColumnMappingCollection : MarshalByRefObject, IColumnMappingCollection , IList, ICollection, IEnumerable + { + #region Fields + + readonly ArrayList list; + readonly Hashtable sourceColumns; + readonly Hashtable dataSetColumns; + + #endregion // Fields + + #region Constructors + + public DataColumnMappingCollection () + { + list = new ArrayList (); + sourceColumns = new Hashtable (); + dataSetColumns = new Hashtable (); + } + + #endregion // Constructors + + #region Properties + + [Browsable (false)] +#if !NET_2_0 + [DataSysDescription ("The number of items in the collection")] +#endif + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public int Count { + get { return list.Count; } + } + + [Browsable (false)] +#if !NET_2_0 + [DataSysDescription ("The specified DataColumnMapping object.")] +#endif + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public DataColumnMapping this [int index] { + get { return (DataColumnMapping)(list[index]); } + set { + DataColumnMapping mapping = (DataColumnMapping)(list[index]); + sourceColumns[mapping] = value; + dataSetColumns[mapping] = value; + list[index] = value; + } + } + + [Browsable (false)] +#if !NET_2_0 + [DataSysDescription ("The specified DataColumnMapping object.")] +#endif + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public DataColumnMapping this [string sourceColumn] { + get { + if (!Contains(sourceColumn)) + throw new IndexOutOfRangeException("DataColumnMappingCollection doesn't contain DataColumnMapping with SourceColumn '" + sourceColumn + "'."); + return (DataColumnMapping) sourceColumns [sourceColumn]; + } + set { + this [list.IndexOf (sourceColumns [sourceColumn])] = value; + } + } + + object ICollection.SyncRoot { + get { return list.SyncRoot; } + } + + bool ICollection.IsSynchronized { + get { return list.IsSynchronized; } + } + + object IColumnMappingCollection.this [string index] { + get { return this [index]; } + set { + if (!(value is DataColumnMapping)) + throw new ArgumentException (); + this [index] = (DataColumnMapping) value; + } + } + + object IList.this [int index] { + get { return this [index]; } + set { + if (!(value is DataColumnMapping)) + throw new ArgumentException (); + this [index] = (DataColumnMapping) value; + } + } + + bool IList.IsReadOnly { + get { return false; } + } + + bool IList.IsFixedSize { + get { return false; } + } + + #endregion // Properties + + #region Methods + + public int Add (object value) + { + if (!(value is DataColumnMapping)) + throw new InvalidCastException (); + + list.Add (value); + sourceColumns [((DataColumnMapping) value).SourceColumn] = value; + dataSetColumns [((DataColumnMapping )value).DataSetColumn] = value; + return list.IndexOf (value); + } + + public DataColumnMapping Add (string sourceColumn, string dataSetColumn) + { + DataColumnMapping mapping = new DataColumnMapping (sourceColumn, dataSetColumn); + Add (mapping); + return mapping; + } + +#if NET_2_0 + public void AddRange (Array values) + { + for (int i = 0; i < values.Length; ++i) + Add (values.GetValue (i)); + } +#endif + + public void AddRange (DataColumnMapping[] values) + { + foreach (DataColumnMapping mapping in values) + Add (mapping); + } + + public void Clear () + { + list.Clear (); + } + + public bool Contains (object value) + { + if (!(value is DataColumnMapping)) + throw new InvalidCastException("Object is not of type DataColumnMapping"); + return (list.Contains (value)); + } + + public bool Contains (string value) + { + return (sourceColumns.Contains (value)); + } + + public void CopyTo (Array array, int index) + { + list.CopyTo (array,index); + } + +#if NET_2_0 + public void CopyTo (DataColumnMapping [] array, int index) + { + list.CopyTo (array, index); + } +#endif + + public DataColumnMapping GetByDataSetColumn (string value) + { + // this should work case-insenstive. + if (!(dataSetColumns [value] == null)) + return (DataColumnMapping) (dataSetColumns [value]); + else { + string lowcasevalue = value.ToLower (); + object [] keyarray = new object [dataSetColumns.Count]; + dataSetColumns.Keys.CopyTo (keyarray, 0); + for (int i = 0; i < keyarray.Length; i++) { + string temp = (string) keyarray [i]; + if (lowcasevalue.Equals (temp.ToLower ())) + return (DataColumnMapping) (dataSetColumns [keyarray [i]]); + } + return null; + } + } + + [EditorBrowsable (EditorBrowsableState.Advanced)] + public static DataColumnMapping GetColumnMappingBySchemaAction (DataColumnMappingCollection columnMappings, string sourceColumn, MissingMappingAction mappingAction) + { + if (columnMappings.Contains (sourceColumn)) + return columnMappings[sourceColumn]; + if (mappingAction == MissingMappingAction.Ignore) + return null; + if (mappingAction == MissingMappingAction.Error) + throw new InvalidOperationException (String.Format ("Missing SourceColumn mapping for '{0}'", sourceColumn)); + return new DataColumnMapping (sourceColumn, sourceColumn); + } + +#if NET_2_0 + [MonoTODO] + [EditorBrowsable (EditorBrowsableState.Advanced)] + public static DataColumn GetDataColumn (DataColumnMappingCollection columnMappings, string sourceColumn, Type dataType, DataTable dataTable, MissingMappingAction mappingAction, MissingSchemaAction schemaAction) + { + throw new NotImplementedException (); + } +#endif + + public IEnumerator GetEnumerator () + { + return list.GetEnumerator (); + } + + IColumnMapping IColumnMappingCollection.Add (string sourceColumnName, string dataSetColumnName) + { + return Add (sourceColumnName, dataSetColumnName); + } + + IColumnMapping IColumnMappingCollection.GetByDataSetColumn (string dataSetColumnName) + { + return GetByDataSetColumn (dataSetColumnName); + } + + public int IndexOf (object value) + { + return list.IndexOf (value); + } + + public int IndexOf (string sourceColumn) + { + return list.IndexOf (sourceColumns [sourceColumn]); + } + + public int IndexOfDataSetColumn (string dataSetColumn) + { + // this should work case-insensitive + if (!(dataSetColumns [dataSetColumn] == null)) + return list.IndexOf (dataSetColumns [dataSetColumn]); + else { + string lowcasevalue = dataSetColumn.ToLower (); + object [] keyarray = new object[dataSetColumns.Count]; + dataSetColumns.Keys.CopyTo (keyarray,0); + for (int i = 0; i < keyarray.Length; i++) { + string temp = (string) keyarray [i]; + if (lowcasevalue.Equals (temp.ToLower ())) + return list.IndexOf (dataSetColumns [keyarray [i]]); + } + return -1; + } + } + + public void Insert (int index, object value) + { + list.Insert (index, value); + sourceColumns [((DataColumnMapping) value).SourceColumn] = value; + dataSetColumns [((DataColumnMapping) value).DataSetColumn] = value; + } + +#if NET_2_0 + public void Insert (int index, DataColumnMapping value) + { + list.Insert (index, value); + sourceColumns [value.SourceColumn] = value; + dataSetColumns [value.DataSetColumn] = value; + } +#endif + + public void Remove (object value) + { + int index = list.IndexOf (value); + sourceColumns.Remove (((DataColumnMapping) value).SourceColumn); + dataSetColumns.Remove (((DataColumnMapping) value).DataSetColumn); + if (index < 0 || index >=list.Count) + throw new ArgumentException("There is no such element in collection."); + list.Remove (value); + } + +#if NET_2_0 + public void Remove (DataColumnMapping value) + { + int index = list.IndexOf (value); + sourceColumns.Remove (value.SourceColumn); + dataSetColumns.Remove (value.DataSetColumn); + if ( index < 0 || index >=list.Count) + throw new ArgumentException("There is no such element in collection."); + list.Remove (value); + } +#endif + + public void RemoveAt (int index) + { + if (index < 0 || index >=list.Count) + throw new IndexOutOfRangeException("There is no element in collection."); + Remove (list [index]); + } + + public void RemoveAt (string sourceColumn) + { + RemoveAt (list.IndexOf (sourceColumns [sourceColumn])); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System.Data/System.Data.Common/DataColumnMappingConverter.cs b/mcs/class/System.Data/System.Data.Common/DataColumnMappingConverter.cs new file mode 100644 index 0000000000..3b34a6ae5b --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DataColumnMappingConverter.cs @@ -0,0 +1,59 @@ +// +// System.Data.Common.DataColumnMappingConverter.cs +// +// Author: +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2004 Andreas Nahr +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR 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.ComponentModel; + +namespace System.Data.Common +{ + internal sealed class DataColumnMappingConverter : ExpandableObjectConverter + { + [MonoTODO] + public DataColumnMappingConverter () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + throw new NotImplementedException (); + } + } +} diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs b/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs new file mode 100644 index 0000000000..81b2522b4e --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DataTableMapping.cs @@ -0,0 +1,159 @@ +// +// System.Data.Common.DataTableMapping.cs +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) +// +// (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002-2003 +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.ComponentModel; +using System.Data; + +namespace System.Data.Common { +#if NET_2_0 + [TypeConverterAttribute ("System.Data.Common.DataTableMapping+DataTableMappingConverter, " + Consts.AssemblySystem_Data)] +#else + [TypeConverterAttribute (typeof (DataTableMappingConverter))] +#endif + public sealed class DataTableMapping : MarshalByRefObject, ITableMapping, ICloneable + { + #region Fields + + string sourceTable; + string dataSetTable; + DataColumnMappingCollection columnMappings; + + #endregion // Fields + + #region Constructors + + public DataTableMapping () + { + dataSetTable = String.Empty; + sourceTable = String.Empty; + columnMappings = new DataColumnMappingCollection (); + } + + public DataTableMapping (string sourceTable, string dataSetTable) + : this () + { + this.sourceTable = sourceTable; + this.dataSetTable = dataSetTable; + } + + public DataTableMapping (string sourceTable, string dataSetTable, DataColumnMapping[] columnMappings) + : this (sourceTable, dataSetTable) + { + this.columnMappings.AddRange (columnMappings); + } + + #endregion // Constructors + + #region Properties + +#if !NET_2_0 + [DataSysDescription ("Individual columns mappings when this table mapping is matched.")] +#endif + [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] + public DataColumnMappingCollection ColumnMappings { + get { return columnMappings; } + } + +#if !NET_2_0 + [DataSysDescription ("DataTable.TableName")] +#endif + [DefaultValue ("")] + public string DataSetTable { + get { return dataSetTable; } + set { dataSetTable = value; } + } + + IColumnMappingCollection ITableMapping.ColumnMappings { + get { return ColumnMappings; } + } + +#if !NET_2_0 + [DataSysDescription ("The DataTableMapping source table name. This name is case sensitive.")] +#endif + [DefaultValue ("")] + public string SourceTable { + get { return sourceTable; } + set { sourceTable = value; } + } + + #endregion // Properties + + #region Methods + + [EditorBrowsable (EditorBrowsableState.Advanced)] + public DataColumnMapping GetColumnMappingBySchemaAction (string sourceColumn, MissingMappingAction mappingAction) + { + return DataColumnMappingCollection.GetColumnMappingBySchemaAction (columnMappings, sourceColumn, mappingAction); + } + +#if NET_2_0 + [MonoTODO] + [EditorBrowsable (EditorBrowsableState.Advanced)] + public DataColumn GetDataColumn (string sourceColumn, + Type dataType, + DataTable dataTable, + MissingMappingAction mappingAction, + MissingSchemaAction schemaAction) + { + throw new NotImplementedException (); + } +#endif + + [EditorBrowsable (EditorBrowsableState.Advanced)] + public DataTable GetDataTableBySchemaAction (DataSet dataSet, MissingSchemaAction schemaAction) + { + if (dataSet.Tables.Contains (DataSetTable)) + return dataSet.Tables [DataSetTable]; + if (schemaAction == MissingSchemaAction.Ignore) + return null; + if (schemaAction == MissingSchemaAction.Error) + throw new InvalidOperationException (String.Format ("Missing the '{0} DataTable for the '{1}' SourceTable", DataSetTable, SourceTable)); + return new DataTable (DataSetTable); + } + + object ICloneable.Clone () + { + DataColumnMapping [] arr = new DataColumnMapping [columnMappings.Count]; + columnMappings.CopyTo (arr, 0); + return new DataTableMapping (SourceTable, DataSetTable, arr); + } + + public override string ToString () + { + return SourceTable; + } + + #endregion // Methods + } +} diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs new file mode 100644 index 0000000000..dbf75f5a13 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DataTableMappingCollection.cs @@ -0,0 +1,326 @@ +// +// System.Data.Common.DataTableMappingCollection.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) +// +// (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002-2003 +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR 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.ComponentModel; + +namespace System.Data.Common +{ + [ListBindable (false)] + [EditorAttribute ("Microsoft.VSDesigner.Data.Design.DataTableMappingCollectionEditor, "+ Consts.AssemblyMicrosoft_VSDesigner, "System.Drawing.Design.UITypeEditor, "+ Consts.AssemblySystem_Drawing )] + public sealed class DataTableMappingCollection : MarshalByRefObject, ITableMappingCollection, IList, ICollection, IEnumerable + { + #region Fields + + ArrayList mappings; + Hashtable sourceTables; + Hashtable dataSetTables; + + #endregion + + #region Constructors + + public DataTableMappingCollection() + { + mappings = new ArrayList (); + sourceTables = new Hashtable (); + dataSetTables = new Hashtable (); + } + + #endregion // Constructors + + #region Properties + + [Browsable (false)] +#if !NET_2_0 + [DataSysDescription ("The number of items in the collection")] +#endif + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public int Count { + get { return mappings.Count; } + } + + [Browsable (false)] +#if !NET_2_0 + [DataSysDescription ("The specified DataTableMapping object")] +#endif + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public DataTableMapping this [int index] { + get { return (DataTableMapping)(mappings[index]); } + set { + DataTableMapping mapping = (DataTableMapping) mappings[index]; + sourceTables [mapping.SourceTable] = value; + dataSetTables [mapping.DataSetTable] = value; + mappings [index] = value; + } + } + + [Browsable (false)] +#if !NET_2_0 + [DataSysDescription ("The specified DataTableMapping object")] +#endif + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + public DataTableMapping this [string sourceTable] { + get { return (DataTableMapping) sourceTables[sourceTable]; } + set { this [mappings.IndexOf (sourceTables[sourceTable])] = value; } + } + + object IList.this [int index] { + get { return (object)(this[index]); } + set { + if (!(value is DataTableMapping)) + throw new ArgumentException (); + this[index] = (DataTableMapping)value; + } + } + + bool ICollection.IsSynchronized { + get { return mappings.IsSynchronized; } + } + + object ICollection.SyncRoot { + get { return mappings.SyncRoot; } + } + + bool IList.IsFixedSize { + get { return false; } + } + + bool IList.IsReadOnly { + get { return false; } + } + + object ITableMappingCollection.this [string index] { + get { return this [index]; } + set { + if (!(value is DataTableMapping)) + throw new ArgumentException (); + this [index] = (DataTableMapping) value; + } + } + + #endregion // Properties + + #region Methods + + public int Add (object value) + { + if (!(value is System.Data.Common.DataTableMapping)) + throw new InvalidCastException ("The object passed in was not a DataTableMapping object."); + + sourceTables [((DataTableMapping) value).SourceTable] = value; + dataSetTables [((DataTableMapping) value).DataSetTable] = value; + return mappings.Add (value); + } + + public DataTableMapping Add (string sourceTable, string dataSetTable) + { + DataTableMapping mapping = new DataTableMapping (sourceTable, dataSetTable); + Add (mapping); + return mapping; + } + +#if NET_2_0 + public void AddRange (Array values) + { + for (int i = 0; i < values.Length; ++i) + Add (values.GetValue (i)); + } +#endif + + public void AddRange (DataTableMapping[] values) + { + foreach (DataTableMapping dataTableMapping in values) + this.Add (dataTableMapping); + } + + public void Clear () + { + sourceTables.Clear (); + dataSetTables.Clear (); + mappings.Clear (); + } + + public bool Contains (object value) + { + return mappings.Contains (value); + } + + public bool Contains (string value) + { + return sourceTables.Contains (value); + } + + public void CopyTo (Array array, int index) + { + mappings.CopyTo (array, index); + } + +#if NET_2_0 + public void CopyTo (DataTableMapping[] array, int index) + { + mappings.CopyTo (array, index); + } +#endif + + public DataTableMapping GetByDataSetTable (string dataSetTable) + { + // this should work case-insenstive. + if (!(dataSetTables[dataSetTable] == null)) + return (DataTableMapping) (dataSetTables [dataSetTable]); + else { + string lowcasevalue = dataSetTable.ToLower (); + object [] keyarray = new object [dataSetTables.Count]; + dataSetTables.Keys.CopyTo (keyarray, 0); + for (int i=0; i= mappings.Count) + throw new ArgumentException("There is no such element in collection."); + mappings.Remove ((DataTableMapping) value); + } + +#if NET_2_0 + public void Remove (DataTableMapping value) + { + int index = mappings.IndexOf (value); + if (index < 0 || index >= mappings.Count) + throw new ArgumentException("There is no such element in collection."); + mappings.Remove ((DataTableMapping) value); + } +#endif + + public void RemoveAt (int index) + { + if (index < 0 || index >= mappings.Count) + throw new IndexOutOfRangeException("There is no element in collection."); + + mappings.RemoveAt (index); + } + + public void RemoveAt (string sourceTable) + { + RemoveAt (mappings.IndexOf (sourceTables[sourceTable])); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System.Data/System.Data.Common/DataTableMappingConverter.cs b/mcs/class/System.Data/System.Data.Common/DataTableMappingConverter.cs new file mode 100644 index 0000000000..7bc0d18b30 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DataTableMappingConverter.cs @@ -0,0 +1,59 @@ +// +// System.Data.Common.DataTableMappingConverter.cs +// +// Author: +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2004 Andreas Nahr +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR 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.ComponentModel; + +namespace System.Data.Common +{ + internal sealed class DataTableMappingConverter : ExpandableObjectConverter + { + [MonoTODO] + public DataTableMappingConverter () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + throw new NotImplementedException (); + } + } +} diff --git a/mcs/class/System.Data/System.Data.Common/DbConnectionOptions.cs b/mcs/class/System.Data/System.Data.Common/DbConnectionOptions.cs new file mode 100644 index 0000000000..f82f2c21aa --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DbConnectionOptions.cs @@ -0,0 +1,257 @@ +// +// System.Data.Common.DbConnectionOptions +// adapted from older (pre beta1) DbConnectionString +// +// Authors: +// Tim Coleman (tim@timcoleman.com) +// Sebastien Pouliot +// +// Copyright (C) Tim Coleman, 2003 +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#if NET_2_0 + +using System.Collections; +using System.Collections.Specialized; +using System.Security; +using System.Text; + +namespace System.Data.Common { + + internal class DbConnectionOptions { + + #region Fields + + internal NameValueCollection options; + internal string normalizedConnectionString; + + #endregion // Fields + + #region Constructors + + internal DbConnectionOptions () + { + } + + protected internal DbConnectionOptions (DbConnectionOptions connectionOptions) + { + options = connectionOptions.options; + } + + public DbConnectionOptions (string connectionString) + { + options = new NameValueCollection (); + ParseConnectionString (connectionString); + } + + [MonoTODO] + public DbConnectionOptions (string connectionString, Hashtable synonyms, bool useFirstKeyValuePair) + : this (connectionString) + { + } + + #endregion // Constructors + + #region Properties + + [MonoTODO] + public bool IsEmpty { + get { throw new NotImplementedException (); } + } + + public string this [string keyword] { + get { return options [keyword]; } + } + + public ICollection Keys { + get { return options.Keys; } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + protected void BuildConnectionString (StringBuilder builder, string[] withoutOptions, string insertValue) + { + throw new NotImplementedException (); + } + + public bool ContainsKey (string keyword) + { + return (options.Get (keyword) != null); + } + + public bool ConvertValueToBoolean (string keyname, bool defaultvalue) + { + if (ContainsKey (keyname)) + return Boolean.Parse (this [keyname].Trim ()); + return defaultvalue; + } + + public int ConvertValueToInt32 (string keyname, int defaultvalue) + { + if (ContainsKey (keyname)) + return Int32.Parse (this [keyname].Trim ()); + return defaultvalue; + } + + [MonoTODO] + public bool ConvertValueToIntegratedSecurity () + { + throw new NotImplementedException (); + } + + public string ConvertValueToString (string keyname, string defaultValue) + { + if (ContainsKey (keyname)) + return this [keyname]; + return defaultValue; + } + + [MonoTODO] + protected internal virtual PermissionSet CreatePermissionSet () + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected internal virtual string Expand () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static string RemoveKeyValuePairs (string connectionString, string[] keynames) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public string UsersConnectionString (bool hisPasswordPwd) + { + throw new NotImplementedException (); + } + + internal void ParseConnectionString (string connectionString) + { + if (connectionString.Length == 0) + return; + + connectionString += ";"; + + bool inQuote = false; + bool inDQuote = false; + bool inName = true; + + string name = String.Empty; + string value = String.Empty; + StringBuilder sb = new StringBuilder (); + + for (int i = 0; i < connectionString.Length; i += 1) { + char c = connectionString [i]; + char peek; + if (i == connectionString.Length - 1) + peek = '\0'; + else + peek = connectionString [i + 1]; + + switch (c) { + case '\'': + if (inDQuote) + sb.Append (c); + else if (peek.Equals (c)) { + sb.Append (c); + i += 1; + } + else + inQuote = !inQuote; + break; + case '"': + if (inQuote) + sb.Append (c); + else if (peek.Equals (c)) { + sb.Append (c); + i += 1; + } + else + inDQuote = !inDQuote; + break; + case ';': + if (inDQuote || inQuote) + sb.Append (c); + else { + if (name != String.Empty && name != null) { + value = sb.ToString (); + // FIXME - KeywordLookup is an NOP + // options [KeywordLookup (name.Trim ())] = value; + options [name.Trim ()] = value; + } + inName = true; + name = String.Empty; + value = String.Empty; + sb = new StringBuilder (); + } + break; + case '=': + if (inDQuote || inQuote || !inName) + sb.Append (c); + else if (peek.Equals (c)) { + sb.Append (c); + i += 1; + } + else { + name = sb.ToString (); + sb = new StringBuilder (); + inName = false; + } + break; + case ' ': + if (inQuote || inDQuote) + sb.Append (c); + else if (sb.Length > 0 && !peek.Equals (';')) + sb.Append (c); + break; + default: + sb.Append (c); + break; + } + } + + StringBuilder normalized = new StringBuilder (); + ArrayList keys = new ArrayList (); + keys.AddRange (Keys); + keys.Sort (); + foreach (string key in keys) + { + string entry = String.Format ("{0}=\"{1}\";", key, this [key].Replace ("\"", "\"\"")); + normalized.Append (entry); + } + normalizedConnectionString = normalized.ToString (); + } + + #endregion // Methods + } +} + +#endif diff --git a/mcs/class/System.Data/System.Data.Common/DbConnectionString.cs b/mcs/class/System.Data/System.Data.Common/DbConnectionString.cs new file mode 100644 index 0000000000..7d2bb6c40f --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DbConnectionString.cs @@ -0,0 +1,113 @@ +// +// System.Data.Common.DbConnectionString +// +// Authors: +// Tim Coleman (tim@timcoleman.com) +// Sebastien Pouliot +// +// Copyright (C) Tim Coleman, 2003 +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#if NET_2_0 + +using System.Collections; +using System.Collections.Specialized; +using System.Runtime.Serialization; +using System.Text; + +namespace System.Data.Common { + + [Obsolete ()] + internal class DbConnectionString : DbConnectionOptions, ISerializable { + + #region Fields + + KeyRestrictionBehavior behavior; + + #endregion // Fields + + #region Constructors + + protected internal DbConnectionString (DbConnectionString constr) + { + options = constr.options; + } + + public DbConnectionString (string connectionString) + : base (connectionString) + { + options = new NameValueCollection (); + ParseConnectionString (connectionString); + } + + [MonoTODO] + protected DbConnectionString (SerializationInfo si, StreamingContext sc) + { + } + + [MonoTODO] + public DbConnectionString (string connectionString, string restrictions, KeyRestrictionBehavior behavior) + : this (connectionString) + { + this.behavior = behavior; + } + + #endregion // Constructors + + #region Properties + + public KeyRestrictionBehavior Behavior { + get { return behavior; } + } + + [MonoTODO] + public string Restrictions { + get { throw new NotImplementedException (); } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public virtual void GetObjectData (SerializationInfo info, StreamingContext context) + { + throw new NotImplementedException (); + } + + protected virtual string KeywordLookup (string keyname) + { + return keyname; + } + + [MonoTODO] + public virtual void PermissionDemand () + { + throw new NotImplementedException (); + } + + #endregion // Methods + } +} + +#endif diff --git a/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs b/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs new file mode 100644 index 0000000000..d878c906ee --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DbConnectionStringBuilder.cs @@ -0,0 +1,802 @@ +// +// System.Data.Common.DbConnectionStringBuilder.cs +// +// Author: +// Sureshkumar T (tsureshkumar@novell.com) +// Gert Driesen (drieseng@users.sourceforge.net +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +#if NET_2_0 +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Data; +using System.Data.Common; +using System.Reflection; +using System.Text; + +namespace System.Data.Common +{ + public class DbConnectionStringBuilder : IDictionary, ICollection, IEnumerable, ICustomTypeDescriptor + { + #region Fields + + readonly Dictionary _dictionary; + readonly bool useOdbcRules; + + #endregion Fields + + #region Constructors + + public DbConnectionStringBuilder () : this (false) + { + } + + public DbConnectionStringBuilder (bool useOdbcRules) + { + this.useOdbcRules = useOdbcRules; + _dictionary = new Dictionary (StringComparer.InvariantCultureIgnoreCase); + } + + #endregion // Constructors + + #region Properties + + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] + [EditorBrowsable (EditorBrowsableState.Never)] + [Browsable (false)] + [DesignOnly (true)] + public bool BrowsableConnectionString { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [RefreshProperties (RefreshProperties.All)] + public string ConnectionString { + get { + IDictionary dictionary = (IDictionary ) _dictionary; + StringBuilder sb = new StringBuilder (); + foreach (string key in Keys) { + object value = null; + if (!dictionary.TryGetValue (key, out value)) + continue; + string val = value.ToString (); + AppendKeyValuePair (sb, key, val, useOdbcRules); + } + return sb.ToString (); + } + set { + Clear (); + if (value == null) + return; + if (value.Trim ().Length == 0) + return; + ParseConnectionString (value); + } + } + + [Browsable (false)] + public virtual int Count + { + get { return _dictionary.Count; } + } + + [Browsable (false)] + public virtual bool IsFixedSize + { + get { return false; } + } + + [Browsable (false)] + public bool IsReadOnly + { + get { throw new NotImplementedException (); } + } + + [Browsable (false)] + public virtual object this [string keyword] { + get { + if (ContainsKey (keyword)) + return _dictionary [keyword]; + else + throw new ArgumentException (string.Format ( + "Keyword '{0}' does not exist", + keyword)); + } + set { + if (value == null) { + Remove (keyword); + return; + } + + if (keyword == null) + throw new ArgumentNullException ("keyword"); + + if (keyword.Length == 0) + throw CreateInvalidKeywordException (keyword); + + for (int i = 0; i < keyword.Length; i++) { + char c = keyword [i]; + if (i == 0 && (Char.IsWhiteSpace (c) || c == ';')) + throw CreateInvalidKeywordException (keyword); + if (i == (keyword.Length - 1) && Char.IsWhiteSpace (c)) + throw CreateInvalidKeywordException (keyword); + if (Char.IsControl (c)) + throw CreateInvalidKeywordException (keyword); + } + + if (ContainsKey (keyword)) + _dictionary [keyword] = value; + else + _dictionary.Add (keyword, value); + } + } + + [Browsable (false)] + public virtual ICollection Keys + { + get { + string [] keys = new string [_dictionary.Keys.Count]; + ((ICollection) _dictionary.Keys).CopyTo (keys, 0); + ReadOnlyCollection keyColl = new ReadOnlyCollection (keys); + return keyColl; + } + } + + bool ICollection.IsSynchronized + { + get { throw new NotImplementedException (); } + } + + object ICollection.SyncRoot + { + get { throw new NotImplementedException (); } + } + + object IDictionary.this [object keyword] + { + get { return this [(string) keyword]; } + set { this [(string) keyword] = value; } + } + + [Browsable (false)] + public virtual ICollection Values { + get { + object [] values = new object [_dictionary.Values.Count]; + ((ICollection) _dictionary.Values).CopyTo (values, 0); + ReadOnlyCollection valuesColl = new ReadOnlyCollection (values); + return valuesColl; + } + } + + #endregion // Properties + + #region Methods + + public void Add (string keyword, object value) + { + this [keyword] = value; + } + + public static void AppendKeyValuePair (StringBuilder builder, string keyword, string value, + bool useOdbcRules) + { + if (builder == null) + throw new ArgumentNullException ("builder"); + if (keyword == null) + throw new ArgumentNullException ("keyName"); + if (keyword.Length == 0) + throw new ArgumentException ("Empty keyword is not valid."); + + if (builder.Length > 0) + builder.Append (';'); + if (!useOdbcRules) + builder.Append (keyword.Replace ("=", "==")); + else + builder.Append (keyword); + builder.Append ('='); + + if (value == null || value.Length == 0) + return; + + if (!useOdbcRules) { + bool dquoteFound = (value.IndexOf ('\"') > -1); + bool squoteFound = (value.IndexOf ('\'') > -1); + + if (dquoteFound && squoteFound) { + builder.Append ('\"'); + builder.Append (value.Replace ("\"", "\"\"")); + builder.Append ('\"'); + } else if (dquoteFound) { + builder.Append ('\''); + builder.Append (value); + builder.Append ('\''); + } else if (squoteFound || value.IndexOf ('=') > -1 || value.IndexOf (';') > -1) { + builder.Append ('\"'); + builder.Append (value); + builder.Append ('\"'); + } else if (ValueNeedsQuoting (value)) { + builder.Append ('\"'); + builder.Append (value); + builder.Append ('\"'); + } else + builder.Append (value); + } else { + int braces = 0; + bool semicolonFound = false; + int len = value.Length; + bool needBraces = false; + + int lastChar = -1; + + for (int i = 0; i < len; i++) { + int peek = 0; + if (i == (len - 1)) + peek = -1; + else + peek = value [i + 1]; + + char c = value [i]; + switch (c) { + case '{': + braces++; + break; + case '}': + if (peek.Equals (c)) { + i++; + continue; + } else { + braces--; + if (peek != -1) + needBraces = true; + } + break; + case ';': + semicolonFound = true; + break; + default: + break; + } + lastChar = c; + } + + if (value [0] == '{' && (lastChar != '}' || (braces == 0 && needBraces))) { + builder.Append ('{'); + builder.Append (value.Replace ("}", "}}")); + builder.Append ('}'); + return; + } + + bool isDriver = (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0); + if (isDriver) { + if (value [0] == '{' && lastChar == '}' && !needBraces) { + builder.Append (value); + return; + } + builder.Append ('{'); + builder.Append (value.Replace ("}", "}}")); + builder.Append ('}'); + return; + } + + if (value [0] == '{' && (braces != 0 || lastChar != '}') && needBraces) { + builder.Append ('{'); + builder.Append (value.Replace ("}", "}}")); + builder.Append ('}'); + return; + } + + if (value [0] != '{' && semicolonFound) { + builder.Append ('{'); + builder.Append (value.Replace ("}", "}}")); + builder.Append ('}'); + return; + } + + builder.Append (value); + } + } + + public static void AppendKeyValuePair (StringBuilder builder, string keyword, string value) + { + AppendKeyValuePair (builder, keyword, value, false); + } + + public virtual void Clear () + { + _dictionary.Clear (); + } + + public virtual bool ContainsKey (string keyword) + { + if (keyword == null) + throw new ArgumentNullException ("keyword"); + return _dictionary.ContainsKey (keyword); + } + + public virtual bool EquivalentTo (DbConnectionStringBuilder connectionStringBuilder) + { + bool ret = true; + try { + if (Count != connectionStringBuilder.Count) + ret = false; + else { + foreach (string key in Keys) { + if (!this [key].Equals (connectionStringBuilder [key])) { + ret = false; + break; + } + } + } + } catch (ArgumentException) { + ret = false; + } + return ret; + } + + [MonoTODO] + protected virtual void GetProperties (Hashtable propertyDescriptors) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected internal void ClearPropertyDescriptors () + { + throw new NotImplementedException (); + } + + public virtual bool Remove (string keyword) + { + if (keyword == null) + throw new ArgumentNullException ("keyword"); + return _dictionary.Remove (keyword); + } + + public virtual bool ShouldSerialize (string keyword) + { + throw new NotImplementedException (); + } + + void ICollection.CopyTo (Array array, int index) + { + if (array == null) + throw new ArgumentNullException ("array"); + KeyValuePair [] arr = array as KeyValuePair []; + if (arr == null) + throw new ArgumentException ("Target array type is not compatible with the type of items in the collection"); + ((ICollection>) _dictionary).CopyTo (arr, index); + } + + void IDictionary.Add (object keyword, object value) + { + this.Add ((string) keyword, value); + } + + bool IDictionary.Contains (object keyword) + { + return ContainsKey ((string) keyword); + } + + IDictionaryEnumerator IDictionary.GetEnumerator () + { + return (IDictionaryEnumerator) _dictionary.GetEnumerator (); + } + + void IDictionary.Remove (object keyword) + { + Remove ((string) keyword); + } + + IEnumerator IEnumerable.GetEnumerator () + { + return (IEnumerator) _dictionary.GetEnumerator (); + } + + private static object _staticAttributeCollection = null; + AttributeCollection ICustomTypeDescriptor.GetAttributes () + { + object value = _staticAttributeCollection; + if (value == null) { + CLSCompliantAttribute clsAttr = new CLSCompliantAttribute (true); + DefaultMemberAttribute defMemAttr = new DefaultMemberAttribute ("Item"); + Attribute [] attrs = {clsAttr, defMemAttr}; + value = new AttributeCollection (attrs); + } + System.Threading.Interlocked.CompareExchange (ref _staticAttributeCollection, value, null); + return _staticAttributeCollection as AttributeCollection; + } + + string ICustomTypeDescriptor.GetClassName () + { + return this.GetType ().ToString (); + } + + string ICustomTypeDescriptor.GetComponentName () + { + return null; + } + + TypeConverter ICustomTypeDescriptor.GetConverter () + { + return new CollectionConverter (); + } + + EventDescriptor ICustomTypeDescriptor.GetDefaultEvent () + { + return null; + } + + PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty () + { + return null; + } + + object ICustomTypeDescriptor.GetEditor (Type editorBaseType) + { + return null; + } + + EventDescriptorCollection ICustomTypeDescriptor.GetEvents () + { + return EventDescriptorCollection.Empty; + } + + EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute [] attributes) + { + return EventDescriptorCollection.Empty; + } + + PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties () + { + return PropertyDescriptorCollection.Empty; + } + + PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute [] attributes) + { + return PropertyDescriptorCollection.Empty; + } + + object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd) + { + throw new NotImplementedException (); + } + + public override string ToString () + { + return ConnectionString; + } + + public virtual bool TryGetValue (string keyword, out object value) + { + // FIXME : not sure, difference between this [keyword] and this method + bool found = ContainsKey (keyword); + if (found) + value = this [keyword]; + else + value = null; + return found; + } + + static ArgumentException CreateInvalidKeywordException (string keyword) + { + return new ArgumentException ("A keyword cannot contain " + + "control characters, leading semicolons or " + + "leading or trailing whitespace.", keyword); + } + + static ArgumentException CreateConnectionStringInvalidException (int index) + { + return new ArgumentException ("Format of initialization " + + "string does not conform to specifications at " + + "index " + index + "."); + } + + static bool ValueNeedsQuoting (string value) + { + foreach (char c in value) { + if (char.IsWhiteSpace (c)) + return true; + } + return false; + } + void ParseConnectionString (string connectionString) + { + if (useOdbcRules) + ParseConnectionStringOdbc (connectionString); + else + ParseConnectionStringNonOdbc (connectionString); + } + + void ParseConnectionStringOdbc (string connectionString) + { + bool inQuote = false; + bool inDQuote = false; + bool inName = true; + bool inBraces = false; + + string name = String.Empty; + string val = String.Empty; + StringBuilder sb = new StringBuilder (); + int len = connectionString.Length; + + for (int i = 0; i < len; i++) { + char c = connectionString [i]; + int peek = (i == (len - 1)) ? -1 : connectionString [i + 1]; + + switch (c) { + case '{': + if (inName) { + sb.Append (c); + continue; + } + + if (sb.Length == 0) + inBraces = true; + sb.Append (c); + break; + case '}': + if (inName || !inBraces) { + sb.Append (c); + continue; + } + + if (peek == -1) { + sb.Append (c); + inBraces = false; + } else if (peek.Equals (c)) { + sb.Append (c); + sb.Append (c); + i++; + } else { + int next = NextNonWhitespaceChar (connectionString, i); + if (next != -1 && ((char) next) != ';') + throw CreateConnectionStringInvalidException (next); + sb.Append (c); + inBraces = false; + } + break; + case ';': + if (inName || inBraces) { + sb.Append (c); + continue; + } + + if (name.Length > 0 && sb.Length > 0) { + val = sb.ToString (); + name = name.ToLower ().TrimEnd (); + this [name] = val; + } else if (sb.Length > 0) + throw CreateConnectionStringInvalidException (c); + inName = true; + name = String.Empty; + sb.Length = 0; + break; + case '=': + if (inBraces || !inName) { + sb.Append (c); + continue; + } + + name = sb.ToString (); + if (name.Length == 0) + throw CreateConnectionStringInvalidException (c); + sb.Length = 0; + inName = false; + break; + default: + if (inDQuote || inQuote || inBraces) + sb.Append (c); + else if (char.IsWhiteSpace (c)) { + // ignore leading whitespace + if (sb.Length > 0) { + int nextChar = SkipTrailingWhitespace (connectionString, i); + if (nextChar == -1) + sb.Append (c); + else + i = nextChar; + } + } else + sb.Append (c); + break; + } + } + + if ((inName && sb.Length > 0) || inDQuote || inQuote || inBraces) + throw CreateConnectionStringInvalidException (len - 1); + + if (name.Length > 0 && sb.Length > 0) { + val = sb.ToString (); + name = name.ToLower ().TrimEnd (); + this [name] = val; + } + } + + void ParseConnectionStringNonOdbc (string connectionString) + { + bool inQuote = false; + bool inDQuote = false; + bool inName = true; + + string name = String.Empty; + string val = String.Empty; + StringBuilder sb = new StringBuilder (); + int len = connectionString.Length; + + for (int i = 0; i < len; i++) { + char c = connectionString [i]; + int peek = (i == (len - 1)) ? -1 : connectionString [i + 1]; + + switch (c) { + case '\'': + if (inName) { + sb.Append (c); + continue; + } + + if (inDQuote) + sb.Append (c); + else if (inQuote) { + if (peek == -1) + inQuote = false; + else if (peek.Equals (c)) { + sb.Append (c); + i++; + } else { + int next = NextNonWhitespaceChar (connectionString, i); + if (next != -1 && ((char) next) != ';') + throw CreateConnectionStringInvalidException (next); + inQuote = false; + } + + if (!inQuote) { + val = sb.ToString (); + name = name.ToLower ().TrimEnd (); + this [name] = val; + inName = true; + name = String.Empty; + sb.Length = 0; + } + } else if (sb.Length == 0) + inQuote = true; + else + sb.Append (c); + break; + case '"': + if (inName) { + sb.Append (c); + continue; + } + + if (inQuote) + sb.Append (c); + else if (inDQuote) { + if (peek == -1) + inDQuote = false; + else if (peek.Equals (c)) { + sb.Append (c); + i++; + } else { + int next = NextNonWhitespaceChar (connectionString, i); + if (next != -1 && ((char) next) != ';') + throw CreateConnectionStringInvalidException (next); + inDQuote = false; + } + } else if (sb.Length == 0) + inDQuote = true; + else + sb.Append (c); + break; + case ';': + if (inName) { + sb.Append (c); + continue; + } + + if (inDQuote || inQuote) + sb.Append (c); + else { + if (name.Length > 0 && sb.Length > 0) { + val = sb.ToString (); + name = name.ToLower ().TrimEnd (); + this [name] = val; + } else if (sb.Length > 0) + throw CreateConnectionStringInvalidException (c); + inName = true; + name = String.Empty; + sb.Length = 0; + } + break; + case '=': + if (inDQuote || inQuote || !inName) + sb.Append (c); + else if (peek != -1 && peek.Equals (c)) { + sb.Append (c); + i++; + } else { + name = sb.ToString (); + if (name.Length == 0) + throw CreateConnectionStringInvalidException (c); + sb.Length = 0; + inName = false; + } + break; + default: + if (inDQuote || inQuote) + sb.Append (c); + else if (char.IsWhiteSpace (c)) { + // ignore leading whitespace + if (sb.Length > 0) { + int nextChar = SkipTrailingWhitespace (connectionString, i); + if (nextChar == -1) + sb.Append (c); + else + i = nextChar; + } + } else + sb.Append (c); + break; + } + } + + if ((inName && sb.Length > 0) || inDQuote || inQuote) + throw CreateConnectionStringInvalidException (len -1); + + if (name.Length > 0 && sb.Length > 0) { + val = sb.ToString (); + name = name.ToLower ().TrimEnd (); + this [name] = val; + } + } + + static int SkipTrailingWhitespace (string value, int index) + { + int len = value.Length; + for (int i = (index + 1); i < len; i++) { + char c = value [i]; + if (c == ';') + return (i - 1); + if (!char.IsWhiteSpace (c)) + return -1; + } + return len - 1; + } + + static int NextNonWhitespaceChar (string value, int index) + { + int len = value.Length; + for (int i = (index + 1); i < len; i++) { + char c = value [i]; + if (!char.IsWhiteSpace (c)) + return (int) c; + } + return -1; + } + + #endregion // Public Methods + } +} +#endif // NET_2_0 using diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs new file mode 100644 index 0000000000..9d2139c982 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DbDataPermission.cs @@ -0,0 +1,317 @@ +// +// System.Data.Common.DbDataPermission.cs +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) +// Sebastien Pouliot +// +// (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002-2003 +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, 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.Security; +using System.Security.Permissions; + +namespace System.Data.Common { + + [Serializable] + public abstract class DBDataPermission : CodeAccessPermission, IUnrestrictedPermission { + + #region Fields + + private const int version = 1; + + private bool allowBlankPassword; + private PermissionState state; + private Hashtable _connections; + + #endregion // Fields + + #region Constructors + +#if NET_2_0 + [Obsolete ("use DBDataPermission (PermissionState.None)", true)] +#endif + protected DBDataPermission () + : this (PermissionState.None) + { + } + + protected DBDataPermission (DBDataPermission permission) + { + if (permission == null) + throw new ArgumentNullException ("permission"); + + state = permission.state; + if (state != PermissionState.Unrestricted) { + allowBlankPassword = permission.allowBlankPassword; + _connections = (Hashtable) permission._connections.Clone (); + } + } + + protected DBDataPermission (DBDataPermissionAttribute permissionAttribute) + { + if (permissionAttribute == null) + throw new ArgumentNullException ("permissionAttribute"); + + _connections = new Hashtable (); + if (permissionAttribute.Unrestricted) { + state = PermissionState.Unrestricted; + } + else { + state = PermissionState.None; + allowBlankPassword = permissionAttribute.AllowBlankPassword; + if (permissionAttribute.ConnectionString.Length > 0) { + Add (permissionAttribute.ConnectionString, permissionAttribute.KeyRestrictions, + permissionAttribute.KeyRestrictionBehavior); + } + } + } + + protected DBDataPermission (PermissionState state) + { + this.state = PermissionHelper.CheckPermissionState (state, true); + _connections = new Hashtable (); + } + +#if NET_2_0 + [Obsolete ("use DBDataPermission (PermissionState.None)", true)] + protected +#else + public +#endif + DBDataPermission (PermissionState state, bool allowBlankPassword) + : this (state) + { + this.allowBlankPassword = allowBlankPassword; + } + + #endregion // Constructors + + #region Properties + + public bool AllowBlankPassword { + get { return allowBlankPassword; } + set { allowBlankPassword = value; } + } + + #endregion // Properties + + #region Methods + + public virtual void Add (string connectionString, string restrictions, KeyRestrictionBehavior behavior) + { + state = PermissionState.None; + _connections [connectionString] = new object [2] { restrictions, behavior }; + } + + protected void Clear () + { + _connections.Clear (); + } + + public override IPermission Copy () + { + DBDataPermission dbdp = CreateInstance (); + dbdp.allowBlankPassword = this.allowBlankPassword; + dbdp._connections = (Hashtable) this._connections.Clone (); + return dbdp; + } + + protected virtual DBDataPermission CreateInstance () + { + return (DBDataPermission) Activator.CreateInstance (this.GetType (), new object [1] { PermissionState.None }); + } + + public override void FromXml (SecurityElement securityElement) + { + PermissionHelper.CheckSecurityElement (securityElement, "securityElement", version, version); + // Note: we do not (yet) care about the return value + // as we only accept version 1 (min/max values) + + state = (PermissionHelper.IsUnrestricted (securityElement) ? + PermissionState.Unrestricted : PermissionState.None); + + allowBlankPassword = false; + string blank = securityElement.Attribute ("AllowBlankPassword"); + if (blank != null) { +#if NET_2_0 + // avoid possible exceptions with Fx 2.0 + if (!Boolean.TryParse (blank, out allowBlankPassword)) + allowBlankPassword = false; +#else + try { + allowBlankPassword = Boolean.Parse (blank); + } + catch { + allowBlankPassword = false; + } +#endif + } + + if (securityElement.Children != null) { + foreach (SecurityElement child in securityElement.Children) { + string connect = child.Attribute ("ConnectionString"); + string restricts = child.Attribute ("KeyRestrictions"); + KeyRestrictionBehavior behavior = (KeyRestrictionBehavior) Enum.Parse ( + typeof (KeyRestrictionBehavior), child.Attribute ("KeyRestrictionBehavior")); + + if ((connect != null) && (connect.Length > 0)) + Add (connect, restricts, behavior); + } + } + } + + public override IPermission Intersect (IPermission target) + { + // FIXME: restrictions not completely implemented - nor documented + DBDataPermission dbdp = Cast (target); + if (dbdp == null) + return null; + if (IsUnrestricted ()) { + if (dbdp.IsUnrestricted ()) { + DBDataPermission u = CreateInstance (); + u.state = PermissionState.Unrestricted; + return u; + } + return dbdp.Copy (); + } + if (dbdp.IsUnrestricted ()) + return Copy (); + if (IsEmpty () || dbdp.IsEmpty ()) + return null; + + DBDataPermission p = CreateInstance (); + p.allowBlankPassword = (allowBlankPassword && dbdp.allowBlankPassword); + foreach (DictionaryEntry de in _connections) { + object o = dbdp._connections [de.Key]; + if (o != null) + p._connections.Add (de.Key, de.Value); + } + return (p._connections.Count > 0) ? p : null; + } + + public override bool IsSubsetOf (IPermission target) + { + // FIXME: restrictions not completely implemented - nor documented + DBDataPermission dbdp = Cast (target); + if (dbdp == null) + return IsEmpty (); + if (dbdp.IsUnrestricted ()) + return true; + if (IsUnrestricted ()) + return dbdp.IsUnrestricted (); + + if (allowBlankPassword && !dbdp.allowBlankPassword) + return false; + if (_connections.Count > dbdp._connections.Count) + return false; + + foreach (DictionaryEntry de in _connections) { + object o = dbdp._connections [de.Key]; + if (o == null) + return false; + // FIXME: this is a subset of what is required + // it seems that we must process both the connect string + // and the restrictions - but this has other effects :-/ + } + return true; + } + + public bool IsUnrestricted () + { + return (state == PermissionState.Unrestricted); + } + + public override SecurityElement ToXml () + { + SecurityElement se = PermissionHelper.Element (this.GetType (), version); + if (IsUnrestricted ()) { + se.AddAttribute ("Unrestricted", "true"); + } + else { + // attribute is present for both True and False + se.AddAttribute ("AllowBlankPassword", allowBlankPassword.ToString ()); + foreach (DictionaryEntry de in _connections) { + SecurityElement child = new SecurityElement ("add"); + child.AddAttribute ("ConnectionString", (string) de.Key); + object[] restrictionsInfo = (object[]) de.Value; + child.AddAttribute ("KeyRestrictions", (string) restrictionsInfo [0]); + KeyRestrictionBehavior krb = (KeyRestrictionBehavior) restrictionsInfo [1]; + child.AddAttribute ("KeyRestrictionBehavior", krb.ToString ()); + se.AddChild (child); + } + } + return se; + } + + public override IPermission Union (IPermission target) + { + // FIXME: restrictions not completely implemented - nor documented + DBDataPermission dbdp = Cast (target); + if (dbdp == null) + return Copy (); + if (IsEmpty () && dbdp.IsEmpty ()) + return Copy (); + + DBDataPermission p = CreateInstance (); + if (IsUnrestricted () || dbdp.IsUnrestricted ()) { + p.state = PermissionState.Unrestricted; + } + else { + p.allowBlankPassword = (allowBlankPassword || dbdp.allowBlankPassword); + p._connections = new Hashtable (_connections.Count + dbdp._connections.Count); + foreach (DictionaryEntry de in _connections) + p._connections.Add (de.Key, de.Value); + // don't duplicate + foreach (DictionaryEntry de in dbdp._connections) + p._connections [de.Key] = de.Value; + } + return p; + } + + // helpers + + private bool IsEmpty () + { + return ((state != PermissionState.Unrestricted) && (_connections.Count == 0)); + } + + private DBDataPermission Cast (IPermission target) + { + if (target == null) + return null; + + DBDataPermission dbdp = (target as DBDataPermission); + if (dbdp == null) { + PermissionHelper.ThrowInvalidPermission (target, this.GetType ()); + } + + return dbdp; + } + + #endregion // Methods + } +} diff --git a/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs b/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs new file mode 100644 index 0000000000..ccc45404d6 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Common/DbDataPermissionAttribute.cs @@ -0,0 +1,113 @@ +// +// System.Data.Common.DbDataPermissionAttribute.cs +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// Tim Coleman (tim@timcoleman.com) +// Sebastien Pouliot +// +// (C) Ximian, Inc +// Copyright (C) Tim Coleman, 2002 +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.ComponentModel; +using System.Security.Permissions; +using System.Globalization; + +namespace System.Data.Common { + + [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class | + AttributeTargets.Struct | AttributeTargets.Constructor | + AttributeTargets.Method, AllowMultiple=true, Inherited=false)] + [Serializable] + public abstract class DBDataPermissionAttribute : CodeAccessSecurityAttribute { + #region Fields + + bool allowBlankPassword; + string keyRestrictions; + KeyRestrictionBehavior keyRestrictionBehavior; + string connectionString; + + #endregion // Fields + + #region Constructors + + protected DBDataPermissionAttribute (SecurityAction action) + : base (action) + { + } + + #endregion // Constructors + + #region Properties + + public bool AllowBlankPassword { + get { return allowBlankPassword; } + set { allowBlankPassword = value; } + } + + public string KeyRestrictions { + get { + if (keyRestrictions == null) + return String.Empty; + return keyRestrictions; + } + set { keyRestrictions = value; } + } + + public string ConnectionString { + get { + if (connectionString == null) + return String.Empty; + return connectionString; + } + set { connectionString = value; } + } + + public KeyRestrictionBehavior KeyRestrictionBehavior { + get { return keyRestrictionBehavior; } + set { + ExceptionHelper.CheckEnumValue (typeof (KeyRestrictionBehavior), value); + keyRestrictionBehavior = value; + } + } + + #endregion // Properties + + #region // Methods + [EditorBrowsableAttribute (EditorBrowsableState.Never)] + public bool ShouldSerializeConnectionString () + { + // FIXME: configurable ? why is this in the attribute class ? + return false; + } + + [EditorBrowsableAttribute (EditorBrowsableState.Never)] + public bool ShouldSerializeKeyRestrictions () + { + // FIXME: configurable ? why is this in the attribute class ? + return false; + } + #endregion // Methods + } +} diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs index 05b52b7ea1..43fead0c00 100644 --- a/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcConnection.cs @@ -326,7 +326,7 @@ namespace System.Data.Odbc ret = libodbc.SQLAllocHandle (OdbcHandleType.Env, IntPtr.Zero, ref henv); if ((ret != OdbcReturn.Success) && (ret != OdbcReturn.SuccessWithInfo)) { OdbcErrorCollection errors = new OdbcErrorCollection (); - errors.Add (new OdbcError (SafeDriver, "Error in " + SafeDriver, "", 1)); + errors.Add (new OdbcError (this)); e = new OdbcException (errors); MessageHandler (e); throw e; @@ -519,7 +519,7 @@ namespace System.Data.Odbc string state = RemoveTrailingNullChar (Encoding.Unicode.GetString (buf_SqlState)); string message = Encoding.Unicode.GetString (buf_MsgText, 0, txtlen * 2); - errors.Add (new OdbcError (SafeDriver, message, state, nativeerror)); + errors.Add (new OdbcError (message, state, nativeerror)); } string source = SafeDriver; diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcConnectionStringBuilder.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcConnectionStringBuilder.cs new file mode 100644 index 0000000000..9d0e60eba0 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcConnectionStringBuilder.cs @@ -0,0 +1,219 @@ +// +// System.Data.Odbc.OdbcConnectionStringBuilder +// +// Authors: +// Nidhi Rawal (rawalnidhi_rawal@yahoo.com) +// +// 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. +// + +#if NET_2_0 +using System; +using System.Collections; +using System.ComponentModel; +using System.Collections.Generic; +using System.Data; +using System.Data.Common; +using System.Data.Odbc; +using System.Reflection; +using System.Text; + +namespace System.Data.Odbc +{ + [DefaultProperty ("Driver")] + [TypeConverter ("System.Data.Odbc.OdbcConnectionStringBuilder+OdbcConnectionStringBuilderConverter, " + Consts.AssemblySystem_Data)] + public sealed class OdbcConnectionStringBuilder : DbConnectionStringBuilder + { + #region Fields + string driver; + string dsn; + #endregion //Fields + + #region Constructors + + public OdbcConnectionStringBuilder () : base (true) + { + } + + public OdbcConnectionStringBuilder (string connectionString) : base (true) + { + if (connectionString == null) { + base.ConnectionString = string.Empty; + return; + } + + base.ConnectionString = connectionString; + } + + #endregion // Constructors + + #region Properties + + public override Object this [string keyword] { + get { + if (keyword == null) + throw new ArgumentNullException ("keyword"); + if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) + return Driver; + if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) + return Dsn; + return base [keyword]; + } + set { + if (value == null) { + Remove (keyword); + return; + } + + if (keyword == null) + throw new ArgumentNullException ("keyword"); + + string text_value = value.ToString (); + + if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) { + Driver = text_value; + return; + } else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) { + dsn = text_value; + } else if (value.ToString ().IndexOf (';') != -1) { + text_value = "{" + text_value + "}"; + } + base [keyword] = value; + } + } + + public override ICollection Keys { + get { + List keys = new List (); + keys.Add ("Dsn"); + keys.Add ("Driver"); + + ICollection base_keys = base.Keys; + foreach (string keyword in base_keys) { + if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) + continue; + if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) + continue; + keys.Add (keyword); + } + + string [] final = new string [keys.Count]; + keys.CopyTo (final); + return final; + } + } + + [DisplayName ("Driver")] + [RefreshProperties (RefreshProperties.All)] + public string Driver { + get { + if (driver == null) + return string.Empty; + return driver; + } + set { + if (value == null) + throw new ArgumentNullException ("Driver"); + driver = value; + + if (value.Length > 0) { + int startBrace = value.IndexOf ('{'); + int endBrace = value.IndexOf ('}'); + if (startBrace == -1 || endBrace == -1) + value = "{" + value + "}"; + else if (startBrace > 0 || endBrace < (value.Length - 1)) + value = "{" + value + "}"; + } + base ["Driver"] = value; + } + } + + [DisplayName ("Dsn")] + [RefreshProperties (RefreshProperties.All)] + public string Dsn { + get { + if (dsn == null) + return string.Empty; + return dsn; + } + set { + if (value == null) + throw new ArgumentNullException ("Dsn"); + dsn = value; + base ["Dsn"] = dsn; + } + } + + #endregion // Properties + + #region Methods + + public override bool ContainsKey (string keyword) + { + if (keyword == null) + throw new ArgumentNullException ("keyword"); + if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) + return true; + if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) + return true; + return base.ContainsKey (keyword); + } + + public override bool Remove (string keyword) + { + if (keyword == null) + throw new ArgumentNullException ("keyword"); + if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) + driver = string.Empty; + else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) + dsn = string.Empty; + return base.Remove (keyword); + } + + public override void Clear () + { + driver = null; + dsn = null; + base.Clear (); + } + + public override bool TryGetValue (string keyword, out Object value) + { + if (keyword == null ) + throw new ArgumentNullException ("keyword"); + bool found = base.TryGetValue (keyword, out value); + if (found) + return found; + if (string.Compare (keyword, "Driver", StringComparison.InvariantCultureIgnoreCase) == 0) { + value = string.Empty; + return true; + } else if (string.Compare (keyword, "Dsn", StringComparison.InvariantCultureIgnoreCase) == 0) { + value = string.Empty; + return true; + } + return false; + } + + #endregion // Methods + } +} +#endif // NET_2_0 using diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcError.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcError.cs new file mode 100644 index 0000000000..28dcebbf70 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcError.cs @@ -0,0 +1,104 @@ +// +// System.Data.Odbc.OdbcError +// +// Author: +// Brian Ritchie (brianlritchie@hotmail.com) +// +// Copyright (C) Brian Ritchie, 2002 +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, 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.ComponentModel; +using System.Data; +using System.Data.Common; +using System.Text; + +namespace System.Data.Odbc +{ + [Serializable] + public sealed class OdbcError + { + readonly string _message; + string _source; + readonly string _state; + readonly int _nativeerror; + + #region Constructors + + internal OdbcError (OdbcConnection connection) + { + _nativeerror = 1; + _source = connection.SafeDriver; + _message = "Error in " + _source; + _state = string.Empty; + } + + internal OdbcError (string message, string state, int nativeerror) + { + _message = message; + _state = state; + _nativeerror = nativeerror; + } + + #endregion // Constructors + + #region Properties + + public string Message { + get { return _message; } + } + + public int NativeError { + get { return _nativeerror; } + } + + public string Source { + get { return _source; } + } + + public string SQLState { + get { return _state; } + } + + #endregion // Properties + + #region methods + + public override string ToString () + { + return Message; + } + + internal void SetSource (string source) + { + _source = source; + } + + #endregion + + } + +} diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcPermission.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcPermission.cs new file mode 100644 index 0000000000..a198de6bb2 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcPermission.cs @@ -0,0 +1,87 @@ +// +// System.Data.Odbc.OdbcPermission +// +// Authors: +// Umadevi S (sumadevi@novell.com) +// Sebastien Pouliot +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Data.Common; +using System.Security; +using System.Security.Permissions; + +namespace System.Data.Odbc +{ + [Serializable] + public sealed class OdbcPermission : DBDataPermission + { + #region Constructors + + [Obsolete ("use OdbcPermission(PermissionState.None)", true)] + public OdbcPermission () + : base (PermissionState.None) + { + } + + public OdbcPermission (PermissionState state) + : base (state) + { + } + + [Obsolete ("use OdbcPermission(PermissionState.None)", true)] + public OdbcPermission (PermissionState state, bool allowBlankPassword) + : base (state) + { + AllowBlankPassword = allowBlankPassword; + } + + // required for Copy method + internal OdbcPermission (DBDataPermission permission) + : base (permission) + { + } + + // easier (and common) permission creation from attribute class + internal OdbcPermission (DBDataPermissionAttribute attribute) + : base (attribute) + { + } + + #endregion + + #region Methods + + public override IPermission Copy () + { + return new OdbcPermission (this); + } + + public override void Add (string connectionString, string restrictions, KeyRestrictionBehavior behavior) + { + base.Add (connectionString, restrictions, behavior); + } + + #endregion + } +} diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcPermissionAttribute.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcPermissionAttribute.cs new file mode 100644 index 0000000000..cf412a1756 --- /dev/null +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcPermissionAttribute.cs @@ -0,0 +1,64 @@ +// +// System.Data.Odbc.OdbcPermissionAttribute +// +// Authors: +// Umadevi S (sumadevi@novell.com) +// Sebastien Pouliot +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System.Data.Common; +using System.Security; +using System.Security.Permissions; + +namespace System.Data.Odbc { + + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | + AttributeTargets.Struct | AttributeTargets.Constructor | + AttributeTargets.Method, AllowMultiple=true, + Inherited=false)] + [Serializable] + public sealed class OdbcPermissionAttribute : DBDataPermissionAttribute { + + #region Constructors + + public OdbcPermissionAttribute (SecurityAction action) + : base (action) + { + } + + #endregion + + #region Properties + #endregion + + #region Methods + + public override IPermission CreatePermission () + { + return new OdbcPermission (this); + } + + #endregion + } +} diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionStringBuilder.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionStringBuilder.cs index ea68940c66..358b26e86a 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionStringBuilder.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlConnectionStringBuilder.cs @@ -379,7 +379,7 @@ namespace System.Data.SqlClient keys.Add("User Instance"); keys.Add("Context Connection"); keys.Add("Transaction Binding"); - var coll = new System.Collections.ObjectModel.ReadOnlyCollection(keys); + ReadOnlyCollection coll = new ReadOnlyCollection(keys); return coll; } } @@ -528,7 +528,7 @@ namespace System.Data.SqlClient values.Add(_userInstance); values.Add(_contextConnection); values.Add(_transactionBinding); - var coll = new System.Collections.ObjectModel.ReadOnlyCollection(values); + ReadOnlyCollection coll = new ReadOnlyCollection(values); return coll; } } diff --git a/mcs/class/System.Data/System.Data.dll.sources b/mcs/class/System.Data/System.Data.dll.sources index fb44281640..ddb438fbb6 100644 --- a/mcs/class/System.Data/System.Data.dll.sources +++ b/mcs/class/System.Data/System.Data.dll.sources @@ -81,6 +81,7 @@ System.Data/ISafeDataRecord.cs System.Data/IsolationLevel.cs System.Data/ITableMapping.cs System.Data/ITableMappingCollection.cs +System.Data/KeyRestrictionBehavior.cs System.Data/LoadOption.cs System.Data/MappingType.cs System.Data/MergeFailedEventArgs.cs @@ -128,12 +129,23 @@ System.Data/XmlDiffLoader.cs System.Data.Common/CatalogLocation.cs System.Data.Common/ComparerFactory.cs System.Data.Common/DataAdapter.cs +System.Data.Common/DataColumnMappingCollection.cs +System.Data.Common/DataColumnMapping.cs +System.Data.Common/DataColumnMappingConverter.cs System.Data.Common/DataContainer.cs +System.Data.Common/DataTableMappingCollection.cs +System.Data.Common/DataTableMapping.cs +System.Data.Common/DataTableMappingConverter.cs System.Data.Common/DbCommandBuilder.cs +System.Data.Common/DbConnectionStringBuilder.cs System.Data.Common/DbConnectionStringBuilderHelper.cs System.Data.Common/DbCommand.cs System.Data.Common/DbConnection.cs +System.Data.Common/DbConnectionOptions.cs +System.Data.Common/DbConnectionString.cs System.Data.Common/DbDataAdapter.cs +System.Data.Common/DbDataPermissionAttribute.cs +System.Data.Common/DbDataPermission.cs System.Data.Common/DbDataReader.cs System.Data.Common/DbDataSourceEnumerator.cs System.Data.Common/DbException.cs @@ -197,7 +209,9 @@ System.Data.Odbc/OdbcDescriptionAttribute.cs System.Data.Odbc/OdbcColumn.cs System.Data.Odbc/OdbcCommand.cs System.Data.Odbc/OdbcConnection.cs +System.Data.Odbc/OdbcConnectionStringBuilder.cs System.Data.Odbc/OdbcDataReader.cs +System.Data.Odbc/OdbcError.cs System.Data.Odbc/OdbcErrorCollection.cs System.Data.Odbc/OdbcException.cs System.Data.Odbc/OdbcMetaDataColumnNames.cs @@ -214,6 +228,8 @@ System.Data.Odbc/OdbcRowUpdatedEventArgs.cs System.Data.Odbc/OdbcRowUpdatedEventHandler.cs System.Data.Odbc/OdbcRowUpdatingEventArgs.cs System.Data.Odbc/OdbcRowUpdatingEventHandler.cs +System.Data.Odbc/OdbcPermissionAttribute.cs +System.Data.Odbc/OdbcPermission.cs System.Data.Odbc/OdbcInfoMessageEventArgs.cs System.Data.Odbc/OdbcInfoMessageEventHandler.cs System.Data.Odbc/OdbcCommandBuilder.cs @@ -302,38 +318,19 @@ ReferenceSources/Bid.cs ReferenceSources/BidArgumentTypeAttribute.cs ReferenceSources/BidMethodAttribute.cs ReferenceSources/DataStorage.cs +ReferenceSources/DbConnectionStringDefaults.cs ReferenceSources/InOutOfProcHelper.cs ReferenceSources/ODB.cs ReferenceSources/Res.cs -ReferenceSources/ResCategoryAttribute.cs ReferenceSources/SafeNativeMethods.cs ReferenceSources/ThisAssembly.cs -ReferenceSources/OdbcHandle.cs - ../../../external/referencesource/System.Data/Misc/HResults.cs ../../../external/referencesource/System.Data/System/Data/Common/AdapterUtil.cs -../../../external/referencesource/System.Data/System/Data/Common/DataColumnMapping.cs -../../../external/referencesource/System.Data/System/Data/Common/DataColumnMappingCollection.cs -../../../external/referencesource/System.Data/System/Data/Common/DataTableMapping.cs -../../../external/referencesource/System.Data/System/Data/Common/DataTableMappingCollection.cs ../../../external/referencesource/System.Data/System/Data/Common/DataRecordInternal.cs -../../../external/referencesource/System.Data/System/Data/Common/DbConnectionOptions.cs -../../../external/referencesource/System.Data/System/Data/Common/DBConnectionString.cs -../../../external/referencesource/System.Data/System/Data/Common/DbConnectionStringBuilder.cs -../../../external/referencesource/System.Data/System/Data/Common/DbConnectionStringCommon.cs -../../../external/referencesource/System.Data/System/Data/Common/DBDataPermission.cs -../../../external/referencesource/System.Data/System/Data/Common/DBDataPermissionAttribute.cs ../../../external/referencesource/System.Data/System/Data/Common/dbdatarecord.cs ../../../external/referencesource/System.Data/System/Data/Common/dbenumerator.cs ../../../external/referencesource/System.Data/System/Data/Common/FieldNameLookup.cs -../../../external/referencesource/System.Data/System/Data/Common/NameValuePair.cs -../../../external/referencesource/System.Data/System/Data/Common/NameValuePermission.cs -../../../external/referencesource/System.Data/System/Data/Odbc/Odbc32.cs -../../../external/referencesource/System.Data/System/Data/Odbc/OdbcConnectionString.cs -../../../external/referencesource/System.Data/System/Data/Odbc/OdbcConnectionStringbuilder.cs -../../../external/referencesource/System.Data/System/Data/Odbc/OdbcError.cs -../../../external/referencesource/System.Data/System/Data/Odbc/OdbcPermission.cs ../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolProviderInfo.cs ../../../external/referencesource/System.Data/System/Data/SqlClient/ApplicationIntent.cs ../../../external/referencesource/System.Data/System/Data/SQLTypes/INullable.cs diff --git a/mcs/class/System.Data/System.Data/KeyRestrictionBehavior.cs b/mcs/class/System.Data/System.Data/KeyRestrictionBehavior.cs new file mode 100644 index 0000000000..96dc21a539 --- /dev/null +++ b/mcs/class/System.Data/System.Data/KeyRestrictionBehavior.cs @@ -0,0 +1,41 @@ +// +// System.Data.KeyRestrictionBehavior +// +// Author: +// Tim Coleman +// +// Copyright (C) Tim Coleman, 2003 +// + +// +// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// 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 System.Data { + [Serializable] + public enum KeyRestrictionBehavior + { + AllowOnly, + PreventUsage + } +} + diff --git a/mcs/class/System.Data/Test/System.Data.Common/DBDataPermissionTest.cs b/mcs/class/System.Data/Test/System.Data.Common/DBDataPermissionTest.cs index 4a5fba9643..ff5b972bac 100644 --- a/mcs/class/System.Data/Test/System.Data.Common/DBDataPermissionTest.cs +++ b/mcs/class/System.Data/Test/System.Data.Common/DBDataPermissionTest.cs @@ -500,7 +500,7 @@ namespace MonoTests.System.Data.Common { { NonAbstractDBDataPermission empty = new NonAbstractDBDataPermission (PermissionState.None); NonAbstractDBDataPermission union = (NonAbstractDBDataPermission) empty.Union (empty); - Assert.IsNull (union, "Empty U Empty"); + Assert.IsNotNull (union, "Empty U Empty"); NonAbstractDBDataPermission dbdp1 = new NonAbstractDBDataPermission (PermissionState.None); dbdp1.Add (defaultConnectString, String.Empty, KeyRestrictionBehavior.AllowOnly); diff --git a/mcs/class/System.Data/Test/System.Data.Common/DbConnectionStringBuilderTest.cs.REMOVED.git-id b/mcs/class/System.Data/Test/System.Data.Common/DbConnectionStringBuilderTest.cs.REMOVED.git-id index 18663b70e1..a5f6955fa5 100644 --- a/mcs/class/System.Data/Test/System.Data.Common/DbConnectionStringBuilderTest.cs.REMOVED.git-id +++ b/mcs/class/System.Data/Test/System.Data.Common/DbConnectionStringBuilderTest.cs.REMOVED.git-id @@ -1 +1 @@ -0ff9d109c2cf0e230c09e3069a3bb7a6f7873181 \ No newline at end of file +a797cf50afab63bc3e3b32e1cc95d46c9c8d5ef8 \ No newline at end of file diff --git a/mcs/class/System.Data/mobile_System.Data.dll.sources b/mcs/class/System.Data/mobile_System.Data.dll.sources index 1145677ddb..5e79b5556f 100644 --- a/mcs/class/System.Data/mobile_System.Data.dll.sources +++ b/mcs/class/System.Data/mobile_System.Data.dll.sources @@ -80,6 +80,7 @@ System.Data/ISafeDataRecord.cs System.Data/IsolationLevel.cs System.Data/ITableMapping.cs System.Data/ITableMappingCollection.cs +System.Data/KeyRestrictionBehavior.cs System.Data/LoadOption.cs System.Data/MappingType.cs System.Data/MergeFailedEventArgs.cs @@ -126,12 +127,23 @@ System.Data/XmlDiffLoader.cs System.Data.Common/CatalogLocation.cs System.Data.Common/ComparerFactory.cs System.Data.Common/DataAdapter.cs +System.Data.Common/DataColumnMappingCollection.cs +System.Data.Common/DataColumnMapping.cs +System.Data.Common/DataColumnMappingConverter.cs System.Data.Common/DataContainer.cs +System.Data.Common/DataTableMappingCollection.cs +System.Data.Common/DataTableMapping.cs +System.Data.Common/DataTableMappingConverter.cs System.Data.Common/DbCommandBuilder.cs +System.Data.Common/DbConnectionStringBuilder.cs System.Data.Common/DbConnectionStringBuilderHelper.cs System.Data.Common/DbCommand.cs System.Data.Common/DbConnection.cs +System.Data.Common/DbConnectionOptions.cs +System.Data.Common/DbConnectionString.cs System.Data.Common/DbDataAdapter.cs +System.Data.Common/DbDataPermissionAttribute.cs +System.Data.Common/DbDataPermission.cs System.Data.Common/DbDataReader.cs System.Data.Common/DbDataSourceEnumerator.cs System.Data.Common/DbException.cs @@ -175,7 +187,6 @@ Microsoft.SqlServer.Server/TriggerAction.cs Microsoft.SqlServer.Server/SqlTriggerContext.cs Microsoft.SqlServer.Server/SqlProcedureAttribute.cs Microsoft.SqlServer.Server/SqlTriggerAttribute.cs -System.Data.SqlClient/SortOrder.cs System.Data.SqlClient/SqlNotificationType.cs System.Data.SqlClient/SqlNotificationInfo.cs System.Data.SqlClient/SqlNotificationSource.cs @@ -243,31 +254,19 @@ ReferenceSources/Bid.cs ReferenceSources/BidArgumentTypeAttribute.cs ReferenceSources/BidMethodAttribute.cs ReferenceSources/DataStorage.cs +ReferenceSources/DbConnectionStringDefaults.cs ReferenceSources/InOutOfProcHelper.cs ReferenceSources/ODB.cs ReferenceSources/Res.cs -ReferenceSources/ResCategoryAttribute.cs ReferenceSources/SafeNativeMethods.cs ReferenceSources/ThisAssembly.cs ../../../external/referencesource/System.Data/Misc/HResults.cs ../../../external/referencesource/System.Data/System/Data/Common/AdapterUtil.cs -../../../external/referencesource/System.Data/System/Data/Common/DataColumnMapping.cs -../../../external/referencesource/System.Data/System/Data/Common/DataColumnMappingCollection.cs -../../../external/referencesource/System.Data/System/Data/Common/DataTableMapping.cs -../../../external/referencesource/System.Data/System/Data/Common/DataTableMappingCollection.cs ../../../external/referencesource/System.Data/System/Data/Common/DataRecordInternal.cs -../../../external/referencesource/System.Data/System/Data/Common/DbConnectionOptions.cs -../../../external/referencesource/System.Data/System/Data/Common/DBConnectionString.cs -../../../external/referencesource/System.Data/System/Data/Common/DbConnectionStringBuilder.cs -../../../external/referencesource/System.Data/System/Data/Common/DbConnectionStringCommon.cs -../../../external/referencesource/System.Data/System/Data/Common/DBDataPermission.cs -../../../external/referencesource/System.Data/System/Data/Common/DBDataPermissionAttribute.cs ../../../external/referencesource/System.Data/System/Data/Common/dbdatarecord.cs ../../../external/referencesource/System.Data/System/Data/Common/dbenumerator.cs ../../../external/referencesource/System.Data/System/Data/Common/FieldNameLookup.cs -../../../external/referencesource/System.Data/System/Data/Common/NameValuePair.cs -../../../external/referencesource/System.Data/System/Data/Common/NameValuePermission.cs ../../../external/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolProviderInfo.cs ../../../external/referencesource/System.Data/System/Data/SqlClient/ApplicationIntent.cs ../../../external/referencesource/System.Data/System/Data/SQLTypes/INullable.cs @@ -289,3 +288,4 @@ ReferenceSources/ThisAssembly.cs ../../../external/referencesource/System.Data/System/Data/SQLTypes/SQLSingle.cs ../../../external/referencesource/System.Data/System/Data/SQLTypes/SQLString.cs ../../../external/referencesource/System.Data/System/Data/SQLTypes/SQLUtility.cs + diff --git a/mcs/class/System.Data/xammac_net_4_5_System.Data.dll.sources b/mcs/class/System.Data/xammac_net_4_5_System.Data.dll.sources new file mode 100644 index 0000000000..cd4775638f --- /dev/null +++ b/mcs/class/System.Data/xammac_net_4_5_System.Data.dll.sources @@ -0,0 +1 @@ +#include System.Data.dll.sources diff --git a/mcs/class/System.IdentityModel.Selectors/Makefile b/mcs/class/System.IdentityModel.Selectors/Makefile index d3b8f149f4..91cb61ad8d 100755 --- a/mcs/class/System.IdentityModel.Selectors/Makefile +++ b/mcs/class/System.IdentityModel.Selectors/Makefile @@ -15,7 +15,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) EXTRA_DISTFILES = -VALID_PROFILE := $(filter net_4_5, $(PROFILE)) +VALID_PROFILE := $(filter net_4_5 xammac_net_4_5, $(PROFILE)) ifndef VALID_PROFILE LIBRARY_NAME = dummy-System.IdentityModel.Selectors.dll NO_INSTALL = yes diff --git a/mcs/class/System.IdentityModel/Makefile b/mcs/class/System.IdentityModel/Makefile index 4889b6c6b8..69403b9a37 100644 --- a/mcs/class/System.IdentityModel/Makefile +++ b/mcs/class/System.IdentityModel/Makefile @@ -2,9 +2,11 @@ thisdir = class/System.IdentityModel SUBDIRS = include ../../build/rules.make +ifndef NO_SYSTEM_WEB_APPSERVICES_DEPENDENCY ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) OTHER_LIB_MCS_FLAGS = -r:System.Web.ApplicationServices.dll endif +endif LIBRARY = System.IdentityModel.dll LIB_MCS_FLAGS = \ @@ -12,12 +14,15 @@ LIB_MCS_FLAGS = \ /r:System.dll \ /r:System.Xml.dll \ /r:System.Security.dll \ - /r:System.Web.dll \ /r:System.Configuration.dll \ /r:Mono.Security.dll \ /r:System.Runtime.Serialization.dll \ $(OTHER_LIB_MCS_FLAGS) +ifndef NO_SYSTEM_WEB_DEPENDENCY +LIB_MCS_FLAGS += /r:System.Web.dll +endif + TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) EXTRA_DISTFILES = \ @@ -26,7 +31,7 @@ EXTRA_DISTFILES = \ Test/Resources/test.pfx \ Test/Resources/test2.pfx -VALID_PROFILE := $(filter net_4_5, $(PROFILE)) +VALID_PROFILE := $(filter net_4_5 xammac_net_4_5, $(PROFILE)) ifndef VALID_PROFILE LIBRARY_NAME = dummy-System.IdentityModel.dll NO_INSTALL = yes diff --git a/mcs/class/System.IdentityModel/System.IdentityModel.Selectors/CustomUserNameSecurityTokenAuthenticator.cs b/mcs/class/System.IdentityModel/System.IdentityModel.Selectors/CustomUserNameSecurityTokenAuthenticator.cs index 7a93f65dc1..f84843e362 100644 --- a/mcs/class/System.IdentityModel/System.IdentityModel.Selectors/CustomUserNameSecurityTokenAuthenticator.cs +++ b/mcs/class/System.IdentityModel/System.IdentityModel.Selectors/CustomUserNameSecurityTokenAuthenticator.cs @@ -1,3 +1,4 @@ +#if !NO_SYSTEM_WEB_DEPENDENCY // // CustomUserNameSecurityTokenAuthenticator.cs // @@ -133,3 +134,4 @@ namespace System.IdentityModel.Selectors } } } +#endif \ No newline at end of file diff --git a/mcs/class/System.IdentityModel/System.IdentityModel.Selectors/UserNamePasswordValidator.cs b/mcs/class/System.IdentityModel/System.IdentityModel.Selectors/UserNamePasswordValidator.cs index 2111c1082b..c8a426e801 100644 --- a/mcs/class/System.IdentityModel/System.IdentityModel.Selectors/UserNamePasswordValidator.cs +++ b/mcs/class/System.IdentityModel/System.IdentityModel.Selectors/UserNamePasswordValidator.cs @@ -1,3 +1,4 @@ +#if !NO_SYSTEM_WEB_DEPENDENCY // // UserNamePasswordValidator.cs // @@ -80,3 +81,4 @@ namespace System.IdentityModel.Selectors } } } +#endif \ No newline at end of file diff --git a/mcs/class/System.Messaging/Makefile b/mcs/class/System.Messaging/Makefile index 681b883509..06b407b91d 100644 --- a/mcs/class/System.Messaging/Makefile +++ b/mcs/class/System.Messaging/Makefile @@ -6,17 +6,22 @@ LIBRARY = System.Messaging.dll LIB_MCS_FLAGS = /resource:System.Messaging/MessageQueue.resx \ /r:System.dll \ /r:System.Configuration.Install.dll \ - /r:System.Drawing.dll \ - /r:System.Windows.Forms.dll \ /r:System.Xml \ /r:Mono.Messaging.dll + TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 \ /r:nunit.mocks.dll EXTRA_DISTFILES = System.Messaging/MessageQueue.resx -ifdef MESSAGING_NO_WINFORMS +ifndef NO_SYSTEM_DRAWING_DEPENDENCY +LIB_MCS_FLAGS += /r:System.Drawing.dll +endif + +ifdef NO_WINFORMS_DEPENDENCY LIB_MCS_FLAGS += -d:NO_WINFORMS_DEPENDENCY +else +LIB_MCS_FLAGS += /r:System.Windows.Forms.dll endif include ../../build/library.make diff --git a/mcs/class/System.Messaging/System.Messaging.Design/QueuePathEditor.cs b/mcs/class/System.Messaging/System.Messaging.Design/QueuePathEditor.cs index d50c600ada..88d8608d58 100644 --- a/mcs/class/System.Messaging/System.Messaging.Design/QueuePathEditor.cs +++ b/mcs/class/System.Messaging/System.Messaging.Design/QueuePathEditor.cs @@ -28,6 +28,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !NO_SYSTEM_DRAWING_DEPENDENCY using System.ComponentModel; using System.Drawing.Design; @@ -53,3 +54,4 @@ namespace System.Messaging.Design } } } +#endif \ No newline at end of file diff --git a/mcs/class/System.Messaging/System.Messaging/MessageQueue.cs b/mcs/class/System.Messaging/System.Messaging/MessageQueue.cs index 8b3481b9d3..7286d05912 100644 --- a/mcs/class/System.Messaging/System.Messaging/MessageQueue.cs +++ b/mcs/class/System.Messaging/System.Messaging/MessageQueue.cs @@ -32,7 +32,9 @@ using System; using System.Collections; using System.ComponentModel; +#if !NO_SYSTEM_DRAWING_DEPENDENCY using System.Drawing; +#endif using System.Messaging.Design; using System.Threading; @@ -258,7 +260,9 @@ namespace System.Messaging } [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] +#if !NO_SYSTEM_DRAWING_DEPENDENCY [TypeConverter (typeof(SizeConverter))] +#endif [MessagingDescription ("MQ_MaximumJournalSize")] public long MaximumJournalSize { get { @@ -270,7 +274,9 @@ namespace System.Messaging } [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)] +#if !NO_SYSTEM_DRAWING_DEPENDENCY [TypeConverter (typeof(SizeConverter))] +#endif [MessagingDescription ("MQ_MaximumQueueSize")] public long MaximumQueueSize { get { diff --git a/mcs/class/System.Messaging/System.Messaging/MessageQueueInstaller.cs b/mcs/class/System.Messaging/System.Messaging/MessageQueueInstaller.cs index d3b9889a80..4606e5ebd1 100644 --- a/mcs/class/System.Messaging/System.Messaging/MessageQueueInstaller.cs +++ b/mcs/class/System.Messaging/System.Messaging/MessageQueueInstaller.cs @@ -31,7 +31,9 @@ using System; using System.Collections; using System.ComponentModel; using System.Configuration.Install; +#if !NO_SYSTEM_DRAWING_DEPENDENCY using System.Drawing; +#endif namespace System.Messaging { @@ -88,7 +90,9 @@ namespace System.Messaging set {throw new NotImplementedException();} } +#if !NO_SYSTEM_DRAWING_DEPENDENCY [TypeConverter (typeof(SizeConverter))] +#endif public long MaximumJournalSize { [MonoTODO] get {throw new NotImplementedException();} @@ -96,7 +100,9 @@ namespace System.Messaging set {throw new NotImplementedException();} } +#if !NO_SYSTEM_DRAWING_DEPENDENCY [TypeConverter (typeof(SizeConverter))] +#endif public long MaximumQueueSize { [MonoTODO] get {throw new NotImplementedException();} @@ -183,4 +189,4 @@ namespace System.Messaging throw new NotImplementedException(); } } -} +} \ No newline at end of file diff --git a/mcs/class/System.Runtime.Serialization/xammac_net_4_5_System.Runtime.Serialization.dll.sources b/mcs/class/System.Runtime.Serialization/xammac_net_4_5_System.Runtime.Serialization.dll.sources new file mode 100644 index 0000000000..17c4f437aa --- /dev/null +++ b/mcs/class/System.Runtime.Serialization/xammac_net_4_5_System.Runtime.Serialization.dll.sources @@ -0,0 +1 @@ +#include net_4_5_System.Runtime.Serialization.dll.sources diff --git a/mcs/class/System.ServiceModel.Web/Makefile b/mcs/class/System.ServiceModel.Web/Makefile index 4db6ae805b..26fc0d671a 100644 --- a/mcs/class/System.ServiceModel.Web/Makefile +++ b/mcs/class/System.ServiceModel.Web/Makefile @@ -7,13 +7,19 @@ LIB_MCS_FLAGS = -r:System.dll -r:System.Xml.dll -r:System.Runtime.Serialization. ifneq (2.1, $(FRAMEWORK_VERSION)) LIB_MCS_FLAGS += -d:NET_3_5 -d:NET_3_0 \ - -r:System.Configuration.dll \ - -r:System.Web.Extensions.dll + -r:System.Configuration.dll + +ifndef NO_SYSTEM_WEB_DEPENDENCY +LIB_MCS_FLAGS += -r:System.Web.Extensions.dll endif +endif + +ifndef NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) LIB_MCS_FLAGS += -r:System.ServiceModel.Activation.dll endif +endif TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs index d6e40c6f4c..3049f2901e 100644 --- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs +++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Channels/WebMessageEncodingBindingElement.cs @@ -146,7 +146,7 @@ namespace System.ServiceModel.Channels return context.GetInnerProperty (); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 [MonoTODO] void IWsdlExportExtension.ExportContract (WsdlExporter exporter, WsdlContractConversionContext context) { diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpBehavior.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpBehavior.cs index 4787560a34..d207385c97 100644 --- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpBehavior.cs +++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpBehavior.cs @@ -84,7 +84,7 @@ namespace System.ServiceModel.Description // clientRuntime.MessageInspectors.Add (something); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 protected virtual void AddServerErrorHandlers (ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) { endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add (new WebHttpErrorHandler ()); @@ -103,7 +103,7 @@ namespace System.ServiceModel.Description public virtual void ApplyDispatchBehavior (ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) { -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 throw new NotImplementedException (); #else endpointDispatcher.DispatchRuntime.OperationSelector = GetOperationSelector (endpoint); @@ -146,7 +146,7 @@ namespace System.ServiceModel.Description } } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 internal class DispatchPairFormatter : IDispatchMessageFormatter { public DispatchPairFormatter (IDispatchMessageFormatter request, IDispatchMessageFormatter reply) diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs index f7fc5d893a..fc8a065f5a 100644 --- a/mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs +++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs @@ -52,7 +52,7 @@ namespace System.ServiceModel public WebHttpBinding (string configurationName) { -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 BindingsSection bindingsSection = ConfigUtil.BindingsSection; WebHttpBindingElement el = (WebHttpBindingElement) bindingsSection ["webHttpBinding"].ConfiguredBindings.FirstOrDefault (c => c.Name == configurationName); if (el != null) { @@ -88,7 +88,7 @@ namespace System.ServiceModel get { return EnvelopeVersion.None; } } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 [DefaultValue (false)] public bool AllowCookies { get { return t.AllowCookies; } diff --git a/mcs/class/System.ServiceModel.Web/xammac_net_4_5_System.ServiceModel.Web.dll.sources b/mcs/class/System.ServiceModel.Web/xammac_net_4_5_System.ServiceModel.Web.dll.sources new file mode 100644 index 0000000000..f45560fd94 --- /dev/null +++ b/mcs/class/System.ServiceModel.Web/xammac_net_4_5_System.ServiceModel.Web.dll.sources @@ -0,0 +1,39 @@ +#include mobile_System.ServiceModel.Web.dll.sources +System.ServiceModel.Web/IncomingWebRequestContext.cs +System.ServiceModel.Web/OutgoingWebResponseContext.cs +System.ServiceModel.Syndication/Atom10FeedFormatter.cs +System.ServiceModel.Syndication/Atom10FeedFormatter_1.cs +System.ServiceModel.Syndication/Atom10ItemFormatter.cs +System.ServiceModel.Syndication/Atom10ItemFormatter_1.cs +System.ServiceModel.Syndication/AtomPub10CategoriesDocumentFormatter.cs +System.ServiceModel.Syndication/AtomPub10ServiceDocumentFormatter.cs +System.ServiceModel.Syndication/AtomPub10ServiceDocumentFormatter_1.cs +System.ServiceModel.Syndication/CategoriesDocument.cs +System.ServiceModel.Syndication/CategoriesDocumentFormatter.cs +System.ServiceModel.Syndication/ISyndicationElement.cs +System.ServiceModel.Syndication/InlineCategoriesDocument.cs +System.ServiceModel.Syndication/ReferencedCategoriesDocument.cs +System.ServiceModel.Syndication/ResourceCollectionInfo.cs +System.ServiceModel.Syndication/Rss20FeedFormatter.cs +System.ServiceModel.Syndication/Rss20FeedFormatter_1.cs +System.ServiceModel.Syndication/Rss20ItemFormatter.cs +System.ServiceModel.Syndication/Rss20ItemFormatter_1.cs +System.ServiceModel.Syndication/ServiceDocument.cs +System.ServiceModel.Syndication/ServiceDocumentFormatter.cs +System.ServiceModel.Syndication/SyndicationCategory.cs +System.ServiceModel.Syndication/SyndicationContent.cs +System.ServiceModel.Syndication/SyndicationElementExtension.cs +System.ServiceModel.Syndication/SyndicationElementExtensionCollection.cs +System.ServiceModel.Syndication/SyndicationExtensions.cs +System.ServiceModel.Syndication/SyndicationFeed.cs +System.ServiceModel.Syndication/SyndicationFeedFormatter.cs +System.ServiceModel.Syndication/SyndicationItem.cs +System.ServiceModel.Syndication/SyndicationItemFormatter.cs +System.ServiceModel.Syndication/SyndicationLink.cs +System.ServiceModel.Syndication/SyndicationPerson.cs +System.ServiceModel.Syndication/SyndicationVersions.cs +System.ServiceModel.Syndication/TextSyndicationContent.cs +System.ServiceModel.Syndication/TextSyndicationContentKind.cs +System.ServiceModel.Syndication/UrlSyndicationContent.cs +System.ServiceModel.Syndication/Workspace.cs +System.ServiceModel.Syndication/XmlSyndicationContent.cs \ No newline at end of file diff --git a/mcs/class/System.ServiceModel/Dummy_2_1.cs b/mcs/class/System.ServiceModel/Dummy_2_1.cs index e125104773..dc094beb45 100644 --- a/mcs/class/System.ServiceModel/Dummy_2_1.cs +++ b/mcs/class/System.ServiceModel/Dummy_2_1.cs @@ -1,3 +1,4 @@ +#if !XAMMAC_4_5 using System.Collections.Generic; using System.Reflection; using System.Runtime.Serialization; @@ -187,3 +188,4 @@ namespace Mono.Xml.XPath class Dummy {} } #endif +#endif \ No newline at end of file diff --git a/mcs/class/System.ServiceModel/Dummy_XM_4_5.cs b/mcs/class/System.ServiceModel/Dummy_XM_4_5.cs new file mode 100644 index 0000000000..100e0ca774 --- /dev/null +++ b/mcs/class/System.ServiceModel/Dummy_XM_4_5.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.CompilerServices; +using System.ServiceModel.Channels; +using System.ServiceModel.Dispatcher; +using System.Text; +using System.Xml; + +namespace System.ServiceModel +{ + public class InstanceContext + { + public InstanceContext (object dummy) {} + } +} + +namespace System.ServiceModel.PeerResolvers +{ + class Dummy {} +} + +namespace System.ServiceModel.Configuration +{ + class Dummy {} +} +namespace System.ServiceModel.Channels.Http +{ +} +namespace System.ServiceModel.Channels.NetTcp +{ +} + +namespace System.ServiceModel.Dispatcher +{ + public sealed class EndpointDispatcher + { + internal EndpointDispatcher () + { + } + } +} + +namespace System.ServiceModel.Channels +{ + public static class UrlUtility { + public static string UrlEncode (string s, Encoding e) + { + return System.Net.WebUtility.UrlEncode (s); + } + + public static string UrlDecode (string s, Encoding e) + { + return System.Net.WebUtility.UrlDecode (s); + } + } +} + +namespace System.ServiceModel.Description +{ + public interface IPolicyExportExtension {} + public interface IPolicyImportExtension {} + public interface IWsdlExportExtension {} + public interface IWsdlImportExtension {} +} +namespace System.ServiceModel.Channels +{ + public interface ITransportTokenAssertionProvider {} +} diff --git a/mcs/class/System.ServiceModel/Makefile b/mcs/class/System.ServiceModel/Makefile index fe7f16e54e..a0ed351ad5 100755 --- a/mcs/class/System.ServiceModel/Makefile +++ b/mcs/class/System.ServiceModel/Makefile @@ -18,6 +18,10 @@ LIB_MCS_FLAGS = \ /r:System.Runtime.Serialization.dll \ $(RESOURCE_FILES:%=/resource:%) +ifdef XAMMAC_4_5 +LIB_REFS += System.ServiceModel.Internals +endif + ifneq (2.1, $(FRAMEWORK_VERSION)) LIB_MCS_FLAGS += /d:NET_3_0 \ /r:System.Configuration.dll \ @@ -27,22 +31,41 @@ LIB_MCS_FLAGS += /d:NET_3_0 \ /r:System.IdentityModel.Selectors.dll \ /r:System.Transactions.dll \ /r:System.Messaging.dll \ - /r:System.Web.dll \ /r:System.Web.Services.dll \ /r:Mono.Security.dll + +ifdef XAMAMC_4_5 +LIB_MCS_FLAGS += /r:System.Net.dll +endif + +ifndef NO_SYSTEM_WEB_DEPENDENCY +LIB_MCS_FLAGS += /r:System.Web.dll +endif + endif ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) +ifndef NO_SYSTEM_WEB_APPSERVICES_DEPENDENCY LIB_MCS_FLAGS += /r:System.Web.ApplicationServices.dll +endif + +ifndef NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY activation = $(the_libdir_base)System.ServiceModel.Activation.dll servicemodel_deps = $(activation) +endif ifneq (plainservice/,$(intermediate)) +ifndef NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY LIB_MCS_FLAGS += -define:HAS_ACTIVATION -r:System.ServiceModel.Activation.dll +endif + +ifndef NO_SYSTEM_WEB_APPSERVICES_DEPENDENCY LIB_MCS_FLAGS += -r:System.Web.ApplicationServices.dll endif endif +endif + TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) TEST_EXTRA_FILES = \ @@ -87,4 +110,4 @@ CLEAN_FILES = $(the_libdir_base)plainservice/System.ServiceModel.dll ifndef intermediate csproj-local: $(MAKE) csproj-local intermediate=plainservice/ -endif \ No newline at end of file +endif diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/BinaryMessageEncodingBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/BinaryMessageEncodingBindingElement.cs index 64f235d2ab..32ab72a9cb 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/BinaryMessageEncodingBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/BinaryMessageEncodingBindingElement.cs @@ -131,7 +131,7 @@ namespace System.ServiceModel.Channels return new BinaryMessageEncoderFactory (this); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 [MonoTODO] void IWsdlExportExtension.ExportContract (WsdlExporter exporter, WsdlContractConversionContext context) diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/FaultConverter.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/FaultConverter.cs index d77e34153d..23c8081ebe 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/FaultConverter.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/FaultConverter.cs @@ -137,7 +137,7 @@ namespace System.ServiceModel.Channels OperationContext ctx = OperationContext.Current; // FIXME: support more fault code depending on the exception type. -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 // FIXME: set correct fault reason. if (ctx != null && ctx.EndpointDispatcher.ChannelDispatcher.IncludeExceptionDetailInFaults) { ExceptionDetail detail = new ExceptionDetail (error); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpTransportBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpTransportBindingElement.cs index eff17df9bc..6b70a26e3b 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpTransportBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpTransportBindingElement.cs @@ -185,7 +185,7 @@ namespace System.ServiceModel.Channels return typeof (TChannel) == typeof (IRequestChannel); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 public override bool CanBuildChannelListener ( BindingContext context) { @@ -201,7 +201,7 @@ namespace System.ServiceModel.Channels return new HttpChannelFactory (this, context); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 internal static object ListenerBuildLock = new object (); public override IChannelListener BuildChannelListener ( @@ -242,7 +242,7 @@ namespace System.ServiceModel.Channels set { throw new NotImplementedException (); } } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 void IPolicyExportExtension.ExportPolicy ( MetadataExporter exporter, PolicyConversionContext context) diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpsTransportBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpsTransportBindingElement.cs index f129787474..d95dd5f35e 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpsTransportBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpsTransportBindingElement.cs @@ -68,7 +68,7 @@ namespace System.ServiceModel.Channels return base.BuildChannelFactory (context); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 [MonoTODO] public override IChannelListener BuildChannelListener ( @@ -83,7 +83,7 @@ namespace System.ServiceModel.Channels return new HttpsTransportBindingElement (this); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 public XmlElement GetTransportTokenAssertion () { var doc = new XmlDocument (); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageEncodingBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageEncodingBindingElement.cs index 4e9808daae..49a8478f6f 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageEncodingBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageEncodingBindingElement.cs @@ -59,7 +59,7 @@ namespace System.ServiceModel.Channels return ctx.GetInnerProperty (); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 [MonoTODO] protected virtual void OnImportPolicy (XmlElement assertion, MessageVersion messageVersion, diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReliableSessionBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReliableSessionBindingElement.cs index 440aa83288..422e6e92c1 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReliableSessionBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ReliableSessionBindingElement.cs @@ -99,7 +99,7 @@ namespace System.ServiceModel.Channels throw new NotImplementedException (); } -#if !MOBILE +#if !MOBILE && !XAMMAC_4_5 void IPolicyExportExtension.ExportPolicy (MetadataExporter exporter, PolicyConversionContext context) { throw new NotImplementedException (); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SecurityBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SecurityBindingElement.cs index 25de2b9205..45aee53cce 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SecurityBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SecurityBindingElement.cs @@ -30,7 +30,7 @@ using System.Collections.ObjectModel; using System.ServiceModel.Description; using System.ServiceModel.Channels; using System.ServiceModel.Security; -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 using System.ServiceModel.Channels.Security; using System.IdentityModel.Selectors; using System.IdentityModel.Tokens; @@ -44,7 +44,7 @@ namespace System.ServiceModel.Channels { internal SecurityBindingElement () { -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 DefaultAlgorithmSuite = SecurityAlgorithmSuite.Default; MessageSecurityVersion = MessageSecurityVersion.Default; KeyEntropyMode = SecurityKeyEntropyMode.CombinedEntropy; @@ -60,7 +60,7 @@ namespace System.ServiceModel.Channels internal SecurityBindingElement (SecurityBindingElement other) { -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 alg_suite = other.alg_suite; key_entropy_mode = other.key_entropy_mode; security_header_layout = other.security_header_layout; @@ -79,7 +79,7 @@ namespace System.ServiceModel.Channels LocalClientSettings = other.LocalClientSettings.Clone (); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 SecurityAlgorithmSuite alg_suite; SecurityKeyEntropyMode key_entropy_mode; SecurityHeaderLayout security_header_layout; @@ -93,7 +93,7 @@ namespace System.ServiceModel.Channels public LocalClientSecuritySettings LocalClientSettings { get; private set; } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 public SecurityAlgorithmSuite DefaultAlgorithmSuite { get { return alg_suite; } set { alg_suite = value; } @@ -138,7 +138,7 @@ namespace System.ServiceModel.Channels [MonoTODO ("Implement for TransportSecurityBindingElement")] public override bool CanBuildChannelFactory (BindingContext context) { -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 // not sure this should be like this, but there isn't Symmetric/Asymmetric elements in 2.1 anyways. return context.CanBuildInnerChannelFactory (); #else @@ -183,7 +183,7 @@ namespace System.ServiceModel.Channels protected abstract IChannelFactory BuildChannelFactoryCore (BindingContext context); -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 [MonoTODO ("Implement for TransportSecurityBindingElement")] public override bool CanBuildChannelListener (BindingContext context) { @@ -270,7 +270,7 @@ namespace System.ServiceModel.Channels #endif #region Factory methods -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 public static SymmetricSecurityBindingElement CreateAnonymousForCertificateBindingElement () { @@ -559,14 +559,14 @@ namespace System.ServiceModel.Channels CreateUserNameOverTransportBindingElement () { var be = new TransportSecurityBindingElement (); -#if !NET_2_1 // FIXME: there should be whatever else to do for 2.1 instead. +#if !NET_2_1 && !XAMMAC_4_5 // FIXME: there should be whatever else to do for 2.1 instead. be.EndpointSupportingTokenParameters.SignedEncrypted.Add (new UserNameSecurityTokenParameters ()); #endif return be; } #endregion -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 // It seems almost internal, hardcoded like this (I tried // custom parameters that sets IssuedTokenSecurityTokenParameters // like below ones, but that didn't trigger this method). diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs index 91caa49cc3..2330e8134c 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TextMessageEncodingBindingElement.cs @@ -143,7 +143,7 @@ namespace System.ServiceModel.Channels return new TextMessageEncoderFactory (this); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 [MonoTODO] protected override void OnImportPolicy (XmlElement assertion, MessageVersion messageVersion, diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs index 9f0a92ffc9..4f1a5fde8f 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportBindingElement.cs @@ -92,7 +92,7 @@ namespace System.ServiceModel.Channels return context.GetInnerProperty (); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 internal static XmlElement CreateTransportBinding (XmlElement transportToken) { var doc = new XmlDocument (); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportSecurityBindingElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportSecurityBindingElement.cs index a366b16804..e29e6f0c55 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportSecurityBindingElement.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/TransportSecurityBindingElement.cs @@ -65,7 +65,7 @@ namespace System.ServiceModel.Channels throw new NotImplementedException (); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 [MonoTODO] protected override IChannelListener BuildChannelListenerCore ( diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs index 623743d0c7..43918f6f60 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs @@ -35,7 +35,9 @@ using System.ServiceModel.Channels; using System.ServiceModel.Configuration; using System.ServiceModel.Description; using System.ServiceModel.Dispatcher; +#if !XAMMAC_4_5 using System.Web.Configuration; +#endif using SysConfig = System.Configuration.Configuration; @@ -43,6 +45,7 @@ namespace System.ServiceModel.Configuration { internal static class ConfigUtil { +#if !XAMMAC_4_5 static object GetSection (string name) { if (ServiceHostingEnvironment.InAspNet) @@ -242,6 +245,7 @@ namespace System.ServiceModel.Configuration { return new EndpointAddress (el.Address, el.Identity != null ? el.Identity.CreateInstance () : null, el.Headers.Headers); } +#endif public static EndpointIdentity CreateInstance (this IdentityElement el) { @@ -299,6 +303,7 @@ namespace System.ServiceModel.Configuration return CreateCertificateFrom (el.StoreLocation, el.StoreName, el.X509FindType, el.FindValue); } +#if !XAMMAC_4_5 public static BindingCollectionElement FindCollectionElement (Binding binding, SysConfig config) { var section = (BindingsSection) config.GetSection ("system.serviceModel/bindings"); @@ -309,6 +314,7 @@ namespace System.ServiceModel.Configuration return null; } +#endif } enum NamedConfigCategory diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ClientCredentials.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ClientCredentials.cs index 04dc37caba..951adecf87 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ClientCredentials.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ClientCredentials.cs @@ -40,7 +40,7 @@ using System.ServiceModel.Security.Tokens; namespace System.ServiceModel.Description { public class ClientCredentials -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 : IEndpointBehavior #else : SecurityCredentialsManager, IEndpointBehavior @@ -128,7 +128,7 @@ namespace System.ServiceModel.Description return new ClientCredentials (this); } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 public override SecurityTokenManager CreateSecurityTokenManager () { return new ClientCredentialsSecurityTokenManager (this); diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs index 6ff6365432..dc25161d46 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/DataContractSerializerOperationBehavior.cs @@ -112,7 +112,7 @@ namespace System.ServiceModel.Description { } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 //IWsdlExportExtension void IWsdlExportExtension.ExportContract (WsdlExporter exporter, diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MessagePartDescription.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MessagePartDescription.cs index 70e427a26c..5e3924b26e 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/MessagePartDescription.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/MessagePartDescription.cs @@ -100,7 +100,7 @@ namespace System.ServiceModel.Description set { type = value; } } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 internal XsdDataContractImporter DataContractImporter { get; set; } internal XmlSerializerMessageContractImporterInternal XmlSerializationImporter { get; set; } internal System.CodeDom.CodeTypeReference CodeTypeReference { get; set; } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/XmlSerializerOperationBehavior.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/XmlSerializerOperationBehavior.cs index 4c41c6b50c..1895c10e75 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/XmlSerializerOperationBehavior.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/XmlSerializerOperationBehavior.cs @@ -104,7 +104,7 @@ namespace System.ServiceModel.Description { } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 void IWsdlExportExtension.ExportContract ( WsdlExporter exporter, WsdlContractConversionContext context) diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Diagnostics/MessageLoggingSettings.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Diagnostics/MessageLoggingSettings.cs index 190bc0ea24..db050b9067 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Diagnostics/MessageLoggingSettings.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Diagnostics/MessageLoggingSettings.cs @@ -36,7 +36,7 @@ namespace System.ServiceModel.Diagnostics { public MessageLoggingSettings () { -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 var e = ConfigUtil.DiagnosticSection.MessageLogging; LogEntireMessage = e.LogEntireMessage; LogKnownPii = e.LogKnownPii; diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchOperation.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchOperation.cs index f226260839..e9fb67f98e 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchOperation.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchOperation.cs @@ -214,7 +214,7 @@ namespace System.ServiceModel.Dispatcher void ThrowIfOpened () { -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 // FIXME: get callback client runtime status when ChannelDispatcher is not available. var state = Parent.ChannelDispatcher != null ? Parent.ChannelDispatcher.State : CommunicationState.Created; // Parent.CallbackClientRuntime.ChannelFactory.State; switch (state) { diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchRuntime.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchRuntime.cs index f2a48bf517..f6660e1c19 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchRuntime.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/DispatchRuntime.cs @@ -31,8 +31,10 @@ using System.Collections.ObjectModel; using System.Reflection; #if !NET_2_1 using System.IdentityModel.Policy; +#if !XAMMAC_4_5 using System.Web.Security; #endif +#endif using System.Text; using System.Threading; using System.ServiceModel; @@ -43,7 +45,7 @@ namespace System.ServiceModel.Dispatcher { public sealed class DispatchRuntime { -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 internal DispatchRuntime (EndpointDispatcher dispatcher, ClientRuntime callbackClientRuntime) { UnhandledDispatchOperation = new DispatchOperation ( diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding_4_5.cs b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding_4_5.cs index c671f1e797..ef9715fb4b 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding_4_5.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpBinding_4_5.cs @@ -50,7 +50,7 @@ namespace System.ServiceModel { } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 public BasicHttpBinding (string configurationName) : this () { @@ -110,7 +110,7 @@ namespace System.ServiceModel SecurityBindingElement element; switch (Security.Mode) { case BasicHttpSecurityMode.Message: -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 throw new NotImplementedException (); #else if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate) @@ -121,7 +121,7 @@ namespace System.ServiceModel #endif case BasicHttpSecurityMode.TransportWithMessageCredential: -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 throw new NotImplementedException (); #else if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate) @@ -135,7 +135,7 @@ namespace System.ServiceModel return null; } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 element.SetKeyDerivation (false); element.SecurityHeaderLayout = SecurityHeaderLayout.Lax; #endif @@ -150,7 +150,7 @@ namespace System.ServiceModel ReaderQuotas.CopyTo (tm.ReaderQuotas); return tm; } else { -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 throw new NotImplementedException (); #else return new MtomMessageEncodingBindingElement ( diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs index 1c65906f6b..e6a96dac52 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/BasicHttpsBinding.cs @@ -50,7 +50,7 @@ namespace System.ServiceModel { } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 public BasicHttpsBinding (string configurationName) : this () { @@ -101,7 +101,8 @@ namespace System.ServiceModel SecurityBindingElement element; switch (Security.Mode) { case BasicHttpsSecurityMode.TransportWithMessageCredential: -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 + throw new NotImplementedException (); #else if (Security.Message.ClientCredentialType != BasicHttpMessageCredentialType.Certificate) @@ -115,7 +116,7 @@ namespace System.ServiceModel return null; } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 element.SetKeyDerivation (false); element.SecurityHeaderLayout = SecurityHeaderLayout.Lax; #endif @@ -130,7 +131,7 @@ namespace System.ServiceModel ReaderQuotas.CopyTo (tm.ReaderQuotas); return tm; } else { -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 throw new NotImplementedException (); #else return new MtomMessageEncodingBindingElement ( diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs index 6835651516..e5ef83357f 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs @@ -90,7 +90,7 @@ namespace System.ServiceModel if (endpointConfig == null) return; -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 try { // It should automatically use XmlXapResolver var cfg = new SilverlightClientConfigLoader ().Load (XmlReader.Create ("ServiceReferences.ClientConfig")); @@ -160,7 +160,7 @@ namespace System.ServiceModel #endif } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 private void ApplyBehavior (string behaviorConfig) { BehaviorsSection behaviorsSection = ConfigUtil.BehaviorsSection; diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/OperationContext.cs b/mcs/class/System.ServiceModel/System.ServiceModel/OperationContext.cs index 0d37c4cf22..097e8cbfa4 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/OperationContext.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/OperationContext.cs @@ -45,7 +45,7 @@ namespace System.ServiceModel } Message incoming_message; -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 EndpointDispatcher dispatcher; #endif IContextChannel channel; @@ -83,7 +83,7 @@ namespace System.ServiceModel } -#if !NET_2_1 +#if !NET_2_1 && !XAMMAC_4_5 public EndpointDispatcher EndpointDispatcher { get { return dispatcher; } set { dispatcher = value; } diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/SilverlightClientConfigLoader.cs b/mcs/class/System.ServiceModel/System.ServiceModel/SilverlightClientConfigLoader.cs index 16f0325837..75d412d50c 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel/SilverlightClientConfigLoader.cs +++ b/mcs/class/System.ServiceModel/System.ServiceModel/SilverlightClientConfigLoader.cs @@ -25,7 +25,8 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if NET_2_1 +#if NET_2_1 || XAMMAC_4_5 + using System; using System.Collections.Generic; using System.ServiceModel.Channels; diff --git a/mcs/class/System.ServiceModel/xammac_net_4_5_System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/xammac_net_4_5_System.ServiceModel.dll.sources new file mode 100644 index 0000000000..1e3d293835 --- /dev/null +++ b/mcs/class/System.ServiceModel/xammac_net_4_5_System.ServiceModel.dll.sources @@ -0,0 +1,64 @@ +#include mobile_System.ServiceModel.dll.sources +System.ServiceModel.Channels/IChannelListener.cs +System.ServiceModel.Channels/IReplyChannel.cs +System.ServiceModel.Channels/IReplySessionChannel.cs +System.ServiceModel.Configuration/CertificateElement.cs +System.ServiceModel.Configuration/CertificateReferenceElement.cs +System.ServiceModel.Configuration/ConfigUtil.cs +System.ServiceModel.Configuration/DnsElement.cs +System.ServiceModel.Configuration/IdentityElement.cs +System.ServiceModel.Configuration/RsaElement.cs +System.ServiceModel.Configuration/ServicePrincipalNameElement.cs +System.ServiceModel.Configuration/UserPrincipalNameElement.cs +System.ServiceModel.Configuration/X509ClientCertificateCredentialsElement.cs +System.ServiceModel.Configuration/X509DefaultServiceCertificateElement.cs +System.ServiceModel.Configuration/X509ScopedServiceCertificateElement.cs +System.ServiceModel.Description/MetadataLocation.cs +System.ServiceModel.Description/MetadataReference.cs +System.ServiceModel.Description/MetadataSection.cs +System.ServiceModel.Description/MetadataSectionSerializerBase.cs +System.ServiceModel.Description/MetadataSet.cs +System.ServiceModel.Dispatcher/ActionMessageFilter.cs +System.ServiceModel.Dispatcher/ActionMessageFilterTable.cs +System.ServiceModel.Dispatcher/ICallContextInitializer.cs +System.ServiceModel.Dispatcher/IMessageFilterTable.cs +System.ServiceModel.Dispatcher/IOperationInvoker.cs +System.ServiceModel.Dispatcher/MatchAllMessageFilter.cs +System.ServiceModel.Dispatcher/MatchNoneMessageFilter.cs +System.ServiceModel.Dispatcher/MessageFilter.cs +System.ServiceModel.Dispatcher/MessageFilterTable.cs +System.ServiceModel.Dispatcher/MultipleMessageFilterMatchesException.cs +System.ServiceModel.Dispatcher/SeekableXPathNavigator.cs +System.ServiceModel.Dispatcher/XPathMessageFilter.cs +System.ServiceModel.Security.Tokens/SecurityContextSecurityToken.cs +System.ServiceModel.Security.Tokens/SslnegoCookieResolver.cs +System.ServiceModel.Security/ChannelProtectionRequirements.cs +System.ServiceModel.Security/IdentityVerifier.cs +System.ServiceModel.Security/IssuedTokenClientCredential.cs +System.ServiceModel.Security/KeyEntropyMode.cs +System.ServiceModel.Security/MessagePartSpecification.cs +System.ServiceModel.Security/PeerCredential.cs +System.ServiceModel.Security/ScopedMessagePartSpecification.cs +System.ServiceModel.Security/SecurityAlgorithmSuite.cs +System.ServiceModel.Security/SecurityContextKeyIdentifierClause.cs +System.ServiceModel.Security/SecurityMessageProperty.cs +System.ServiceModel.Security/SecurityStateEncoder.cs +System.ServiceModel.Security/SecurityTokenAttachmentMode.cs +System.ServiceModel.Security/SecurityTokenSpecification.cs +System.ServiceModel.Security/SupportingTokenSpecification.cs +System.ServiceModel.Security/X509CertificateInitiatorClientCredential.cs +System.ServiceModel.Security/X509CertificateRecipientClientCredential.cs +System.ServiceModel.Security/X509PeerCertificateAuthentication.cs +System.ServiceModel.Security/X509ServiceCertificateAuthentication.cs +System.ServiceModel/DnsEndpointIdentity.cs +System.ServiceModel/EndpointAddressAugust2004.cs +System.ServiceModel/EndpointIdentity.cs +System.ServiceModel/IDuplexClientChannel.cs +System.ServiceModel/OperationBehaviorAttribute.cs +System.ServiceModel/RsaEndpointIdentity.cs +System.ServiceModel/ServiceSecurityContext.cs +System.ServiceModel/SpnEndpointIdentity.cs +System.ServiceModel/UpnEndpointIdentity.cs +System.ServiceModel/X509CertificateEndpointIdentity.cs +System.ServiceModel.Dispatcher/IErrorHandler.cs +Dummy_XM_4_5.cs diff --git a/mcs/class/System.Web.Services/Makefile b/mcs/class/System.Web.Services/Makefile index 2d02f95861..0c38150d80 100644 --- a/mcs/class/System.Web.Services/Makefile +++ b/mcs/class/System.Web.Services/Makefile @@ -20,13 +20,16 @@ LIB_MCS_FLAGS = \ -r:System.dll \ -r:System.EnterpriseServices.dll \ -r:System.Xml.dll \ - -r:System.Web.dll +ifndef NO_SYSTEM_WEB_DEPENDENCY +LIB_MCS_FLAGS += -r:System.Web.dll plainweb_dir = $(the_libdir_base)plainweb LOCAL_MCS_FLAGS = -lib:$(plainweb_dir) plainweb = $(plainweb_dir)/System.Web.dll system_web_services_deps = $(plainweb) +LOCAL_MCS_FLAGS += -lib:$(plainweb_dir) +endif ifneq (1, $(FRAMEWORK_VERSION_MAJOR)) LIB_MCS_FLAGS += \ @@ -53,4 +56,4 @@ $(the_libdir_base)$(LIBRARY): $(system_web_services_deps) $(plainweb): (cd ../System.Web; $(MAKE) $@) -.NOTPARALLEL: $(plainweb) \ No newline at end of file +.NOTPARALLEL: $(plainweb) diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs index bcc9fbee75..4bfcff325b 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ExtensionManager.cs @@ -71,7 +71,7 @@ namespace System.Web.Services.Description RegisterExtensionType (typeof (Soap12HeaderBinding)); RegisterExtensionType (typeof (Soap12OperationBinding)); -#if !MOBILE +#if !MOBILE && !XAMMAC_4_5 /* * Currently, the mobile profile has not support for * System.Configuration, so there are no external modules @@ -164,7 +164,7 @@ namespace System.Web.Services.Description /* * The mobile profile lacks support for configuration */ -#if MOBILE +#if MOBILE || XAMMAC_4_5 public static ArrayList BuildExtensionImporters () { return new ArrayList (0); diff --git a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs index be3201d18c..dd29adbeb1 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Description/ServiceDescriptionImporter.cs @@ -142,7 +142,7 @@ namespace System.Web.Services.Description { schemas.Add (serviceDescription.Types.Schemas); } -#if !MOBILE +#if !MOBILE && !XAMMAC_4_5 public ServiceDescriptionImportWarnings Import (CodeNamespace codeNamespace, CodeCompileUnit codeCompileUnit) { foreach (ProtocolImporter importer in GetSupportedImporters ()) { @@ -163,9 +163,6 @@ namespace System.Web.Services.Description { list.Add (new HttpPostProtocolImporter ()); return list; } -#endif - -#if !MOBILE [MonoTODO] // where to use Verbose and Extensions in options? public static StringCollection GenerateWebReferences ( diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs index 1774d436ed..2585d05360 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs @@ -487,7 +487,7 @@ namespace System.Web.Services.Protocols { xmlImporter.IncludeTypes (Type); soapImporter.IncludeTypes (Type); -#if MOBILE +#if MOBILE || XAMMAC_4_5 SoapExtensions = new SoapExtensionRuntimeConfig [2][]; #else SoapExtensions = SoapExtension.GetTypeExtensions (Type); diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerType.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerType.cs index 61ce80625f..57852949ef 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerType.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerType.cs @@ -207,7 +207,7 @@ namespace System.Web.Services.Protocols soap12Protocol.Initialize (); } return soap12Protocol; -#if !MOBILE +#if !MOBILE && !XAMMAC_4_5 case "HttpGet": if (httpGetProtocol == null){ httpGetProtocol = new HttpGetTypeStubInfo (this); diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtension.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtension.cs index 2846572ec6..ae1bd44980 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtension.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapExtension.cs @@ -100,7 +100,7 @@ namespace System.Web.Services.Protocols { return pos; } -#if !MOBILE +#if !MOBILE && !XAMMAC_4_5 static void InitializeGlobalExtensions () { globalExtensions = new ArrayList[2]; diff --git a/mcs/class/System.Web.Services/xammac_net_4_5_System.Web.Services.dll.sources b/mcs/class/System.Web.Services/xammac_net_4_5_System.Web.Services.dll.sources new file mode 100644 index 0000000000..2e521cf877 --- /dev/null +++ b/mcs/class/System.Web.Services/xammac_net_4_5_System.Web.Services.dll.sources @@ -0,0 +1,3 @@ +#include mobile_System.Web.Services.dll.sources +System.Web.Services.Description/ServiceDescription.cs +System.Web.Services.Description/ServiceDescriptionImportWarnings.cs diff --git a/mcs/class/System.Web/System.Web.Util/HttpEncoder.cs b/mcs/class/System.Web/System.Web.Util/HttpEncoder.cs index 2a2800483a..2629156713 100644 --- a/mcs/class/System.Web/System.Web.Util/HttpEncoder.cs +++ b/mcs/class/System.Web/System.Web.Util/HttpEncoder.cs @@ -35,7 +35,7 @@ using System.Collections.Generic; using System.Configuration; using System.IO; using System.Text; -#if NET_4_0 && !MOBILE +#if !NO_SYSTEM_WEB_DEPENDENCY && NET_4_0 && !MOBILE using System.Web.Configuration; #endif @@ -163,7 +163,7 @@ namespace System.Web.Util static HttpEncoder GetCustomEncoderFromConfig () { -#if MOBILE +#if MOBILE || NO_SYSTEM_WEB_DEPENDENCY return defaultEncoder.Value; #else var cfg = HttpRuntime.Section; diff --git a/mcs/class/System.Web/System.Web/HttpUtility.cs b/mcs/class/System.Web/System.Web/HttpUtility.cs index 786956ee9d..83fe4eb3b7 100644 --- a/mcs/class/System.Web/System.Web/HttpUtility.cs +++ b/mcs/class/System.Web/System.Web/HttpUtility.cs @@ -511,7 +511,7 @@ namespace System.Web { if (value == null) return null; -#if !MOBILE +#if !(MOBILE || NO_SYSTEM_WEB_DEPENDENCY) IHtmlString htmlString = value as IHtmlString; if (htmlString != null) return htmlString.ToHtmlString (); diff --git a/mcs/class/System/System.Diagnostics/Process.cs b/mcs/class/System/System.Diagnostics/Process.cs index a394dc4fa7..7cda5c60e1 100644 --- a/mcs/class/System/System.Diagnostics/Process.cs +++ b/mcs/class/System/System.Diagnostics/Process.cs @@ -595,7 +595,8 @@ namespace System.Diagnostics { } private StreamReader error_stream=null; - + bool error_stream_exposed; + [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] [MonitoringDescription ("The standard error stream of this process.")] public StreamReader StandardError { @@ -608,11 +609,13 @@ namespace System.Diagnostics { async_mode |= AsyncModes.SyncError; + error_stream_exposed = true; return(error_stream); } } private StreamWriter input_stream=null; + bool input_stream_exposed; [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] [MonitoringDescription ("The standard input stream of this process.")] @@ -621,11 +624,13 @@ namespace System.Diagnostics { if (input_stream == null) throw new InvalidOperationException("Standard input has not been redirected"); + input_stream_exposed = true; return(input_stream); } } private StreamReader output_stream=null; + bool output_stream_exposed; [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden), Browsable (false)] [MonitoringDescription ("The standard output stream of this process.")] @@ -639,6 +644,7 @@ namespace System.Diagnostics { async_mode |= AsyncModes.SyncOutput; + output_stream_exposed = true; return(output_stream); } } @@ -1568,17 +1574,18 @@ namespace System.Diagnostics { async_error.Close (); if (input_stream != null) { - input_stream.Close(); + if (!input_stream_exposed) + input_stream.Close (); input_stream = null; } - if (output_stream != null) { - output_stream.Close(); + if (!output_stream_exposed) + output_stream.Close (); output_stream = null; } - if (error_stream != null) { - error_stream.Close(); + if (!error_stream_exposed) + error_stream.Close (); error_stream = null; } } diff --git a/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs b/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs index 436e0e1252..00fbcf73ba 100644 --- a/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs +++ b/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs @@ -840,5 +840,19 @@ namespace MonoTests.System.Diagnostics public void HasExitedCurrent () { Assert.IsFalse (Process.GetCurrentProcess ().HasExited); } + + [Test] + public void DisposeWithDisposedStreams () + { + var psi = GetCrossPlatformStartInfo (); + psi.RedirectStandardInput = true; + psi.RedirectStandardOutput = true; + psi.UseShellExecute = false; + + var p = Process.Start (psi); + p.StandardInput.BaseStream.Dispose (); + p.StandardOutput.BaseStream.Dispose (); + p.Dispose (); + } } } diff --git a/mcs/class/WindowsBase/ZipSharp/NativeUnzip.cs b/mcs/class/WindowsBase/ZipSharp/NativeUnzip.cs index 47e277bdbf..3b3c3dc5d8 100644 --- a/mcs/class/WindowsBase/ZipSharp/NativeUnzip.cs +++ b/mcs/class/WindowsBase/ZipSharp/NativeUnzip.cs @@ -68,8 +68,7 @@ namespace zipsharp public static long CurrentFileLength (UnzipHandle handle) { UnzipFileInfo info; - StringBuilder sbName = new StringBuilder (128); - int result = unzGetCurrentFileInfo (handle, out info, sbName, new IntPtr (sbName.Capacity), IntPtr.Zero, IntPtr.Zero, null, IntPtr.Zero); + int result = unzGetCurrentFileInfo (handle, out info, null, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, null, IntPtr.Zero); if (result != 0) return -1; @@ -80,8 +79,13 @@ namespace zipsharp static string GetCurrentFileName (UnzipHandle handle) { UnzipFileInfo info; - StringBuilder sbName = new StringBuilder (128); - int result = unzGetCurrentFileInfo (handle, out info, sbName, new IntPtr (sbName.Capacity), IntPtr.Zero, new IntPtr (0), null, IntPtr.Zero); + int result = unzGetCurrentFileInfo (handle, out info, null, IntPtr.Zero, IntPtr.Zero, new IntPtr (0), null, IntPtr.Zero); + + if (result != 0) + return null; + + StringBuilder sbName = new StringBuilder ((int)info.SizeFilename+1); // +1 to account for extra \0 at the end + result = unzGetCurrentFileInfo (handle, out info, sbName, new IntPtr (sbName.Capacity), IntPtr.Zero, new IntPtr (0), null, IntPtr.Zero); if (result != 0) return null; diff --git a/mcs/class/lib/monolite/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite/Mono.Security.dll.REMOVED.git-id index 34518b2078..8a2a6698b3 100644 --- a/mcs/class/lib/monolite/Mono.Security.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/Mono.Security.dll.REMOVED.git-id @@ -1 +1 @@ -c908dadf9032fd884e4eb15b4e451b9a1456f1aa \ No newline at end of file +b4bd1fc94e2f39c65a9cc3f1224e45a1e8fb3e37 \ No newline at end of file diff --git a/mcs/class/lib/monolite/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite/System.Configuration.dll.REMOVED.git-id index 18492af8d3..9e450f2a9e 100644 --- a/mcs/class/lib/monolite/System.Configuration.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/System.Configuration.dll.REMOVED.git-id @@ -1 +1 @@ -bc2a11adca47ad33d784d35d25efddb11b6d375e \ No newline at end of file +2b5f667533551ac33fc9de43b43a62b448b55a90 \ No newline at end of file diff --git a/mcs/class/lib/monolite/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite/System.Core.dll.REMOVED.git-id index 37d7718c34..e76c30e3b8 100644 --- a/mcs/class/lib/monolite/System.Core.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/System.Core.dll.REMOVED.git-id @@ -1 +1 @@ -ca052b55848fabd417bf3831574d8cf686d794e6 \ No newline at end of file +5e889cf1e66abc75e57bafd92c7139ab2c808069 \ No newline at end of file diff --git a/mcs/class/lib/monolite/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite/System.Security.dll.REMOVED.git-id index bb38d24306..5b64d70aa7 100644 --- a/mcs/class/lib/monolite/System.Security.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/System.Security.dll.REMOVED.git-id @@ -1 +1 @@ -8fa97ae80be483b7c5d6c93ca8d7eda2446b0a50 \ No newline at end of file +4218f3c3bb5d10cef11ff7c790e5ade5d1b86898 \ No newline at end of file diff --git a/mcs/class/lib/monolite/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite/System.Xml.dll.REMOVED.git-id index c2d7be6408..ad508ec283 100644 --- a/mcs/class/lib/monolite/System.Xml.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/System.Xml.dll.REMOVED.git-id @@ -1 +1 @@ -5e1eefc23b8bc74491a1013153f0c68f114a8f88 \ No newline at end of file +7bfd852fe1e8dfccebc97bc42d66f587b73fc941 \ No newline at end of file diff --git a/mcs/class/lib/monolite/System.dll.REMOVED.git-id b/mcs/class/lib/monolite/System.dll.REMOVED.git-id index bb9fb4f369..a3b1d285df 100644 --- a/mcs/class/lib/monolite/System.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/System.dll.REMOVED.git-id @@ -1 +1 @@ -d2e2263060787a5e37b9477fe11c5343f0115f05 \ No newline at end of file +e1a7446b92066e58218a67fdb7c41ceeaac06ba1 \ No newline at end of file diff --git a/mcs/class/lib/monolite/basic.exe.REMOVED.git-id b/mcs/class/lib/monolite/basic.exe.REMOVED.git-id index e655e735ee..036f052e71 100644 --- a/mcs/class/lib/monolite/basic.exe.REMOVED.git-id +++ b/mcs/class/lib/monolite/basic.exe.REMOVED.git-id @@ -1 +1 @@ -2466018829715ab5ac300ffca8d1bb7ec855865b \ No newline at end of file +d1e78ca363e0bc43ca096886c4e79ff83563cc31 \ No newline at end of file diff --git a/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id index 8f96686c70..28a285b245 100644 --- a/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id @@ -1 +1 @@ -481c08d3c457bfa5fb2f1337f7c7c58cfcd12690 \ No newline at end of file +af5a7726c9961fd49e771b276c914cee6dd7ca85 \ No newline at end of file diff --git a/mono-core.spec b/mono-core.spec index 19579bb652..a892e8973b 100644 --- a/mono-core.spec +++ b/mono-core.spec @@ -15,7 +15,7 @@ License: LGPL v2.1 only Group: Development/Languages/Mono Summary: A .NET Runtime Environment Url: http://www.mono-project.com -Version: 4.0.2 +Version: 4.0.3 Release: 0 Source0: mono-%{version}.tar.bz2 BuildRequires: bison diff --git a/mono/metadata/debug-helpers.c b/mono/metadata/debug-helpers.c index aa62ad230e..d8a20e06a6 100644 --- a/mono/metadata/debug-helpers.c +++ b/mono/metadata/debug-helpers.c @@ -82,9 +82,11 @@ append_class_name (GString *res, MonoClass *class, gboolean include_namespace) append_class_name (res, class->nested_in, include_namespace); g_string_append_c (res, '/'); } - if (include_namespace && *(class->name_space)) - g_string_append_printf (res, "%s.", class->name_space); - g_string_append_printf (res, "%s", class->name); + if (include_namespace && *(class->name_space)) { + g_string_append (res, class->name_space); + g_string_append_c (res, '.'); + } + g_string_append (res, class->name); } static MonoClass* diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c index 233efef8aa..33cd384f43 100644 --- a/mono/metadata/loader.c +++ b/mono/metadata/loader.c @@ -1491,7 +1491,7 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char /* * Try loading the module using a variety of names */ - for (i = 0; i < 4; ++i) { + for (i = 0; i < 5; ++i) { char *base_name = NULL, *dir_name = NULL; gboolean is_absolute = is_absolute_path (new_scope); @@ -1525,6 +1525,14 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char break; } continue; + case 3: + if (!is_absolute && mono_dl_get_system_dir ()) { + dir_name = mono_dl_get_system_dir (); + file_name = g_path_get_basename (new_scope); + base_name = NULL; + } else + continue; + break; default: #ifndef TARGET_WIN32 if (!g_ascii_strcasecmp ("user32.dll", new_scope) || diff --git a/mono/mini/Makefile.am b/mono/mini/Makefile.am index d44b3bbbec..3325cbc70f 100644 --- a/mono/mini/Makefile.am +++ b/mono/mini/Makefile.am @@ -758,7 +758,7 @@ EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \ Makefile.am.in version.h: Makefile - echo "#define FULL_VERSION \"Stable 4.0.2.5/c99aa0c\"" > version.h + echo "#define FULL_VERSION \"Stable 4.0.3.13/429313d\"" > version.h # Utility target for patching libtool to speed up linking patch-libtool: diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index d44b3bbbec..3325cbc70f 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -758,7 +758,7 @@ EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \ Makefile.am.in version.h: Makefile - echo "#define FULL_VERSION \"Stable 4.0.2.5/c99aa0c\"" > version.h + echo "#define FULL_VERSION \"Stable 4.0.3.13/429313d\"" > version.h # Utility target for patching libtool to speed up linking patch-libtool: diff --git a/mono/mini/Makefile.in.REMOVED.git-id b/mono/mini/Makefile.in.REMOVED.git-id index bb9f35a55c..295296a21b 100644 --- a/mono/mini/Makefile.in.REMOVED.git-id +++ b/mono/mini/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -07a0c8c1ddf80aee829b97c5ba84b3a569a43636 \ No newline at end of file +69eae9968f7637f83f0e9f91850e8f2a9d4c4ad8 \ No newline at end of file diff --git a/mono/mini/aot-compiler.c.REMOVED.git-id b/mono/mini/aot-compiler.c.REMOVED.git-id index 9945e630f7..1b0e58e105 100644 --- a/mono/mini/aot-compiler.c.REMOVED.git-id +++ b/mono/mini/aot-compiler.c.REMOVED.git-id @@ -1 +1 @@ -3a7fd76d7bfbda58972705ab20fe87bd61bfe4b8 \ No newline at end of file +88c8d341bb0f54aa9ec1b76bdbe96882b35da8fc \ No newline at end of file diff --git a/mono/mini/aot-runtime.c.REMOVED.git-id b/mono/mini/aot-runtime.c.REMOVED.git-id index 5fb4e18de3..9d631d8da6 100644 --- a/mono/mini/aot-runtime.c.REMOVED.git-id +++ b/mono/mini/aot-runtime.c.REMOVED.git-id @@ -1 +1 @@ -4f6e190e7870c918795d049c7ac2c574b773529c \ No newline at end of file +f60b2e44986c523649dca9a101b12b8f2bfe5f11 \ No newline at end of file diff --git a/mono/mini/basic-float.cs b/mono/mini/basic-float.cs index a5ccf787e7..0eb1e240bc 100644 --- a/mono/mini/basic-float.cs +++ b/mono/mini/basic-float.cs @@ -812,5 +812,13 @@ class Tests short b = (short)a; return b == 127 ? 0 : 1; } + + public static int test_10_rconv_to_u8 () { + ulong l = 10; + float f = (float)l; + l = (ulong)f; + return (int)l; + } + } diff --git a/mono/mini/jit-icalls.c b/mono/mini/jit-icalls.c index 318bd067a4..2da429f810 100644 --- a/mono/mini/jit-icalls.c +++ b/mono/mini/jit-icalls.c @@ -844,6 +844,12 @@ mono_fconv_u8 (double v) return (guint64)v; } +guint64 +mono_rconv_u8 (float v) +{ + return (guint64)v; +} + #ifdef MONO_ARCH_EMULATE_FCONV_TO_I8 gint64 mono_fconv_i8 (double v) diff --git a/mono/mini/jit-icalls.h b/mono/mini/jit-icalls.h index 5991716bdc..6c0835f9d4 100644 --- a/mono/mini/jit-icalls.h +++ b/mono/mini/jit-icalls.h @@ -67,6 +67,8 @@ gpointer mono_ldtoken_wrapper_generic_shared (MonoImage *image, int token, MonoM guint64 mono_fconv_u8 (double v) MONO_INTERNAL; +guint64 mono_rconv_u8 (float v) MONO_INTERNAL; + gint64 mono_fconv_i8 (double v) MONO_INTERNAL; guint32 mono_fconv_u4 (double v) MONO_INTERNAL; diff --git a/mono/mini/mini.c.REMOVED.git-id b/mono/mini/mini.c.REMOVED.git-id index f68da0ff9d..cfd85ae79c 100644 --- a/mono/mini/mini.c.REMOVED.git-id +++ b/mono/mini/mini.c.REMOVED.git-id @@ -1 +1 @@ -2db8d861eff4843bacec8f1b86cc931e68850d75 \ No newline at end of file +0521f4e014d9432948a7095ecc78a1d548a6213d \ No newline at end of file diff --git a/mono/mini/version.h b/mono/mini/version.h index 3b353c9b78..a3186f3869 100644 --- a/mono/mini/version.h +++ b/mono/mini/version.h @@ -1 +1 @@ -#define FULL_VERSION "Stable 4.0.2.5/c99aa0c" +#define FULL_VERSION "Stable 4.0.3.13/429313d" diff --git a/mono/utils/mono-dl-darwin.c b/mono/utils/mono-dl-darwin.c index b1cd30f904..ff7028555c 100644 --- a/mono/utils/mono-dl-darwin.c +++ b/mono/utils/mono-dl-darwin.c @@ -50,4 +50,15 @@ mono_dl_get_executable_path (char *buf, int buflen) return -1; } +const char* +mono_dl_get_system_dir (void) +{ +#ifdef TARGET_IOS + /* IOS9 can't load system libraries using relative paths, i.e. 'libc' doesn't work, but '/usr/lib/libc' does. */ + return "/usr/lib"; +#else + return NULL; +#endif +} + #endif diff --git a/mono/utils/mono-dl-posix.c b/mono/utils/mono-dl-posix.c index be52a3e6e4..09eed6222e 100644 --- a/mono/utils/mono-dl-posix.c +++ b/mono/utils/mono-dl-posix.c @@ -47,6 +47,13 @@ mono_dl_get_executable_path (char *buf, int buflen) { return readlink ("/proc/self/exe", buf, buflen - 1); } + +const char* +mono_dl_get_system_dir (void) +{ + return NULL; +} + #endif void * diff --git a/mono/utils/mono-dl-windows.c b/mono/utils/mono-dl-windows.c index 5dabce4483..19ff818f73 100644 --- a/mono/utils/mono-dl-windows.c +++ b/mono/utils/mono-dl-windows.c @@ -159,4 +159,10 @@ mono_dl_get_executable_path (char *buf, int buflen) return -1; //TODO } +const char* +mono_dl_get_system_dir (void) +{ + return NULL; +} + #endif diff --git a/mono/utils/mono-dl.h b/mono/utils/mono-dl.h index 4b972ef62f..c87823208a 100644 --- a/mono/utils/mono-dl.h +++ b/mono/utils/mono-dl.h @@ -34,7 +34,6 @@ char* mono_dl_build_path (const char *directory, const char *name, void ** MonoDl* mono_dl_open_runtime_lib (const char *lib_name, int flags, char **error_msg) MONO_INTERNAL; -//Platform API for mono_dl const char* mono_dl_get_so_prefix (void) MONO_INTERNAL; const char** mono_dl_get_so_suffixes (void) MONO_INTERNAL; void* mono_dl_open_file (const char *file, int flags) MONO_INTERNAL; @@ -43,6 +42,7 @@ void* mono_dl_lookup_symbol (MonoDl *module, const char *name) MONO_INTERNAL; int mono_dl_convert_flags (int flags) MONO_INTERNAL; char* mono_dl_current_error_string (void) MONO_INTERNAL; int mono_dl_get_executable_path (char *buf, int buflen) MONO_INTERNAL; +const char* mono_dl_get_system_dir (void); #endif /* __MONO_UTILS_DL_H__ */ diff --git a/po/mcs/de.gmo b/po/mcs/de.gmo index 710755c5e2..9231bf8066 100644 Binary files a/po/mcs/de.gmo and b/po/mcs/de.gmo differ diff --git a/po/mcs/de.po.REMOVED.git-id b/po/mcs/de.po.REMOVED.git-id index 8ed565ecb6..63eb26b2ea 100644 --- a/po/mcs/de.po.REMOVED.git-id +++ b/po/mcs/de.po.REMOVED.git-id @@ -1 +1 @@ -9b24976a70d1b8540bb066de6de7687a00ec33ea \ No newline at end of file +4d58095efc006b4475f0937656021d3e741a9afb \ No newline at end of file diff --git a/po/mcs/es.gmo b/po/mcs/es.gmo index 3b1fcc5e84..046e494178 100644 Binary files a/po/mcs/es.gmo and b/po/mcs/es.gmo differ diff --git a/po/mcs/es.po.REMOVED.git-id b/po/mcs/es.po.REMOVED.git-id index 423e30c330..648fc550fd 100644 --- a/po/mcs/es.po.REMOVED.git-id +++ b/po/mcs/es.po.REMOVED.git-id @@ -1 +1 @@ -6b68074399dbf6856f14738016f0ca01bfeeba4b \ No newline at end of file +5a230520eaa0256c490e4344ed75646ed7f5b40e \ No newline at end of file diff --git a/po/mcs/ja.gmo b/po/mcs/ja.gmo index 922ef71491..8132c95967 100644 Binary files a/po/mcs/ja.gmo and b/po/mcs/ja.gmo differ diff --git a/po/mcs/ja.po.REMOVED.git-id b/po/mcs/ja.po.REMOVED.git-id index aea64c9cc1..2c94f50fd0 100644 --- a/po/mcs/ja.po.REMOVED.git-id +++ b/po/mcs/ja.po.REMOVED.git-id @@ -1 +1 @@ -04db4cc48179d7ff1d7e2c5af612edbf42a6c49b \ No newline at end of file +bd76d39f7b22ce7c74a5d0d77fea4d17a72d4829 \ No newline at end of file diff --git a/po/mcs/mcs.pot b/po/mcs/mcs.pot index af102b8ed8..f7e10b4526 100644 --- a/po/mcs/mcs.pot +++ b/po/mcs/mcs.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: mono 4.0.2\n" +"Project-Id-Version: mono 4.0.3\n" "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n" -"POT-Creation-Date: 2015-06-24 04:42-0400\n" +"POT-Creation-Date: 2015-07-20 03:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/po/mcs/pt_BR.gmo b/po/mcs/pt_BR.gmo index 40e04cb3b9..f0860fde84 100644 Binary files a/po/mcs/pt_BR.gmo and b/po/mcs/pt_BR.gmo differ diff --git a/po/mcs/pt_BR.po.REMOVED.git-id b/po/mcs/pt_BR.po.REMOVED.git-id index ccae03b30b..07bcd220e8 100644 --- a/po/mcs/pt_BR.po.REMOVED.git-id +++ b/po/mcs/pt_BR.po.REMOVED.git-id @@ -1 +1 @@ -08ab739a93d37dc29faf6cfc05b286b231a3cf25 \ No newline at end of file +ad63cc2659816a6cd943ec3d41eeaa9d2e987c8d \ No newline at end of file diff --git a/runtime/Makefile.am b/runtime/Makefile.am index 3f6fe489fa..fd26eea24b 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -47,7 +47,7 @@ build_profiles += monotouch monotouch_runtime endif if INSTALL_XAMMAC -build_profiles += xammac +build_profiles += xammac xammac_net_4_5 endif test_profiles = $(build_profiles) diff --git a/runtime/Makefile.in b/runtime/Makefile.in index f9706f4901..46aa8277f8 100644 --- a/runtime/Makefile.in +++ b/runtime/Makefile.in @@ -83,7 +83,7 @@ target_triplet = @target@ @INSTALL_4_5_TRUE@@ONLY_MONOTOUCH_FALSE@@ONLY_XAMMAC_FALSE@am__append_2 = binary_reference_assemblies net_4_5 xbuild_12 xbuild_14 @INSTALL_MONODROID_TRUE@@ONLY_MONOTOUCH_FALSE@@ONLY_XAMMAC_FALSE@am__append_3 = monodroid @INSTALL_MONOTOUCH_TRUE@@ONLY_MONOTOUCH_FALSE@@ONLY_XAMMAC_FALSE@am__append_4 = monotouch monotouch_runtime -@INSTALL_XAMMAC_TRUE@@ONLY_MONOTOUCH_FALSE@@ONLY_XAMMAC_FALSE@am__append_5 = xammac +@INSTALL_XAMMAC_TRUE@@ONLY_MONOTOUCH_FALSE@@ONLY_XAMMAC_FALSE@am__append_5 = xammac xammac_net_4_5 subdir = runtime DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(srcdir)/mono-wrapper.in \ diff --git a/winconfig.h b/winconfig.h index 206aa9e6ee..840060e59f 100644 --- a/winconfig.h +++ b/winconfig.h @@ -642,5 +642,5 @@ /* #undef USE_MONO_MUTEX */ /* Version number of package */ -#define VERSION "4.0.0" +#define VERSION "4.0.3" #endif