public RenamedClass(IMappingEntity reader, Mapping owner)
        {
            try
            {
                string nameOld = ProcessName(reader.Name);

                string nameNew = null;

                skipReason = reader.SkipReason;
                if (skipReason == null)
                {
                    nameNew = ProcessName(reader.NewName);
                }

                name = new Renamed(nameOld, nameNew);

                foreach (IMappingEntity subEntity in reader.SubEntities)
                {
                    items.Add(new RenamedItem(subEntity, this));
                }
            }
            catch (ObfuscarParserException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new ObfuscarParserException("Failed to process element", e, reader.Path);
            }
        }
示例#2
0
        public RenamedItem(IMappingEntity reader, RenamedClass owner)
        {
            this.owner = owner;

            try
            {
                this.owner = owner;
                entityType = reader.Type;
                string str = reader.Name;

                int i;
                if ((i = str.IndexOf(' ')) != -1)
                {
                    string s = str.Substring(0, i);
                    int    k = s.IndexOf('/');
                    if (k != -1)
                    {
                        resultType = new RenamedParam(s.Substring(0, k) + "." + s.Substring(k + 1));
                    }
                    else
                    {
                        resultType = new RenamedParam(s);
                    }
                    str = str.Substring(i + 1);
                }

                if ((i = str.IndexOf("::")) != -1)
                {
                    str = str.Substring(i + 2);
                }

                if ((i = str.IndexOf('(')) != -1)
                {
                    methodParams = new List <RenamedParam>();
                    foreach (string s in EntityName.ParseList(str, i + 1, ')'))
                    {
                        int k = s.IndexOf('/');
                        if (k != -1)
                        {
                            methodParams.Add(new RenamedParam(s.Substring(0, k) + "." + s.Substring(k + 1)));
                        }
                        else
                        {
                            methodParams.Add(new RenamedParam(s));
                        }
                    }

                    str = str.Substring(0, i);

                    i = str.IndexOf('[');
                    if (i != -1 && str[i + 2] == ']')
                    {
                        str = str.Substring(0, i);
                    }
                }

                string strNew = reader.NewName;
                if (strNew != "dropped")
                {
                    name = new Renamed(str, strNew);
                }
                else
                {
                    name = new Renamed(str);
                }

                skipReason = reader.SkipReason;
                if (name.NameOld.Name == "ctor")
                {
                    entityType = EntityType.Constructor;
                }
            }
            catch (Exception e)
            {
                throw new ObfuscarParserException("Failed to process item element", e, reader.Path);
            }
        }
示例#3
0
 public Renamed(Renamed nameOld, EntityName nameNew)
 {
     this.nameNew = nameNew;
     this.nameOld = nameOld.nameOld;
 }