示例#1
0
        public static void DoDiscovery(string path, sharptest.ModLibrary library)
        {
            string[] dllList = Directory.GetFiles(path, "*.dll", SearchOption.TopDirectoryOnly);
            for (int idx = 0; idx < dllList.Length; idx++)
            {
                IntPtr hModule = LoadLibrary(dllList[idx]);
                if (hModule != IntPtr.Zero)
                {
                    CppProxyModuleDriver module = null;
                    try
                    {
                        module = new CppProxyModuleDriver(dllList[idx], hModule);
                    }
                    catch (Exception)
                    {
                        FreeLibrary(hModule);
                        continue;
                    }

                    signals.IBlockDriver[] drivers = module.Drivers;
                    if (drivers != null)
                    {
                        for (int didx = 0; didx < drivers.Length; didx++)
                        {
                            library.add(drivers[didx]);
                        }
                    }

                    signals.IFunctionSpec[] funcs = module.Functions;
                    if (funcs != null)
                    {
                        for (int fidx = 0; fidx < funcs.Length; fidx++)
                        {
                            library.add(funcs[fidx]);
                        }
                    }
                }
            }
        }
示例#2
0
 public CppProxyFunctionSpec(CppProxyModuleDriver parent, IntPtr native)
 {
     if (parent == null) throw new ArgumentNullException("parent");
     if (native == IntPtr.Zero) throw new ArgumentNullException("native");
     m_parent = parent;
     m_nativeRef = native;
     Registration.storeObject(native, this);
     m_native = (Native.IFunctionSpec)CppNativeProxy.CreateCallout(native, typeof(Native.IFunctionSpec));
     interrogate();
 }