Beispiel #1
0
        //============================================================
        // Methods
        //============================================================

        /// <summary>
        /// Ignored
        /// </summary>
        public override System.ComponentModel.License GetLicense(LicenseContext context, Type type, object instance, bool allowExceptions)
        {
            System.ComponentModel.License controlLicense = null;

            try
            {
                var licenseControl = instance as Control;
                if (licenseControl != null)
                {
                    if ((HttpContext.Current == null) || (AllowLocalHost && IsLocalHost()) || (AllowLocal && IsLocal()) || (IsLicensed(GetRunningServer(), GetMachineName(), ProductName, ProductVersion)))
                    {
                        controlLicense = new ValidLicense();
                    }
                }
            }
            catch (Exception)
            {
                if (allowExceptions)
                {
#if DEBUG
                    throw;
#else
                    throw new LicenseException(type, instance, Globalisation.GetString("invalidLicenseData"));
#endif
                }
            }

            return(controlLicense);
        }
Beispiel #2
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="EmailAddressValidator"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="EmailAddressValidator"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public EmailAddressValidator()
        {
            _license = LicenseManager.Validate(typeof(EmailAddressValidator), this);

            ValidationExpression = ValidAddressRegex;

            return;
        }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="PrintButton"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="PrintButton"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public PrintButton()
        {
            _license = LicenseManager.Validate(typeof(PrintButton), this);

            Text = Globalisation.GetString("printButtonDefaultText");

            return;
        }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="ShowOnConditionClientSide"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="ShowOnConditionClientSide"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public ShowOnConditionClientSide()
        {
            _license = LicenseManager.Validate(typeof(ShowOnConditionClientSide), this);

            ShowOnConditionValue    = UnsetValue;
            ShowOnConditionNotValue = UnsetValue;

            return;
        }
        //============================================================
        // Methods
        //============================================================

        ///
        /// <summary>
        /// Enables a server control to perform final clean up before it is released from
        /// memory.
        /// </summary>
        /// <remarks>
        /// The Dispose method leaves the Control in an unusable state. After calling this
        /// method, you must release all references to the control so the memory it was
        /// occupying can be reclaimed by garbage collection.
        /// </remarks>
        /// <param name="disposing"><b>true</b> to release both managed and unmanaged resources; <b>false</b> to release only unmanaged resources.</param>
        ///
        protected virtual void Dispose (bool disposing)
        {
            if ((disposing) && (_license != null))
            {
                _license.Dispose ();
                _license = null;
            }

            return;
        }
 /// <summary>
 /// Releases the resources used by the <see cref="ObjectManager">ObjectManager</see>.
 /// </summary>
 /// <param name="disposing"></param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (license != null)
         {
             license.Dispose();
             license = null;
         }
     }
 }
        private void ValidateLicense()
        {
            if (license == null)
            {
                license = LicenseManager.Validate(typeof(ObjectManager), this);
            }

            if (license == null)
            {
                throw new LicenseException(typeof(ObjectManager), this, "Your license is invalid");
            }
        }
        ///
        /// <summary>
        /// Enables a server control to perform final clean up before it is released from
        /// memory.
        /// </summary>
        /// <remarks>
        /// The Dispose method leaves the Control in an unusable state. After calling this
        /// method, you must release all references to the control so the memory it was
        /// occupying can be reclaimed by garbage collection.
        /// </remarks>
        /// <param name="disposing"><b>true</b> to release both managed and unmanaged resources; <b>false</b> to release only unmanaged resources.</param>
        ///
        protected override void Dispose(bool disposing)
        {
            try
            {
                if ((disposing) && (_license != null))
                {
                    _license.Dispose();
                    _license = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
            }

            return;
        }
Beispiel #9
0
        ///
        /// <summary>
        /// Enables a server control to perform final clean up before it is released from
        /// memory.
        /// </summary>
        /// <remarks>
        /// The Dispose method leaves the Control in an unusable state. After calling this
        /// method, you must release all references to the control so the memory it was
        /// occupying can be reclaimed by garbage collection.
        /// </remarks>
        /// <param name="disposing"><b>true</b> to release both managed and unmanaged resources; <b>false</b> to release only unmanaged resources.</param>
        ///
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_license != null)
                {
                    _license.Dispose();
                    _license = null;
                }

                if (_realField != null)
                {
                    _realField.Dispose();
                    _realField = null;
                }
            }

            return;
        }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="ShowIfNotLoggedIn"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="ShowIfNotLoggedIn"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public ShowIfNotLoggedIn() : base(HtmlTextWriterTag.Span)
        {
            _license = LicenseManager.Validate(typeof(ShowIfNotLoggedIn), this);

            return;
        }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="MakeMeHomePageImageButton"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="MakeMeHomePageImageButton"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public MakeMeHomePageImageButton()
        {
            _license = LicenseManager.Validate(typeof(MakeMeHomePageImageButton), this);

            return;
        }
