Example #1
0
        public ImportModules()
        {
//            TODO: WORK PATH BELOW
            rootPath = @"D:\OOP\OOP\Lab1\PictureDraw\Modules";
            modules  = new List <Assembly>();
            var directory = new DirectoryInfo(rootPath);

            foreach (var file in directory.GetFiles("*.dll"))
            {
                try
                {
                    if (RSACrypt.VerifySignedHash(File.ReadAllBytes(file.FullName), File.ReadAllText(@"G:\public.xml")))
                    {
                        modules.Add(Assembly.LoadFrom(file.FullName));
                    }
                }
                catch
                {
                    MessageBox.Show($@"Sorry, but {rootPath}\{file} was damaged. Please, fix or remove it.", "Load error",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }