This is Resource file or not?

Explore, browse and analyze .NET assemblies

Moderators: Luke Jefferson, Charles Brown, StephenC, Alex.Davies, Greg.Tillman, melvyn.harbour

This is Resource file or not?

Postby lopin123 » Tue Feb 15, 2011 9:09 am

I've been decompiled an aplication to learn about how they handle command. But I do not know exactly what type of the following file.because the file is inherit from superclass that inherit from system.windows.forms.component but also this file have resource (ExploreCommand.Resx) file in reflector.

Resource save image and string to execute command.
Code :

Code: Select all
[DesignerCategory("Accurate Command Binders"), ToolboxItem(true), DesignTimeVisible(true)]
internal class ExplorerCommands : CommandBinder
{
    // Fields
    private static readonly ResourceManager resources = new ResourceManager(typeof(ExplorerCommands));

    // Methods
    protected ExplorerCommands()
    {
    }

    public ExplorerCommands(Control control) : base(control)
    {
    }

    // Properties
    [Browsable(false)]
    public Command AboutAccurate    {
        get
        {
            return base.GetCommandForCaller("AboutAccurate ", "CitraKarya.Bisnis.Akunting.UI.Explorer.AboutAccurate ", "");
        }
    }
AND THIS THE SUPERCLASS :

Code: Select all
[DesignerCategory(""), DesignTimeVisible(false), Designer(typeof(CommandBinderDesigner), typeof(IDesigner)), ProvideProperty("Command", typeof(object)), TypeConverter(typeof(CommandBinderTypeConverter)), ToolboxItem(false)]
public abstract class CommandBinder : Component
{
              // Methods
    protected CommandBinder()
    {
        this.commands = new Dictionary<object, Command>();
        this.InitializeComponent();
    }

    protected CommandBinder(Control parentControl)
    {
        this.commands = new Dictionary<object, Command>();
        this.parentControl = parentControl;
        IComponent component = parentControl;
        if ((component.Site != null) && (component.Site.Container != null))
        {
            component.Site.Container.Add(this);
        }
        this.InitializeComponent();
    }


}

sOMEBOY CAN help me please....
lopin123
 
Posts: 5
Joined: Sun Nov 07, 2010 6:48 pm

base class

Postby haleyjason » Wed Feb 16, 2011 3:01 am

What about the base class's GetCommandForCaller method?

Without seeing everything, my guess is they have done one of the following:
1. stored either serialized code in those resources that they are just extracting and handing back as a command to execute

2. stored binaries in the resources to be extracted and executed as needed

There are other options as well, but my guess would be #1 above. If you look into the GetCommandForCaller it should help.
haleyjason
 
Posts: 78
Joined: Sat Oct 25, 2008 5:34 pm
Location: Seattle, WA

Postby lopin123 » Wed Feb 16, 2011 4:05 am

#haleyJason
Thanks for your quick response. This the Code for GetCommandForCaller :

Code: Select all
 protected Command GetCommandForCaller(string propertyName, string id, string category)
    {
        CommandManager commandManager = CommandManager;
        Command command = null;
        if (commandManager != null)
        {
            command = commandManager.Commands[id];
        }
        if (command == null)
        {
            command = CreateCommand(propertyName, id, category);
            if (commandManager != null)
            {
                commandManager.Commands.Add(command);
                return command;
            }
            CommandsToBeAdded.Add(command);
        }
        return command;
    }


so I can't create ExploreCommand.resx manualy? what do you think?
lopin123
 
Posts: 5
Joined: Sun Nov 07, 2010 6:48 pm

Still don't know

Postby haleyjason » Thu Feb 17, 2011 1:21 pm

Can you create it manually? That depends on what you mean by 'create'. Are you looking to use their code (via reference) or are you trying to build something like it (via inspiration)?

If you're referencing there code, then that shouldn't be a problem.

If you're using the code for inspiration for your own implementation, then you'll really need to understand what they are doing before you will be able to just create your own ... but I'm guessing you knew that.
haleyjason
 
Posts: 78
Joined: Sat Oct 25, 2008 5:34 pm
Location: Seattle, WA


Return to .Net Reflector 6.x and .NET Reflector 6.x Pro

Who is online

Users browsing this forum: No registered users and 0 guests