Jump to content

Attempting to Rebuild an Old plugin


Recommended Posts

@Simon Brown

 

I have been able to decompile and import into VB 2019 one of your failing plugins. CustomFrame.dll.

No errors show in any of the files and all references have been linked. I have 2 problems.

When I debug, it generates an error message that I can't fix or understand. It sounds like a known issue with no solution.

The dll does compile, but will not load into the beta version of Paint.Net 4.300.7906.2652

 

I was able to rebuild one dll with success (just to learn the process), however I am stuck on this one. Any help would be appreciated. Think of it as a learning curve for me. 

I would think this procedure could be applied to all the failed plugins that the Authors have abandoned.

"ZIP Removed"

Seems we have more programmers than artists lately. Any help would be appreciated.

Edited by AndrewDavid
Removed ZIP

Signature2018.png

 

Link to comment
Share on other sites

36 minutes ago, toe_head2001 said:

You're trying to compile it with v3.36 paint.net assemblies

I had to link the DLL to them to get it to decompile.

 

37 minutes ago, toe_head2001 said:

TargetFramework from net48 to net5.0-windows

My VB2019 will only see 4.8 even though I have Net5.0 installed.

 

40 minutes ago, toe_head2001 said:

and use the v4.3 assemblies

And that's when the project fills with errors.

And that's why I'm stuck

 

Thanks for looking @toe_head2001

Signature2018.png

 

Link to comment
Share on other sites

Posted (edited)

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> is what it says

OK I changed it to "net5.0-windows" and it didn't like it very much. 

Now I get this

image.png.05cee1428d888acba7048f3fed0d7f8c.png

image.png.9a4375087d1d38a444518f3262fb9f14.png

Now to find that json file...

Edited by AndrewDavid

Signature2018.png

 

Link to comment
Share on other sites

Oh Yes. Everything in that list is installed. I did manage to change all the references to 4.3. It generated some simple errors intelligence was able to correct. However there are now too many errors for me to debug. I appreciate the fact the plugin was built on earlier versions of the assemblies and they have been depreciated. That's where a professional is needed to modify the syntax to current language formats. Back to the C# tutorials.

 

1 hour ago, AndrewDavid said:

OK I changed it to "net5.0-windows" and it didn't like it very much. 

 

My first line reads Microsoft.NET.Sdk.WindowsDesktop. If I change it to net5.0-windows the project file won't load and I get all kinds of errors.

I was changing it in the wrong place.     <TargetFramework>net5.0</TargetFramework> is where I changed it.

I am getting practice though and I will get better over time (I Hope). Perhaps I picked a plugin that was too old. 

Thanks for the help. Get some sleep :)

 

Signature2018.png

 

Link to comment
Share on other sites

@Rick Brewster

I took a whole new approach to building the plugin this time and it worked a lot better. Sort of built it from square one. It is posted to GitHub now. My Username is AndrewDavid007 / CustomFrame. Some of the errors I was able to fix, but the ones remaining are beyond my knowledge. I also think you might be interested in seeing the items that are referenced in 4.3 Libraries that are not in 5.0.

 

Should be quick easy fixes for you. Anything else I can do, let me know.

  • Like 1

Signature2018.png

 

Link to comment
Share on other sites

OK now I'm lost. I did my part on GitHub, Cloned it to a new GitHub folder on my machine and I see everything is locked (Safety is paramount). I synced in my VBE and still see everything is locked. Is his my doing or yours @toe_head2001?

On GitHub I see Release and Publish. Do I click on those? What are the next steps? I tried to debug but the dll file is too small (9kb) to be correct. At the end of debug it asked me to link it to a executable and make it the startup app. When I try to edit project file I don't get that screen. (Locked out I assume).

So what am I missing?

Signature2018.png

 

Link to comment
Share on other sites

Posted (edited)

The little blue icons have appeared. They look like locks. I just figured it out. Source Control was set to GIT. Changed it to none and the locks disappear.

image.png.30b5deb0a65567f84184a79b54acecab.png

VBE = Visual Basic Environment (Visual Studio 2019 Preview)

Edited by AndrewDavid

Signature2018.png

 

Link to comment
Share on other sites

 

Nothing is locked.  The blue icon indicates that the file is checked into source control (git).  i.e. no pending edits that need to be committed.

 

For debugging, you can follow these steps. The screenshots are outdated, but the information is still correct.

https://forums.getpaint.net/topic/4209-how-to-debug-your-plugin/

 

20 minutes ago, AndrewDavid said:

VBE = Visual Basic Environment (Visual Studio 2019 Preview)

 

Okay... but you're not using Visual Basic; you're using C#.

 

 

Link to comment
Share on other sites

Well the debugging is going well. First of all this is the error message from paint

 

Spoiler

