Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 C#4.0 DLL Managed reflection , +
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 10:09am
Edited 7-Jan-12 11:25am
v2

1 solution

Rate this: bad
good
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
}
 
//usage:

ElementContainer container = new ElementContainer(/*...*/);
container.Add(/*...*/);
contaner.AddRange(/*...*/);
Element myElement = container[3]; // :-)
 
—SA
  Permalink  
v4
Comments
Yukiiii at 7-Jan-12 19:52pm
   
Thank you, just what i needed!
SAKryukov at 8-Jan-12 0:18am
   
Sure, you are welcome.
Good luck, call again.
--SA

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

  Print Answers RSS
0 OriginalGriff 584
1 Maciej Los 275
2 DamithSL 233
3 Sergey Alexandrovich Kryukov 209
4 BillWoodruff 200
0 OriginalGriff 6,803
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,421
3 Manas Bhardwaj 4,841
4 Maciej Los 4,330


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 8 Jan 2012
Copyright © CodeProject, 1999-2014
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