Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

My resource would not be linked in my project bug

Hi,

I kill my skull for a few hours now with an incoherent bug ... be saying my resource would not be linked in my project, while it is well ...

If someone can help me ... because I do not understand anything about all this error and google is not my friends

Here is a screen via dnspy for view resources i here and bug is here:

[Image: 175068Capture.png]


and the functions I use to write and read in my resources ...

Builder side:
Code
string NameResFile = Utils.Settings.RandomString(rand.Next(5, 25 + 1));
string res1 = Utils.Settings.RandomString(rand.Next(5, 80 + 1));
string ResFile = Path.Combine(Application.StartupPath, NameResFile + ".resources");

using (ResourceWriter Writer = new ResourceWriter(ResFile))
            {
                Writer.AddResource(res1, compress);
                Writer.Generate();
            }
Stub side:
Code
public static byte[] ReadManaged(string RessourceAdded, string filename)
        {
            ResourceManager Manager = new ResourceManager(filename, Assembly.GetExecutingAssembly());
            byte[] bytes = (byte[])Manager.GetObject(RessourceAdded);
            return bytes;
        }
I use ReadManaged like that:

Code
byte[] myRes = ReadManaged("GoiqViIZBLCDeZlackUfLySPXzEpyCNcRZZOWzGYRyI", "IfoTjzHillpCiyJeg");

I thank all those who can help me
These resources should help you

ResourceManager constructor (namespace, assembly)
In your case: ResourceManager("crypted.crypted.Resources", Assembly.GetExecutingAssembly())
https://msdn.microsoft.com/en-us/library....110).aspx

And

ResourceManager.GetObject(object name) method
In your case: resourceManager.GetObject("encrypted payload")
https://msdn.microsoft.com/en-us/library....110).aspx


Also a personal tip, don't declare your resourcemanager on every call to ReadManaged, rather set it class-level and make ReadManaged only call getobject
[Image: Syr3DlV.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by Juice.Mar 10, 2020 07:02 PM 0 136 Mar 10, 2020 07:02 PM
Last Post: Juice.
[C] by g4143Dec 28, 2019 09:24 AM 1 349 Dec 28, 2019 09:24 AM
Last Post: an balker
[Java] by gianniFeb 3, 2018 01:55 PM 2 131 Feb 3, 2018 01:55 PM
Last Post: gianni