Beispiel #12
0
 /// <summary>Determines whether a valid license can be granted for the specified instance of the type. This method creates a valid <see cref="T:System.ComponentModel.License" />.</summary>
 /// <returns>true if a valid <see cref="T:System.ComponentModel.License" /> can be granted; otherwise, false.</returns>
 /// <param name="type">A <see cref="T:System.Type" /> that represents the type of object that requests the license. </param>
 /// <param name="instance">An object of the specified type or a type derived from the specified type. </param>
 /// <param name="license">A <see cref="T:System.ComponentModel.License" /> that is a valid license, or null if a valid license cannot be granted. </param>
 public static bool IsValid(Type type, object instance, out License license)
 {
     return(LicenseManager.privateGetLicense(type, null, false, out license));
 }
Beispiel #13
0
        /// <summary>
        ///     Since we want to walk up the entire inheritance change, when not
        ///     give an instance, we need another helper method to walk up
        ///     the chain...
        /// </summary>
        private static bool ValidateInternalRecursive(LicenseContext context, Type type, object instance, bool allowExceptions, out License license, out string licenseKey)
        {
            LicenseProvider provider = GetCachedProvider(type);

            if (provider == null && !GetCachedNoLicenseProvider(type))
            {
                // NOTE : Must look directly at the class, we want no inheritance.
                //

                LicenseProviderAttribute attr = (LicenseProviderAttribute)Attribute.GetCustomAttribute(type, typeof(LicenseProviderAttribute), false);

                if (attr != null)
                {
                    Type providerType = attr.LicenseProvider;
                    provider = GetCachedProviderInstance(providerType) ??
                               (LicenseProvider)SecurityUtils.SecureCreateInstance(providerType);
                }

                CacheProvider(type, provider);
            }

            license = null;
            bool isValid = true;

            licenseKey = null;
            if (provider != null)
            {
                license = provider.GetLicense(context, type, instance, allowExceptions);
                if (license == null)
                {
                    isValid = false;
                }
                else
                {
                    // For the case where a COM client is calling "RequestLicKey",
                    // we try to squirrel away the first found license key
                    //
                    licenseKey = license.LicenseKey;
                }
            }

            // When looking only at a type, we need to recurse up the inheritence
            // chain, however, we can't give out the license, since this may be
            // from more than one provider.
            //
            if (isValid && instance == null)
            {
                Type baseType = type.BaseType;
                if (baseType != typeof(object) && baseType != null)
                {
                    if (license != null)
                    {
                        license.Dispose();
                        license = null;
                    }
                    string temp;
                    isValid = ValidateInternalRecursive(context, baseType, null, allowExceptions, out license, out temp);
                    if (license != null)
                    {
                        license.Dispose();
                        license = null;
                    }
                }
            }

            return(isValid);
        }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="PopupButton"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="PopupButton"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public PopupButton ()
        {
            _license = LicenseManager.Validate (typeof (PopupButton), this);

            return;
        }
Beispiel #15
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="ComboBox"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="ComboBox"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public ComboBox()
        {
            _license = LicenseManager.Validate(typeof(ComboBox), this);

            return;
        }
Beispiel #16
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="PopupAutomatically"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="PopupAutomatically"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public PopupAutomatically()
        {
            _license = LicenseManager.Validate(typeof(PopupAutomatically), this);

            return;
        }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="RichTextBox"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="RichTextBox"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public RichTextBox()
        {
            _license = LicenseManager.Validate(typeof(RichTextBox), this);

            return;
        }
Beispiel #18
0
 public static bool IsValid(Type type, Object instance, out License license)
 {
     license = PerformValidation(type, instance);
     return(license != null);
 }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="PrintLinkButton"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="PrintLinkButton"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public PrintLinkButton()
        {
            _license = LicenseManager.Validate(typeof(PrintLinkButton), this);

            return;
        }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="ShowOnConditionServerSide"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="ShowOnConditionServerSide"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public ShowOnConditionServerSide()
        {
            _license = LicenseManager.Validate(typeof(ShowOnConditionServerSide), this);

            return;
        }
Beispiel #21
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="ShowAtTime"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="ShowAtTime"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public ShowAtTime()
        {
            _license = LicenseManager.Validate(typeof(ShowAtTime), this);

            return;
        }