System.Resources.MissingManifestResourceException
  HResult=0x80131532
  Message=Could not find the resource "CustomFrame.Properties.Resources.resources" among the resources "" embedded in the assembly "CustomFrame", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.

 

I also see a problem related to icons. The project is looking for the .png files I think. In what folder should they be placed? Is there a naming convention I have to follow? 

If that's the case or do I need to do something else.

 

When I debug it stops at line 18 in EffectPlugin.cs

18                    public static Bitmap StaticIcon => Resources.cficon;

 

 

Baby steps. You did not answer my questions about GitHub. Or do I have to get all the bugs worked out?

Signature2018.png

 

Link to comment
Share on other sites

9 minutes ago, AndrewDavid said:

The project is looking for the .png files I think. In what folder should they be placed? Is there a naming convention I have to follow? 

 

You can name things whatever you want.  Place your text caret on cficon in line 18, and press F12. That will take you to the definition, and you can modify it accordingly.

You can also double click on the Resources file within the Solution Explorer, and you can modify it using a GUI.

 

9 minutes ago, AndrewDavid said:

You did not answer my questions about GitHub

 

Those buttons on Github? Those are just for version tagging within source control. There's no need to do that, unless you really want to.

Link to comment
Share on other sites

Still no help. Perhaps you have some tools installed that I don't. Double clicking on it just takes me to the resource file and highlighting "Resource".

image.png.5189614d89af9fb8e2f2edb34c672e75.png

Error still exists

 

Spoiler

  Message=Could not find the resource "CustomFrame.Properties.Resources.resources" among the resources "" embedded in the assembly "CustomFrame", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.

 

I'm officially stuck :)

Signature2018.png

 

Link to comment
Share on other sites

I downloaded the protect as zip and could build it (after removing three dead references to System.XXX in CustomFrame/Dependencies/Assemblies).

 

The icons are located in resources.cs which uses the namespace CustomFrame.Properties. This namespace embeds the class Resources which contains the embedded icons.

 

 

midoras signature.gif

Link to comment
Share on other sites

@midora Thanks for the help. Overnight @toe_head2001 made a few changes and I just added another one to GitHub.

When you say "build it" do you mean build the project file? The current issue is trying to get the dll to work. Have you been able to successfully debug it?

The current error I am getting is;

 

Spoiler

Exception thrown: 'System.Resources.MissingManifestResourceException' in System.Private.CoreLib.dll
An exception of type 'System.Resources.MissingManifestResourceException' occurred in System.Private.CoreLib.dll but was not handled in user code
Could not find the resource "CustomFrame.Properties.Resources.resources" among the resources "" embedded in the assembly "CustomFrame", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.

 

That's where I am stuck. When debugging, it gives that error on line 18 of EffectPlugin.cs

I didn't think rebuilding an old plugin would be so difficult. But it is a good learning experience. 

Any help you can provide in debugging this would be greatly appreciated. No reason why you can't join us on GitHub as well. :)

 

Signature2018.png

 

Link to comment
Share on other sites

CustomFrame.DLL

 

There was a resource file under selectframe.cs / (I deleted it too but I think I still need it)

Followed your suggestion and found the resource file the decompiler created. I must of added it to selectframe.cs in error (I do make mistakes)

I learned there is a big difference between copying and pasting and or Add new/existing item to a project.

 

And now the good news :)

It successfully built the dll that now runs in Paint.net

It doesn't do what the old plugin did so I'm not out of the woods yet. From what I remember, you could open a premade png file to create the custom frame.

Although working, it doesn't give that option. I've pushed the changes to GitHub and await your thoughts on this matter.

This is where Selectframe.cs comes in. I think that was the functionality it provided.

Signature2018.png

 

Link to comment
Share on other sites

Another way to extract the resources is to run ildasm at the command-line.

 

ildasm customframe.dll /all /out=customframe.il

 

The resources will be put in separate files. PDN comes with ildasm.exe now so you won’t have to go fishing for it.

 

(ildasm as in “IL Disassembler”, IL as in “intermediate language,” the byte code that .NET runs)

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

@Rick Brewster @toe_head2001

JusttifyText.DLL

 

Uploaded another broken plugin to GitHub for determining what is causing the failure of the plugin's menu attempt to save/load files. Definitely need help for this one.

I can't even find the source code for that functionality. I have been able to create the DLL correctly, I have updated it to run on net5.0-windows and hope you can resolve this loss of functionality. There are about six more plugins that fail in the same manner, so I hope when we determine the correct code for this one, it can be applied to the others.

image.png.cb13da145435f33ce333739c79b03989.png

This is the error 

Signature2018.png

 

Link to comment
Share on other sites

30 minutes ago, toe_head2001 said:

Where on the forum can I find this plugin? I can't find it in the plugin index.

Buried in Unfinished plugins

30 minutes ago, toe_head2001 said:

What tool are you using for de-compilation?

ILSpy.exe

 

Signature2018.png

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...