/// <summary>
        /// Tries to find a disassembled entity, given a disassembled target.
        /// </summary>
        /// <param name="disassemblyTarget">The disassembly target.</param>
        /// <returns></returns>
        public DisassembledEntity FindDisassembledEntity(DisassemblyTarget disassemblyTarget)
        {
            //  If there's no target, we can't find anything.
            if (disassemblyTarget == null)
            {
                return(null);
            }

            switch (disassemblyTarget.TargetType)
            {
            case DisassemblyTargetType.Class:

                //  Find the class with the given name.
                return(AllClasses.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));

            case DisassemblyTargetType.Enumeration:

                //  Find the enumeration with the given name.
                return(AllEnumerations.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));

            case DisassemblyTargetType.Method:

                //  Find the entity with the given name.
                return(AllMethods.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));

            case DisassemblyTargetType.Property:

                //  Find the entity with the given name.
                return(AllProperties.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));

            case DisassemblyTargetType.Field:

                //  Find the entity with the given name.
                return(AllFields.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));

            case DisassemblyTargetType.Structure:

                //  Find the structure with the given name.
                return(AllStructures.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));

            case DisassemblyTargetType.Interface:

                //  Find the structure with the given name.
                return(AllInterfaces.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));

            case DisassemblyTargetType.Event:

                //  Find the structure with the given name.
                return(AllEvents.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));

            case DisassemblyTargetType.Delegate:

                //  Find the structure with the given name.
                return(AllDelegates.FirstOrDefault(c => c.FullName == disassemblyTarget.FullName));


            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemple #2
0
    void MapStructuresCatego()
    {
        var infrastructure = StInfr.GetValues(typeof(StInfr));
        var housing        = StHous.GetValues(typeof(StHous));
        var farming        = StFarm.GetValues(typeof(StFarm));
        var raw            = StRaw.GetValues(typeof(StRaw));
        var production     = StProd.GetValues(typeof(StProd));
        var industry       = StInd.GetValues(typeof(StInd));
        var trade          = StTrade.GetValues(typeof(StTrade));
        var govServ        = StGov.GetValues(typeof(StGov));
        var other          = StOther.GetValues(typeof(StOther));
        var mil            = StMil.GetValues(typeof(StMil));
        var structCateg    = StCat.GetValues(typeof(StCat));
        var dec            = StDec.GetValues(typeof(StDec));


        MenuGroupsList = UList.ConvertToList(structCateg);

        List <List <H> > listedArrays = new List <List <H> >();

        listedArrays.Add(UList.ConvertToList(infrastructure));
        listedArrays.Add(UList.ConvertToList(housing));
        listedArrays.Add(UList.ConvertToList(farming));
        listedArrays.Add(UList.ConvertToList(raw));
        listedArrays.Add(UList.ConvertToList(production));
        listedArrays.Add(UList.ConvertToList(industry));
        listedArrays.Add(UList.ConvertToList(trade));
        listedArrays.Add(UList.ConvertToList(govServ));
        listedArrays.Add(UList.ConvertToList(other));
        listedArrays.Add(UList.ConvertToList(mil));
        listedArrays.Add(UList.ConvertToList(dec));


        for (int i = 0; i < MenuGroupsList.Count; i++)
        {
            _structuresDict.Add(MenuGroupsList[i], listedArrays[i]);
        }

        foreach (KeyValuePair <H, List <H> > entry in StructuresDict)
        {
            for (int i = 0; i < entry.Value.Count; i++)
            {
                AllStructures.Add(entry.Value[i]);
            }
        }
    }