Click here to Skip to main content
13,089,536 members (70,787 online)
Rate this:
Please Sign up or sign in to vote.
See more: , +
The DLL:

public static List<byte[]> RequestDialoge(int NPCID,int Control)
            List<byte[]> CombinedPacket = new List<byte[]>();
            CombinedPacket = Dialoge.Create(NPCID, Control);
            return CombinedPacket;

How i want to use it:

int NPCID = BitConverter.ToInt32(Packet, 4);
                            int Control = (int)Packet[10];
                            Cli.CurrentNPC = NPCID;
                            object[] Data = new object[2];
                            Data[0] = NPCID;
                            Data[1] = Control;
                            Assembly assembly = Assembly.LoadFile(@"Y:\OS Share\C#\DynamicNpcDialoge.dll\bin\Debug\DynamicNpcDialoge.dll");
                            Type T = assembly.GetType("DynamicNpcDialoge.dll.DynamicNpcDialog");
                            MethodInfo foo = T.GetMethod("RequestDialoge");
                            object Packers = foo.Invoke(T, Data);  

Got my solution already, i was just thinking too complicated

List<byte[]> packets = Packers as List<byte[]>;

Packers now becomes count 5
Every of that 5 contains a byte array,

however, i dont know how to access them...

Any Ideas?
Posted 7-Jan-12 9:09am
Updated 7-Jan-12 10:25am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Your code is not quite clear to me, but providing a data structure that looks like an array for a user and is not an array in implementation is quite easy:

internal struct Element {/*..*/} //or class
class ElementContainer {
    internal Element Add(Element element) {/*...*/ return element; }
    internal void AddRange(Element[] elements) {/*...*/}
    internal Element this[int index] { get { return GetElement; } }
    #region implementation
        Element GetElement(int index) {/*...*/}
        //all complexity is hidden here :-)
    #endregion implementation
ElementContainer container = new ElementContainer(/*...*/);
Element myElement = container[3]; // :-)

Yukiiii 7-Jan-12 19:52pm
Thank you, just what i needed!
SAKryukov 8-Jan-12 0:18am
Sure, you are welcome.
Good luck, call again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 8 Jan 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100