Exemple #1
0
        internal static ComplexMapResult <TSource, TTarget> Create <TSource, TSourceProperty, TTarget, TTargetProperty>(
            PropertyInfo sourceProperty,
            PropertyInfo targetProperty,
            Dictionary <SourceToTargetMap, MapTracker> typeMappings,
            PropertyConfig <TSourceProperty, TTargetProperty> config)
            where TSource : class
            where TTarget : class
            where TSourceProperty : class
            where TTargetProperty : class
        {
            var createMapFunc = typeof(MappingBuilder).GetMethod(nameof(MappingBuilder.CreateMap), BindingFlags.Static | BindingFlags.NonPublic)
                                .MakeGenericMethod(sourceProperty.PropertyType, targetProperty.PropertyType);

            var mapFuncResult = (ComplexMapResult <TSourceProperty, TTargetProperty>)createMapFunc
                                .Invoke(null, new object[] { sourceProperty.PropertyType, targetProperty.PropertyType, config.MappingConfiguration, typeMappings });
            var mapFunc     = mapFuncResult.MappingFunc;
            var constructor = PropertyAccess.GetDefaultConstructor <TTargetProperty>();

            var sourcePropertyGetter = PropertyAccess.CreateGetter <TSource, TSourceProperty>(sourceProperty);
            var setter = PropertyAccess.CreateSetter <TTarget, TTargetProperty>(targetProperty);

            var requiresReferenceTracking = mapFuncResult.ReferenceTrackingTypes;

            if (!config.MappingConfiguration.ReferenceTrackingEnabled || requiresReferenceTracking.Any(x =>
                                                                                                       x.Source == sourceProperty.PropertyType && x.Target == targetProperty.PropertyType))
            {
                return(new ComplexMapResult <TSource, TTarget>(MappingFuncWithReferenceTracking(sourcePropertyGetter, setter, constructor, mapFunc),
                                                               requiresReferenceTracking));
            }

            return(new ComplexMapResult <TSource, TTarget>(
                       MappingWithoutReferenceTracking(sourcePropertyGetter, setter, constructor, mapFunc),
                       requiresReferenceTracking));
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "commentid": // Int
                return(CommentId.ToString(strFormat, formatProvider));

            case "userid": // Int
                return(UserId.ToString(strFormat, formatProvider));

            case "flightid": // Int
                return(FlightId.ToString(strFormat, formatProvider));

            case "datime": // DateTime
                return(Datime.ToString(strFormat, formatProvider));

            case "remarks": // NVarCharMax
                return(PropertyAccess.FormatString(Remarks, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Exemple #3
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "apikey": // VarChar
                return(PropertyAccess.FormatString(ApiKey, strFormat));

            case "conferenceid": // Int
                return(ConferenceId.ToString(strFormat, formatProvider));

            case "expires": // DateTime
                if (Expires == null)
                {
                    return("");
                }
                ;
                return(((DateTime)Expires).ToString(strFormat, formatProvider));

            case "createdbyuserid": // Int
                return(CreatedByUserID.ToString(strFormat, formatProvider));

            case "createdondate": // DateTime
                return(CreatedOnDate.ToString(strFormat, formatProvider));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "namespaceid": // Int
                return(NamespaceId.ToString(strFormat, formatProvider));

            case "parentid": // Int
                return(ParentId.ToString(strFormat, formatProvider));

            case "moduleid": // Int
                return(ModuleId.ToString(strFormat, formatProvider));

            case "namespacename": // NVarChar
                return(PropertyAccess.FormatString(NamespaceName, strFormat));

            case "lastqualifier": // NVarChar
                return(PropertyAccess.FormatString(LastQualifier, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
        public string GetProperty(string propertyName, string format, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            string OutputFormat = string.Empty;

            if (format == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = format;
            }
            propertyName = propertyName.ToLowerInvariant();
            switch (propertyName)
            {
            case "url":
                return(PropertyAccess.FormatString(Url, format));

            case "title":
                return(PropertyAccess.FormatString(Title, format));

            case "description":
                return(PropertyAccess.FormatString(Description, format));

            case "imageurl":
                return(PropertyAccess.FormatString(ImageUrl, format));
            }

            propertyNotFound = true;
            return(string.Empty);
        }
Exemple #6
0
        /// <summary>
        /// Get Property out of NameValueCollection
        /// </summary>
        /// <param name="strPropertyName"></param>
        /// <param name="strFormat"></param>
        /// <param name="formatProvider"></param>
        /// <param name="AccessingUser"></param>
        /// <param name="AccessLevel"></param>
        /// <param name="PropertyNotFound"></param>
        /// <returns></returns>
        public string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            if (NameValueCollection == null)
            {
                return(string.Empty);
            }
            string value        = NameValueCollection[strPropertyName];
            string OutputFormat = null;

            if (strFormat == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = string.Empty;
            }
            if (value != null)
            {
                PortalSecurity Security = new PortalSecurity();
                value = Security.InputFilter(value, PortalSecurity.FilterFlag.NoScripting);
                return(Security.InputFilter(PropertyAccess.FormatString(value, strFormat), PortalSecurity.FilterFlag.NoScripting));
            }
            else
            {
                PropertyNotFound = true;
                return(string.Empty);
            }
        }
Exemple #7
0
        public string GetProperty(string propertyName, string format, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            string OutputFormat = string.Empty;

            if (format == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = format;
            }
            propertyName = propertyName.ToLowerInvariant();
            switch (propertyName)
            {
            case "id":
                return(PropertyAccess.FormatString(Id.ToString(), format));

            case "name":
                return(PropertyAccess.FormatString(Name.ToString(), format));

            case "vanity":
                return(PropertyAccess.FormatString(Vanity.ToString(), format));

            case "avatar":
                return(PropertyAccess.FormatString(Avatar.ToString(), format));
            }

            propertyNotFound = true;
            return(string.Empty);
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "referenceid": // Int
                return(ReferenceId.ToString(strFormat, formatProvider));

            case "codeblockid": // Int
                return(CodeBlockId.ToString(strFormat, formatProvider));

            case "fullname": // VarChar
                return(PropertyAccess.FormatString(FullName, strFormat));

            case "offset": // Int
                return(Offset.ToString(strFormat, formatProvider));

            case "referencedmemberid": // Int
                if (ReferencedMemberId == null)
                {
                    return("");
                }
                ;
                return(((int)ReferencedMemberId).ToString(strFormat, formatProvider));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Exemple #9
0
        IElement ParseProperty(XmlReader property)
        {
            if (property == null)
            {
                return(null);
            }

            property.Read();
            string         name   = property["name"];
            Argument       type   = new Argument(property["type"], null);
            PropertyAccess access = PropertyAccess.Read;

            switch (property["access"])
            {
            case "readwrite":
                access = PropertyAccess.ReadWrite;
                break;

            case "read":
                access = PropertyAccess.Read;
                break;

            case "write":
                access = PropertyAccess.Write;
                break;
            }

            property.Close();

            return(elementFactory.FromPropertyDefinition(name, type.Type, access));
        }
        public override void Update(PropertyAccess propertyAccess, ImageAnalysis imageAnalyzerResult, OcrResult ocrResult, TranslationService translationService)
        {
            if (imageAnalyzerResult?.Categories == null)
            {
                return;
            }

            var celebrities = imageAnalyzerResult.Categories.Where(x => x.Detail != null)
                              .Select(x => x.Detail.Celebrities).Where(x => x != null)
                              .SelectMany(x => x)
                              .Select(y => y.Name)
                              .ToList();

            if (!celebrities.Any())
            {
                return;
            }

            if (IsStringProperty(propertyAccess.Property))
            {
                propertyAccess.SetValue(string.Join(", ", celebrities));
            }
            else if (IsStringListProperty(propertyAccess.Property))
            {
                propertyAccess.SetValue(celebrities.ToList());
            }
        }
Exemple #11
0
        public static PropertyInfo GetPropertyInfo(
            Mobile m, ref object obj, string propertyName, PropertyAccess access, ref string failReason)
        {
            var chain = GetPropertyInfoChain(m, obj.GetType(), propertyName, access, ref failReason);

            return(chain == null ? null : GetPropertyInfo(ref obj, chain, ref failReason));
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "sessionresourceid": // Int
                return(SessionResourceId.ToString(strFormat, formatProvider));

            case "sessionid": // Int
                return(SessionId.ToString(strFormat, formatProvider));

            case "resourcelink": // NVarChar
                return(PropertyAccess.FormatString(ResourceLink, strFormat));

            case "resourcedescription": // NVarChar
                if (ResourceDescription == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(ResourceDescription, strFormat));

            case "resourcetype": // Int
                return(ResourceType.ToString(strFormat, formatProvider));

            case "visibility": // Int
                return(Visibility.ToString(strFormat, formatProvider));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Exemple #13
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "rideid": // Int
                return(RideId.ToString(strFormat, formatProvider));

            case "moduleid": // Int
                return(ModuleId.ToString(strFormat, formatProvider));

            case "userid": // Int
                return(UserId.ToString(strFormat, formatProvider));

            case "incoming": // Bit
                return(Incoming.ToString());

            case "location": // NVarChar
                return(PropertyAccess.FormatString(Location, strFormat));

            case "notes": // NVarCharMax
                return(PropertyAccess.FormatString(Notes, strFormat));

            case "placesavailable": // Int
                return(PlacesAvailable.ToString(strFormat, formatProvider));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
        public override string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "createdbyuser": // NVarChar
                if (CreatedByUser == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(CreatedByUser, strFormat));

            case "lastmodifiedbyuser": // NVarChar
                if (LastModifiedByUser == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(LastModifiedByUser, strFormat));

            case "nrsessions": // Int
                if (NrSessions == null)
                {
                    return("");
                }
                ;
                return(((int)NrSessions).ToString(strFormat, formatProvider));

            default:
                return(base.GetProperty(strPropertyName, strFormat, formatProvider, accessingUser, accessLevel, ref propertyNotFound));
            }
        }
Exemple #15
0
        public static PropertyInfo[] GetPropertyInfoChain(
            Mobile from, Type type, string propertyString,
            PropertyAccess access, out string failReason
            )
        {
            failReason = null;
            var split = propertyString.Split('.');

            if (split.Length == 0)
            {
                return(null);
            }

            var info = new PropertyInfo[split.Length];

            for (var i = 0; i < info.Length; ++i)
            {
                var propertyName = split[i];
                var props        = type.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);

                var p = GetPropertyInfoByName(from, props, propertyName, access, out failReason);

                if (p == null)
                {
                    failReason ??= $"Property '{propertyName}' not found.";
                    return(null);
                }

                info[i] = p;
                type    = p.PropertyType;
            }

            return(info);
        }
Exemple #16
0
        RenderFragment RenderChildren(IEnumerable children, int depth)
        {
            var level = depth < Levels.Count() ? Levels.ElementAt(depth) : Levels.Last();

            return(new RenderFragment(builder =>
            {
                Func <object, string> text = null;

                foreach (var data in children)
                {
                    if (text == null)
                    {
                        text = level.Text ?? Getter <string>(data, level.TextProperty);
                    }

                    RenderTreeItem(builder, data, level.Template, text, level.HasChildren, level.Expanded, level.Selected);

                    var hasChildren = level.HasChildren(data);

                    if (!string.IsNullOrEmpty(level.ChildrenProperty))
                    {
                        var grandChildren = PropertyAccess.GetValue(data, level.ChildrenProperty) as IEnumerable;

                        if (grandChildren != null && hasChildren)
                        {
                            builder.AddAttribute(7, "ChildContent", RenderChildren(grandChildren, depth + 1));
                            builder.AddAttribute(8, nameof(RadzenTreeItem.Data), grandChildren);
                        }
                    }

                    builder.CloseComponent();
                }
            }));
        }
Exemple #17
0
        /// <summary>
        /// Called when initialized.
        /// </summary>
        protected override void OnInitialized()
        {
            if (Grid != null)
            {
                Grid.AddColumn(this);

                if (!string.IsNullOrEmpty(FilterProperty) || Type == null)
                {
                    var property = GetFilterProperty();

                    if (!string.IsNullOrEmpty(property))
                    {
                        _filterPropertyType = PropertyAccess.GetPropertyType(typeof(TItem), property);
                    }
                }

                if (_filterPropertyType == null)
                {
                    _filterPropertyType = Type;
                }
                else
                {
                    propertyValueGetter = PropertyAccess.Getter <TItem, object>(Property);
                }

                if (_filterPropertyType == typeof(string))
                {
                    FilterOperator = FilterOperator.Contains;
                }
            }
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "rideid": // Int
                return(RideId.ToString(strFormat, formatProvider));

            case "userid": // Int
                return(UserId.ToString(strFormat, formatProvider));

            case "accepted": // Bit
                return(Accepted.ToString());

            case "comments": // NVarCharMax
                if (Comments == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Comments, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
        public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider,
                                  UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            strPropertyName = strPropertyName.ToLowerInvariant();
            switch (strPropertyName)
            {
            case "md5hash":
                return(PropertyAccess.FormatString(Md5Hash(_email), strFormat));

            case "url":
                return
                    (PropertyAccess.FormatString(
                         string.Format("http://www.gravatar.com/avatar/{0}", Md5Hash(_email)), strFormat));

            case "image":
                return
                    (PropertyAccess.FormatString(
                         string.Format("<img alt=\"gravatar\" src=\"http://www.gravatar.com/avatar/{0}\" />",
                                       Md5Hash(_email)), strFormat));

            default:
                propertyNotFound = true;
                return(string.Empty);
            }
        }
        /// <summary>
        /// Get Property out of NameValueCollection
        /// </summary>
        /// <param name="strPropertyName"></param>
        /// <param name="strFormat"></param>
        /// <param name="formatProvider"></param>
        /// <param name="AccessingUser"></param>
        /// <param name="AccessLevel"></param>
        /// <param name="PropertyNotFound"></param>
        /// <returns></returns>
        public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
        {
            if (NameValueCollection == null)
            {
                return(string.Empty);
            }
            var value = NameValueCollection[strPropertyName];

            //string OutputFormat = null;
            //if (strFormat == string.Empty)
            //{
            //    OutputFormat = "g";
            //}
            //else
            //{
            //    OutputFormat = string.Empty;
            //}
            if (value != null)
            {
                var Security = new PortalSecurity();
                value = Security.InputFilter(value, PortalSecurity.FilterFlag.NoScripting);
                return(Security.InputFilter(PropertyAccess.FormatString(value, strFormat), PortalSecurity.FilterFlag.NoScripting));
            }
            PropertyNotFound = true;
            return(string.Empty);
        }
Exemple #21
0
        public override void Update(PropertyAccess propertyAccess, ImageAnalysis imageAnalyzerResult, OcrResult ocrResult, TranslationService translationService)
        {
            if (imageAnalyzerResult.Tags == null || imageAnalyzerResult.Tags.Count == 0)
            {
                return;
            }

            var tags = imageAnalyzerResult.Tags.Select(x => x.Name);

            if (IsStringProperty(propertyAccess.Property))
            {
                var translatedTags = GetTranslatedTags(tags, translationService);
                propertyAccess.SetValue(string.Join(", ", translatedTags));
            }
            else if (IsStringListProperty(propertyAccess.Property))
            {
                var translatedTags = GetTranslatedTags(tags, translationService);
                propertyAccess.SetValue(translatedTags.ToList());
            }
            else if (IsLocalizedStringProperty(propertyAccess.Property))
            {
                propertyAccess.SetValue(GetTranslatedLocalizedStrings(tags.ToList(), GetLanguageCodes(), translationService));
            }
            else if (IsLocalizedStringListProperty(propertyAccess.Property))
            {
                propertyAccess.SetValue(GetTranslatedLocalizedStringLists(tags.ToList(), GetLanguageCodes(), translationService));
            }
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "conferenceid": // Int
                return(ConferenceId.ToString(strFormat, formatProvider));

            case "userid": // Int
                return(UserId.ToString(strFormat, formatProvider));

            case "status": // Int
                return(Status.ToString(strFormat, formatProvider));

            case "receivenotifications": // Bit
                return(ReceiveNotifications.ToString());

            case "company": // NVarChar
                if (Company == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Company, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
        public string GetProperty(string strPropertyName, string strFormat, CultureInfo formatProvider,
                                  UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            if (_nameValueCollection == null)
            {
                return(string.Empty);
            }
            var value = _nameValueCollection[strPropertyName];

            if (string.IsNullOrEmpty(strFormat))
            {
                strFormat = string.Empty;
            }
            if (value != null)
            {
                var security = new PortalSecurity();
                value = security.InputFilter(value, PortalSecurity.FilterFlag.NoScripting);
                return(security.InputFilter(PropertyAccess.FormatString(value, strFormat),
                                            PortalSecurity.FilterFlag.NoScripting));
            }
            else
            {
                propertyNotFound = true;
                return(string.Empty);
            }
        }
        internal static int AccessMaskFromPropertyAccess(PropertyAccess access)
        {
            int accessMask = 0;

            if (access < PropertyAccess.Read || access > PropertyAccess.Write)
            {
                throw new InvalidEnumArgumentException("access", (int)access, typeof(PropertyAccess));
            }

            switch (access)
            {
            case PropertyAccess.Read:
            {
                accessMask = ActiveDirectoryRightsTranslator.AccessMaskFromRights(ActiveDirectoryRights.ReadProperty);
                break;
            }

            case PropertyAccess.Write:
            {
                accessMask = ActiveDirectoryRightsTranslator.AccessMaskFromRights(ActiveDirectoryRights.WriteProperty);
                break;
            }

            default:

                //
                // This should not happen. Indicates a problem with the
                // internal logic.
                //
                Debug.Fail("Invalid PropertyAccess value");
                throw new ArgumentException("access");
            }
            return(accessMask);
        }
Exemple #25
0
 public PropertyCompletionData(TypeInfo aType, string desc, PropertyAccess aPropertyAccess = PropertyAccess.Public)
     : base(aPropertyAccess == PropertyAccess.Readonly ?
            "roproperty.png" :
            (aPropertyAccess == PropertyAccess.Protected ? "proproperty.png" : "property.png"),
            desc, aType.Name)
 {
     classType_ = aType;
 }
Exemple #26
0
        public static Property Parse(Type type, string binding, PropertyAccess access)
        {
            Property prop = new Property(binding);

            prop.BindTo(type, access);

            return(prop);
        }
Exemple #27
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "slotid": // Int
                return(SlotId.ToString(strFormat, formatProvider));

            case "conferenceid": // Int
                return(ConferenceId.ToString(strFormat, formatProvider));

            case "start": // Time
                return(Start.ToString(strFormat, formatProvider));

            case "durationmins": // Int
                return(DurationMins.ToString(strFormat, formatProvider));

            case "slottype": // Int
                return(SlotType.ToString(strFormat, formatProvider));

            case "title": // NVarChar
                if (Title == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Title, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            case "daynr": // Int
                if (DayNr == null)
                {
                    return("");
                }
                ;
                return(((int)DayNr).ToString(strFormat, formatProvider));

            case "locationid": // Int
                if (LocationId == null)
                {
                    return("");
                }
                ;
                return(((int)LocationId).ToString(strFormat, formatProvider));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Exemple #28
0
        public override string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "createdbyuserdisplayname": // NVarChar
                if (CreatedByUserDisplayName == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(CreatedByUserDisplayName, strFormat));

            case "lastmodifiedbyuserdisplayname": // NVarChar
                if (LastModifiedByUserDisplayName == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(LastModifiedByUserDisplayName, strFormat));

            case "documentationcontents": // NVarCharMax
                if (DocumentationContents == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(DocumentationContents, strFormat));

            case "classname": // NVarChar
                return(PropertyAccess.FormatString(ClassName, strFormat));

            case "namespacename": // NVarChar
                return(PropertyAccess.FormatString(NamespaceName, strFormat));

            case "fullqualifier": // NVarChar
                return(PropertyAccess.FormatString(FullQualifier, strFormat));

            case "moduleid": // Int
                return(ModuleId.ToString(strFormat, formatProvider));

            case "componentname": // NVarChar
                return(PropertyAccess.FormatString(ComponentName, strFormat));

            case "latestversion": // VarChar
                return(PropertyAccess.FormatString(LatestVersion, strFormat));

            case "codeblockcount": // Int
                if (CodeBlockCount == null)
                {
                    return("");
                }
                ;
                return(((int)CodeBlockCount).ToString(strFormat, formatProvider));

            default:
                return(base.GetProperty(strPropertyName, strFormat, formatProvider, accessingUser, accessLevel, ref propertyNotFound));
            }
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "locationid": // Int
                return(LocationId.ToString(strFormat, formatProvider));

            case "conferenceid": // Int
                return(ConferenceId.ToString(strFormat, formatProvider));

            case "name": // NVarChar
                if (Name == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Name, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            case "capacity": // Int
                if (Capacity == null)
                {
                    return("");
                }
                ;
                return(((int)Capacity).ToString(strFormat, formatProvider));

            case "sort": // Int
                if (Sort == null)
                {
                    return("");
                }
                ;
                return(((int)Sort).ToString(strFormat, formatProvider));

            case "backgroundcolor": // NVarChar
                if (BackgroundColor == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(BackgroundColor, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
        public void PropertyAccessModifier()
        {
            var obj = new PropertyAccess();

            Assert.AreEqual("Value", TokenFormatter.Format("{PublicValue}", obj));
            Assert.AreEqual("Value", TokenFormatter.Format("{InternalValue}", obj, TokenOptions.NonPublicAccess));

            Assert.ThrowsException <KeyNotFoundException>(() => TokenFormatter.Format("{InternalValue}", obj));
        }
        internal static int AccessMaskFromPropertyAccess(PropertyAccess access)
        {
            if ((access < PropertyAccess.Read) || (access > PropertyAccess.Write))
            {
                throw new InvalidEnumArgumentException("access", (int) access, typeof(PropertyAccess));
            }
            switch (access)
            {
                case PropertyAccess.Read:
                    return ActiveDirectoryRightsTranslator.AccessMaskFromRights(ActiveDirectoryRights.ReadProperty);

                case PropertyAccess.Write:
                    return ActiveDirectoryRightsTranslator.AccessMaskFromRights(ActiveDirectoryRights.WriteProperty);
            }
            throw new ArgumentException("access");
        }
Exemple #32
0
        public static string GetName(string name, PropertyAccess access, FieldCase fieldCase)
        {
            switch (access)
            {
                case PropertyAccess.Property:
                    switch (fieldCase)
                    {
                        case FieldCase.Unchanged:
                            return name;
                        case FieldCase.Camelcase:
                            return MakeCamel(name);
                        case FieldCase.CamelcaseUnderscore:
                            return "_" + MakeCamel(name);
                        case FieldCase.CamelcaseMUnderscore:
                            return "m_" + MakeCamel(name);
                        case FieldCase.Pascalcase:
                            return MakePascal(name);
                        case FieldCase.PascalcaseUnderscore:
                            return "_" + MakePascal(name);
                        case FieldCase.PascalcaseMUnderscore:
                            return "m_" + MakePascal(name);
                    }
                    break;
                case PropertyAccess.Field:
                    return name;
                case PropertyAccess.FieldCamelcase:
                case PropertyAccess.NosetterCamelcase:
                    return MakeCamel(name);
                case PropertyAccess.FieldCamelcaseUnderscore:
                case PropertyAccess.NosetterCamelcaseUnderscore:
                    return "_" + MakeCamel(name);
                case PropertyAccess.FieldPascalcaseMUnderscore:
                case PropertyAccess.NosetterPascalcaseMUnderscore:
                    return "m_" + MakePascal(name);
                case PropertyAccess.FieldLowercaseUnderscore:
                case PropertyAccess.NosetterLowercaseUnderscore:
                    return "_" + name.ToLowerInvariant();
                case PropertyAccess.NosetterLowercase:
                    return name.ToLowerInvariant();
            }

            return name;
        }
        public IElement FromPropertyDefinition(string name, string type, PropertyAccess access)
        {
            string spec = Concat (access.ToString().ToLowerInvariant(),
                                  " property ", name, " : ", type);
            Dictionary<string, LangProcesser> temp = new Dictionary<string,LangProcesser>();

            foreach (KeyValuePair<ILangDefinition, IParserVisitor<string>> visitor in visitors) {
                temp.Add(visitor.Key.Name, delegate {
                    string realType = Parser.ParseDBusTypeExpression(type, visitor.Value);
                    return visitor.Key.PropertyFormat(name, realType, access);
                });
            }

            Element elem = new Element (name, new ElementRepresentation (spec, temp), propertyPb, 3);
            elem.Data = new InvocationData (type, Enumerable.Empty<Argument> (), true);
            elem.Data.PropertyAcces = access;

            return elem;
        }
		public static PropertyInfo GetPropertyInfo( Mobile from, ref object obj, string propertyName, PropertyAccess access, ref string failReason )
		{
			PropertyInfo[] chain = GetPropertyInfoChain( from, obj.GetType(), propertyName, access, ref failReason );

			if ( chain == null )
				return null;

			return GetPropertyInfo( ref obj, chain, ref failReason );
		}
 private CodeMemberField GetPrivateMemberFieldOfCompositeClass(CodeTypeDeclaration compositeClass, PropertyAccess access)
 {
     return GetMemberField(compositeClass.Name, compositeClass.Name, Accessor.Private, access);
 }
        private CodeMemberField GetGenericMemberField(string typeName, string name, string fieldType, Accessor accessor, PropertyAccess access)
        {
            CodeMemberField memberField = GetMemberFieldWithoutType(name, accessor, access);

            CodeTypeReference type = new CodeTypeReference(fieldType);
            if (!TypeHelper.ContainsGenericDecleration(fieldType, _language))
            {
                type.TypeArguments.Add(typeName);
            }
            memberField.Type = type;

            return memberField;
        }
 public PropertyAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.AccessControlType type, PropertyAccess access, ActiveDirectorySecurityInheritance inheritanceType) : base (default(System.Security.Principal.IdentityReference), default(ActiveDirectoryRights), default(System.Security.AccessControl.AccessControlType))
 {
   Contract.Requires(identity != null);
 }
        private void GenerateHasMany(CodeTypeDeclaration classDeclaration, string thisClassName, string propertyName, string customPropertyType, PropertyAccess propertyAccess, string description, CodeAttributeDeclaration attribute, bool genericRelation, bool propertyChanged, bool propertyChanging, string oppositeClassName, string oppositePropertyName, bool automaticAssociationGenerated, bool manyToMany, CodeAttributeDeclaration collectionIdAttribute)
        {
            string propertyType = String.IsNullOrEmpty(customPropertyType)
                                      ? Context.Model.EffectiveListInterface
                                      : customPropertyType;

            string memberType = propertyType;
            if (automaticAssociationGenerated)
                memberType = Context.Model.AutomaticAssociationCollectionImplementation;

            CodeMemberField memberField;
            if (!genericRelation)
                memberField = GetMemberField(propertyName, memberType, Accessor.Private, propertyAccess);
            else
                memberField = GetGenericMemberField(oppositeClassName, propertyName, memberType, Accessor.Private, propertyAccess);
            classDeclaration.Members.Add(memberField);

            // Initializes the collection by assigning a new list instance to the field.
            // Many-to-many relationships never had the initialization code enabled before.
            // Automatic associations initialize their lists in the constructor instead.
            if (Context.Model.InitializeIListFields && propertyType == Context.Model.EffectiveListInterface && !automaticAssociationGenerated)
            {
                CodeObjectCreateExpression fieldCreator = new CodeObjectCreateExpression();
                fieldCreator.CreateType = GetConcreteListType(oppositeClassName);
                memberField.InitExpression = fieldCreator;
            }

            bool createSetter = automaticAssociationGenerated ? false : true;

            if (description == "") description = null;
            CodeMemberProperty memberProperty = GetMemberProperty(memberField, propertyName, true, createSetter, propertyChanged, propertyChanging, description);
            // We need the propertyType with generic arguments added if there are any.
            memberProperty.Type = new CodeTypeReference(propertyType);
            memberProperty.Type.TypeArguments.AddRange(memberField.Type.TypeArguments);
                               
            classDeclaration.Members.Add(memberProperty);

            if (automaticAssociationGenerated)
            {
                AddConstructorForWatchedList(classDeclaration, memberField, propertyName);
                AddInternalWatchedListProperty(classDeclaration, memberProperty.Type, propertyName, memberField.Name, propertyChanged, propertyChanging, propertyAccess);
                AddItemAddedRemovedMethods(classDeclaration, thisClassName, propertyName, oppositeClassName, oppositePropertyName, manyToMany);
            }

            memberProperty.CustomAttributes.Add(attribute);

            if (collectionIdAttribute != null)
                memberProperty.CustomAttributes.Add(collectionIdAttribute);
        }
Exemple #39
0
		public static PropertyInfo GetPropertyInfo(
			Mobile m, ref object obj, string propertyName, PropertyAccess access, ref string failReason)
		{
			var chain = GetPropertyInfoChain(m, obj.GetType(), propertyName, access, ref failReason);

			return chain == null ? null : GetPropertyInfo(ref obj, chain, ref failReason);
		}
		public static PropertyInfo[] GetPropertyInfoChain( Mobile from, Type type, string propertyString, PropertyAccess endAccess, ref string failReason )
		{
			string[] split = propertyString.Split( '.' );

			if ( split.Length == 0 )
				return null;

			PropertyInfo[] info = new PropertyInfo[split.Length];

			for ( int i = 0; i < info.Length; ++i )
			{
				string propertyName = split[i];

				if ( CIEqual( propertyName, "current" ) )
					continue;

				PropertyInfo[] props = type.GetProperties( BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public );

				bool isFinal = ( i == (info.Length - 1) );

				PropertyAccess access = endAccess;

				if ( !isFinal )
					access |= PropertyAccess.Read;

				for ( int j = 0; j < props.Length; ++j )
				{
					PropertyInfo p = props[j];

					if ( CIEqual( p.Name, propertyName ) )
					{
						CPA attr = GetCPA( p );

						if ( attr == null )
						{
							failReason = String.Format( "Property '{0}' not found.", propertyName );
							return null;
						}
						else if ( (access & PropertyAccess.Read) != 0 && from.AccessLevel < attr.ReadLevel )
						{
							failReason = String.Format( "You must be at least {0} to get the property '{1}'.",
								Mobile.GetAccessLevelName( attr.ReadLevel ), propertyName );

							return null;
						}
						else if ( (access & PropertyAccess.Write) != 0 && from.AccessLevel < attr.WriteLevel )
						{
							failReason = String.Format( "You must be at least {0} to set the property '{1}'.",
								Mobile.GetAccessLevelName( attr.WriteLevel ), propertyName );

							return null;
						}
						else if ( (access & PropertyAccess.Read) != 0 && !p.CanRead )
						{
							failReason = String.Format( "Property '{0}' is write only.", propertyName );
							return null;
						}
						else if ( (access & PropertyAccess.Write) != 0 && !p.CanWrite && isFinal )
						{
							failReason = String.Format( "Property '{0}' is read only.", propertyName );
							return null;
						}

						info[i] = p;
						type = p.PropertyType;
						break;
					}
				}

				if ( info[i] == null )
				{
					failReason = String.Format( "Property '{0}' not found.", propertyName );
					return null;
				}
			}

			return info;
		}
 public PropertyCompletionData(TypeInfo aType, string desc, PropertyAccess aPropertyAccess = PropertyAccess.Public)
     : base(aPropertyAccess == PropertyAccess.Readonly ? 
         "roproperty.png" : 
         (aPropertyAccess == PropertyAccess.Protected ? "proproperty.png" : "property.png"), 
         desc, aType.Name)
 {
     classType_ = aType;
 }
 private CodeMemberField GetMemberField(string name, string fieldType, Accessor accessor, PropertyAccess access)
 {
     return GetMemberField(name, new CodeTypeReference(fieldType), accessor, access);
 }
 public PropertyAccessRule(IdentityReference identity, AccessControlType type, PropertyAccess access, Guid propertyType, ActiveDirectorySecurityInheritance inheritanceType, Guid inheritedObjectType) : base(identity, PropertyAccessTranslator.AccessMaskFromPropertyAccess(access), type, propertyType, false, ActiveDirectoryInheritanceTranslator.GetInheritanceFlags(inheritanceType), ActiveDirectoryInheritanceTranslator.GetPropagationFlags(inheritanceType), inheritedObjectType)
 {
 }
Exemple #44
0
            public dynamic GetValueFromScope(string propertyName, string format = null)
            {
                try
                {
                    var keys = propertyName.Split('.');
                    var digTo = keys.Count(x => x == "$parent");
                    var d = 0;
                    var p = this;

                    while (digTo > 0 && digTo + 1 > d)
                    {
                        p = p.Parent;
                        d += p.Scope != null ? 1 : 0;
                    }
                    if (digTo > 0) keys = keys.Where(x => x != "$parent").ToArray();

                    var property = new PropertyAccess(keys[0]);
                    var scope = p.Scope;
                    var parent = this;
                    while (scope == null || !scope.ContainsKey(property.Name))
                    {
                        parent = parent.Parent;
                        scope = parent.Scope;
                    }

                    var obj = scope[property.Name];
                    var level = 1;

                    while (level < keys.Length)
                    {
                        obj = property.GetValue(obj);
                        property = new PropertyAccess(keys[level]);
                        var t = obj.GetType();
                        obj = t == typeof(Dictionary<string, dynamic>) || t.IsArray
                            ? obj[property.Name]
                            : t.GetProperty(property.Name).GetValue(obj, null);
                        level++;
                    }

                    if (string.IsNullOrWhiteSpace(format))
                        return property.GetValue(obj);
                    return property.GetValue(obj).ToString(format);
                }
                catch (Exception)
                {
                    Trace.WriteLine(propertyName + " not found. default value returned = false");
                    return false;
                }
            }
		public PropertySetAccessRule (IdentityReference identity, AccessControlType type, PropertyAccess access, Guid propertySetType) : base(identity, (int)AccessControlType.Allow, type, propertySetType, false, InheritanceFlags.None, PropagationFlags.None, Guid.Empty)
		{
		}
Exemple #46
0
		public static PropertyInfo[] GetPropertyInfoChain(
			Mobile m, Type type, string propertyString, PropertyAccess endAccess, ref string failReason)
		{
			var split = propertyString.Split('.');

			if (split.Length == 0)
			{
				return null;
			}

			var info = new PropertyInfo[split.Length];

			for (int i = 0; i < info.Length; ++i)
			{
				string propertyName = split[i];

				if (CIEqual(propertyName, "current"))
				{
					continue;
				}

				var props = type.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);

				bool isFinal = i == info.Length - 1;

				PropertyAccess access = endAccess;

				if (!isFinal)
				{
					access |= PropertyAccess.Read;
				}

				foreach (PropertyInfo p in props)
				{
					if (!CIEqual(p.Name, propertyName))
					{
						continue;
					}

					CPA attr = GetCPA(p);

					if (attr == null)
					{
						failReason = String.Format("Property '{0}' not found.", propertyName);
						return null;
					}

					if ((access & PropertyAccess.Read) != 0 && m.AccessLevel < attr.ReadLevel)
					{
						failReason = String.Format(
							"You must be at least {0} to get the property '{1}'.", Mobile.GetAccessLevelName(attr.ReadLevel), propertyName);

						return null;
					}

					if ((access & PropertyAccess.Write) != 0 && m.AccessLevel < attr.WriteLevel)
					{
						failReason = String.Format(
							"You must be at least {0} to set the property '{1}'.", Mobile.GetAccessLevelName(attr.WriteLevel), propertyName);

						return null;
					}

					if ((access & PropertyAccess.Read) != 0 && !p.CanRead)
					{
						failReason = String.Format("Property '{0}' is write only.", propertyName);
						return null;
					}

					if ((access & PropertyAccess.Write) != 0 && (!p.CanWrite || attr.ReadOnly) && isFinal)
					{
						failReason = String.Format("Property '{0}' is read only.", propertyName);
						return null;
					}

					info[i] = p;
					type = p.PropertyType;
					break;
				}

				if (info[i] != null)
				{
					continue;
				}

				failReason = String.Format("Property '{0}' not found.", propertyName);
				return null;
			}

			return info;
		}
		public void BindTo( Type objectType, PropertyAccess desiredAccess )
		{
			if ( IsBound )
				throw new AlreadyBoundException( this );

			string[] split = m_Binding.Split( '.' );

			PropertyInfo[] chain = new PropertyInfo[split.Length];

			for ( int i = 0; i < split.Length; ++i )
			{
				bool isFinal = ( i == ( chain.Length - 1 ) );

				chain[i] = objectType.GetProperty( split[i], BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase );

				if ( chain[i] == null )
					throw new UnknownPropertyException( this, split[i] );

				objectType = chain[i].PropertyType;

				PropertyAccess access = desiredAccess;

				if ( !isFinal )
					access |= PropertyAccess.Read;

				if ( ( access & PropertyAccess.Read ) != 0 && !chain[i].CanRead )
					throw new WriteOnlyException( this );

				if ( ( access & PropertyAccess.Write ) != 0 && !chain[i].CanWrite )
					throw new ReadOnlyException( this );
			}

			m_Access = desiredAccess;
			m_Chain = chain;
		}
 public string PropertyFormat(string name, string type, PropertyAccess access)
 {
     return propDelegate(name, type, access);
 }
		public static Property Parse( Type type, string binding, PropertyAccess access )
		{
			Property prop = new Property( binding );

			prop.BindTo( type, access );

			return prop;
		}
		/// <summary>
		/// Convert <param name="access"/> to its NHibernate string 
		/// </summary>
		public static string ToString(PropertyAccess access)
		{
			switch (access)
			{
				case PropertyAccess.Property:
					return "property";
				case PropertyAccess.Field:
					return "field";
				case PropertyAccess.AutomaticProperty:
					return "backfield";
				case PropertyAccess.ReadOnly:
					return "readonly";
				case PropertyAccess.FieldCamelcase:
					return "field.camelcase";
				case PropertyAccess.FieldCamelcaseUnderscore:
					return "field.camelcase-underscore";
				case PropertyAccess.FieldPascalcaseMUnderscore:
					return "field.pascalcase-m-underscore";
				case PropertyAccess.FieldLowercaseUnderscore:
					return "field.lowercase-underscore";
				case PropertyAccess.NosetterCamelcase:
					return "nosetter.camelcase";
				case PropertyAccess.NosetterCamelcaseUnderscore:
					return "nosetter.camelcase-underscore";
				case PropertyAccess.NosetterPascalcaseMUndersc:
					return "nosetter.pascalcase-m-underscore";
				case PropertyAccess.NosetterPascalcaseUnderscore:
					return "nosetter.pascalcase-underscore";
				case PropertyAccess.NosetterLowercaseUnderscore:
					return "nosetter.lowercase-underscore";
				case PropertyAccess.NosetterLowercase:
					return "nosetter.lowercase";
				default:
					throw new InvalidOperationException("Invalid value for PropertyAccess");
			}
		}
 public PropertyAccessRule(IdentityReference identity, AccessControlType type, PropertyAccess access) : base(identity, PropertyAccessTranslator.AccessMaskFromPropertyAccess(access), type, Guid.Empty, false, InheritanceFlags.None, PropagationFlags.None, Guid.Empty)
 {
 }
		public PropertySetAccessRule (IdentityReference identity, AccessControlType type, PropertyAccess access, Guid propertySetType, ActiveDirectorySecurityInheritance inheritanceType, Guid inheritedObjectType) : base(identity, (int)AccessControlType.Allow, type, propertySetType, false, InheritanceFlags.None, PropagationFlags.None, inheritedObjectType)
		{
		}
        private void AddInternalWatchedListProperty(CodeTypeDeclaration typeDeclaration, CodeTypeReference propertyTypeReference, string propertyName, string fieldName, bool implementPropertyChanged, bool implementPropertyChanging, PropertyAccess propertyAccess)
        {
            CodeMemberProperty property = new CodeMemberProperty();
            property.Name = propertyName + "Internal";
            property.Type = propertyTypeReference;

            var list = new CodePropertyReferenceExpression(new CodeFieldReferenceExpression(null, fieldName), "List");

            property.GetStatements.Add(new CodeMethodReturnStatement(list));

            // If the user specifies that they access the data through the property, then we
            // would want the change events to fire as if the property was being set.  If the
            // field is being accessed directly, we want to avoid the change events.

            if (implementPropertyChanging && propertyAccess == PropertyAccess.Property)
                property.SetStatements.Add(new CodeMethodInvokeExpression(null, Context.Model.PropertyChangingMethodName, new CodePrimitiveExpression(propertyName)));

            property.SetStatements.Add(new CodeAssignStatement(list, new CodeArgumentReferenceExpression("value")));

            if (implementPropertyChanged && propertyAccess == PropertyAccess.Property)
                property.SetStatements.Add(new CodeMethodInvokeExpression(null, Context.Model.PropertyChangedMethodName, new CodePrimitiveExpression(propertyName)));

            typeDeclaration.Members.Add(property);
        }
 public PropertyAccessRule(
     IdentityReference identity,
     AccessControlType type,
     PropertyAccess access,
     ActiveDirectorySecurityInheritance inheritanceType)
     : base(
         identity,
         (int)PropertyAccessTranslator.AccessMaskFromPropertyAccess(access),
         type,
         Guid.Empty, // all properties
         false,
         ActiveDirectoryInheritanceTranslator.GetInheritanceFlags(inheritanceType),
         ActiveDirectoryInheritanceTranslator.GetPropagationFlags(inheritanceType),
         Guid.Empty)
 {
 }
Exemple #55
0
		PropertyAccessExpression EvaluatePropertyExpression (int start, int end)
		{
			// member access
			int dotAt = source.LastIndexOf ('.', end, end - start);
			int colonsAt = source.LastIndexOf ("::", end, end - start, StringComparison.Ordinal);
			if (dotAt < 0 && colonsAt < 0) {
				// property access without member specification
				int parenAt = source.IndexOf ('(', start, end - start);
				string name = parenAt < 0 ? source.Substring (start, end - start) : source.Substring (start, parenAt - start);
				var access = new PropertyAccess () {
					Name = new NameToken () { Name = name },
					TargetType = PropertyTargetType.Object
					};
				if (parenAt > 0) { // method arguments
					start = parenAt + 1;
					access.Arguments = ParseFunctionArguments (ref start, end);
				}
				return new PropertyAccessExpression () { Access = access };
			}
			if (colonsAt < 0 || colonsAt < dotAt) {
				// property access with member specification
				int mstart = dotAt + 1;
				int parenAt = source.IndexOf ('(', mstart, end - mstart);
				string name = parenAt < 0 ? source.Substring (mstart, end - mstart) : source.Substring (mstart, parenAt - mstart);
				var access = new PropertyAccess () {
					Name = new NameToken () { Name = name },
					TargetType = PropertyTargetType.Object,
					Target = dotAt < 0 ? null : Parse (start, dotAt).FirstOrDefault () 
				};
				if (parenAt > 0) { // method arguments
					start = parenAt + 1;
					access.Arguments = ParseFunctionArguments (ref start, end);
				}
				return new PropertyAccessExpression () { Access = access };
			} else {
				// static type access
				string type = source.Substring (start, colonsAt - start);
				if (type.Length < 2 || type [0] != '[' || type [type.Length - 1] != ']')
					throw new InvalidProjectFileException (string.Format ("Static function call misses appropriate type name surrounded by '[' and ']' at {0} in \"{1}\"", start, source));
				type = type.Substring (1, type.Length - 2);
				start = colonsAt + 2;
				int parenAt = source.IndexOf ('(', start, end - start);
				string member = parenAt < 0 ? source.Substring (start, end - start) : source.Substring (start, parenAt - start);
				if (member.Length == 0)
					throw new InvalidProjectFileException ("Static member name is missing");
				var access = new PropertyAccess () {
					Name = new NameToken () { Name = member },
					TargetType = PropertyTargetType.Type,
					Target = new StringLiteral () { Value = new NameToken () { Name = type } }
				};
				if (parenAt > 0) { // method arguments
					start = parenAt + 1;
					access.Arguments = ParseFunctionArguments (ref start, end);
				}
				return new PropertyAccessExpression () { Access = access };
			}
		}
        internal static int AccessMaskFromPropertyAccess(PropertyAccess access)
        {
            int accessMask = 0;

            if (access < PropertyAccess.Read || access > PropertyAccess.Write)
            {
                throw new InvalidEnumArgumentException("access", (int)access, typeof(PropertyAccess));
            }

            switch (access)
            {
                case PropertyAccess.Read:
                    {
                        accessMask = ActiveDirectoryRightsTranslator.AccessMaskFromRights(ActiveDirectoryRights.ReadProperty);
                        break;
                    }

                case PropertyAccess.Write:
                    {
                        accessMask = ActiveDirectoryRightsTranslator.AccessMaskFromRights(ActiveDirectoryRights.WriteProperty);
                        break;
                    }

                default:

                    //
                    // This should not happen. Indicates a problem with the 
                    // internal logic.
                    //
                    Debug.Fail("Invalid PropertyAccess value");
                    throw new ArgumentException("access");
            }
            return accessMask;
        }
        private CodeMemberField GetMemberField(string name, string fieldType, Accessor accessor, PropertyAccess access)
        {
            CodeMemberField memberField = GetMemberFieldWithoutType(name, accessor, access);

            memberField.Type = new CodeTypeReference(fieldType);

            return memberField;
        }
 // Constructors
 public PropertySetAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.AccessControlType type, PropertyAccess access, System.Guid propertySetType)
 {
 }
        private CodeMemberField GetMemberFieldWithoutType(string name, Accessor accessor, PropertyAccess access)
        {
            CodeMemberField memberField = GetMemberFieldWithoutTypeAndName(accessor);

            memberField.Name = NamingHelper.GetName(name, access, _model.CaseOfPrivateFields);

            return memberField;
        }
 public PropertySetAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.AccessControlType type, PropertyAccess access, System.Guid propertySetType, ActiveDirectorySecurityInheritance inheritanceType)
 {
 }