示例#1
0
        public bool ShouldSkip(EventKey evt, InheritMap map, bool keepPublicApi, bool hidePrivateApi, bool markedOnly, out string message)
        {
            // skip runtime special events
            if (evt.Event.IsRuntimeSpecialName) {
                message = "runtime special name";
                return true;
            }

            var attribute = evt.Event.MarkedToRename ();
            // skip runtime methods
            if (attribute != null) {
                message = "attribute";
                return !attribute.Value;
            }

            var parent = evt.DeclaringType.MarkedToRename ();
            if (parent != null) {
                message = "type attribute";
                return !parent.Value;
            }

            if (markedOnly) {
                message = "MarkedOnly option in configuration";
                return true;
            }

            if (ShouldForce (evt.TypeKey, TypeAffectFlags.AffectEvent, map)) {
                message = "type rule in configuration";
                return false;
            }

            if (forceEvents.IsMatch (evt, map)) {
                message = "event rule in configuration";
                return false;
            }

            if (ShouldSkip (evt.TypeKey, TypeAffectFlags.AffectEvent, map)) {
                message = "type rule in configuration";
                return true;
            }

            if (skipEvents.IsMatch (evt, map)) {
                message = "event rule in configuration";
                return true;
            }

            if (evt.DeclaringType.IsTypePublic () && evt.Event.IsPublic ()) {
                message = "KeepPublicApi option in configuration";
                return keepPublicApi;
            }

            message = "HidePrivateApi option in configuration";
            return !hidePrivateApi;
        }
示例#2
0
        private void DumpEvent( TextWriter writer, EventKey key, ObfuscatedThing info )
        {
            if ( info.Status == ObfuscationStatus.Renamed )
                writer.WriteLine( "\t{0} {1} -> {2}", key.Type, info.Name, info.StatusText );
            else
            {
                Debug.Assert( info.Status == ObfuscationStatus.Skipped,
                    "Status is expected to be either Renamed or Skipped." );

                writer.WriteLine( "\t{0} {1} skipped:  {2}", key.Type, info.Name, info.StatusText );
            }
        }
示例#3
0
 private void DumpEvent( XmlWriter writer, EventKey key, ObfuscatedThing info )
 {
     if (info.Status == ObfuscationStatus.Renamed)
     {
         writer.WriteStartElement("renamedEvent");
         writer.WriteAttributeString("oldName", info.Name);
         writer.WriteAttributeString("newName", info.StatusText);
         writer.WriteEndElement();
         writer.WriteString("\r\n");
     }
     else
     {
         writer.WriteStartElement("skippedEvent");
         writer.WriteAttributeString("name", info.Name);
         writer.WriteAttributeString("reason", info.StatusText);
         writer.WriteEndElement();
         writer.WriteString("\r\n");
     }
 }
示例#4
0
		public void UpdateEvent(EventKey key, ObfuscationStatus status, string text)
		{
			ObfuscatedThing m = GetEvent(key);

			m.Update(status, text);
		}
示例#5
0
        public bool ShouldSkip(EventKey evt, InheritMap map, bool keepPublicApi, bool hidePrivateApi, bool markedOnly, out string message)
        {
            // skip runtime special events
            if (evt.Event.IsRuntimeSpecialName)
            {
                message = "runtime special name";
                return(true);
            }

            var attribute = evt.Event.MarkedToRename();

            // skip runtime methods
            if (attribute != null)
            {
                message = "attribute";
                return(!attribute.Value);
            }

            var parent = evt.DeclaringType.MarkedToRename();

            if (parent != null)
            {
                message = "type attribute";
                return(!parent.Value);
            }

            if (markedOnly)
            {
                message = "MarkedOnly option in configuration";
                return(true);
            }

            if (ShouldForce(evt.TypeKey, TypeAffectFlags.AffectEvent, map))
            {
                message = "type rule in configuration";
                return(false);
            }

            if (forceEvents.IsMatch(evt, map))
            {
                message = "event rule in configuration";
                return(false);
            }

            if (ShouldSkip(evt.TypeKey, TypeAffectFlags.AffectEvent, map))
            {
                message = "type rule in configuration";
                return(true);
            }

            if (skipEvents.IsMatch(evt, map))
            {
                message = "event rule in configuration";
                return(true);
            }

            if (evt.DeclaringType.IsTypePublic() && evt.Event.IsPublic())
            {
                message = "KeepPublicApi option in configuration";
                return(keepPublicApi);
            }

            message = "HidePrivateApi option in configuration";
            return(!hidePrivateApi);
        }
示例#6
0
		public ObfuscatedThing GetEvent(EventKey key)
		{
			ObfuscatedClass c = GetClass(key.TypeKey);

			ObfuscatedThing t;
			if (!c.Events.TryGetValue(key, out t))
			{
				t = new ObfuscatedThing(key.ToString());
				c.Events[key] = t;
			}

			return t;
		}
示例#7
0
		public bool ShouldSkip(EventKey evt, InheritMap map)
		{
			if (ShouldSkip(evt.TypeKey, TypeSkipFlags.SkipEvent, map))
				return true;

			return skipEvents.IsMatch(evt, map);
		}
示例#8
0
        public void UpdateEvent(EventKey key, ObfuscationStatus status, string text)
        {
            ObfuscatedThing m = GetEvent(key);

            m.Update(status, text);
        }
示例#9
0
 private void DumpEvent(int tabs, EventKey key, ObfuscatedThing @event, bool isLast)
 {
     WriteLine(tabs, $"\"{GetRawTypeName(key.TypeKey)} {key.Name}\": \"{@event.StatusText}\"{(isLast ? "" : ",")}");
 }
示例#10
0
        internal bool ShouldSkip(EventKey evt)
        {
            if (ShouldSkip(evt.TypeKey, TypeSkipFlags.SkipEvent))
                return true;

            return skipEvents.IsMatch( evt );
        }