Red Gate forums :: View topic - This is Resource file or not?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
.Net Reflector 6.x and .NET Reflector 6.x Pro
.Net Reflector 6.x and .NET Reflector 6.x Pro forum

This is Resource file or not?

Search in .Net Reflector 6.x and .NET Reflector 6.x Pro forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
lopin123



Joined: 07 Nov 2010
Posts: 5

PostPosted: Tue Feb 15, 2011 9:09 am    Post subject: This is Resource file or not? Reply with quote

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:
[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:
[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....
Back to top
View user's profile Send private message
haleyjason



Joined: 25 Oct 2008
Posts: 78
Location: Seattle, WA

PostPosted: Wed Feb 16, 2011 3:01 am    Post subject: base class Reply with quote

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.
Back to top
View user's profile Send private message
lopin123



Joined: 07 Nov 2010
Posts: 5

PostPosted: Wed Feb 16, 2011 4:05 am    Post subject: Reply with quote

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

Code:
 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?
Back to top
View user's profile Send private message
haleyjason



Joined: 25 Oct 2008
Posts: 78
Location: Seattle, WA

PostPosted: Thu Feb 17, 2011 1:21 pm    Post subject: Still don't know Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group