Example #1
0
        internal static void RegisterCustomRestriction(string resourceType, int propId,
                                                       IResourceRestriction restriction)
        {
            if (resourceType == null)
            {
                throw new ArgumentNullException("resourceType");
            }
            if (!MyPalStorage.Storage.ResourceTypes.Exist(resourceType))
            {
                throw new ArgumentException("Invalid resource type " + resourceType, resourceType);
            }

            string            restrictionClass    = restriction.GetType().FullName;
            CustomRestriction existingRestriction = (CustomRestriction)_customRestrictions [restrictionClass];

            if (existingRestriction != null)
            {
                existingRestriction.SetImplementation(restriction);
            }
            else
            {
                CustomRestriction customRestriction = new CustomRestriction(resourceType, propId, restriction);
                AddResourceRestriction(customRestriction);
                customRestriction.SaveToResourceStore();
                _customRestrictions [restrictionClass] = customRestriction;
            }
        }
Example #2
0
 internal static void RegisterRestrictionOnDelete(string resourceType, IResourceRestriction restriction)
 {
     RegisterCustomRestriction(resourceType, ResourceProps.Id, restriction);
 }
Example #3
0
 internal void SetImplementation(IResourceRestriction restriction)
 {
     _restriction = restriction;
 }
Example #4
0
 public CustomRestriction(string resourceType, int propId, IResourceRestriction restriction)
     : base(resourceType, propId)
 {
     _restriction      = restriction;
     _restrictionClass = _restriction.GetType().FullName;
 }
Example #5
0
 public void RegisterRestrictionOnDelete(string resourceType, IResourceRestriction restriction)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public void RegisterCustomRestriction(string resourceType, int propId, IResourceRestriction restriction)
 {
     throw new NotImplementedException();
 }