dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System/ComponentModel LicFileLicenseP


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System/ComponentModel LicFileLicenseProvider.cs, NONE, 1.1 License.cs, NONE, 1.1 LicenseException.cs, NONE, 1.1 LicenseManager.cs, NONE, 1.1 LicenseProvider.cs, NONE, 1.1 LicenseProviderAttribute.cs, NONE, 1.1 PropertyTabAttribute.cs, NONE, 1.1 ProvidePropertyAttribute.cs, NONE, 1.1 TypeConverter.cs, 1.7, 1.8 Win32Exception.cs, 1.8, 1.9
Date: Fri, 12 Sep 2003 02:09:01 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/System/ComponentModel
In directory subversions:/tmp/cvs-serv8758/System/ComponentModel

Modified Files:
        TypeConverter.cs Win32Exception.cs 
Added Files:
        LicFileLicenseProvider.cs License.cs LicenseException.cs 
        LicenseManager.cs LicenseProvider.cs 
        LicenseProviderAttribute.cs PropertyTabAttribute.cs 
        ProvidePropertyAttribute.cs 
Log Message:


Missing classes in "System.ComponentModel".


--- NEW FILE ---
/*
 * LicFileLicenseProvider.cs - Implementation of the
 *              "System.ComponentModel.ComponentModel.LicFileLicenseProvider" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.ComponentModel
{

#if CONFIG_COMPONENT_MODEL

using System;

public class LicFileLicenseProvider : LicenseProvider
{
        // Constructor.
        public LicFileLicenseProvider() {}

        // Get the license for a type.
        [TODO]
        public override License GetLicense
                                (LicenseContext context, Type type, object 
instance,
                                 bool allowExceptions)
                        {
                                // TODO
                                return null;
                        }

        // Get the key for a type.
        protected virtual string GetKey(Type type)
                        {
                                // Don't translate this - needed for 
compatibility.
                                return type.FullName + " is a licensed 
component.";
                        }

        // Determine if a key is valid for a particular type.
        protected virtual bool IsKeyValid(String key, Type type)
                        {
                                if(key != null)
                                {
                                        return key.StartsWith(GetKey(type));
                                }
                                else
                                {
                                        return false;
                                }
                        }

}; // class LicFileLicenseProvider

#endif // CONFIG_COMPONENT_MODEL

}; // namespace System.ComponentModel

--- NEW FILE ---
/*
 * License.cs - Implementation of the
 *              "System.ComponentModel.ComponentModel.License" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.ComponentModel
{

#if CONFIG_COMPONENT_MODEL

using System;

public abstract class License : IDisposable
{
        // Constructor.
        protected License() {}

        // Get the license key.
        public abstract String LicenseKey { get; }

        // Dispose of this license.
        public abstract void Dispose();

}; // class License

#endif // CONFIG_COMPONENT_MODEL

}; // namespace System.ComponentModel

--- NEW FILE ---
/*
 * LicenseException.cs - Implementation of the
 *              "System.ComponentModel.LicenseException" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.ComponentModel
{

#if !ECMA_COMPAT

using System;

public class LicenseException : SystemException
{
        // Internal state.
        private Type type;
        private Object instance;

        // Constructors.
        public LicenseException(Type type)
                        : base(S._("Exception_License"))
                        {
                                this.type = type;
                                HResult = unchecked((int)0x80131901);
                        }
        public LicenseException(Type type, Object instance)
                        : base(S._("Exception_License"))
                        {
                                this.type = type;
                                this.instance = instance;
                                HResult = unchecked((int)0x80131901);
                        }
        public LicenseException(Type type, Object instance, String message)
                        : base(message)
                        {
                                this.type = type;
                                this.instance = instance;
                                HResult = unchecked((int)0x80131901);
                        }
        public LicenseException(Type type, Object instance, String message,
                                                        Exception 
innerException)
                        : base(message, innerException)
                        {
                                this.type = type;
                                this.instance = instance;
                                HResult = unchecked((int)0x80131901);
                        }

        // Get the licensed type that caused the exception.
        public Type LicensedType
                        {
                                get
                                {
                                        return type;
                                }
                        }

}; // class LicenseException

#endif // !ECMA_COMPAT

}; // namespace System.ComponentModel

--- NEW FILE ---
/*
 * LicenseManager.cs - Implementation of the
 *              "System.ComponentModel.ComponentModel.LicenseManager" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.ComponentModel
{

#if CONFIG_COMPONENT_MODEL

using System;

public sealed class LicenseManager
{
        // Internal state.
        private static LicenseContext currentContext;

        // Cannot instantiate this class.
        private LicenseManager() {}

        // Get or set the current license context.
        public static LicenseContext CurrentContext
                        {
                                get
                                {
                                        lock(typeof(LicenseManager))
                                        {
                                                if(currentContext == null)
                                                {
                                                        currentContext = new 
LicenseContext();
                                                }
                                                return currentContext;
                                        }
                                }
                                set
                                {
                                        lock(typeof(LicenseManager))
                                        {
                                                if(currentContext != null)
                                                {
                                                        throw new 
InvalidOperationException
                                                                
(S._("Invalid_LicenseContextChange"));
                                                }
                                                currentContext = value;
                                        }
                                }
                        }

        // Get the usage mode for the current license context.
        public static LicenseUsageMode UsageMode
                        {
                                get
                                {
                                        return CurrentContext.UsageMode;
                                }
                        }

        // Create an instance of an object, within a particular license context.
        public static Object CreateWithContext
                                (Type type, LicenseContext creationContext)
                        {
                                return CreateWithContext(type, creationContext, 
new Object [0]);
                        }
        [TODO]
        public static Object CreateWithContext
                                (Type type, LicenseContext creationContext, 
Object[] args)
                        {
                                // TODO
                                return null;
                        }

        // Determine if a type has a valid license.
        [TODO]
        public static bool IsLicensed(Type type)
                        {
                                // TODO
                                return false;
                        }

        // Determine if a valid license can be granted for a type.
        [TODO]
        public static bool IsValid(Type type)
                        {
                                // TODO
                                return false;
                        }
        [TODO]
        public static bool IsValid(Type type, Object instance, out License 
license)
                        {
                                // TODO
                                return false;
                        }

        // Lock the license context associated with an object.
        [TODO]
        public static void LockContext(Object contextUser)
                        {
                                // TODO
                        }

        // Unlock the license context associated with an object.
        [TODO]
        public static void UnlockContext(Object contextUser)
                        {
                                // TODO
                        }

        // Validate a license for a type.
        public static void Validate(Type type)
                        {
                                if(!IsValid(type))
                                {
                                        throw new LicenseException(type);
                                }
                        }
        public static void Validate(Type type, Object instance)
                        {
                                License license;
                                if(!IsValid(type, instance, out license))
                                {
                                        throw new LicenseException(type, 
instance);
                                }
                        }

}; // class LicenseManager

#endif // CONFIG_COMPONENT_MODEL

}; // namespace System.ComponentModel

--- NEW FILE ---
/*
 * LicenseProvider.cs - Implementation of the
 *              "System.ComponentModel.ComponentModel.LicenseProvider" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.ComponentModel
{

#if CONFIG_COMPONENT_MODEL

using System;

public abstract class LicenseProvider
{
        // Constructor.
        protected LicenseProvider() {}

        // Get the license for a type.
        public abstract License GetLicense
                        (LicenseContext context, Type type, object instance,
                         bool allowExceptions);

}; // class LicenseProvider

#endif // CONFIG_COMPONENT_MODEL

}; // namespace System.ComponentModel

--- NEW FILE ---
/*
 * LicenseProviderAttribute.cs - Implementation of the
 *              "System.ComponentModel.ComponentModel.LicenseProviderAttribute" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.ComponentModel
{

#if CONFIG_COMPONENT_MODEL

using System;

[AttributeUsage(AttributeTargets.Class)]
public sealed class LicenseProviderAttribute : Attribute
{
        // Internal state.
        private Type type;

        // Constructors.
        public LicenseProviderAttribute() {}
        public LicenseProviderAttribute(String typeName)
                        {
                                this.type = Type.GetType(typeName);
                        }
        public LicenseProviderAttribute(Type type)
                        {
                                this.type = type;
                        }

        // Get this attribute's values.
        public Type LicenseProvider
                        {
                                get
                                {
                                        return type;
                                }
                        }
        public override Object TypeId
                        {
                                get
                                {
                                        if(type != null)
                                        {
                                                return GetType().FullName + 
type.FullName;
                                        }
                                        else
                                        {
                                                return GetType().FullName;
                                        }
                                }
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                LicenseProviderAttribute other =
                                        (obj as LicenseProviderAttribute);
                                if(other != null)
                                {
                                        return (other.type == type);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return base.GetHashCode();
                        }

}; // class LicenseProviderAttribute

#endif // CONFIG_COMPONENT_MODEL

}; // namespace System.ComponentModel

--- NEW FILE ---
/*
 * PropertyTabAttribute.cs - Implementation of the
 *              "System.ComponentModel.ComponentModel.PropertyTabAttribute" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.ComponentModel
{

#if CONFIG_COMPONENT_MODEL

using System;

[AttributeUsage(AttributeTargets.All)]
public class PropertyTabAttribute : Attribute
{
        // Internal state.
        private Type[] tabClasses;
        private String[] tabClassNames;
        private PropertyTabScope[] tabScopes;

        // Constructors.
        public PropertyTabAttribute()
                        {
                                tabClasses = new Type [0];
                                tabClassNames = new String [0];
                                tabScopes = new PropertyTabScope [0];
                        }
        public PropertyTabAttribute(String tabClassName)
                        {
                                InitializeArrays
                                        (new String[] {tabClassName},
                                         new PropertyTabScope[] 
{PropertyTabScope.Component});
                        }
        public PropertyTabAttribute(Type tabClass)
                        {
                                InitializeArrays
                                        (new Type[] {tabClass},
                                         new PropertyTabScope[] 
{PropertyTabScope.Component});
                        }
        public PropertyTabAttribute(String tabClassName,
                                                                
PropertyTabScope tabScope)
                        {
                                InitializeArrays
                                        (new String[] {tabClassName},
                                         new PropertyTabScope[] {tabScope});
                        }
        public PropertyTabAttribute(Type tabClass,
                                                                
PropertyTabScope tabScope)
                        {
                                InitializeArrays
                                        (new Type[] {tabClass},
                                         new PropertyTabScope[] {tabScope});
                        }

        // Get this attribute's values.
        public Type[] TabClasses
                        {
                                get
                                {
                                        return tabClasses;
                                }
                        }
        public PropertyTabScope[] TabScopes
                        {
                                get
                                {
                                        return tabScopes;
                                }
                        }
        protected String[] TabClassNames
                        {
                                get
                                {
                                        return tabClassNames;
                                }
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                PropertyTabAttribute other =
                                        (obj as PropertyTabAttribute);
                                if(other != null)
                                {
                                        if(other.tabClasses.Length != 
tabClasses.Length)
                                        {
                                                return false;
                                        }
                                        int index;
                                        for(index = 0; index < 
tabClasses.Length; ++index)
                                        {
                                                if(other.tabClasses[index] != 
tabClasses[index])
                                                {
                                                        return false;
                                                }
                                                if(other.tabClassNames[index] 
!= tabClassNames[index])
                                                {
                                                        return false;
                                                }
                                                if(other.tabScopes[index] != 
tabScopes[index])
                                                {
                                                        return false;
                                                }
                                        }
                                        return true;
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return base.GetHashCode();
                        }

        // Initialize the arrays within this attribute.
        protected void InitializeArrays(String[] tabClassNames,
                                                                        
PropertyTabScope[] tabScopes)
                        {
                                if(tabClassNames.Length != tabScopes.Length)
                                {
                                        throw new 
ArgumentException(S._("Arg_ArraysSameSize"));
                                }
                                this.tabClassNames = tabClassNames;
                                this.tabScopes = tabScopes;
                                this.tabClasses = new Type 
[tabClassNames.Length];
                                int index;
                                for(index = 0; index < tabClassNames.Length; 
++index)
                                {
                                        tabClasses[index] = Type.GetType
                                                (tabClassNames[index], true);
                                }
                        }
        protected void InitializeArrays(Type[] tabClasses,
                                                                        
PropertyTabScope[] tabScopes)
                        {
                                if(tabClasses.Length != tabScopes.Length)
                                {
                                        throw new 
ArgumentException(S._("Arg_ArraysSameSize"));
                                }
                                this.tabClasses = tabClasses;
                                this.tabScopes = tabScopes;
                                this.tabClassNames = new String 
[tabClasses.Length];
                                int index;
                                for(index = 0; index < tabClasses.Length; 
++index)
                                {
                                        tabClassNames[index] =
                                                
tabClasses[index].AssemblyQualifiedName;
                                }
                        }

}; // class PropertyTabAttribute

#endif // CONFIG_COMPONENT_MODEL

}; // namespace System.ComponentModel

--- NEW FILE ---
/*
 * ProvidePropertyAttribute.cs - Implementation of the
 *              "System.ComponentModel.ComponentModel.ProvidePropertyAttribute" 
class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.ComponentModel
{

#if CONFIG_COMPONENT_MODEL

using System;

[AttributeUsage(AttributeTargets.Class)]
public sealed class ProvidePropertyAttribute : Attribute
{
        // Internal state.
        private String propertyName;
        private String receiverTypeName;

        // Constructors.
        public ProvidePropertyAttribute(String propertyName,
                                                                        String 
receiverTypeName)
                        {
                                this.propertyName = propertyName;
                                this.receiverTypeName = receiverTypeName;
                        }
        public ProvidePropertyAttribute(String propertyName,
                                                                        Type 
receiverType)
                        {
                                this.propertyName = propertyName;
                                this.receiverTypeName = 
receiverType.AssemblyQualifiedName;
                        }

        // Get this attribute's values.
        public String PropertyName
                        {
                                get
                                {
                                        return propertyName;
                                }
                        }
        public String ReceiverTypeName
                        {
                                get
                                {
                                        return receiverTypeName;
                                }
                        }
        public override Object TypeId
                        {
                                get
                                {
                                        return GetType().FullName + 
propertyName;
                                }
                        }

        // Determine if two objects are equal.
        public override bool Equals(Object obj)
                        {
                                ProvidePropertyAttribute other =
                                        (obj as ProvidePropertyAttribute);
                                if(other != null)
                                {
                                        return (other.propertyName == 
propertyName &&
                                                        other.receiverTypeName 
== receiverTypeName);
                                }
                                else
                                {
                                        return false;
                                }
                        }

        // Get the hash code for this object.
        public override int GetHashCode()
                        {
                                return propertyName.GetHashCode() ^
                                           receiverTypeName.GetHashCode();
                        }

}; // class ProvidePropertyAttribute

#endif // CONFIG_COMPONENT_MODEL

}; // namespace System.ComponentModel

Index: TypeConverter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/ComponentModel/TypeConverter.cs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** TypeConverter.cs    8 Aug 2003 02:56:50 -0000       1.7
--- TypeConverter.cs    12 Sep 2003 06:08:58 -0000      1.8
***************
*** 218,222 ****
  
        // Return a collection of standard values for this data type.
!       public StandardValuesCollection GetStandardValues()
                        {
                                return GetStandardValues(null);
--- 218,222 ----
  
        // Return a collection of standard values for this data type.
!       public ICollection GetStandardValues()
                        {
                                return GetStandardValues(null);

Index: Win32Exception.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/ComponentModel/Win32Exception.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Win32Exception.cs   5 Jul 2003 05:07:10 -0000       1.8
--- Win32Exception.cs   12 Sep 2003 06:08:58 -0000      1.9
***************
*** 21,24 ****
--- 21,25 ----
  
  using System;
+ using System.Security;
  using System.Runtime.InteropServices;
  using System.Runtime.Serialization;
***************
*** 27,30 ****
--- 28,33 ----
  {
  #if !ECMA_COMPAT
+       [Serializable]
+       [SuppressUnmanagedCodeSecurity]
        public class Win32Exception: ExternalException
        {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]