Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New method of loading icon sprite. #22

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Higgs1
Copy link

@Higgs1 Higgs1 commented May 2, 2022

Hewwos again :D

I think I've settled on a slightly different way of loading in the sprite for Roo. It's not a major change, but I'm gonna use this method for my mods in the future, if at the very least just because it looks sleeker in my opinion (unless it turns out that it's actually rally bad).

know the git diff will show the differences, but lemme explain:

  • Assembly.GetExecutingAssembly().GetManifestResourceStream("icon") -> GetType().Assembly.GetManifestResourceStream("icon") removes the need for the using System.Reflection;
  • stream.Read(imgData, 0, (int) stream.Length); -> new byte[stream.Length] removes the need for the explicit cast, since new byte[stream.Length] does so implicitly.
  • using (...) { ... } -> using ...; just looks shorter. Produces the exact same bytecode though (try/catch/finally block).

As always, up to you! Just though I'd share what I discovered (still learning Microsoft's SDK). Thanks again for making the mod in the first place!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant