private static CodeProperty2[] GetExistingSets(CodeClass2 cls)
        {
            var setProps = cls.GetProperties()
                .Where(p => p.Type.AsFullName.StartsWith(_GetExistingSets_DbsetTypeName));

            return setProps.ToArray();
        }
Esempio n. 2
0
        public static CodeProperty2[] GetAutoProperties(this CodeClass2 cls)
        {
            var props = cls.GetProperties().ToArray();
            Func <CodeProperty, bool> isAutoProperty = x => !x.Setter.GetText().Contains("{");

            return(props.Where(x => x.ReadWrite == vsCMPropertyKind.vsCMPropertyKindReadWrite &&
                               isAutoProperty(x) && x.OverrideKind != vsCMOverrideKind.vsCMOverrideKindAbstract).ToArray());
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>Array of invalid properties</returns>
        /// <remarks></remarks>
        public string[] ValidateExtraNotifications(CodeClass2 cc, string[] extras)
        {
            var propNames = new HashSet <string>(cc.GetProperties().Select((x) => x.Name));
            var invalids  = extras.Where((x) => !(propNames.Contains(x))).ToArray();

            if (invalids.Any())
            {
                return(invalids);
            }

            ExtraNotifications = string.Join(", ", extras);
            return(new string[0]); //return empty array
        }
Esempio n. 4
0
        public void WritePropertyNames(CodeClass2 cls)
        {
            var props  = cls.GetProperties().Select(p => p.ToPropertyInfo()).ToArray();
            var output = new System.IO.StringWriter();

            GenEnum(output, props, true);

            var writer = Manager.CreateWriter();

            writer.Class       = cls;
            writer.SegmentType = SegmentTypes.Region;
            writer.SearchStart = cls.StartPoint;
            writer.SearchEnd   = cls.EndPoint;
            writer.OptionTag   = new ManagerType.OptionTag()
            {
                Version = Version, RegenMode = RegenModes.Always, Trigger = new TriggerInfo(TriggerTypes.CodeSnippet)
            };
            writer.Content     = output.ToString();
            writer.InsertStart = cls.GetStartPoint(vsCMPart.vsCMPartBody);
            writer.InsertOrReplace();
        }
        public void WritePropertyNames(CodeClass2 cls)
        {
            var props = cls.GetProperties().Select(p => p.ToPropertyInfo()).ToArray();
            var output = new System.IO.StringWriter();
            GenEnum(output, props, true);

            var writer = Manager.CreateWriter() ;
            writer.Class = cls;
            writer.SegmentType = SegmentTypes.Region;
            writer.SearchStart = cls.StartPoint;
            writer.SearchEnd = cls.EndPoint;
            writer.OptionTag = new ManagerType.OptionTag() { Version = Version, RegenMode = RegenModes.Always, Trigger = new TriggerInfo( TriggerTypes.CodeSnippet)};
            writer.Content = output.ToString();
            writer.InsertStart =cls.GetStartPoint(vsCMPart.vsCMPartBody);
            writer.InsertOrReplace();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns>Array of invalid properties</returns>
        /// <remarks></remarks>
        public string[] ValidateExtraNotifications(CodeClass2 cc, string[] extras)
        {
            var propNames = new HashSet<string>(cc.GetProperties().Select((x) => x.Name));
            var invalids = extras.Where((x) => !(propNames.Contains(x))).ToArray();
            if (invalids.Any()) {
                return invalids;
            }

            ExtraNotifications = string.Join(", ", extras);
            return new string[0]; //return empty array
        }