Beispiel #22
0
        private static bool privateGetLicense(Type type, object instance, bool allowExceptions, out License license)
        {
            bool    result   = false;
            License license2 = null;
            LicenseProviderAttribute licenseProviderAttribute = (LicenseProviderAttribute)Attribute.GetCustomAttribute(type, typeof(LicenseProviderAttribute), true);

            if (licenseProviderAttribute != null)
            {
                Type licenseProvider = licenseProviderAttribute.LicenseProvider;
                if (licenseProvider != null)
                {
                    LicenseProvider licenseProvider2 = (LicenseProvider)Activator.CreateInstance(licenseProvider);
                    if (licenseProvider2 != null)
                    {
                        license2 = licenseProvider2.GetLicense(LicenseManager.CurrentContext, type, instance, allowExceptions);
                        if (license2 != null)
                        {
                            result = true;
                        }
                    }
                }
            }
            else
            {
                result = true;
            }
            license = license2;
            return(result);
        }
Beispiel #23
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="MakeMeHomePageAutomatically"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="MakeMeHomePageAutomatically"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public MakeMeHomePageAutomatically()
        {
            _license = LicenseManager.Validate(typeof(MakeMeHomePageAutomatically), this);

            return;
        }
Beispiel #24
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="NoRepostValidator"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="NoRepostValidator"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public NoRepostValidator ()
        {
            _license = LicenseManager.Validate (typeof (NoRepostValidator), this);

            return;
        }
Beispiel #25
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="TwinListBox"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="TwinListBox"/>
        /// class. This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public TwinListBox()
        {
            _license = LicenseManager.Validate(typeof(TwinListBox), this);

            return;
        }
Beispiel #26
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="Note"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="Note"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public Note() : base(HtmlTextWriterTag.Table)
        {
            _license = LicenseManager.Validate(typeof(Note), this);

            return;
        }
Beispiel #27
0
        public InternalGrid(PropertyGrid parentCtrl)
        {
#if _XHEOSOURCECODE
            _license = System.ComponentModel.LicenseManager.Validate(typeof(InternalGrid), this);
#endif
            _parentCtrl = parentCtrl;

            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
                Utilities.DoubleBufferStyle | ControlStyles.Opaque, true);

            UpdateStyles();

            LeftColumnWidth = 16;

            GridColor = SystemColors.ActiveBorder;

            _activePropertyCollection = _categorizedPropertyCollection;

            _firstDisplayedPropertyEnumerator = _activePropertyCollection.GetVisibleDeepEnumerator().RightBound.GetVisibleDeepEnumerator();
            _selectedPropertyEnum = _activePropertyCollection.GetVisibleDeepEnumerator().RightBound.GetVisibleDeepEnumerator();

            TabStop = true;

            BackColor = SystemColors.Window;

            _mouseHook = new MouseHook(this, this);
            _messageHook = new MessageHook(this, this);
            _keyboardHook = new KeyboardHook(this, this);
        }
Beispiel #28
0
 /// <summary>
 ///    <para>Determines if a valid license can be granted for the
 ///       specified instance of the type. This method creates a valid <see cref='System.ComponentModel.License'/>. </para>
 /// </summary>
 public static bool IsValid(Type type, object instance, out License license)
 {
     return(ValidateInternal(type, instance, false, out license));
 }
Beispiel #29
0
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (_license != null)
				{
					_license.Dispose();
					_license = null;
				}
			}
			base.Dispose(disposing);
		}
Beispiel #30
0
        /// <summary>
        ///     Internal validation helper.
        /// </summary>
        private static bool ValidateInternal(Type type, object instance, bool allowExceptions, out License license)
        {
            string licenseKey;

            return(ValidateInternalRecursive(CurrentContext,
                                             type,
                                             instance,
                                             allowExceptions,
                                             out license,
                                             out licenseKey));
        }
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="ScrollablePanel"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="ScrollablePanel"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public ScrollablePanel()
        {
            _license = LicenseManager.Validate(typeof(ScrollablePanel), this);

            return;
        }
Beispiel #32
0
        //============================================================
        // Constructors
        //============================================================

        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="DatePicker"/> class.
        /// </summary>
        /// <remarks>
        /// Use this constructor to create and initialize a new instance of the <see cref="DatePicker"/> class.
        /// This default constructor initializes all fields to their default values.
        /// </remarks>
        ///
        public DatePicker() : base(HtmlTextWriterTag.Div)
        {
            _license = LicenseManager.Validate(typeof(DatePicker), this);

            return;
        }