public override CrayonWorkerResult DoWorkImpl(CrayonWorkerResult[] args)
 {
     LibraryMetadata[] allLibraries = new LibraryFinder().LibraryFlatList;
     return(new CrayonWorkerResult()
     {
         Value = allLibraries
     });
 }
Example #2
0
        public MainWindow()
        {
            InitializeComponent();
            ConfigureScintilla();

            finder = new LibraryFinder(@"D:\Software\Arduino", @"E:\GitHub Repositories\twometer-iot\Library");
            parser = new Parser(finder);

            LoadFile(@"E:\GitHub Repositories\twometer-iot\Library\TwometerIoT.h");
        }
Example #3
0
        public static IntPtr Load(Type ofType, bool rtldGlobal = true)
        {
            object[] attributes = ofType.GetCustomAttributes(typeof(LibraryAttribute), false);
            if (attributes.Length == 0)
            {
                throw new ArgumentNullException("Type '" + ofType.Name + "' is missing LibraryAttribute.");
            }

            #region Find library
            LibraryAttribute libAttribute = (LibraryAttribute)attributes[0];
            string           filename     = LibraryFinder.Resolve(libAttribute.Name, libAttribute.SearchOptions, libAttribute.CustomRoot);
            #endregion

            #region Open library
            IntPtr libraryPtr = IntPtr.Zero;

            if (!File.Exists(filename))
            {
                throw new DllNotFoundException(filename);
            }

            libraryPtr = Open(filename, rtldGlobal ? RTLD_NOW : RTLD_GLOBAL | RTLD_NOW);

#if DEBUG
            ConsoleColor oldFG = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine(filename);
            Console.WriteLine("\t|");
            Console.WriteLine("\t-> (0x{0})", libraryPtr.ToString("X16"));
            Console.WriteLine();
            Console.ForegroundColor = oldFG;
#endif
            #endregion

            CilHelper.LinkAllExternalMethods(ofType, libraryPtr);

            return(libraryPtr);
        }
Example #4
0
 public Parser(LibraryFinder libraryFinder)
 {
     this.libraryFinder = libraryFinder;
 }