Example #1
0
            // TODO: if it's an indexer then we want to override get_Item/set_Item methods
            // which map to [] and []=

            internal void AddBaseMethods(Type finishedType, SpecialNames specialNames)
            {
                // "Adds" base methods to super type - this makes super(...).xyz to work - otherwise
                // we'd return a function that did a virtual call resulting in a stack overflow.
                OverriddenMembers overrides = OverriddenMembers.GetForType(finishedType);

                foreach (MethodInfo mi in finishedType.GetMethods())
                {
                    if (!ShouldOverrideVirtual(mi))
                    {
                        continue;
                    }

                    string methodName = mi.Name;
                    if (methodName.StartsWith(BaseMethodPrefix) || methodName.StartsWith(FieldGetterPrefix) || methodName.StartsWith(FieldSetterPrefix))
                    {
                        foreach (string newName in specialNames.GetBaseName(mi))
                        {
                            if (mi.IsSpecialName && (newName.StartsWith("get_") || newName.StartsWith("set_")))
                            {
                                StoreOverriddenProperty(overrides, mi, newName);
                            }
                            else if (mi.IsSpecialName && (newName.StartsWith(FieldGetterPrefix) || newName.StartsWith(FieldSetterPrefix)))
                            {
                                StoreOverriddenField(overrides, mi, newName);
                            }
                            else
                            {
                                StoreOverriddenMethod(overrides, mi, newName);
                            }
                        }
                    }
                }
            }
Example #2
0
        private void CheckAnalyticsPermissions(string userTableName, bool?isUtilityTableCommand)
        {
            bool flag = (isUtilityTableCommand.HasValue ? isUtilityTableCommand.Value : true);

            if (!this.AccountIdentifier.IsAdmin && flag && SpecialNames.IsTableContainerSpecialName(userTableName))
            {
                throw new InsufficientAccountPermissionsException();
            }
        }
Example #3
0
        public static string GetInternalXmlName(this XamlType type)
        {
            if (type.IsMarkupExtension && type.Name.EndsWith("Extension", StringComparison.Ordinal))
            {
                return(type.Name.Substring(0, type.Name.Length - 9));
            }
            var stn = SpecialNames.FirstOrDefault(s => s.Type == type);

            return(stn != null ? stn.Name : type.Name);
        }
Example #4
0
        private Group ListToGroup(listType list)
        {
            Group group = new Group(list.name, list.displayname.Value);

            group.Authorization = SpecialNames.GetAutorization(group.Name);
            if (group.Authorization == Authorization.UnKnown)
            {
                group.Authorization = Authorization.Allowed; // FIXME
            }
            return(group);
        }
Example #5
0
        public static void CheckContainerName(string containerName, ContainerType containerType, bool isSummaryContainer)
        {
            int num;

            if (string.IsNullOrEmpty(containerName))
            {
                if (!isSummaryContainer)
                {
                    throw new ArgumentNullException("containerName");
                }
                return;
            }
            if (containerName.Length > 63 || containerName.Length < 3)
            {
                if (!isSummaryContainer)
                {
                    throw new XStoreArgumentOutOfRangeException("containerName", string.Format("containerName must be at least {0} characters and at most {1} characters", 3, 63), "The specified resource name length is not within the permissible limits.");
                }
                return;
            }
            if ((containerType == ContainerType.BlobContainer || containerType == ContainerType.FileContainer) && SpecialNames.IsBlobContainerSpecialName(containerName))
            {
                return;
            }
            if (containerType == ContainerType.TableContainer && SpecialNames.IsTableContainerSpecialName(containerName))
            {
                return;
            }
            num = (containerType != ContainerType.TableContainer ? StorageStampHelpers.GetContainerNameInvalidChar(containerName) : StorageStampHelpers.GetTableNameInvalidChar(containerName));
            if (num < 0)
            {
                return;
            }
            if (!isSummaryContainer)
            {
                throw new InvalidResourceNameException(string.Format("The character '{0}' at index {1} is not allowed in the container name", StorageStampHelpers.MakeXmlFriendlyString(containerName[num]), num));
            }
        }
Example #6
0
 protected ClsTypeEmitter(TypeBuilder tb) {
     _tb = tb;
     _baseType = tb.BaseType;
     _specialNames = new SpecialNames();
 }
Example #7
0
 protected ClsTypeEmitter(TypeBuilder tb) {
     _tb = tb;
     _baseType = tb.BaseType;
     _specialNames = new SpecialNames();
     _dynamicSiteFactories = new List<Expression>();
 }
Example #8
0
 protected ClsTypeEmitter(TypeBuilder tb)
 {
     _tb           = tb;
     _baseType     = tb.BaseType;
     _specialNames = new SpecialNames();
 }
Example #9
0
 public virtual bool Visit(SpecialNames specialNames)
 {
     return(true);
 }
Example #10
0
            // TODO: if it's an indexer then we want to override get_Item/set_Item methods
            // which map to [] and []=

            internal void AddBaseMethods(Type finishedType, SpecialNames specialNames) {
                // "Adds" base methods to super type - this makes super(...).xyz to work - otherwise 
                // we'd return a function that did a virtual call resulting in a stack overflow.
                OverriddenMembers overrides = OverriddenMembers.GetForType(finishedType);

                foreach (MethodInfo mi in finishedType.GetMethods()) {
                    if (!ShouldOverrideVirtual(mi)) continue;

                    string methodName = mi.Name;
                    if (methodName.StartsWith(BaseMethodPrefix) || methodName.StartsWith(FieldGetterPrefix) || methodName.StartsWith(FieldSetterPrefix)) {
                        foreach (string newName in specialNames.GetBaseName(mi)) {
                            if (mi.IsSpecialName && (newName.StartsWith("get_") || newName.StartsWith("set_"))) {
                                StoreOverriddenProperty(overrides, mi, newName);
                            } else if (mi.IsSpecialName && (newName.StartsWith(FieldGetterPrefix) || newName.StartsWith(FieldSetterPrefix))) {
                                StoreOverriddenField(overrides, mi, newName);
                            } else {
                                StoreOverriddenMethod(overrides, mi, newName);
                            }
                        }
                    }
                }
            }