This project has moved. For the latest updates, please go here.

how to fasterflect a public method within an internal class?

Sep 29, 2013 at 3:04 AM
Edited Sep 29, 2013 at 3:22 AM
i need to reference this class.
it should already be instantiated.
namespace Ship_Game
{
    internal static class Fonts
    {


        public static SpriteFont Arial12Bold
...
}
my flasterflect skills are pretty weak but this is frustrating as its such a small part of the code.

this is how it is being called in the method i want to get at. the class AgentComponent is in the same namespace as the internal class Fonts.
namespace Stardrive_DevekMod.Mods
{
     class GremlinAgentComponent:AgentComponent
    {
...
public void Draw()
        {
...
this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, "250", costPos, Color.White);
}
I have removed a extra code with the ...'s
Coordinator
Sep 30, 2013 at 12:44 AM
Did you read the documentation already? It explains in great detail how to use Fasterflect to accomplish various tasks.

If you did this already, and are still looking for help, please see this first: http://www.yoda.arachsys.com/csharp/complete.html

Thanks!
Sep 30, 2013 at 5:47 AM
Thanks for the tips. Yeah ok i know almost nothing about reflection or fasterflect. maybe a 100 hours in to this and not much C# but i have got a lot to work.

I am using fasterflect in visual studio and using stardrive.exe as reference source.
my mod exe starts stardrive and then trys to run reflection on some of it methods.

in the stardrive exe there is an internal class with a public member i want to get.
but the internal class doesnt show up as a type.

the documentation examples do not seem to work on there own and i need some kinds of example to see how this works in fasterflect.

It would something like the below but the accessinternal namespace is in another exe trying to get access to the internaltest class and its members via fasteflect. specifically the "x" member.

Does that help?
using System;

namespace internaltestns
{
    internal static class internaltest
    {
        public static string x = "false";
    }
}

namespace accessinternal
{
    public class Test
    {
        static void Main()
        {
            
            string x = internaltestns.internaltest.x;
            Console.WriteLine(x.Length);
        }
    }
}