Exemple #1
0
        private void FindDLLs()
        {
            //// ModuleInfoRetriever infoRetriever = new ModuleInfoRetriever(LookForFile());
            //// ModuleInfoRetriever infoRetriever = new ModuleInfoRetriever();

            // Bring up explorer to allow user to choose a file location
            FileLocation = LookForFile();
            MessageBox.Show(FileLocation);
            ModuleInfoRetriever infoRetriever = new ModuleInfoRetriever();

            // Check the file location for any .dll's
            foreach (var mod in infoRetriever.GetInfoFromDll())
            {
                Modules.Add(new Module(mod.Name, mod.Description, mod.Methods));
            }
        }
        /// <summary>
        /// StoreModules will attempt to get all assemblies from a dll and store it
        /// as a Module in the Modules collection.
        /// </summary>
        private async void StoreModules()
        {
            string moduleDirectory = GetModuleDirectory();

            // If directory selection was cancled, exit this method.
            if (moduleDirectory == null)
            {
                return;
            }

            // add all the files of the assemblies you actually want info from
            string[] dllFiles = Directory.GetFiles(moduleDirectory, @"*.dll");

            if (dllFiles.Length == 0)
            {
                MessageBox.Show("No .dll Files Found In " + moduleDirectory);
                return;
            }

            InfoRetriever = new ModuleInfoRetriever(moduleDirectory);

            // Show progress bar
            CurrentProgress      = 0;
            ProgressBarText      = string.Empty;
            ProgressBarIsVisible = true;

            Modules.Clear();

            LoadingModules = true;

            Thread thread = new Thread(new ThreadStart(UpdateProgressBarText))
            {
                IsBackground = true
            };

            thread.Start();

            // Run async to allow UI thread to update UI with the property changes above.
            Modules = await Task.Run(() => InfoRetriever.GetModules(dllFiles));

            // Kill progress bar
            LoadingModules       = false;
            ProgressBarText      = string.Empty;
            ProgressBarIsVisible = false;
        }